From 9641f8c39c96b6abdae196fac43e2e6dd7175960 Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Fri, 18 Sep 2015 18:24:57 +0200 Subject: [PATCH 1/2] 6lowpan nd: send rtr adv after receiving a rtr adv A router should turn into a router after receiving a valid router advertisement. --- sys/net/gnrc/network_layer/ndp/gnrc_ndp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c b/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c index f474a30a95..7a624f9fc2 100644 --- a/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c +++ b/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c @@ -613,6 +613,9 @@ void gnrc_ndp_rtr_adv_handle(kernel_pid_t iface, gnrc_pktsnip_t *pkt, ipv6_hdr_t gnrc_sixlowpan_nd_rtr_sol_reschedule(nc_entry, next_rtr_sol); gnrc_ndp_internal_send_nbr_sol(nc_entry->iface, NULL, &nc_entry->ipv6_addr, &nc_entry->ipv6_addr); + if (if_entry->flags & GNRC_IPV6_NETIF_FLAGS_ROUTER) { + gnrc_ipv6_netif_set_rtr_adv(if_entry, true); + } } #endif } From 6f2d90a95cc26f5308ba1e4a85229ddd43d4d8ef Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Sat, 19 Sep 2015 21:29:35 +0200 Subject: [PATCH 2/2] 6lowpan nd: send rtr adv on new address --- .../network_layer/ipv6/netif/gnrc_ipv6_netif.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/sys/net/gnrc/network_layer/ipv6/netif/gnrc_ipv6_netif.c b/sys/net/gnrc/network_layer/ipv6/netif/gnrc_ipv6_netif.c index 06c053f819..09ea6d5af9 100644 --- a/sys/net/gnrc/network_layer/ipv6/netif/gnrc_ipv6_netif.c +++ b/sys/net/gnrc/network_layer/ipv6/netif/gnrc_ipv6_netif.c @@ -105,15 +105,22 @@ static ipv6_addr_t *_add_addr_to_entry(gnrc_ipv6_netif_t *entry, const ipv6_addr } else { if (!ipv6_addr_is_link_local(addr)) { -#ifdef MODULE_GNRC_NDP_ROUTER - /* New prefixes MAY allow the router to retransmit up to - * GNRC_NDP_MAX_INIT_RTR_ADV_NUMOF unsolicited RA - * (see https://tools.ietf.org/html/rfc4861#section-6.2.4) */ +#if defined(MODULE_GNRC_NDP_ROUTER) || defined(MODULE_GNRC_SIXLOWPAN_ND_ROUTER) if ((entry->flags & GNRC_IPV6_NETIF_FLAGS_ROUTER) && (entry->flags & GNRC_IPV6_NETIF_FLAGS_RTR_ADV)) { - entry->rtr_adv_count = GNRC_NDP_MAX_INIT_RTR_ADV_NUMOF; mutex_unlock(&entry->mutex); /* function below relocks mutex */ +#ifdef MODULE_GNRC_NDP_ROUTER + /* New prefixes MAY allow the router to retransmit up to + * GNRC_NDP_MAX_INIT_RTR_ADV_NUMOF unsolicited RA + * (see https://tools.ietf.org/html/rfc4861#section-6.2.4) */ + entry->rtr_adv_count = GNRC_NDP_MAX_INIT_RTR_ADV_NUMOF; gnrc_ndp_router_retrans_rtr_adv(entry); +#elif defined(MODULE_GNRC_SIXLOWPAN_ND_ROUTER) + if (entry->flags & GNRC_IPV6_NETIF_FLAGS_SIXLOWPAN) { + gnrc_ndp_internal_send_rtr_adv(entry->pid, &tmp_addr->addr, + NULL, false); + } +#endif mutex_lock(&entry->mutex); /* relock mutex */ } #endif