1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #13564 from miri64/gnrc_uhcpc/enh/6ln

gnrc_uhcpc: only configure 6Lo-ND features if wireless-interface is 6LN
This commit is contained in:
Martine Lenders 2020-03-05 23:39:26 +01:00 committed by GitHub
commit f5da8ed9c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -129,9 +129,11 @@ void uhcp_handle_prefix(uint8_t *prefix, uint8_t prefix_len, uint16_t lifetime,
if (ipv6_addr_equal(&_prefix, (ipv6_addr_t*)prefix)) {
LOG_WARNING("gnrc_uhcpc: uhcp_handle_prefix(): got same prefix again\n");
#ifdef MODULE_GNRC_SIXLOWPAN_CTX
/* always update 6LoWPAN compression context so it does not time out, we
* can't just remove it anyway according to the RFC */
_update_6ctx((ipv6_addr_t *)prefix, 64);
if (gnrc_netif_is_6ln(gnrc_netif_get_by_pid(gnrc_wireless_interface))) {
/* always update 6LoWPAN compression context so it does not time
* out, we can't just remove it anyway according to the RFC */
_update_6ctx((ipv6_addr_t *)prefix, 64);
}
#endif
return;
}
@ -148,14 +150,19 @@ void uhcp_handle_prefix(uint8_t *prefix, uint8_t prefix_len, uint16_t lifetime,
memcpy(&_prefix, prefix, sizeof(_prefix));
gnrc_netapi_set(gnrc_wireless_interface, NETOPT_IPV6_ADDR, (64 << 8),
prefix, sizeof(ipv6_addr_t));
/* only configure 6Lo-ND features when wireless interface uses
* 6Lo-ND */
if (gnrc_netif_is_6ln(gnrc_netif_get_by_pid(gnrc_wireless_interface))) {
#ifdef MODULE_GNRC_SIXLOWPAN_CTX
/* add compression before ABR to add it automatically to its context list */
_update_6ctx((ipv6_addr_t *)prefix, 64);
/* add compression before ABR to add it automatically to its context
* list */
_update_6ctx((ipv6_addr_t *)prefix, 64);
#endif
#if defined(MODULE_GNRC_IPV6_NIB) && GNRC_IPV6_NIB_CONF_6LBR && \
GNRC_IPV6_NIB_CONF_MULTIHOP_P6C
gnrc_ipv6_nib_abr_add((ipv6_addr_t *)prefix);
GNRC_IPV6_NIB_CONF_MULTIHOP_P6C
gnrc_ipv6_nib_abr_add((ipv6_addr_t *)prefix);
#endif
}
#ifdef MODULE_GNRC_RPL
gnrc_rpl_init(gnrc_wireless_interface);
gnrc_rpl_instance_t *inst = gnrc_rpl_instance_get(GNRC_RPL_DEFAULT_INSTANCE);