Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gnrc_netif: make auto-config of compression context optional #17678

Merged
merged 1 commit into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions sys/include/net/gnrc/netif/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions sys/net/gnrc/netif/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 6 additions & 4 deletions sys/net/gnrc/netif/gnrc_netif.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down