1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 14:03:55 +01:00

Merge pull request #16755 from benpicco/gnrc_ipv6_nib-no_adv_router

gnrc_dhcpv6_client / uhcp: delay router advertisements until prefix was received
This commit is contained in:
benpicco 2022-01-04 13:34:32 +01:00 committed by GitHub
commit 55900e0fb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 19 deletions

View File

@ -60,6 +60,7 @@ endif
ifneq (,$(filter gnrc_dhcpv6_client_simple_pd,$(USEMODULE)))
USEMODULE += gnrc_dhcpv6_client
USEMODULE += dhcpv6_client_ia_pd
CFLAGS += -DCONFIG_GNRC_IPV6_NIB_ADV_ROUTER=0
endif
ifneq (,$(filter gnrc_uhcpc,$(USEMODULE)))
@ -67,6 +68,7 @@ ifneq (,$(filter gnrc_uhcpc,$(USEMODULE)))
USEMODULE += uhcpc
USEMODULE += gnrc_sock_udp
USEMODULE += fmt
CFLAGS += -DCONFIG_GNRC_IPV6_NIB_ADV_ROUTER=0
endif
ifneq (,$(filter gnrc_%,$(filter-out gnrc_lorawan gnrc_netapi gnrc_netreg gnrc_netif% gnrc_pkt%,$(USEMODULE))))

View File

@ -84,7 +84,10 @@ void dhcpv6_client_conf_prefix(unsigned iface, const ipv6_addr_t *pfx,
{
gnrc_netif_t *netif = gnrc_netif_get_by_pid(iface);
int idx = gnrc_netif_ipv6_add_prefix(netif, pfx, pfx_len, valid, pref);
if (idx >= 0) {
if ((idx >= 0) && (pfx_len != IPV6_ADDR_BIT_LEN)) {
/* start advertising subnet obtained via DHCPv6 */
gnrc_ipv6_nib_change_rtr_adv_iface(netif, true);
/* configure this router as RPL root */
gnrc_rpl_configure_root(netif, &netif->ipv6.addrs[idx]);
}
}

View File

@ -84,15 +84,6 @@ static void _configure_upstream_netif(gnrc_netif_t *upstream_netif)
addr.u8[15] = 2;
gnrc_netif_ipv6_addr_add(upstream_netif, &addr, 64, 0);
}
/* Disable router advertisements on upstream interface. With this, the border
* router
* 1. Does not confuse the upstream router to add the border router to its
* default router list and
* 2. Solicits upstream Router Advertisements quicker to auto-configure its
* upstream global address.
*/
gnrc_ipv6_nib_change_rtr_adv_iface(upstream_netif, false);
}
/**

View File

@ -40,15 +40,6 @@ static void set_interface_roles(void)
sizeof(addr));
ipv6_addr_from_str(&addr, "fe80::1");
gnrc_ipv6_nib_ft_add(&defroute, IPV6_ADDR_BIT_LEN, &addr, dev, 0);
/* Disable router advertisements on upstream interface. With this,
* the border router
* 1. Does not confuse the upstream router to add the border router
* to its default router list and
* 2. Solicits upstream Router Advertisements quicker to
* auto-configure its upstream global address.
*/
gnrc_ipv6_nib_change_rtr_adv_iface(netif, false);
}
else if ((!gnrc_wireless_interface) && (is_wired != 1)) {
gnrc_wireless_interface = dev;
@ -86,6 +77,9 @@ void uhcp_handle_prefix(uint8_t *prefix, uint8_t prefix_len, uint16_t lifetime,
idx = gnrc_netif_ipv6_add_prefix(wireless, (ipv6_addr_t *)prefix, prefix_len,
lifetime, lifetime);
if (idx >= 0) {
/* start advertising subnet obtained via UHCP */
gnrc_ipv6_nib_change_rtr_adv_iface(wireless, true);
/* configure this router as RPL root */
gnrc_rpl_configure_root(wireless, &wireless->ipv6.addrs[idx]);
}
}