From 802136dd9a41987451565050657ce6f201fd56d2 Mon Sep 17 00:00:00 2001
From: Martine Lenders <mlenders@inf.fu-berlin.de>
Date: Tue, 22 Mar 2016 20:02:27 +0100
Subject: [PATCH] gnrc_ndp: unset isRouter flag for neighbor sending RS

---
 sys/net/gnrc/network_layer/ndp/gnrc_ndp.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c b/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c
index 893570ece1..016d2ed6cc 100644
--- a/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c
+++ b/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c
@@ -381,6 +381,7 @@ void gnrc_ndp_rtr_sol_handle(kernel_pid_t iface, gnrc_pktsnip_t *pkt,
     gnrc_ipv6_netif_t *if_entry = gnrc_ipv6_netif_get(iface);
 
     if (if_entry->flags & GNRC_IPV6_NETIF_FLAGS_ROUTER) {
+        gnrc_ipv6_nc_t *nc_entry;
         int sicmpv6_size = (int)icmpv6_size, l2src_len = 0;
         uint8_t l2src[GNRC_IPV6_NC_L2_ADDR_MAX];
         uint16_t opt_offset = 0;
@@ -458,12 +459,18 @@ void gnrc_ndp_rtr_sol_handle(kernel_pid_t iface, gnrc_pktsnip_t *pkt,
                 /* or unicast, if source is known */
                 /* XXX: can't just use GNRC_NETAPI_MSG_TYPE_SND, since the next retransmission
                  * must also be set. */
-                gnrc_ipv6_nc_t *nc_entry = gnrc_ipv6_nc_get(iface, &ipv6->src);
+                nc_entry = gnrc_ipv6_nc_get(iface, &ipv6->src);
                 xtimer_set_msg(&nc_entry->rtr_adv_timer, delay, &nc_entry->rtr_adv_msg,
                                gnrc_ipv6_pid);
             }
 #endif
         }
+        nc_entry = gnrc_ipv6_nc_get(iface, &ipv6->src);
+        if (nc_entry != NULL) {
+            /* unset isRouter flag
+             * (https://tools.ietf.org/html/rfc4861#section-6.2.6) */
+            nc_entry->flags &= ~GNRC_IPV6_NC_IS_ROUTER;
+        }
     }
     /* otherwise ignore silently */
 }
-- 
GitLab