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

gnrc_netif: make auto-config of compression context optional

This commit is contained in:
Martine Lenders 2022-02-18 16:42:08 +01:00
parent 60f3410ae0
commit 3d819ce707
No known key found for this signature in database
GPG Key ID: 2134D77A5336DD80
3 changed files with 23 additions and 4 deletions

View File

@ -194,6 +194,16 @@ extern "C" {
#define CONFIG_GNRC_NETIF_NONSTANDARD_6LO_MTU 0
#endif
/**
* @brief Automatically add 6LoWPAN compression at border router
*
* When set, 6LoWPAN compression context 0 will be automatically set for the prefix configured by
* prefix deligation at the border router.
*/
#ifndef CONFIG_GNRC_NETIF_IPV6_BR_AUTO_6CTX
#define CONFIG_GNRC_NETIF_IPV6_BR_AUTO_6CTX 1
#endif
#ifdef __cplusplus
}
#endif

View File

@ -74,5 +74,12 @@ config GNRC_NETIF_LORAWAN_NETIF_HDR
GNRC LoRaWAN packets will include the GNRC Netif
header. Therefore this parameter will be removed
config GNRC_NETIF_IPV6_BR_AUTO_6CTX
bool "Automatically add 6LoWPAN compression at border router"
default y
depends on USEMODULE_GNRC_IPV6_NIB_6LBR && USEMODULE_GNRC_SIXLOWPAN_IPHC && USEMODULE_GNRC_SIXLOWPAN_CTX
help
When set, 6LoWPAN compression context 0 will be automatically set for the prefix configured
by prefix deligation at the border router.
endif # KCONFIG_USEMODULE_GNRC_NETIF

View File

@ -1287,10 +1287,12 @@ int gnrc_netif_ipv6_add_prefix(gnrc_netif_t *netif,
IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) &&
gnrc_netif_is_6ln(netif)) {
/* configure compression context */
if (gnrc_sixlowpan_ctx_update_6ctx(pfx, pfx_len, valid)) {
DEBUG("gnrc_netif: add compression context for prefix %s/%u\n",
ipv6_addr_to_str(addr_str, pfx, sizeof(addr_str)), pfx_len);
if (IS_ACTIVE(CONFIG_GNRC_NETIF_IPV6_BR_AUTO_6CTX)) {
/* configure compression context */
if (gnrc_sixlowpan_ctx_update_6ctx(pfx, pfx_len, valid)) {
DEBUG("gnrc_netif: add compression context for prefix %s/%u\n",
ipv6_addr_to_str(addr_str, pfx, sizeof(addr_str)), pfx_len);
}
}
(void)gnrc_ipv6_nib_abr_add(&addr);