From e02ced8c98a0bf5e5bcb1d9b57a3ffd4a5448351 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 23 Jan 2015 15:10:47 -0600 Subject: [PATCH] Networking: Final fixes. IPv6 pings now work in both directions --- net/devif/ipv6_input.c | 9 +++------ net/icmpv6/icmpv6_input.c | 11 ++++++----- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/net/devif/ipv6_input.c b/net/devif/ipv6_input.c index baec56da6c..3f71a0ee3c 100644 --- a/net/devif/ipv6_input.c +++ b/net/devif/ipv6_input.c @@ -171,14 +171,11 @@ int ipv6_input(FAR struct net_driver_s *dev) * we set d_len to the correct value. * * The length reported in the IPv6 header is the length of the payload - * that follows the header. However, uIP uses the d_len variable for - * holding the size of the entire packet, including the IP header. For - * IPv4 this is not a problem as the length field in the IPv4 header - * contains the length of the entire packet. But for IPv6 we need to add - * the size of the IPv6 header (40 bytes). + * that follows the header. The device interface uses the d_len variable for + * holding the size of the entire packet, including the IP header. */ - iplen = (ipv6->len[0] << 8) + ipv6->len[1] + IPv6_HDRLEN; + iplen = (ipv6->len[0] << 8) + ipv6->len[1] + IPv6_HDRLEN + ETH_HDRLEN; if (iplen <= dev->d_len) { dev->d_len = iplen; diff --git a/net/icmpv6/icmpv6_input.c b/net/icmpv6/icmpv6_input.c index cb375e213f..08e540a9d8 100644 --- a/net/icmpv6/icmpv6_input.c +++ b/net/icmpv6/icmpv6_input.c @@ -145,7 +145,7 @@ void icmpv6_input(FAR struct net_driver_s *dev) * * * Set up the IPv6 header. Most is probably already in place from - * the Neighbor Solitication. We could save some time here. + * the Neighbor Solicitation. We could save some time here. */ icmp->vtc = 0x60; /* Version/traffic class (MS) */ @@ -224,6 +224,11 @@ void icmpv6_input(FAR struct net_driver_s *dev) eth->type = HTONS(ETHTYPE_IP6); } #endif + /* No additional neighbor lookup is required on this packet + * (We are using a multicast address). + */ + + IFF_SET_NOARP(dev->d_flags); } else { @@ -320,10 +325,6 @@ void icmpv6_input(FAR struct net_driver_s *dev) goto icmpv6_type_error; } - /* No additional neighbor lookup is required on this packet. */ - - IFF_SET_NOARP(dev->d_flags); - nllvdbg("Outgoing ICMPv6 packet length: %d (%d)\n", dev->d_len, (icmp->len[0] << 8) | icmp->len[1]);