diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2015-01-23 16:40:18 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2015-01-23 16:40:18 -0600 |
commit | c6f348acc5e6108896d6cfbc4565dd09418ba890 (patch) | |
tree | ed986bf560e20068706fa9c722afd6949bcd3d20 /nuttx/net/devif | |
parent | 9b0a2b82889066203257626cab8df0dfbe0af990 (diff) | |
download | px4-nuttx-c6f348acc5e6108896d6cfbc4565dd09418ba890.tar.gz px4-nuttx-c6f348acc5e6108896d6cfbc4565dd09418ba890.tar.bz2 px4-nuttx-c6f348acc5e6108896d6cfbc4565dd09418ba890.zip |
Networking: IPv4 and IPv6 work together. This fixes a bug necessary to accomplish that as well as cleaning up a couple of other issues
Diffstat (limited to 'nuttx/net/devif')
-rw-r--r-- | nuttx/net/devif/ipv6_input.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/nuttx/net/devif/ipv6_input.c b/nuttx/net/devif/ipv6_input.c index 3f71a0ee3..d50838902 100644 --- a/nuttx/net/devif/ipv6_input.c +++ b/nuttx/net/devif/ipv6_input.c @@ -140,7 +140,7 @@ int ipv6_input(FAR struct net_driver_s *dev) { FAR struct ipv6_hdr_s *ipv6 = IPv6BUF; - uint16_t iplen; + uint16_t pktlen; /* This is where the input processing starts. */ @@ -172,13 +172,21 @@ int ipv6_input(FAR struct net_driver_s *dev) * * The length reported in the IPv6 header is the length of the payload * that follows the header. The device interface uses the d_len variable for - * holding the size of the entire packet, including the IP header. + * holding the size of the entire packet, including the IP and link layer + * headers. */ - iplen = (ipv6->len[0] << 8) + ipv6->len[1] + IPv6_HDRLEN + ETH_HDRLEN; - if (iplen <= dev->d_len) +#if defined(CONFIG_NET_MULTILINK) + pktlen = (ipv6->len[0] << 8) + ipv6->len[1] + IPv6_HDRLEN + dev->d_llhdrlen; +#elif defined(CONFIG_NET_ETHERNET) + pktlen = (ipv6->len[0] << 8) + ipv6->len[1] + IPv6_HDRLEN + ETH_HDRLEN; +#else /* if defined(CONFIG_NET_SLIP) */ + pktlen = (ipv6->len[0] << 8) + ipv6->len[1] + IPv6_HDRLEN; +#endif + + if (pktlen <= dev->d_len) { - dev->d_len = iplen; + dev->d_len = pktlen; } else { |