mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
net: move device buffer define to common header
Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
@@ -82,7 +82,7 @@ static inline void forward_ipselect(FAR struct forward_s *fwd)
|
||||
|
||||
/* Set the offset to the beginning of the UDP data payload */
|
||||
|
||||
dev->d_appdata = &dev->d_buf[IPv4UDP_HDRLEN + NET_LL_HDRLEN(dev)];
|
||||
dev->d_appdata = IPBUF(IPv4UDP_HDRLEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -92,7 +92,7 @@ static inline void forward_ipselect(FAR struct forward_s *fwd)
|
||||
|
||||
/* Set the offset to the beginning of the UDP data payload */
|
||||
|
||||
dev->d_appdata = &dev->d_buf[IPv6UDP_HDRLEN + NET_LL_HDRLEN(dev)];
|
||||
dev->d_appdata = IPBUF(IPv6UDP_HDRLEN);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -54,20 +54,19 @@
|
||||
static int ipfwd_packet_proto(FAR struct net_driver_s *dev)
|
||||
{
|
||||
FAR struct ipv6_hdr_s *ipv6;
|
||||
int llhdrlen = NET_LL_HDRLEN(dev);
|
||||
|
||||
/* Make sure the there is something in buffer that is at least as large as
|
||||
* the IPv6_HDR.
|
||||
*/
|
||||
|
||||
if (dev->d_len > (IPv6_HDRLEN + llhdrlen))
|
||||
if (dev->d_len > (IPv6_HDRLEN + NET_LL_HDRLEN(dev)))
|
||||
{
|
||||
if (dev->d_lltype == NET_LL_IEEE802154 ||
|
||||
dev->d_lltype == NET_LL_PKTRADIO)
|
||||
{
|
||||
/* There should be an IPv6 packet at the beginning of the buffer */
|
||||
|
||||
ipv6 = (FAR struct ipv6_hdr_s *)&dev->d_buf[llhdrlen];
|
||||
ipv6 = IPv6BUF;
|
||||
if ((ipv6->vtc & IP_VERSION_MASK) == IPv6_VERSION)
|
||||
{
|
||||
/* Yes.. return the L2 protocol of the packet */
|
||||
|
||||
@@ -376,7 +376,7 @@ int ipv4_forward_callback(FAR struct net_driver_s *fwddev, FAR void *arg)
|
||||
* d_buf.
|
||||
*/
|
||||
|
||||
ipv4 = (FAR struct ipv4_hdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)];
|
||||
ipv4 = IPv4BUF;
|
||||
|
||||
/* Send the packet asynchrously on the forwarding device. */
|
||||
|
||||
|
||||
@@ -512,7 +512,7 @@ int ipv6_forward_callback(FAR struct net_driver_s *fwddev, FAR void *arg)
|
||||
* d_buf.
|
||||
*/
|
||||
|
||||
ipv6 = (FAR struct ipv6_hdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)];
|
||||
ipv6 = IPv6BUF;
|
||||
|
||||
/* Send the packet asynchrously on the forwarding device. */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user