]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lwip.git/commitdiff
fixes bug #36389: Use IPv6 Src Address of Echo Response as Destination
authorIvan Delamer <delamer@inicotech.com>
Fri, 4 May 2012 23:43:54 +0000 (17:43 -0600)
committerIvan Delamer <delamer@inicotech.com>
Fri, 4 May 2012 23:43:54 +0000 (17:43 -0600)
Address in Echo Response

src/core/ipv6/icmp6.c

index dfe9210773d56595b9e0ce4811eb77212896dd28..ea82682efde7a99058fb28252e8e90aadc03597f 100644 (file)
@@ -158,13 +158,21 @@ icmp6_input(struct pbuf *p, struct netif *inp)
     }
 
     /* Determine reply source IPv6 address. */
-    reply_src = ip6_select_source_address(inp, ip6_current_src_addr());
-    if (reply_src == NULL) {
-      /* drop */
-      pbuf_free(p);
-      pbuf_free(r);
-      ICMP6_STATS_INC(icmp6.rterr);
-      return;
+#if LWIP_MULTICAST_PING
+    if (ip6_addr_ismulticast(ip6_current_dest_addr())) {
+      reply_src = ip6_select_source_address(inp, ip6_current_src_addr());
+      if (reply_src == NULL) {
+        /* drop */
+        pbuf_free(p);
+        pbuf_free(r);
+        ICMP6_STATS_INC(icmp6.rterr);
+        return;
+      }
+    }
+    else
+#endif /* LWIP_MULTICAST_PING */
+    {
+      reply_src = ip6_current_dest_addr();
     }
 
     /* Set fields in reply. */