]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lwip.git/commitdiff
In ip6_input(), accept solicited node packets that match the receiving
authorIvan Delamer <delamer@inicotech.com>
Sat, 5 May 2012 00:11:47 +0000 (18:11 -0600)
committerIvan Delamer <delamer@inicotech.com>
Sat, 5 May 2012 00:11:47 +0000 (18:11 -0600)
netif addresses, when multicast is disabled.

Change-Id: I3f59258ee605a820f0a525b696b1dede0d53948f

src/core/ipv6/ip6.c
src/include/ipv6/lwip/ip6_addr.h

index fcae57c6b1245b4728e1d2c0385136274ddd4553..3d8e3d1b043f9326dbe15f5b8bcb6f838926bc25 100644 (file)
@@ -405,15 +405,24 @@ ip6_input(struct pbuf *p, struct netif *inp)
         ip6_addr_isallnodes_linklocal(ip6_current_dest_addr())) {
       netif = inp;
     }
-#if LWIP_IPV6_MLD
+#if 0
     else if (mld6_lookfor_group(inp, ip6_current_dest_addr())) {
       netif = inp;
     }
 #else /* LWIP_IPV6_MLD */
     else if (ip6_addr_issolicitednode(ip6_current_dest_addr())) {
-      /* Accept all solicited node packets when MLD is not enabled
+      /* Filter solicited node packets when MLD is not enabled
        * (for Neighbor discovery). */
-      netif = inp;
+      netif = NULL;
+      for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
+        if (ip6_addr_isvalid(netif_ip6_addr_state(inp, i)) &&
+            ip6_addr_cmp_solicitednode(ip6_current_dest_addr(), netif_ip6_addr(inp, i))) {
+          netif = inp;
+          LWIP_DEBUGF(IP6_DEBUG, ("ip6_input: solicited node packet accepted on interface %c%c\n",
+              netif->name[0], netif->name[1]));
+          break;
+        }
+      }
     }
 #endif /* LWIP_IPV6_MLD */
     else {
index 68e93e0601ef217cf1a81b1393b04d3b8443ec30..89b5b8113926ab4a7886ac85b0191f2da334aa6f 100644 (file)
@@ -234,6 +234,10 @@ Little-endian version, stored in network order (no htonl). */
                 (ip6addr)->addr[2] = PP_HTONL(0x00000001UL); \
                 (ip6addr)->addr[3] = htonl(0xff000000UL | (htonl(if_id) & 0x00ffffffUL));}while(0)
 
+#define ip6_addr_cmp_solicitednode(ip6addr, sn_addr) (((ip6addr)->addr[0] == PP_HTONL(0xff020000UL)) && \
+                                    ((ip6addr)->addr[1] == 0) && \
+                                    ((ip6addr)->addr[2] == PP_HTONL(0x00000001UL)) && \
+                                    ((ip6addr)->addr[3] == htonl(0xff000000UL | (htonl((sn_addr)->addr[3]) & 0x00ffffffUL))))
 
 /* IPv6 address states. */
 #define IP6_ADDR_INVALID      0x00