diff --git a/sys/include/net/gnrc/ipv6/nib/abr.h b/sys/include/net/gnrc/ipv6/nib/abr.h index 18345b8ac7..4474fcc417 100644 --- a/sys/include/net/gnrc/ipv6/nib/abr.h +++ b/sys/include/net/gnrc/ipv6/nib/abr.h @@ -21,6 +21,8 @@ #ifndef NET_GNRC_IPV6_NIB_ABR_H #define NET_GNRC_IPV6_NIB_ABR_H +#include + #include "net/ipv6/addr.h" #include "net/gnrc/ipv6/nib/conf.h" @@ -39,7 +41,7 @@ typedef struct { } gnrc_ipv6_nib_abr_t; #if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C || defined(DOXYGEN) -#if GNRC_IPV6_NIB_CONF_6LBR || defined(DOXYGEN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) || defined(DOXYGEN) /** * @brief Adds the address of an authoritative border router to the NIB * @@ -47,7 +49,7 @@ typedef struct { * * @return 0 on success. * @return -ENOMEM, if no space is left in the neighbor cache. - * @return -ENOTSUP, if @ref GNRC_IPV6_NIB_CONF_6LBR or + * @return -ENOTSUP, if @ref CONFIG_GNRC_IPV6_NIB_6LBR or * @ref GNRC_IPV6_NIB_CONF_MULTIHOP_P6C is not defined */ int gnrc_ipv6_nib_abr_add(const ipv6_addr_t *addr); @@ -58,10 +60,10 @@ int gnrc_ipv6_nib_abr_add(const ipv6_addr_t *addr); * @param[in] addr The address of an authoritative border router. */ void gnrc_ipv6_nib_abr_del(const ipv6_addr_t *addr); -#else /* GNRC_IPV6_NIB_CONF_6LBR || defined(DOXYGEN) */ +#else /* CONFIG_GNRC_IPV6_NIB_6LBR || defined(DOXYGEN) */ #define gnrc_ipv6_nib_abr_add(addr) (-ENOTSUP) #define gnrc_ipv6_nib_abr_del(addr) (void)(addr) -#endif /* GNRC_IPV6_NIB_CONF_6LBR || defined(DOXYGEN) */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LBR || defined(DOXYGEN) */ /** * @brief Iterates over all authoritative border router in the NIB diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index 724222a21f..e8efb2b307 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -21,14 +21,16 @@ #ifndef NET_GNRC_IPV6_NIB_CONF_H #define NET_GNRC_IPV6_NIB_CONF_H +#include + #ifdef __cplusplus extern "C" { #endif /* some pseudo-module based configuration, doc: see below */ #ifdef MODULE_GNRC_IPV6_NIB_6LBR -#ifndef GNRC_IPV6_NIB_CONF_6LBR -#define GNRC_IPV6_NIB_CONF_6LBR 1 +#ifndef CONFIG_GNRC_IPV6_NIB_6LBR +#define CONFIG_GNRC_IPV6_NIB_6LBR 1 #endif #ifndef GNRC_IPV6_NIB_CONF_SLAAC #define GNRC_IPV6_NIB_CONF_SLAAC 1 @@ -84,15 +86,15 @@ extern "C" { /** * @brief enable features for 6Lo border router */ -#ifndef GNRC_IPV6_NIB_CONF_6LBR -#define GNRC_IPV6_NIB_CONF_6LBR 0 +#ifndef CONFIG_GNRC_IPV6_NIB_6LBR +#define CONFIG_GNRC_IPV6_NIB_6LBR 0 #endif /** * @brief enable features for 6Lo router */ #ifndef GNRC_IPV6_NIB_CONF_6LR -#if GNRC_IPV6_NIB_CONF_6LBR +#if CONFIG_GNRC_IPV6_NIB_6LBR #define GNRC_IPV6_NIB_CONF_6LR 1 #else #define GNRC_IPV6_NIB_CONF_6LR 0 @@ -126,7 +128,7 @@ extern "C" { */ #ifndef GNRC_IPV6_NIB_CONF_ADV_ROUTER #if GNRC_IPV6_NIB_CONF_ROUTER && \ - (!GNRC_IPV6_NIB_CONF_6LR || GNRC_IPV6_NIB_CONF_6LBR) + (!GNRC_IPV6_NIB_CONF_6LR || CONFIG_GNRC_IPV6_NIB_6LBR) #define GNRC_IPV6_NIB_CONF_ADV_ROUTER 1 #else #define GNRC_IPV6_NIB_CONF_ADV_ROUTER 0 diff --git a/sys/include/net/gnrc/netif/internal.h b/sys/include/net/gnrc/netif/internal.h index 9e22439214..700e57f011 100644 --- a/sys/include/net/gnrc/netif/internal.h +++ b/sys/include/net/gnrc/netif/internal.h @@ -21,6 +21,8 @@ #ifndef NET_GNRC_NETIF_INTERNAL_H #define NET_GNRC_NETIF_INTERNAL_H +#include + #include "net/gnrc/netif.h" #include "net/l2util.h" #include "net/netopt.h" @@ -430,7 +432,7 @@ static inline bool gnrc_netif_is_6lr(const gnrc_netif_t *netif) * according to RFC 6775 * * @attention Requires prior locking - * @note Assumed to be false, when @ref GNRC_IPV6_NIB_CONF_6LBR == 0. + * @note Assumed to be false, when @ref CONFIG_GNRC_IPV6_NIB_6LBR == 0. * * @param[in] netif the network interface * @@ -441,7 +443,7 @@ static inline bool gnrc_netif_is_6lr(const gnrc_netif_t *netif) */ static inline bool gnrc_netif_is_6lbr(const gnrc_netif_t *netif) { - if (IS_ACTIVE(GNRC_IPV6_NIB_CONF_6LBR)) { + if (IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR)) { return (netif->flags & GNRC_NETIF_FLAGS_6LO_ABR) && gnrc_netif_is_6lr(netif); } diff --git a/sys/net/gnrc/application_layer/dhcpv6/client.c b/sys/net/gnrc/application_layer/dhcpv6/client.c index 1a49ee9433..80b7f23e69 100644 --- a/sys/net/gnrc/application_layer/dhcpv6/client.c +++ b/sys/net/gnrc/application_layer/dhcpv6/client.c @@ -148,7 +148,7 @@ void dhcpv6_client_conf_prefix(unsigned iface, const ipv6_addr_t *pfx, } gnrc_ipv6_nib_pl_set(netif->pid, pfx, pfx_len, valid, pref); if (IS_USED(MODULE_GNRC_IPV6_NIB) && - GNRC_IPV6_NIB_CONF_6LBR && + IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) && GNRC_IPV6_NIB_CONF_MULTIHOP_P6C && gnrc_netif_is_6ln(netif)) { if (IS_USED(MODULE_GNRC_SIXLOWPAN_CTX)) { diff --git a/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c b/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c index 5f6bbc9e00..678b90def1 100644 --- a/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c +++ b/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c @@ -6,6 +6,8 @@ * directory for more details. */ +#include + #include "net/gnrc/ipv6/nib.h" #include "net/gnrc/ipv6.h" #include "net/gnrc/netapi.h" @@ -151,7 +153,7 @@ void uhcp_handle_prefix(uint8_t *prefix, uint8_t prefix_len, uint16_t lifetime, else if (!ipv6_addr_is_unspecified(&_prefix)) { gnrc_netapi_set(gnrc_wireless_interface, NETOPT_IPV6_ADDR_REMOVE, 0, &_prefix, sizeof(_prefix)); -#if defined(MODULE_GNRC_IPV6_NIB) && GNRC_IPV6_NIB_CONF_6LBR && \ +#if defined(MODULE_GNRC_IPV6_NIB) && IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) && \ GNRC_IPV6_NIB_CONF_MULTIHOP_P6C gnrc_ipv6_nib_abr_del(&_prefix); #endif @@ -171,7 +173,7 @@ void uhcp_handle_prefix(uint8_t *prefix, uint8_t prefix_len, uint16_t lifetime, * list */ _update_6ctx((ipv6_addr_t *)prefix, prefix_len); #endif -#if defined(MODULE_GNRC_IPV6_NIB) && GNRC_IPV6_NIB_CONF_6LBR && \ +#if defined(MODULE_GNRC_IPV6_NIB) && IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) && \ GNRC_IPV6_NIB_CONF_MULTIHOP_P6C gnrc_ipv6_nib_abr_add((ipv6_addr_t *)prefix); #endif diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.h index aa6c0753c8..4f29fc47dd 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.h @@ -19,6 +19,8 @@ #ifndef PRIV_NIB_ROUTER_H #define PRIV_NIB_ROUTER_H +#include + #include "net/gnrc/ipv6/nib/conf.h" #include "net/gnrc/netif/internal.h" #include "net/gnrc/netif/ipv6.h" @@ -43,12 +45,12 @@ static inline void _init_iface_router(gnrc_netif_t *netif) netif->ipv6.last_ra = UINT32_MAX; netif->ipv6.ra_sent = 0; netif->flags |= GNRC_NETIF_FLAGS_IPV6_FORWARDING; -#if !GNRC_IPV6_NIB_CONF_6LR || GNRC_IPV6_NIB_CONF_6LBR +#if !GNRC_IPV6_NIB_CONF_6LR || IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) netif->flags |= GNRC_NETIF_FLAGS_IPV6_RTR_ADV; -#endif /* !GNRC_IPV6_NIB_CONF_6LR || GNRC_IPV6_NIB_CONF_6LBR */ -#if GNRC_IPV6_NIB_CONF_6LBR +#endif /* !GNRC_IPV6_NIB_CONF_6LR || CONFIG_GNRC_IPV6_NIB_6LBR */ +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) netif->flags |= GNRC_NETIF_FLAGS_6LO_ABR; -#endif /* GNRC_IPV6_NIB_CONF_6LBR */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LBR */ gnrc_netif_ipv6_group_join_internal(netif, &ipv6_addr_all_routers_link_local); } diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib.c b/sys/net/gnrc/network_layer/ipv6/nib/nib.c index 2c77559df4..551de7c23b 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib.c @@ -15,6 +15,7 @@ #include #include +#include #include "log.h" #include "net/ipv6/addr.h" @@ -637,13 +638,13 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, byteorder_ntohs(abro->ltime) * SEC_PER_MIN * MS_PER_SEC); } -#if !GNRC_IPV6_NIB_CONF_6LBR +#if !IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) else if (gnrc_netif_is_6lr(netif)) { DEBUG("nib: multihop prefix and context dissemination on router activated,\n" " but no ABRO found. Discarding router advertisement silently\n"); return; } -#endif /* !GNRC_IPV6_NIB_CONF_6LBR */ +#endif /* !CONFIG_GNRC_IPV6_NIB_6LBR */ #endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ if (rtr_adv->ltime.u16 != 0) { uint16_t rtr_ltime = byteorder_ntohs(rtr_adv->ltime); diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib_abr.c b/sys/net/gnrc/network_layer/ipv6/nib/nib_abr.c index fad3fd839f..eaf64678df 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib_abr.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib_abr.c @@ -14,6 +14,7 @@ */ #include +#include #include "net/gnrc/ipv6/nib/abr.h" @@ -21,7 +22,7 @@ #include "_nib-internal.h" #if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C -#if GNRC_IPV6_NIB_CONF_6LBR +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) int gnrc_ipv6_nib_abr_add(const ipv6_addr_t *addr) { _nib_abr_entry_t *abr; @@ -55,7 +56,7 @@ void gnrc_ipv6_nib_abr_del(const ipv6_addr_t *addr) _nib_abr_remove(addr); _nib_release(); } -#endif /* GNRC_IPV6_NIB_CONF_6LBR */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LBR */ bool gnrc_ipv6_nib_abr_iter(void **state, gnrc_ipv6_nib_abr_t *entry) { diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib_pl.c b/sys/net/gnrc/network_layer/ipv6/nib/nib_pl.c index c9100f134a..62202ca0b6 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib_pl.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib_pl.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "net/gnrc/ipv6/nib/pl.h" #include "net/gnrc/netif/internal.h" @@ -71,7 +72,7 @@ int gnrc_ipv6_nib_pl_set(unsigned iface, if (netif->ipv6.aac_mode == GNRC_NETIF_AAC_AUTO) { dst->flags |= _PFX_SLAAC; } -#if GNRC_IPV6_NIB_CONF_6LBR && GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) && GNRC_IPV6_NIB_CONF_MULTIHOP_P6C if (gnrc_netif_is_6lbr(netif)) { _nib_abr_entry_t *abr = NULL; diff --git a/sys/shell/commands/sc_gnrc_ipv6_nib.c b/sys/shell/commands/sc_gnrc_ipv6_nib.c index 3baf21c8f9..ad1d4bb7f6 100644 --- a/sys/shell/commands/sc_gnrc_ipv6_nib.c +++ b/sys/shell/commands/sc_gnrc_ipv6_nib.c @@ -14,6 +14,7 @@ */ #include +#include #include "net/gnrc/ipv6/nib.h" #include "net/gnrc/netif.h" @@ -297,14 +298,14 @@ static int _nib_route(int argc, char **argv) #if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C static void _usage_nib_abr(char **argv) { -#if GNRC_IPV6_NIB_CONF_6LBR - printf("usage: %s %s [show|add|del|help]\n", argv[0], argv[1]); - printf(" %s %s add \n", - argv[0], argv[1]); - printf(" %s %s del \n", argv[0], argv[1]); -#else /* GNRC_IPV6_NIB_CONF_6LBR */ - printf("usage: %s %s [show|help]\n", argv[0], argv[1]); -#endif /* GNRC_IPV6_NIB_CONF_6LBR */ + if (IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR)) { + printf("usage: %s %s [show|add|del|help]\n", argv[0], argv[1]); + printf(" %s %s add \n", argv[0], argv[1]); + printf(" %s %s del \n", argv[0], argv[1]); + } + else { + printf("usage: %s %s [show|help]\n", argv[0], argv[1]); + } printf(" %s %s show\n", argv[0], argv[1]); } @@ -321,7 +322,7 @@ static int _nib_abr(int argc, char **argv) else if ((argc > 2) && (strcmp(argv[2], "help") == 0)) { _usage_nib_abr(argv); } -#if GNRC_IPV6_NIB_CONF_6LBR +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) else if ((argc > 3) && (strcmp(argv[2], "del") == 0)) { ipv6_addr_t addr = IPV6_ADDR_UNSPECIFIED; @@ -355,7 +356,7 @@ static int _nib_abr(int argc, char **argv) return 1; } } -#endif /* GNRC_IPV6_NIB_CONF_6LBR */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LBR */ else { _usage_nib_abr(argv); return 1; diff --git a/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include b/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include index 24fa30541c..fe468920a1 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include +++ b/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include @@ -6,7 +6,7 @@ CFLAGS += -DGNRC_IPV6_NIB_NUMOF=16 CFLAGS += -DGNRC_IPV6_NIB_OFFL_NUMOF=25 CFLAGS += -DGNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF=4 CFLAGS += -DGNRC_IPV6_NIB_ABR_NUMOF=4 -CFLAGS += -DGNRC_IPV6_NIB_CONF_6LBR=1 +CFLAGS += -DCONFIG_GNRC_IPV6_NIB_6LBR=1 CFLAGS += -DGNRC_IPV6_NIB_CONF_MULTIHOP_P6C=1 CFLAGS += -DGNRC_IPV6_NIB_CONF_DC=1