From 40c78f1c758e775f088135c844d8a8795c695e7c Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Wed, 11 Mar 2020 17:38:03 +0100 Subject: [PATCH 01/24] gnrc/nib: Move GNRC_IPV6_NIB_CONF_6LBR to 'CONFIG_' namespace Also evaluate it using IS_ACTIVE macro. --- sys/include/net/gnrc/ipv6/nib/abr.h | 10 +++++---- sys/include/net/gnrc/ipv6/nib/conf.h | 14 +++++++------ sys/include/net/gnrc/netif/internal.h | 6 ++++-- .../gnrc/application_layer/dhcpv6/client.c | 2 +- .../gnrc/application_layer/uhcpc/gnrc_uhcpc.c | 6 ++++-- .../gnrc/network_layer/ipv6/nib/_nib-router.h | 10 +++++---- sys/net/gnrc/network_layer/ipv6/nib/nib.c | 5 +++-- sys/net/gnrc/network_layer/ipv6/nib/nib_abr.c | 5 +++-- sys/net/gnrc/network_layer/ipv6/nib/nib_pl.c | 3 ++- sys/shell/commands/sc_gnrc_ipv6_nib.c | 21 ++++++++++--------- .../tests-gnrc_ipv6_nib/Makefile.include | 2 +- 11 files changed, 49 insertions(+), 35 deletions(-) diff --git a/sys/include/net/gnrc/ipv6/nib/abr.h b/sys/include/net/gnrc/ipv6/nib/abr.h index 18345b8ac7a9..4474fcc41793 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 724222a21fdd..e8efb2b3077a 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 9e22439214c1..700e57f011fc 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 1a49ee9433d2..80b7f23e69b2 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 5f6bbc9e0093..678b90def13f 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 aa6c0753c854..4f29fc47dd23 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 2c77559df466..551de7c23ba0 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 fad3fd839f3e..eaf64678df44 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 c9100f134ad6..62202ca0b67e 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 3baf21c8f9a3..ad1d4bb7f684 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 24fa30541cc4..fe468920a120 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 From 398bb6d025a46615ea9023a6dbd9d0d4038043d4 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 12 Mar 2020 12:15:26 +0100 Subject: [PATCH 02/24] gnrc/nib: Move GNRC_IPV6_NIB_CONF_6LR to 'CONFIG_' namespace Also evaluate it using IS_ACTIVE --- sys/include/net/gnrc/ipv6/nib.h | 2 +- sys/include/net/gnrc/ipv6/nib/conf.h | 20 ++++++++--------- sys/include/net/gnrc/netif/internal.h | 9 ++++---- .../gnrc/network_layer/ipv6/nib/_nib-6ln.c | 7 +++--- .../gnrc/network_layer/ipv6/nib/_nib-6lr.c | 7 +++--- .../gnrc/network_layer/ipv6/nib/_nib-6lr.h | 9 ++++---- .../gnrc/network_layer/ipv6/nib/_nib-arsm.c | 5 +++-- .../network_layer/ipv6/nib/_nib-internal.c | 5 +++-- .../network_layer/ipv6/nib/_nib-internal.h | 7 +++--- .../gnrc/network_layer/ipv6/nib/_nib-router.h | 16 +++++++++----- sys/net/gnrc/network_layer/ipv6/nib/nib.c | 22 +++++++++---------- sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c | 4 ++-- 12 files changed, 62 insertions(+), 51 deletions(-) diff --git a/sys/include/net/gnrc/ipv6/nib.h b/sys/include/net/gnrc/ipv6/nib.h index 40a03aa4a00a..df08b099f4d8 100644 --- a/sys/include/net/gnrc/ipv6/nib.h +++ b/sys/include/net/gnrc/ipv6/nib.h @@ -140,7 +140,7 @@ extern "C" { * timeout. The expected message context is a pointer to a valid on-link entry * representing the neighbor which faces a timeout of its address registration. * - * @note Only handled with @ref GNRC_IPV6_NIB_CONF_6LR != 0 + * @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_6LR != 0 */ #define GNRC_IPV6_NIB_ADDR_REG_TIMEOUT (0x4fc9U) diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index e8efb2b3077a..00828938ebb1 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -41,8 +41,8 @@ extern "C" { #endif #ifdef MODULE_GNRC_IPV6_NIB_6LR -#ifndef GNRC_IPV6_NIB_CONF_6LR -#define GNRC_IPV6_NIB_CONF_6LR 1 +#ifndef CONFIG_GNRC_IPV6_NIB_6LR +#define CONFIG_GNRC_IPV6_NIB_6LR 1 #endif #ifndef GNRC_IPV6_NIB_CONF_SLAAC #define GNRC_IPV6_NIB_CONF_SLAAC 0 @@ -59,7 +59,7 @@ extern "C" { #ifndef GNRC_IPV6_NIB_CONF_QUEUE_PKT #define GNRC_IPV6_NIB_CONF_QUEUE_PKT 0 #endif -#if !GNRC_IPV6_NIB_CONF_6LR +#if !CONFIG_GNRC_IPV6_NIB_6LR # ifndef GNRC_IPV6_NIB_CONF_ARSM # define GNRC_IPV6_NIB_CONF_ARSM 0 # endif @@ -93,11 +93,11 @@ extern "C" { /** * @brief enable features for 6Lo router */ -#ifndef GNRC_IPV6_NIB_CONF_6LR +#ifndef CONFIG_GNRC_IPV6_NIB_6LR #if CONFIG_GNRC_IPV6_NIB_6LBR -#define GNRC_IPV6_NIB_CONF_6LR 1 +#define CONFIG_GNRC_IPV6_NIB_6LR 1 #else -#define GNRC_IPV6_NIB_CONF_6LR 0 +#define CONFIG_GNRC_IPV6_NIB_6LR 0 #endif #endif @@ -105,7 +105,7 @@ extern "C" { * @brief enable features for 6Lo node */ #ifndef GNRC_IPV6_NIB_CONF_6LN -#if GNRC_IPV6_NIB_CONF_6LR +#if CONFIG_GNRC_IPV6_NIB_6LR #define GNRC_IPV6_NIB_CONF_6LN 1 #else #define GNRC_IPV6_NIB_CONF_6LN 0 @@ -116,7 +116,7 @@ extern "C" { * @brief enable features for IPv6 routers */ #ifndef GNRC_IPV6_NIB_CONF_ROUTER -#if GNRC_IPV6_NIB_CONF_6LR +#if CONFIG_GNRC_IPV6_NIB_6LR #define GNRC_IPV6_NIB_CONF_ROUTER 1 #else #define GNRC_IPV6_NIB_CONF_ROUTER 0 @@ -128,7 +128,7 @@ extern "C" { */ #ifndef GNRC_IPV6_NIB_CONF_ADV_ROUTER #if GNRC_IPV6_NIB_CONF_ROUTER && \ - (!GNRC_IPV6_NIB_CONF_6LR || CONFIG_GNRC_IPV6_NIB_6LBR) + (!CONFIG_GNRC_IPV6_NIB_6LR || CONFIG_GNRC_IPV6_NIB_6LBR) #define GNRC_IPV6_NIB_CONF_ADV_ROUTER 1 #else #define GNRC_IPV6_NIB_CONF_ADV_ROUTER 0 @@ -196,7 +196,7 @@ extern "C" { * @see [RFC 6775, section 8.1](https://tools.ietf.org/html/rfc6775#section-8.1) */ #ifndef GNRC_IPV6_NIB_CONF_MULTIHOP_P6C -#if GNRC_IPV6_NIB_CONF_6LR +#if CONFIG_GNRC_IPV6_NIB_6LR #define GNRC_IPV6_NIB_CONF_MULTIHOP_P6C 1 #else #define GNRC_IPV6_NIB_CONF_MULTIHOP_P6C 0 diff --git a/sys/include/net/gnrc/netif/internal.h b/sys/include/net/gnrc/netif/internal.h index 700e57f011fc..695ac19d3cba 100644 --- a/sys/include/net/gnrc/netif/internal.h +++ b/sys/include/net/gnrc/netif/internal.h @@ -405,7 +405,7 @@ static inline bool gnrc_netif_is_6ln(const gnrc_netif_t *netif) * RFC 6775 * * @attention Requires prior locking - * @note Assumed to be false, when @ref GNRC_IPV6_NIB_CONF_6LR == 0 + * @note Assumed to be false, when @ref CONFIG_GNRC_IPV6_NIB_6LR == 0 * * @param[in] netif the network interface * @@ -417,9 +417,10 @@ static inline bool gnrc_netif_is_6ln(const gnrc_netif_t *netif) static inline bool gnrc_netif_is_6lr(const gnrc_netif_t *netif) { /* if flag checkers even evaluate, otherwise just assume their result */ - if (GNRC_IPV6_NIB_CONF_6LR && (IS_USED(MODULE_GNRC_IPV6_ROUTER) || - (!gnrc_netif_highlander()) || - !IS_USED(MODULE_GNRC_SIXLOWPAN))) { + if (IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) && + (IS_USED(MODULE_GNRC_IPV6_ROUTER) || + (!gnrc_netif_highlander()) || + !IS_USED(MODULE_GNRC_SIXLOWPAN))) { return gnrc_netif_is_rtr(netif) && gnrc_netif_is_6ln(netif); } else { diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c index 9979e193e0e4..f6141a065ba0 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c @@ -12,6 +12,7 @@ * @file * @author Martine Lenders */ +#include #include "net/gnrc/netif/internal.h" #include "net/gnrc/ipv6/nib.h" @@ -140,15 +141,15 @@ uint8_t _handle_aro(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, } return aro->status; } -#if GNRC_IPV6_NIB_CONF_6LR +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) else if (gnrc_netif_is_6lr(netif) && (icmpv6->type == ICMPV6_NBR_SOL)) { return _reg_addr_upstream(netif, ipv6, icmpv6, aro, sl2ao, nce); } -#else /* GNRC_IPV6_NIB_CONF_6LR */ +#else /* CONFIG_GNRC_IPV6_NIB_6LR */ (void)sl2ao; (void)nce; -#endif /* GNRC_IPV6_NIB_CONF_6LR */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LR */ } #if ENABLE_DEBUG else if (aro->len != SIXLOWPAN_ND_OPT_AR_LEN) { diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.c index 094a9deef035..cdae02add1c1 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.c @@ -12,6 +12,7 @@ * @file * @author Martine Lenders */ +#include #include "net/gnrc/ipv6/nib.h" #include "net/gnrc/netif/internal.h" @@ -22,7 +23,7 @@ #define ENABLE_DEBUG (0) #include "debug.h" -#if GNRC_IPV6_NIB_CONF_6LR +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) static char addr_str[IPV6_ADDR_MAX_STR_LEN]; @@ -120,8 +121,8 @@ gnrc_pktsnip_t *_copy_and_handle_aro(gnrc_netif_t *netif, } return reply_aro; } -#else /* GNRC_IPV6_NIB_CONF_6LR */ +#else /* CONFIG_GNRC_IPV6_NIB_6LR */ typedef int dont_be_pedantic; -#endif /* GNRC_IPV6_NIB_CONF_6LR */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LR */ /** @} */ diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.h index a7df32240a75..60054a703bcf 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.h @@ -12,13 +12,14 @@ * * @file * @brief Definitions related to 6Lo router (6LR) functionality of the NIB - * @see @ref GNRC_IPV6_NIB_CONF_6LR + * @see @ref CONFIG_GNRC_IPV6_NIB_6LR * * @author Martine Lenders */ #ifndef PRIV_NIB_6LR_H #define PRIV_NIB_6LR_H +#include #include "net/gnrc/ipv6/nib/conf.h" #include "net/ndp.h" @@ -32,7 +33,7 @@ extern "C" { #endif -#if GNRC_IPV6_NIB_CONF_6LR || defined(DOXYGEN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) || defined(DOXYGEN) /** * @brief Gets address registration state of a neighbor * @@ -123,7 +124,7 @@ gnrc_pktsnip_t *_copy_and_handle_aro(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6 * @param[in] netif The interface. */ void _set_rtr_adv(gnrc_netif_t *netif); -#else /* GNRC_IPV6_NIB_CONF_6LR || defined(DOXYGEN) */ +#else /* CONFIG_GNRC_IPV6_NIB_6LR || defined(DOXYGEN) */ #define _rtr_sol_on_6lr(netif, icmpv6) (false) #define _get_ar_state(nbr) (_ADDR_REG_STATUS_IGNORE) #define _set_ar_state(nbr, state) (void)nbr; (void)state @@ -133,7 +134,7 @@ void _set_rtr_adv(gnrc_netif_t *netif); #define _copy_and_handle_aro(netif, ipv6, icmpv6, aro, sl2ao) \ (NULL) #define _set_rtr_adv(netif) (void)netif -#endif /* GNRC_IPV6_NIB_CONF_6LR || defined(DOXYGEN) */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LR || defined(DOXYGEN) */ #ifdef __cplusplus } diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c index 6ad0a178a84a..c51e9276ed3e 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c @@ -12,6 +12,7 @@ * @file * @author Martine Lenders */ +#include #include "evtimer.h" #include "net/gnrc/ndp.h" @@ -120,7 +121,7 @@ void _handle_sl2ao(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, if (icmpv6->type == ICMPV6_NBR_SOL) { nce->info &= ~GNRC_IPV6_NIB_NC_INFO_IS_ROUTER; } -#if GNRC_IPV6_NIB_CONF_MULTIHOP_DAD && GNRC_IPV6_NIB_CONF_6LR +#if GNRC_IPV6_NIB_CONF_MULTIHOP_DAD && IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) else if (_rtr_sol_on_6lr(netif, icmpv6)) { DEBUG("nib: Setting newly created entry to tentative\n"); _set_ar_state(nce, GNRC_IPV6_NIB_NC_INFO_AR_STATE_TENTATIVE); @@ -128,7 +129,7 @@ void _handle_sl2ao(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, &nce->addr_reg_timeout, SIXLOWPAN_ND_TENTATIVE_NCE_SEC_LTIME * MS_PER_SEC); } -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_DAD && GNRC_IPV6_NIB_CONF_6LR */ +#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_DAD && CONFIG_GNRC_IPV6_NIB_6LR */ } #if ENABLE_DEBUG else { diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c index 78ee6f9cfa3e..ac2c4cc09b13 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "net/gnrc/icmpv6/error.h" #include "net/gnrc/ipv6.h" @@ -272,9 +273,9 @@ void _nib_nc_remove(_nib_onl_entry_t *node) #if GNRC_IPV6_NIB_CONF_ROUTER evtimer_del((evtimer_t *)&_nib_evtimer, &node->reply_rs.event); #endif /* GNRC_IPV6_NIB_CONF_ROUTER */ -#if GNRC_IPV6_NIB_CONF_6LR +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) evtimer_del((evtimer_t *)&_nib_evtimer, &node->addr_reg_timeout.event); -#endif /* GNRC_IPV6_NIB_CONF_6LR */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LR */ #if GNRC_IPV6_NIB_CONF_QUEUE_PKT gnrc_pktqueue_t *tmp; for (gnrc_pktqueue_t *ptr = node->pktqueue; diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h index 114a850827b7..1b862ef7048f 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h @@ -23,6 +23,7 @@ #include #include #include +#include #include "bitfield.h" #include "evtimer_msg.h" @@ -103,11 +104,11 @@ typedef struct _nib_onl_entry { * @brief Neighbors IPv6 address */ ipv6_addr_t ipv6; -#if GNRC_IPV6_NIB_CONF_6LR || defined(DOXYGEN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) || defined(DOXYGEN) /** * @brief The neighbors EUI-64 (used for DAD) * - * @note Only available if @ref GNRC_IPV6_NIB_CONF_6LR != 0. + * @note Only available if @ref CONFIG_GNRC_IPV6_NIB_6LR != 0. */ eui64_t eui64; #endif @@ -144,7 +145,7 @@ typedef struct _nib_onl_entry { #if GNRC_IPV6_NIB_CONF_ROUTER || defined(DOXYGEN) evtimer_msg_event_t reply_rs; /**< Event for @ref GNRC_IPV6_NIB_REPLY_RS */ #endif -#if GNRC_IPV6_NIB_CONF_6LR || defined(DOXYGEN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) || defined(DOXYGEN) evtimer_msg_event_t addr_reg_timeout; /**< Event for @ref GNRC_IPV6_NIB_ADDR_REG_TIMEOUT */ #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 4f29fc47dd23..22e58bcd423b 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.h @@ -45,12 +45,16 @@ 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 || IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) - netif->flags |= GNRC_NETIF_FLAGS_IPV6_RTR_ADV; -#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 /* CONFIG_GNRC_IPV6_NIB_6LBR */ + + if (!IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) || + IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR)) { + netif->flags |= GNRC_NETIF_FLAGS_IPV6_RTR_ADV; + } + + if (IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR)) { + netif->flags |= GNRC_NETIF_FLAGS_6LO_ABR; + } + 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 551de7c23ba0..a18b58c6a1f6 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib.c @@ -361,11 +361,11 @@ void gnrc_ipv6_nib_handle_timer_event(void *ctx, uint16_t type) _nib_ft_remove(ctx); break; #endif /* GNRC_IPV6_NIB_CONF_ROUTER */ -#if GNRC_IPV6_NIB_CONF_6LR +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) case GNRC_IPV6_NIB_ADDR_REG_TIMEOUT: _nib_nc_remove(ctx); break; -#endif /* GNRC_IPV6_NIB_CONF_6LR */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LR */ #if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C case GNRC_IPV6_NIB_ABR_TIMEOUT: _nib_abr_remove(&((_nib_abr_entry_t *)ctx)->addr); @@ -538,11 +538,11 @@ static void _handle_rtr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, next_ra_delay); } } -#if GNRC_IPV6_NIB_CONF_6LR +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) else if (gnrc_netif_is_rtr(netif) && gnrc_netif_is_rtr_adv(netif)) { _snd_rtr_advs(netif, &ipv6->src, false); } -#endif /* GNRC_IPV6_NIB_CONF_6LR */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LR */ #if GNRC_IPV6_NIB_CONF_6LN (void)nce; /* NCE is not used */ #endif @@ -935,13 +935,13 @@ static void _handle_nbr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, } else { gnrc_pktsnip_t *reply_aro = NULL; -#if GNRC_IPV6_NIB_CONF_6LR +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) ndp_opt_t *sl2ao = NULL; sixlowpan_nd_opt_ar_t *aro = NULL; -#else /* GNRC_IPV6_NIB_CONF_6LR */ +#else /* CONFIG_GNRC_IPV6_NIB_6LR */ #define sl2ao (NULL) #define aro (NULL) -#endif /* GNRC_IPV6_NIB_CONF_6LR */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LR */ tmp_len = icmpv6_len - sizeof(ndp_nbr_sol_t); if (!(netif->flags & GNRC_NETIF_FLAGS_HAS_L2ADDR)) { @@ -952,22 +952,22 @@ static void _handle_nbr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, FOREACH_OPT(nbr_sol, opt, tmp_len) { switch (opt->type) { case NDP_OPT_SL2A: -#if GNRC_IPV6_NIB_CONF_6LR +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) if (gnrc_netif_is_6lr(netif)) { DEBUG("nib: Storing SL2AO for later handling\n"); sl2ao = opt; break; } -#endif /* GNRC_IPV6_NIB_CONF_6LR */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LR */ _handle_sl2ao(netif, ipv6, (const icmpv6_hdr_t *)nbr_sol, opt); break; -#if GNRC_IPV6_NIB_CONF_6LR +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) case NDP_OPT_AR: DEBUG("nib: Storing ARO for later handling\n"); aro = (sixlowpan_nd_opt_ar_t *)opt; break; -#endif /* GNRC_IPV6_NIB_CONF_6LR */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LR */ default: DEBUG("nib: Ignoring unrecognized option type %u for NS\n", opt->type); diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c b/sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c index e78b8e18045b..b99ff537ec03 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c @@ -117,7 +117,7 @@ static const char *_nud_str[] = { }; #endif -#if GNRC_IPV6_NIB_CONF_6LR +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) #define _AR_STR_IDX(state) ((state) >> GNRC_IPV6_NIB_NC_INFO_AR_STATE_POS) static const char *_ar_str[] = { @@ -146,7 +146,7 @@ void gnrc_ipv6_nib_nc_print(gnrc_ipv6_nib_nc_t *entry) #if GNRC_IPV6_NIB_CONF_ARSM printf(" %s", _nud_str[gnrc_ipv6_nib_nc_get_nud_state(entry)]); #endif -#if GNRC_IPV6_NIB_CONF_6LR +#if CONFIG_GNRC_IPV6_NIB_6LR printf(" %s",_ar_str[_AR_STR_IDX(gnrc_ipv6_nib_nc_get_ar_state(entry))]); #endif puts(""); From 1acfe7ae19a981806f58736e8f24614cc40cc044 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 12 Mar 2020 13:33:35 +0100 Subject: [PATCH 03/24] gnrc/nib: Move GNRC_IPV6_NIB_CONF_6LN to 'CONFIG_' namespace Also evaluate it using IS_ACTIVE macro. --- sys/include/net/gnrc/ipv6/nib.h | 2 +- sys/include/net/gnrc/ipv6/nib/conf.h | 12 +++--- sys/include/net/gnrc/netif/internal.h | 4 +- sys/include/net/gnrc/netif/ipv6.h | 5 ++- sys/net/gnrc/netif/gnrc_netif.c | 5 ++- sys/net/gnrc/netif/gnrc_netif_device_type.c | 5 ++- sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c | 7 ++-- .../gnrc/network_layer/ipv6/nib/_nib-6ln.c | 6 +-- .../gnrc/network_layer/ipv6/nib/_nib-6ln.h | 9 +++-- .../network_layer/ipv6/nib/_nib-internal.c | 8 ++-- .../gnrc/network_layer/ipv6/nib/_nib-slaac.c | 25 ++++++------ .../gnrc/network_layer/ipv6/nib/_nib-slaac.h | 6 +-- sys/net/gnrc/network_layer/ipv6/nib/nib.c | 40 +++++++++---------- 13 files changed, 70 insertions(+), 64 deletions(-) diff --git a/sys/include/net/gnrc/ipv6/nib.h b/sys/include/net/gnrc/ipv6/nib.h index df08b099f4d8..180e1f8b843e 100644 --- a/sys/include/net/gnrc/ipv6/nib.h +++ b/sys/include/net/gnrc/ipv6/nib.h @@ -189,7 +189,7 @@ extern "C" { * upstream router. The expected message context is an IPv6 address assigned to * one of the nodes interfaces. * - * @note Only handled with @ref GNRC_IPV6_NIB_CONF_6LN != 0 + * @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_6LN != 0 */ #define GNRC_IPV6_NIB_REREG_ADDRESS (0x4fcfU) diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index 00828938ebb1..085863c8c7e5 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -50,8 +50,8 @@ extern "C" { #endif #ifdef MODULE_GNRC_IPV6_NIB_6LN -#ifndef GNRC_IPV6_NIB_CONF_6LN -#define GNRC_IPV6_NIB_CONF_6LN 1 +#ifndef CONFIG_GNRC_IPV6_NIB_6LN +#define CONFIG_GNRC_IPV6_NIB_6LN 1 #endif #ifndef GNRC_IPV6_NIB_CONF_SLAAC #define GNRC_IPV6_NIB_CONF_SLAAC 0 @@ -104,11 +104,11 @@ extern "C" { /** * @brief enable features for 6Lo node */ -#ifndef GNRC_IPV6_NIB_CONF_6LN +#ifndef CONFIG_GNRC_IPV6_NIB_6LN #if CONFIG_GNRC_IPV6_NIB_6LR -#define GNRC_IPV6_NIB_CONF_6LN 1 +#define CONFIG_GNRC_IPV6_NIB_6LN 1 #else -#define GNRC_IPV6_NIB_CONF_6LN 0 +#define CONFIG_GNRC_IPV6_NIB_6LN 0 #endif #endif @@ -146,7 +146,7 @@ extern "C" { * @brief queue packets for address resolution */ #ifndef GNRC_IPV6_NIB_CONF_QUEUE_PKT -#if GNRC_IPV6_NIB_CONF_6LN +#if CONFIG_GNRC_IPV6_NIB_6LN #define GNRC_IPV6_NIB_CONF_QUEUE_PKT 0 #else #define GNRC_IPV6_NIB_CONF_QUEUE_PKT 1 diff --git a/sys/include/net/gnrc/netif/internal.h b/sys/include/net/gnrc/netif/internal.h index 695ac19d3cba..b0cfa48c5c47 100644 --- a/sys/include/net/gnrc/netif/internal.h +++ b/sys/include/net/gnrc/netif/internal.h @@ -381,7 +381,7 @@ static inline bool gnrc_netif_is_6lo(const gnrc_netif_t *netif) * RFC 6775 * * @attention Requires prior locking - * @note Assumed to be false, when @ref GNRC_IPV6_NIB_CONF_6LN is 0. + * @note Assumed to be false, when @ref CONFIG_GNRC_IPV6_NIB_6LN is 0. * * @param[in] netif the network interface * @@ -392,7 +392,7 @@ static inline bool gnrc_netif_is_6lo(const gnrc_netif_t *netif) */ static inline bool gnrc_netif_is_6ln(const gnrc_netif_t *netif) { - if (IS_ACTIVE(GNRC_IPV6_NIB_CONF_6LN)) { + if (IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN)) { return (netif->flags & GNRC_NETIF_FLAGS_6LN); } else { diff --git a/sys/include/net/gnrc/netif/ipv6.h b/sys/include/net/gnrc/netif/ipv6.h index d775e96a8046..17c442b68175 100644 --- a/sys/include/net/gnrc/netif/ipv6.h +++ b/sys/include/net/gnrc/netif/ipv6.h @@ -19,6 +19,7 @@ #define NET_GNRC_NETIF_IPV6_H #include +#include #include "evtimer_msg.h" #include "net/ipv6/addr.h" @@ -151,13 +152,13 @@ typedef struct { * and @ref net_gnrc_ipv6_nib "NIB" */ evtimer_msg_event_t search_rtr; -#if GNRC_IPV6_NIB_CONF_6LN || GNRC_IPV6_NIB_CONF_SLAAC || DOXYGEN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || GNRC_IPV6_NIB_CONF_SLAAC || DOXYGEN /** * @brief Timers for address re-registration * * @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6" and * @ref net_gnrc_ipv6_nib "NIB" and if - * @ref GNRC_IPV6_NIB_CONF_6LN != 0 or + * @ref CONFIG_GNRC_IPV6_NIB_6LN != 0 or * @ref GNRC_IPV6_NIB_CONF_SLAAC != 0 * @note Might also be usable in the later default SLAAC implementation * for NS retransmission timers. diff --git a/sys/net/gnrc/netif/gnrc_netif.c b/sys/net/gnrc/netif/gnrc_netif.c index 090fa02d12d5..e7d4196f8920 100644 --- a/sys/net/gnrc/netif/gnrc_netif.c +++ b/sys/net/gnrc/netif/gnrc_netif.c @@ -16,6 +16,7 @@ */ #include +#include #include "bitfield.h" #include "net/ethernet.h" @@ -1309,10 +1310,10 @@ static void _test_options(gnrc_netif_t *netif) assert(-ENOTSUP != gnrc_netif_ndp_addr_len_from_l2ao(netif, &dummy_opt)); #endif /* MODULE_GNRC_IPV6 */ -#if GNRC_IPV6_NIB_CONF_6LN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) assert(-ENOTSUP != gnrc_netif_ipv6_iid_to_addr(netif, (eui64_t *)&tmp64, dummy_addr)); -#endif /* GNRC_IPV6_NIB_CONF_6LN */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN */ } #endif /* (GNRC_NETIF_L2ADDR_MAXLEN > 0) */ options_tested = true; diff --git a/sys/net/gnrc/netif/gnrc_netif_device_type.c b/sys/net/gnrc/netif/gnrc_netif_device_type.c index 1d5bde412f78..bf8a6739906c 100644 --- a/sys/net/gnrc/netif/gnrc_netif_device_type.c +++ b/sys/net/gnrc/netif/gnrc_netif_device_type.c @@ -15,6 +15,7 @@ */ #include +#include #include "log.h" #ifdef MODULE_GNRC_IPV6 @@ -109,9 +110,9 @@ void gnrc_netif_init_6ln(gnrc_netif_t *netif) case NETDEV_TYPE_ESP_NOW: #endif case NETDEV_TYPE_NRFMIN: -#if GNRC_IPV6_NIB_CONF_6LN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) netif->flags |= GNRC_NETIF_FLAGS_6LN; -#endif /* GNRC_IPV6_NIB_CONF_6LN */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN */ /* intentionally falls through */ default: break; diff --git a/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c b/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c index 34fa86f17fb0..55961e70def1 100644 --- a/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c +++ b/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include "byteorder.h" @@ -387,7 +388,7 @@ static int _fill_ipv6_hdr(gnrc_netif_t *netif, gnrc_pktsnip_t *ipv6) (gnrc_netif_ipv6_addr_get_state(netif, idx) != GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID); gnrc_netif_release(netif); if (invalid_src) { -#if GNRC_IPV6_NIB_CONF_6LN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) gnrc_pktsnip_t *icmpv6 = gnrc_pktsnip_search_type(ipv6, GNRC_NETTYPE_ICMPV6); icmpv6_hdr_t *icmpv6_hdr; @@ -402,11 +403,11 @@ static int _fill_ipv6_hdr(gnrc_netif_t *netif, gnrc_pktsnip_t *ipv6) ipv6_addr_to_str(addr_str, &hdr->src, sizeof(addr_str))); return -EADDRNOTAVAIL; } -#else /* GNRC_IPV6_NIB_CONF_6LN */ +#else /* CONFIG_GNRC_IPV6_NIB_6LN */ DEBUG("ipv6: preset packet source address %s is invalid\n", ipv6_addr_to_str(addr_str, &hdr->src, sizeof(addr_str))); return -EADDRNOTAVAIL; -#endif /* GNRC_IPV6_NIB_CONF_6LN */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN */ } } diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c index f6141a065ba0..ba25811b4985 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c @@ -24,7 +24,7 @@ #define ENABLE_DEBUG (0) #include "debug.h" -#if GNRC_IPV6_NIB_CONF_6LN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) static char addr_str[IPV6_ADDR_MAX_STR_LEN]; @@ -293,9 +293,9 @@ uint32_t _handle_6co(const icmpv6_hdr_t *icmpv6, #endif /* MODULE_GNRC_SIXLOWPAN_CTX */ return ltime * SEC_PER_MIN * MS_PER_SEC; } -#else /* GNRC_IPV6_NIB_CONF_6LN */ +#else /* CONFIG_GNRC_IPV6_NIB_6LN */ typedef int dont_be_pedantic; -#endif /* GNRC_IPV6_NIB_CONF_6LN */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN */ /** @} */ diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.h index 35ff239580fc..37d84124447c 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.h @@ -12,13 +12,14 @@ * * @file * @brief Definitions related to 6Lo node (6LN) functionality of the NIB - * @see @ref GNRC_IPV6_NIB_CONF_6LN + * @see @ref CONFIG_GNRC_IPV6_NIB_6LN * * @author Martine Lenders */ #ifndef PRIV_NIB_6LN_H #define PRIV_NIB_6LN_H +#include #include #include "net/gnrc/ipv6/nib/conf.h" @@ -33,7 +34,7 @@ extern "C" { #endif -#if GNRC_IPV6_NIB_CONF_6LN || defined(DOXYGEN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || defined(DOXYGEN) /** * @brief Additional (local) status to ARO status values for tentative * addresses @@ -134,7 +135,7 @@ uint32_t _handle_6co(const icmpv6_hdr_t *icmpv6, uint32_t _handle_6co(const icmpv6_hdr_t *icmpv6, const sixlowpan_nd_opt_6ctx_t *sixco); #endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C || defined(DOXYGEN) */ -#else /* GNRC_IPV6_NIB_CONF_6LN || defined(DOXYGEN) */ +#else /* CONFIG_GNRC_IPV6_NIB_6LN || defined(DOXYGEN) */ #define _resolve_addr_from_ipv6(dst, netif, nce) (false) /* _handle_aro() doesn't make sense without 6LR so don't even use it * => throw error in case it is compiled in => don't define it here as NOP macro @@ -147,7 +148,7 @@ uint32_t _handle_6co(const icmpv6_hdr_t *icmpv6, #else /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C || defined(DOXYGEN) */ #define _handle_6co(icmpv6, sixco) (UINT32_MAX) #endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C || defined(DOXYGEN) */ -#endif /* GNRC_IPV6_NIB_CONF_6LN || defined(DOXYGEN) */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN || defined(DOXYGEN) */ #ifdef __cplusplus diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c index ac2c4cc09b13..19de7f5ccaec 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c @@ -293,7 +293,7 @@ void _nib_nc_remove(_nib_onl_entry_t *node) _nib_onl_clear(node); } -#if GNRC_IPV6_NIB_CONF_6LN || !GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || !GNRC_IPV6_NIB_CONF_ARSM static inline int _get_l2addr_from_ipv6(const gnrc_netif_t *netif, const _nib_onl_entry_t *node, gnrc_ipv6_nib_nc_t *nce) @@ -309,7 +309,7 @@ static inline int _get_l2addr_from_ipv6(const gnrc_netif_t *netif, } return res; } -#endif /* GNRC_IPV6_NIB_CONF_6LN || !GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN || !GNRC_IPV6_NIB_CONF_ARSM */ void _nib_nc_get(const _nib_onl_entry_t *node, gnrc_ipv6_nib_nc_t *nce) { @@ -317,7 +317,7 @@ void _nib_nc_get(const _nib_onl_entry_t *node, gnrc_ipv6_nib_nc_t *nce) memcpy(&nce->ipv6, &node->ipv6, sizeof(nce->ipv6)); nce->info = node->info; #if GNRC_IPV6_NIB_CONF_ARSM -#if GNRC_IPV6_NIB_CONF_6LN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) if (ipv6_addr_is_link_local(&nce->ipv6)) { gnrc_netif_t *netif = gnrc_netif_get_by_pid(_nib_onl_get_if(node)); assert(netif != NULL); @@ -327,7 +327,7 @@ void _nib_nc_get(const _nib_onl_entry_t *node, gnrc_ipv6_nib_nc_t *nce) return; } } -#endif /* GNRC_IPV6_NIB_CONF_6LN */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN */ nce->l2addr_len = node->l2addr_len; memcpy(&nce->l2addr, &node->l2addr, node->l2addr_len); #else /* GNRC_IPV6_NIB_CONF_ARSM */ diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.c index 44cd244b1fb1..19fa421eb7de 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.c @@ -13,6 +13,7 @@ * @author Martine Lenders */ +#include #include #include "log.h" @@ -25,7 +26,7 @@ #define ENABLE_DEBUG (0) #include "debug.h" -#if GNRC_IPV6_NIB_CONF_6LN || GNRC_IPV6_NIB_CONF_SLAAC +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || GNRC_IPV6_NIB_CONF_SLAAC static char addr_str[IPV6_ADDR_MAX_STR_LEN]; void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx, @@ -51,9 +52,9 @@ void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx, DEBUG("nib: add address based on %s/%u automatically to interface %u\n", ipv6_addr_to_str(addr_str, pfx, sizeof(addr_str)), pfx_len, netif->pid); -#if GNRC_IPV6_NIB_CONF_6LN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) bool new_address = false; -#endif /* GNRC_IPV6_NIB_CONF_6LN */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN */ gnrc_netif_ipv6_get_iid(netif, (eui64_t *)&addr.u64[1]); ipv6_addr_init_prefix(&addr, pfx, pfx_len); if ((idx = gnrc_netif_ipv6_addr_idx(netif, &addr)) < 0) { @@ -63,12 +64,12 @@ void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx, netif->pid); return; } -#if GNRC_IPV6_NIB_CONF_6LN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) new_address = true; -#endif /* GNRC_IPV6_NIB_CONF_6LN */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN */ } -#if GNRC_IPV6_NIB_CONF_6LN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) /* mark link-local addresses as valid on 6LN */ if (gnrc_netif_is_6ln(netif) && ipv6_addr_is_link_local(pfx)) { /* don't do this beforehand or risk a deadlock: @@ -78,17 +79,17 @@ void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx, netif->ipv6.addrs_flags[idx] &= ~GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_MASK; netif->ipv6.addrs_flags[idx] |= GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID; } -#endif /* GNRC_IPV6_NIB_CONF_6LN */ -#if GNRC_IPV6_NIB_CONF_6LN +#endif /* CONFIG_GNRC_IPV6_NIB_6LN */ +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) if (new_address && gnrc_netif_is_6ln(netif) && !gnrc_netif_is_6lbr(netif)) { _handle_rereg_address(&netif->ipv6.addrs[idx]); } -#else /* GNRC_IPV6_NIB_CONF_6LN */ +#else /* CONFIG_GNRC_IPV6_NIB_6LN */ (void)idx; -#endif /* GNRC_IPV6_NIB_CONF_6LN */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN */ } -#endif /* GNRC_IPV6_NIB_CONF_6LN || GNRC_IPV6_NIB_CONF_SLAAC */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN || GNRC_IPV6_NIB_CONF_SLAAC */ #if GNRC_IPV6_NIB_CONF_SLAAC static bool _try_l2addr_reconfiguration(gnrc_netif_t *netif) @@ -101,7 +102,7 @@ static bool _try_l2addr_reconfiguration(gnrc_netif_t *netif) return false; } luid_get(hwaddr, hwaddr_len); -#if GNRC_IPV6_NIB_CONF_6LN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) if (hwaddr_len == IEEE802154_LONG_ADDRESS_LEN) { if (gnrc_netapi_set(netif->pid, NETOPT_ADDRESS_LONG, 0, hwaddr, hwaddr_len) < 0) { diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.h index cb87eba964bd..139753b3af25 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.h @@ -31,7 +31,7 @@ extern "C" { #endif -#if GNRC_IPV6_NIB_CONF_6LN || GNRC_IPV6_NIB_CONF_SLAAC || defined(DOXYGEN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || GNRC_IPV6_NIB_CONF_SLAAC || defined(DOXYGEN) /** * @brief Auto-configures an address from a given prefix * @@ -41,10 +41,10 @@ extern "C" { */ void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx, uint8_t pfx_len); -#else /* GNRC_IPV6_NIB_CONF_6LN || GNRC_IPV6_NIB_CONF_SLAAC */ +#else /* CONFIG_GNRC_IPV6_NIB_6LN || GNRC_IPV6_NIB_CONF_SLAAC */ #define _auto_configure_addr(netif, pfx, pfx_len) \ (void)netif; (void)pfx; (void)pfx_len; -#endif /* GNRC_IPV6_NIB_CONF_6LN || GNRC_IPV6_NIB_CONF_SLAAC */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN || GNRC_IPV6_NIB_CONF_SLAAC */ #if GNRC_IPV6_NIB_CONF_SLAAC || defined(DOXYGEN) /** * @brief Removes a tentative address from the interface and tries to diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib.c b/sys/net/gnrc/network_layer/ipv6/nib/nib.c index a18b58c6a1f6..fefdecc720f8 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib.c @@ -128,16 +128,16 @@ void gnrc_ipv6_nib_init_iface(gnrc_netif_t *netif) _init_iface_arsm(netif); netif->ipv6.retrans_time = NDP_RETRANS_TIMER_MS; -#if GNRC_IPV6_NIB_CONF_SLAAC || GNRC_IPV6_NIB_CONF_6LN +#if GNRC_IPV6_NIB_CONF_SLAAC || IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) /* TODO: set differently dependent on GNRC_IPV6_NIB_CONF_SLAAC if * alternatives exist */ netif->ipv6.aac_mode = GNRC_NETIF_AAC_AUTO; -#endif /* GNRC_IPV6_NIB_CONF_SLAAC || GNRC_IPV6_NIB_CONF_6LN */ +#endif /* GNRC_IPV6_NIB_CONF_SLAAC || CONFIG_GNRC_IPV6_NIB_6LN */ _init_iface_router(netif); gnrc_netif_init_6ln(netif); -#if GNRC_IPV6_NIB_CONF_6LN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) netif->ipv6.rs_sent = 0; -#endif /* GNRC_IPV6_NIB_CONF_6LN */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN */ netif->ipv6.na_sent = 0; if (gnrc_netif_ipv6_group_join_internal(netif, &ipv6_addr_all_nodes_link_local) < 0) { @@ -167,13 +167,13 @@ static bool _on_link(const ipv6_addr_t *dst, unsigned *iface) { _nib_offl_entry_t *entry = NULL; -#if GNRC_IPV6_NIB_CONF_6LN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) if (*iface != 0) { if (gnrc_netif_is_6ln(gnrc_netif_get_by_pid(*iface))) { return ipv6_addr_is_link_local(dst); } } -#endif /* GNRC_IPV6_NIB_CONF_6LN */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN */ while ((entry = _nib_offl_iter(entry))) { if ((entry->mode & _PL) && (entry->flags & _PFX_ON_LINK) && (ipv6_addr_match_prefix(dst, &entry->pfx) >= entry->pfx_len)) { @@ -377,11 +377,11 @@ void gnrc_ipv6_nib_handle_timer_event(void *ctx, uint16_t type) case GNRC_IPV6_NIB_RTR_TIMEOUT: _handle_rtr_timeout(ctx); break; -#if GNRC_IPV6_NIB_CONF_6LN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) case GNRC_IPV6_NIB_REREG_ADDRESS: _handle_rereg_address(ctx); break; -#endif /* GNRC_IPV6_NIB_CONF_6LN */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN */ case GNRC_IPV6_NIB_DAD: _handle_dad(ctx); break; @@ -543,7 +543,7 @@ static void _handle_rtr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, _snd_rtr_advs(netif, &ipv6->src, false); } #endif /* CONFIG_GNRC_IPV6_NIB_6LR */ -#if GNRC_IPV6_NIB_CONF_6LN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) (void)nce; /* NCE is not used */ #endif } @@ -690,7 +690,7 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, if (rtr_adv->retrans_timer.u32 != 0) { netif->ipv6.retrans_time = byteorder_ntohl(rtr_adv->retrans_timer); } -#if GNRC_IPV6_NIB_CONF_6LN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) if ((dr != NULL) && gnrc_netif_is_6ln(netif) && !gnrc_netif_is_6lbr(netif)) { /* (register addresses already assigned but not valid yet)*/ @@ -701,7 +701,7 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, } } } -#endif /* GNRC_IPV6_NIB_CONF_6LN */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN */ tmp_len = icmpv6_len - sizeof(ndp_rtr_adv_t); FOREACH_OPT(rtr_adv, opt, tmp_len) { switch (opt->type) { @@ -729,7 +729,7 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, break; } /* ABRO was already secured in the option check above */ -#if GNRC_IPV6_NIB_CONF_6LN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) case NDP_OPT_6CTX: #if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C next_timeout = _min(_handle_6co((icmpv6_hdr_t *)rtr_adv, @@ -741,7 +741,7 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, next_timeout); #endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ break; -#endif /* GNRC_IPV6_NIB_CONF_6LN */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN */ #if GNRC_IPV6_NIB_CONF_DNS case NDP_OPT_RDNSS: next_timeout = _min(_handle_rdnsso(netif, @@ -757,7 +757,7 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, /* stop sending router solicitations * see https://tools.ietf.org/html/rfc4861#section-6.3.7 */ evtimer_del(&_nib_evtimer, &netif->ipv6.search_rtr.event); -#if GNRC_IPV6_NIB_CONF_6LN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) if (gnrc_netif_is_6ln(netif) && !gnrc_netif_is_6lbr(netif)) { _set_rtr_adv(netif); /* but re-fetch information from router in time */ @@ -765,7 +765,7 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, &netif->ipv6.search_rtr, (next_timeout >> 2) * 3); /* i.e. 3/4 of the time before the earliest expires */ } -#endif /* GNRC_IPV6_NIB_CONF_6LN */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN */ } static inline size_t _get_l2src(const gnrc_netif_t *netif, uint8_t *l2src) @@ -1065,7 +1065,7 @@ static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, #if GNRC_IPV6_NIB_CONF_ARSM bool tl2ao_avail = false; #endif /* GNRC_IPV6_NIB_CONF_ARSM */ -#if GNRC_IPV6_NIB_CONF_6LN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) uint8_t aro_status = _ADDR_REG_STATUS_UNAVAIL; #endif @@ -1078,14 +1078,14 @@ static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, tl2ao_avail = true; break; #endif /* GNRC_IPV6_NIB_CONF_ARSM */ -#if GNRC_IPV6_NIB_CONF_6LN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) case NDP_OPT_AR: aro_status = _handle_aro(netif, ipv6, (const icmpv6_hdr_t *)nbr_adv, (const sixlowpan_nd_opt_ar_t *)opt, opt, nce); break; -#endif /* GNRC_IPV6_NIB_CONF_6LN */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN */ default: DEBUG("nib: Ignoring unrecognized option type %u for NA\n", opt->type); @@ -1101,7 +1101,7 @@ static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, _handle_adv_l2(netif, nce, (icmpv6_hdr_t *)nbr_adv, NULL); } #endif /* GNRC_IPV6_NIB_CONF_ARSM */ -#if GNRC_IPV6_NIB_CONF_SLAAC && GNRC_IPV6_NIB_CONF_6LN +#if GNRC_IPV6_NIB_CONF_SLAAC && IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) /* 6Lo-ND duplicate address detection (DAD) was ignored by neighbor, try * traditional DAD */ if ((aro_status == _ADDR_REG_STATUS_UNAVAIL) && @@ -1109,7 +1109,7 @@ static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, DEBUG("nib: No ARO in NA, falling back to classic DAD\n"); _handle_dad(&ipv6->dst); } -#elif GNRC_IPV6_NIB_CONF_6LN +#elif IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) (void)aro_status; #endif } From 49ec28867c7bca1c9fccae67853520c76440d9a5 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 12 Mar 2020 13:50:13 +0100 Subject: [PATCH 04/24] gnrc/nib: Move GNRC_IPV6_NIB_CONF_ROUTER to 'CONFIG_' namespace Also evaluate it using IS_ACTIVE macro. --- sys/include/net/gnrc/ipv6/nib.h | 8 ++--- sys/include/net/gnrc/ipv6/nib/conf.h | 10 +++--- sys/include/net/gnrc/netif/conf.h | 4 ++- sys/include/net/gnrc/netif/ipv6.h | 18 +++++------ sys/net/gnrc/netif/gnrc_netif.c | 8 ++--- .../gnrc/network_layer/ipv6/nib/_nib-arsm.c | 6 ++-- .../network_layer/ipv6/nib/_nib-internal.c | 10 +++--- .../network_layer/ipv6/nib/_nib-internal.h | 12 +++---- .../gnrc/network_layer/ipv6/nib/_nib-router.c | 7 ++-- .../gnrc/network_layer/ipv6/nib/_nib-router.h | 6 ++-- sys/net/gnrc/network_layer/ipv6/nib/nib.c | 32 +++++++++---------- sys/net/gnrc/network_layer/ipv6/nib/nib_ft.c | 6 ++-- sys/net/gnrc/network_layer/ipv6/nib/nib_pl.c | 4 +-- sys/net/gnrc/network_layer/ndp/gnrc_ndp.c | 4 +-- tests/gnrc_ndp/main.c | 5 +-- .../tests-gnrc_ipv6_nib/Makefile.include | 2 +- 16 files changed, 73 insertions(+), 69 deletions(-) diff --git a/sys/include/net/gnrc/ipv6/nib.h b/sys/include/net/gnrc/ipv6/nib.h index 180e1f8b843e..bfb359e03454 100644 --- a/sys/include/net/gnrc/ipv6/nib.h +++ b/sys/include/net/gnrc/ipv6/nib.h @@ -95,7 +95,7 @@ extern "C" { * pointer to a valid on-link entry representing the neighbor that sent the * Router Solicitation. * - * @note Only handled with @ref GNRC_IPV6_NIB_CONF_ROUTER != 0 + * @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_ROUTER != 0 */ #define GNRC_IPV6_NIB_REPLY_RS (0x4fc5U) @@ -107,7 +107,7 @@ extern "C" { * which the Router Advertisement will be sent and by which parameters it will * be configured. * - * @note Only handled with @ref GNRC_IPV6_NIB_CONF_ROUTER != 0 + * @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_ROUTER != 0 */ #define GNRC_IPV6_NIB_SND_MC_RA (0x4fc6U) @@ -199,7 +199,7 @@ extern "C" { * This message type is for the event of a route timeout. The expected message * context is a valid off-link entry representing the route. * - * @note Only handled with @ref GNRC_IPV6_NIB_CONF_ROUTER != 0 + * @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_ROUTER != 0 */ #define GNRC_IPV6_NIB_ROUTE_TIMEOUT (0x4fd0U) @@ -379,7 +379,7 @@ void gnrc_ipv6_nib_handle_pkt(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, */ void gnrc_ipv6_nib_handle_timer_event(void *ctx, uint16_t type); -#if GNRC_IPV6_NIB_CONF_ROUTER || defined(DOXYGEN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) || defined(DOXYGEN) /** * @brief Changes the state if an interface advertises itself as a router * or not diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index 085863c8c7e5..bb678657481f 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -71,7 +71,7 @@ extern "C" { #endif #ifdef MODULE_GNRC_IPV6_NIB_ROUTER -#define GNRC_IPV6_NIB_CONF_ROUTER 1 +#define CONFIG_GNRC_IPV6_NIB_ROUTER 1 #endif #ifdef MODULE_GNRC_IPV6_NIB_DNS @@ -115,11 +115,11 @@ extern "C" { /** * @brief enable features for IPv6 routers */ -#ifndef GNRC_IPV6_NIB_CONF_ROUTER +#ifndef CONFIG_GNRC_IPV6_NIB_ROUTER #if CONFIG_GNRC_IPV6_NIB_6LR -#define GNRC_IPV6_NIB_CONF_ROUTER 1 +#define CONFIG_GNRC_IPV6_NIB_ROUTER 1 #else -#define GNRC_IPV6_NIB_CONF_ROUTER 0 +#define CONFIG_GNRC_IPV6_NIB_ROUTER 0 #endif #endif @@ -127,7 +127,7 @@ extern "C" { * @brief (de-)activate router advertising at interface start-up */ #ifndef GNRC_IPV6_NIB_CONF_ADV_ROUTER -#if GNRC_IPV6_NIB_CONF_ROUTER && \ +#if CONFIG_GNRC_IPV6_NIB_ROUTER && \ (!CONFIG_GNRC_IPV6_NIB_6LR || CONFIG_GNRC_IPV6_NIB_6LBR) #define GNRC_IPV6_NIB_CONF_ADV_ROUTER 1 #else diff --git a/sys/include/net/gnrc/netif/conf.h b/sys/include/net/gnrc/netif/conf.h index b5ddb6c1f55d..66a9dfd98707 100644 --- a/sys/include/net/gnrc/netif/conf.h +++ b/sys/include/net/gnrc/netif/conf.h @@ -20,6 +20,8 @@ #ifndef NET_GNRC_NETIF_CONF_H #define NET_GNRC_NETIF_CONF_H +#include + #include "net/ieee802154.h" #include "net/ethernet/hdr.h" #include "net/gnrc/ipv6/nib/conf.h" @@ -76,7 +78,7 @@ extern "C" { * * @note Used for calculation of @ref GNRC_NETIF_IPV6_GROUPS_NUMOF */ -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) #define GNRC_NETIF_IPV6_RTR_ADDR (1) #else #define GNRC_NETIF_IPV6_RTR_ADDR (0) diff --git a/sys/include/net/gnrc/netif/ipv6.h b/sys/include/net/gnrc/netif/ipv6.h index 17c442b68175..7f879c505532 100644 --- a/sys/include/net/gnrc/netif/ipv6.h +++ b/sys/include/net/gnrc/netif/ipv6.h @@ -108,7 +108,7 @@ typedef struct { netstats_t stats; #endif #if defined(MODULE_GNRC_IPV6_NIB) || DOXYGEN -#if GNRC_IPV6_NIB_CONF_ROUTER || DOXYGEN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) || DOXYGEN /** * @brief Route info callback * @@ -131,10 +131,10 @@ typedef struct { * * @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6". * and @ref net_gnrc_ipv6_nib "NIB" and if - * @ref GNRC_IPV6_NIB_CONF_ROUTER != 0 + * @ref CONFIG_GNRC_IPV6_NIB_ROUTER != 0 */ evtimer_msg_event_t snd_mc_ra; -#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ +#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ #if GNRC_IPV6_NIB_CONF_ARSM || DOXYGEN /** * @brief Event for @ref GNRC_IPV6_NIB_RECALC_REACH_TIME @@ -166,17 +166,17 @@ typedef struct { evtimer_msg_event_t addrs_timers[CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF]; #endif -#if GNRC_IPV6_NIB_CONF_ROUTER || DOXYGEN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) || DOXYGEN /** * @brief Timestamp in milliseconds of last unsolicited router * advertisement * * @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6". * and @ref net_gnrc_ipv6_nib "NIB" and if - * @ref GNRC_IPV6_NIB_CONF_ROUTER != 0 + * @ref CONFIG_GNRC_IPV6_NIB_ROUTER != 0 */ uint32_t last_ra; -#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ +#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ #if GNRC_IPV6_NIB_CONF_ARSM || defined(DOXYGEN) /** * @brief Base for random reachable time calculation and advertised @@ -205,13 +205,13 @@ typedef struct { * @ref net_gnrc_ipv6_nib "NIB" */ uint32_t retrans_time; -#if GNRC_IPV6_NIB_CONF_ROUTER || DOXYGEN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) || DOXYGEN /** * @brief (Advertised) Router lifetime (default 1800). * * @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6". * and @ref net_gnrc_ipv6_nib "NIB" and if - * @ref GNRC_IPV6_NIB_CONF_ROUTER != 0 + * @ref CONFIG_GNRC_IPV6_NIB_ROUTER != 0 */ uint16_t rtr_ltime; /** @@ -223,7 +223,7 @@ typedef struct { * * @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6". * and @ref net_gnrc_ipv6_nib "NIB" and if - * @ref GNRC_IPV6_NIB_CONF_ROUTER != 0 + * @ref CONFIG_GNRC_IPV6_NIB_ROUTER != 0 */ uint8_t ra_sent; #endif diff --git a/sys/net/gnrc/netif/gnrc_netif.c b/sys/net/gnrc/netif/gnrc_netif.c index e7d4196f8920..545e6cc056e5 100644 --- a/sys/net/gnrc/netif/gnrc_netif.c +++ b/sys/net/gnrc/netif/gnrc_netif.c @@ -203,7 +203,7 @@ int gnrc_netif_get_from_netdev(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt) } /* else ask device */ break; -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) case NETOPT_IPV6_FORWARDING: assert(opt->data_len == sizeof(netopt_enable_t)); *((netopt_enable_t *)opt->data) = (gnrc_netif_is_rtr(netif)) ? @@ -216,7 +216,7 @@ int gnrc_netif_get_from_netdev(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt) NETOPT_ENABLE : NETOPT_DISABLE; res = sizeof(netopt_enable_t); break; -#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ +#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ #endif /* MODULE_GNRC_IPV6 */ #ifdef MODULE_GNRC_SIXLOWPAN_IPHC case NETOPT_6LO_IPHC: @@ -296,7 +296,7 @@ int gnrc_netif_set_from_netdev(gnrc_netif_t *netif, } /* else set device */ break; -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) case NETOPT_IPV6_FORWARDING: assert(opt->data_len == sizeof(netopt_enable_t)); if (*(((netopt_enable_t *)opt->data)) == NETOPT_ENABLE) { @@ -316,7 +316,7 @@ int gnrc_netif_set_from_netdev(gnrc_netif_t *netif, (*(((netopt_enable_t *)opt->data)) == NETOPT_ENABLE)); res = sizeof(netopt_enable_t); break; -#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ +#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ #endif /* MODULE_GNRC_IPV6 */ #ifdef MODULE_GNRC_SIXLOWPAN_IPHC case NETOPT_6LO_IPHC: diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c index c51e9276ed3e..a51d12172ff5 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c @@ -434,16 +434,16 @@ void _set_nud_state(gnrc_netif_t *netif, _nib_onl_entry_t *nce, nce->info &= ~GNRC_IPV6_NIB_NC_INFO_NUD_STATE_MASK; nce->info |= state; -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) gnrc_netif_acquire(netif); if (netif != NULL) { _call_route_info_cb(netif, GNRC_IPV6_NIB_ROUTE_INFO_TYPE_NSC, &nce->ipv6, (void *)((intptr_t)state)); } gnrc_netif_release(netif); -#else /* GNRC_IPV6_NIB_CONF_ROUTER */ +#else /* CONFIG_GNRC_IPV6_NIB_ROUTER */ (void)netif; -#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ +#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ } bool _is_reachable(_nib_onl_entry_t *entry) diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c index 19de7f5ccaec..07a1d1ee941c 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c @@ -270,9 +270,9 @@ void _nib_nc_remove(_nib_onl_entry_t *node) #if GNRC_IPV6_NIB_CONF_ARSM evtimer_del((evtimer_t *)&_nib_evtimer, &node->nud_timeout.event); #endif /* GNRC_IPV6_NIB_CONF_ARSM */ -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) evtimer_del((evtimer_t *)&_nib_evtimer, &node->reply_rs.event); -#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ +#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) evtimer_del((evtimer_t *)&_nib_evtimer, &node->addr_reg_timeout.event); #endif /* CONFIG_GNRC_IPV6_NIB_6LR */ @@ -631,7 +631,7 @@ int _nib_get_route(const ipv6_addr_t *dst, gnrc_pktsnip_t *pkt, _nib_dr_entry_t *router = _nib_drl_get_dr(); if ((router == NULL) && (offl == NULL)) { -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) gnrc_netif_t *ptr = NULL; while ((ptr = gnrc_netif_iter(ptr))) { @@ -639,9 +639,9 @@ int _nib_get_route(const ipv6_addr_t *dst, gnrc_pktsnip_t *pkt, GNRC_IPV6_NIB_ROUTE_INFO_TYPE_RRQ, dst, pkt); } -#else /* GNRC_IPV6_NIB_CONF_ROUTER */ +#else /* CONFIG_GNRC_IPV6_NIB_ROUTER */ (void)pkt; -#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ +#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ return -ENETUNREACH; } else if (router != NULL) { diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h index 1b862ef7048f..75c6f6b60c78 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h @@ -142,7 +142,7 @@ typedef struct _nib_onl_entry { * @brief Event for @ref GNRC_IPV6_NIB_SND_NA */ evtimer_msg_event_t snd_na; -#if GNRC_IPV6_NIB_CONF_ROUTER || defined(DOXYGEN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) || defined(DOXYGEN) evtimer_msg_event_t reply_rs; /**< Event for @ref GNRC_IPV6_NIB_REPLY_RS */ #endif #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) || defined(DOXYGEN) @@ -202,7 +202,7 @@ typedef struct { * @brief Event for @ref GNRC_IPV6_NIB_PFX_TIMEOUT */ evtimer_msg_event_t pfx_timeout; -#ifdef GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) /** * @brief Event for @ref GNRC_IPV6_NIB_ROUTE_TIMEOUT */ @@ -661,7 +661,7 @@ _nib_offl_entry_t *_nib_pl_add(unsigned iface, */ void _nib_pl_remove(_nib_offl_entry_t *nib_offl); -#if GNRC_IPV6_NIB_CONF_ROUTER || DOXYGEN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) || DOXYGEN /** * @brief Creates or gets an existing forwarding table entry by its prefix * @@ -676,7 +676,7 @@ void _nib_pl_remove(_nib_offl_entry_t *nib_offl); * @ref _nib_drl_add() for default route destinations. * @param[in] pfx_len The length in bits of @p pfx in bits. * - * @note Only available if @ref GNRC_IPV6_NIB_CONF_ROUTER. + * @note Only available if @ref CONFIG_GNRC_IPV6_NIB_ROUTER. * * @return A new or existing off-link entry with _nib_offl_entry_t::pfx set to * @p pfx. @@ -697,13 +697,13 @@ static inline _nib_offl_entry_t *_nib_ft_add(const ipv6_addr_t *next_hop, * * Corresponding on-link entry is removed, too. * - * @note Only available if @ref GNRC_IPV6_NIB_CONF_ROUTER. + * @note Only available if @ref CONFIG_GNRC_IPV6_NIB_ROUTER. */ static inline void _nib_ft_remove(_nib_offl_entry_t *nib_offl) { _nib_offl_remove(nib_offl, _FT); } -#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ +#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ #if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C || defined(DOXYGEN) /** diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c index c14c45a6d58b..94960735d3bb 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c @@ -12,6 +12,7 @@ * @file * @author Martine Lenders */ +#include #include "net/gnrc/ipv6/nib.h" #include "net/gnrc/ndp.h" @@ -29,7 +30,7 @@ #define ENABLE_DEBUG (0) #include "debug.h" -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) static char addr_str[IPV6_ADDR_MAX_STR_LEN]; static void _snd_ra(gnrc_netif_t *netif, const ipv6_addr_t *dst, @@ -231,8 +232,8 @@ static void _snd_ra(gnrc_netif_t *netif, const ipv6_addr_t *dst, gnrc_ndp_rtr_adv_send(netif, NULL, dst, final, ext_opts); } -#else /* GNRC_IPV6_NIB_CONF_ROUTER */ +#else /* CONFIG_GNRC_IPV6_NIB_ROUTER */ typedef int dont_be_pedantic; -#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ +#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ /** @} */ 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 22e58bcd423b..76286fe335f6 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.h @@ -33,7 +33,7 @@ extern "C" { #endif -#if GNRC_IPV6_NIB_CONF_ROUTER || defined(DOXYGEN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) || defined(DOXYGEN) /** * @brief Initializes interface for router behavior * @@ -119,7 +119,7 @@ void _set_rtr_adv(gnrc_netif_t *netif); */ void _snd_rtr_advs(gnrc_netif_t *netif, const ipv6_addr_t *dst, bool final); -#else /* GNRC_IPV6_NIB_CONF_ROUTER */ +#else /* CONFIG_GNRC_IPV6_NIB_ROUTER */ #define _init_iface_router(netif) (void)netif #define _call_route_info_cb(netif, type, ctx_addr, ctx) (void)netif; \ (void)type; \ @@ -131,7 +131,7 @@ void _snd_rtr_advs(gnrc_netif_t *netif, const ipv6_addr_t *dst, #define _snd_rtr_advs(netif, dst, final) (void)netif; \ (void)dst; \ (void)final -#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ +#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ #ifdef __cplusplus } diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib.c b/sys/net/gnrc/network_layer/ipv6/nib/nib.c index fefdecc720f8..9c3682ff7bf6 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib.c @@ -59,10 +59,10 @@ static evtimer_msg_event_t _rdnss_timeout; * @internal * @{ */ -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) static void _handle_rtr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const ndp_rtr_sol_t *rtr_sol, size_t icmpv6_len); -#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ +#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const ndp_rtr_adv_t *rtr_adv, size_t icmpv6_len); static void _handle_nbr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, @@ -155,11 +155,11 @@ void gnrc_ipv6_nib_init_iface(gnrc_netif_t *netif) _evtimer_add(netif, GNRC_IPV6_NIB_SEARCH_RTR, &netif->ipv6.search_rtr, next_rs_time); } -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) else { _handle_snd_mc_ra(netif); } -#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ +#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ gnrc_netif_release(netif); } @@ -293,11 +293,11 @@ void gnrc_ipv6_nib_handle_pkt(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, gnrc_netif_acquire(netif); _nib_acquire(); switch (icmpv6->type) { -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) case ICMPV6_RTR_SOL: _handle_rtr_sol(netif, ipv6, (ndp_rtr_sol_t *)icmpv6, icmpv6_len); break; -#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ +#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ case ICMPV6_RTR_ADV: _handle_rtr_adv(netif, ipv6, (ndp_rtr_adv_t *)icmpv6, icmpv6_len); break; @@ -350,7 +350,7 @@ void gnrc_ipv6_nib_handle_timer_event(void *ctx, uint16_t type) case GNRC_IPV6_NIB_SEARCH_RTR: _handle_search_rtr(ctx); break; -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) case GNRC_IPV6_NIB_REPLY_RS: _handle_reply_rs(ctx); break; @@ -360,7 +360,7 @@ void gnrc_ipv6_nib_handle_timer_event(void *ctx, uint16_t type) case GNRC_IPV6_NIB_ROUTE_TIMEOUT: _nib_ft_remove(ctx); break; -#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ +#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) case GNRC_IPV6_NIB_ADDR_REG_TIMEOUT: _nib_nc_remove(ctx); @@ -398,7 +398,7 @@ void gnrc_ipv6_nib_handle_timer_event(void *ctx, uint16_t type) _nib_release(); } -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) void gnrc_ipv6_nib_change_rtr_adv_iface(gnrc_netif_t *netif, bool enable) { gnrc_netif_acquire(netif); @@ -417,7 +417,7 @@ void gnrc_ipv6_nib_change_rtr_adv_iface(gnrc_netif_t *netif, bool enable) } gnrc_netif_release(netif); } -#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ +#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ /* * @internal @@ -446,7 +446,7 @@ static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, icmpv6_len -= (opt->len << 3), \ opt = (ndp_opt_t *)(((uint8_t *)opt) + (opt->len << 3))) -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) static void _handle_rtr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const ndp_rtr_sol_t *rtr_sol, size_t icmpv6_len) { @@ -547,7 +547,7 @@ static void _handle_rtr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, (void)nce; /* NCE is not used */ #endif } -#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ +#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ static inline uint32_t _min(uint32_t a, uint32_t b) { @@ -807,11 +807,11 @@ static void _send_delayed_nbr_adv(const gnrc_netif_t *netif, gnrc_pktbuf_release(payload); return; } -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) if (gnrc_netif_is_rtr(netif)) { reply_flags |= NDP_NBR_ADV_FLAGS_R; } -#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ +#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ #if GNRC_NETIF_L2ADDR_MAXLEN > 0 if (ipv6_addr_is_multicast(&ipv6_hdr->dst)) { uint8_t l2addr[GNRC_NETIF_L2ADDR_MAXLEN]; @@ -1179,14 +1179,14 @@ static bool _resolve_addr(const ipv6_addr_t *dst, gnrc_netif_t *netif, gnrc_pktbuf_release(pkt); return false; } -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) if (netif != NULL) { _call_route_info_cb(netif, GNRC_IPV6_NIB_ROUTE_INFO_TYPE_NSC, dst, (void *)GNRC_IPV6_NIB_NC_INFO_NUD_STATE_INCOMPLETE); } -#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ +#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ #if GNRC_IPV6_NIB_CONF_ARSM reset = true; #endif /* GNRC_IPV6_NIB_CONF_ARSM */ diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib_ft.c b/sys/net/gnrc/network_layer/ipv6/nib/nib_ft.c index 83621e217ad4..7208b992c95f 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib_ft.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib_ft.c @@ -59,7 +59,7 @@ int gnrc_ipv6_nib_ft_add(const ipv6_addr_t *dst, unsigned dst_len, } } } -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) else { _nib_offl_entry_t *ptr; @@ -73,7 +73,7 @@ int gnrc_ipv6_nib_ft_add(const ipv6_addr_t *dst, unsigned dst_len, &ptr->route_timeout, ltime * MS_PER_SEC); } } -#else /* GNRC_IPV6_NIB_CONF_ROUTER */ +#else /* CONFIG_GNRC_IPV6_NIB_ROUTER */ else { res = -ENOTSUP; } @@ -92,7 +92,7 @@ void gnrc_ipv6_nib_ft_del(const ipv6_addr_t *dst, unsigned dst_len) _nib_drl_remove(entry); } } -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) else { _nib_offl_entry_t *entry = NULL; 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 62202ca0b67e..98e22b6a6413 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib_pl.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib_pl.c @@ -85,7 +85,7 @@ int gnrc_ipv6_nib_pl_set(unsigned iface, gnrc_netif_release(netif); #endif /* MODULE_GNRC_NETIF */ _nib_release(); -#if defined(MODULE_GNRC_NETIF) && GNRC_IPV6_NIB_CONF_ROUTER +#if defined(MODULE_GNRC_NETIF) && IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) /* update prefixes down-stream */ _handle_snd_mc_ra(netif); #endif @@ -106,7 +106,7 @@ void gnrc_ipv6_nib_pl_del(unsigned iface, (ipv6_addr_match_prefix(pfx, &dst->pfx) >= pfx_len)) { _nib_pl_remove(dst); _nib_release(); -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) gnrc_netif_t *netif = gnrc_netif_get_by_pid(iface); if (netif) { diff --git a/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c b/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c index 69ad62c00e8f..c7d5fe332b44 100644 --- a/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c +++ b/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c @@ -472,7 +472,7 @@ void gnrc_ndp_rtr_adv_send(gnrc_netif_t *netif, const ipv6_addr_t *src, const ipv6_addr_t *dst, bool fin, gnrc_pktsnip_t *ext_opts) { -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) gnrc_pktsnip_t *hdr = NULL, *pkt = ext_opts; uint32_t reach_time = 0, retrans_timer = 0; uint16_t adv_ltime = 0; @@ -586,7 +586,7 @@ void gnrc_ndp_rtr_adv_send(gnrc_netif_t *netif, const ipv6_addr_t *src, (void)fin; DEBUG("ndp: not a router, dropping ext_opts\n"); gnrc_pktbuf_release(ext_opts); -#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ +#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ } static gnrc_pktsnip_t *_build_headers(gnrc_netif_t *netif, diff --git a/tests/gnrc_ndp/main.c b/tests/gnrc_ndp/main.c index 4940e5e709df..ba611c1e80a2 100644 --- a/tests/gnrc_ndp/main.c +++ b/tests/gnrc_ndp/main.c @@ -18,6 +18,7 @@ * @} */ +#include #include #include "byteorder.h" @@ -888,7 +889,7 @@ static void test_rtr_sol_send__pktbuf_full4(void) TEST_ASSERT(gnrc_pktbuf_is_empty()); } -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) static void test_rtr_adv_send(const ipv6_addr_t *src, const ipv6_addr_t *dst, bool fin, gnrc_pktsnip_t *exp_ext_opts) { @@ -1156,7 +1157,7 @@ static Test *tests_gnrc_ndp_send(void) new_TestFixture(test_rtr_sol_send__pktbuf_full2), new_TestFixture(test_rtr_sol_send__pktbuf_full3), new_TestFixture(test_rtr_sol_send__pktbuf_full4), -#if GNRC_IPV6_NIB_CONF_ROUTER +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) new_TestFixture(test_rtr_adv_send__src_NULL_dst_NULL_no_fin_no_ext_opts), new_TestFixture(test_rtr_adv_send__src_NULL_dst_NULL_no_fin_ext_opts), new_TestFixture(test_rtr_adv_send__src_NULL_dst_NULL_fin_no_ext_opts), diff --git a/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include b/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include index fe468920a120..ad400ce84ff5 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include +++ b/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include @@ -1,7 +1,7 @@ USEMODULE += gnrc_ipv6_nib USEMODULE += gnrc_sixlowpan_nd # required for GNRC_IPV6_NIB_CONF_MULTIHOP_P6C -CFLAGS += -DGNRC_IPV6_NIB_CONF_ROUTER=1 +CFLAGS += -DCONFIG_GNRC_IPV6_NIB_ROUTER=1 CFLAGS += -DGNRC_IPV6_NIB_NUMOF=16 CFLAGS += -DGNRC_IPV6_NIB_OFFL_NUMOF=25 CFLAGS += -DGNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF=4 From ce931f179cd84c048c0e2f0156b772a0dcc9c144 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 12 Mar 2020 14:04:20 +0100 Subject: [PATCH 05/24] gnrc/nib: Move GNRC_IPV6_NIB_CONF_SLAAC to 'CONFIG_' namespace Also evaluate it using IS_ACTIVE macro. --- examples/suit_update/README.md | 4 ++-- pkg/nimble/README.ipv6-over-ble.md | 4 ++-- sys/include/net/gnrc/ipv6/nib.h | 4 ++-- sys/include/net/gnrc/ipv6/nib/conf.h | 16 ++++++++-------- sys/include/net/gnrc/netif/ipv6.h | 4 ++-- sys/net/gnrc/netif/gnrc_netif.c | 2 +- sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.c | 14 +++++++------- sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.h | 15 ++++++++------- sys/net/gnrc/network_layer/ipv6/nib/nib.c | 16 ++++++++-------- tests/gnrc_netif/Makefile | 2 +- 10 files changed, 41 insertions(+), 40 deletions(-) diff --git a/examples/suit_update/README.md b/examples/suit_update/README.md index b648b55f6c06..fe2d711d46f8 100644 --- a/examples/suit_update/README.md +++ b/examples/suit_update/README.md @@ -213,7 +213,7 @@ the prefix (`2001:db8::`) and the EUI64 suffix, in this case `7b7e:3255:1313:8d9 - Provision the wireless ble device: ``` - $ CFLAGS=-DGNRC_IPV6_NIB_CONF_SLAAC=1 USEMODULE+=nimble_autoconn_ipsp USE_ETHOS=0 BOARD=nrf52dk make -C examples/suit_update clean flash -j4 + $ CFLAGS=-DCONFIG_GNRC_IPV6_NIB_SLAAC=1 USEMODULE+=nimble_autoconn_ipsp USE_ETHOS=0 BOARD=nrf52dk make -C examples/suit_update clean flash -j4 ``` - Open a serial terminal on the device to get its local address: @@ -237,7 +237,7 @@ the prefix (`2001:db8::`) and the EUI64 suffix, in this case `7b7e:3255:1313:8d9 **NOTE 2:** Currently, Linux does not support 6LoWPAN neighbor discovery (which RIOT uses per default with BLE), so RIOT needs to be compiled to use stateless -address auto configuration (SLAAC) -> `CFLAGS=-DGNRC_IPV6_NIB_CONF_SLAAC=1`. +address auto configuration (SLAAC) -> `CFLAGS=-DCONFIG_GNRC_IPV6_NIB_SLAAC=1`. - Use `bluetoothctl` on Linux to scan for the device. Once `bluetoothctl` has started, issue `scan on` to start scanning. The default name for the RIOT diff --git a/pkg/nimble/README.ipv6-over-ble.md b/pkg/nimble/README.ipv6-over-ble.md index 8233f311f803..240b7e3bbc82 100644 --- a/pkg/nimble/README.ipv6-over-ble.md +++ b/pkg/nimble/README.ipv6-over-ble.md @@ -8,7 +8,7 @@ the moment and does suffer stability issues! **NOTE 2:** Currently, Linux does not support 6LoWPAN neighbor discovery (which RIOT uses per default with BLE), so RIOT needs to be compiled to use stateless -address auto configuration (SLAAC) -> `CFLAGS=-DGNRC_IPV6_NIB_CONF_SLAAC=1`. +address auto configuration (SLAAC) -> `CFLAGS=-DCONFIG_GNRC_IPV6_NIB_SLAAC=1`. ## Prerequisites @@ -27,7 +27,7 @@ following: First, you compile and flash the `examples/gnrc_networking` application to your RIOT device. When doing this, make sure to enable SLAAC -(`CFLAGS=-DGNRC_IPV6_NIB_CONF_SLAAC=1`), see note above. +(`CFLAGS=-DCONFIG_GNRC_IPV6_NIB_SLAAC=1`), see note above. Once the firmware is running, you can verify it by typing diff --git a/sys/include/net/gnrc/ipv6/nib.h b/sys/include/net/gnrc/ipv6/nib.h index bfb359e03454..64971912af97 100644 --- a/sys/include/net/gnrc/ipv6/nib.h +++ b/sys/include/net/gnrc/ipv6/nib.h @@ -209,7 +209,7 @@ extern "C" { * This message type is for performing DAD for a given address. The expected * message context is a TENTATIVE IPv6 address. * - * @note Only handled with @ref GNRC_IPV6_NIB_CONF_SLAAC != 0 + * @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_SLAAC != 0 */ #define GNRC_IPV6_NIB_DAD (0x4fd1U) @@ -219,7 +219,7 @@ extern "C" { * Moves a TENTATIVE address to VALID state. The expected message context is a * TENTATIVE IPv6 address. * - * @note Only handled with @ref GNRC_IPV6_NIB_CONF_SLAAC != 0 + * @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_SLAAC != 0 */ #define GNRC_IPV6_NIB_VALID_ADDR (0x4fd2U) diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index bb678657481f..c464cb8935ee 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -32,8 +32,8 @@ extern "C" { #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 +#ifndef CONFIG_GNRC_IPV6_NIB_SLAAC +#define CONFIG_GNRC_IPV6_NIB_SLAAC 1 #endif #ifndef GNRC_IPV6_NIB_NUMOF #define GNRC_IPV6_NIB_NUMOF (16) @@ -44,8 +44,8 @@ extern "C" { #ifndef CONFIG_GNRC_IPV6_NIB_6LR #define CONFIG_GNRC_IPV6_NIB_6LR 1 #endif -#ifndef GNRC_IPV6_NIB_CONF_SLAAC -#define GNRC_IPV6_NIB_CONF_SLAAC 0 +#ifndef CONFIG_GNRC_IPV6_NIB_SLAAC +#define CONFIG_GNRC_IPV6_NIB_SLAAC 0 #endif #endif @@ -53,8 +53,8 @@ extern "C" { #ifndef CONFIG_GNRC_IPV6_NIB_6LN #define CONFIG_GNRC_IPV6_NIB_6LN 1 #endif -#ifndef GNRC_IPV6_NIB_CONF_SLAAC -#define GNRC_IPV6_NIB_CONF_SLAAC 0 +#ifndef CONFIG_GNRC_IPV6_NIB_SLAAC +#define CONFIG_GNRC_IPV6_NIB_SLAAC 0 #endif #ifndef GNRC_IPV6_NIB_CONF_QUEUE_PKT #define GNRC_IPV6_NIB_CONF_QUEUE_PKT 0 @@ -159,8 +159,8 @@ extern "C" { * * @see [RFC 4862](https://tools.ietf.org/html/rfc4862) */ -#ifndef GNRC_IPV6_NIB_CONF_SLAAC -#define GNRC_IPV6_NIB_CONF_SLAAC 1 +#ifndef CONFIG_GNRC_IPV6_NIB_SLAAC +#define CONFIG_GNRC_IPV6_NIB_SLAAC 1 #endif /** diff --git a/sys/include/net/gnrc/netif/ipv6.h b/sys/include/net/gnrc/netif/ipv6.h index 7f879c505532..d93771005df3 100644 --- a/sys/include/net/gnrc/netif/ipv6.h +++ b/sys/include/net/gnrc/netif/ipv6.h @@ -152,14 +152,14 @@ typedef struct { * and @ref net_gnrc_ipv6_nib "NIB" */ evtimer_msg_event_t search_rtr; -#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || GNRC_IPV6_NIB_CONF_SLAAC || DOXYGEN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC) || DOXYGEN /** * @brief Timers for address re-registration * * @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6" and * @ref net_gnrc_ipv6_nib "NIB" and if * @ref CONFIG_GNRC_IPV6_NIB_6LN != 0 or - * @ref GNRC_IPV6_NIB_CONF_SLAAC != 0 + * @ref CONFIG_GNRC_IPV6_NIB_SLAAC != 0 * @note Might also be usable in the later default SLAAC implementation * for NS retransmission timers. */ diff --git a/sys/net/gnrc/netif/gnrc_netif.c b/sys/net/gnrc/netif/gnrc_netif.c index 545e6cc056e5..a9d36e9d49ac 100644 --- a/sys/net/gnrc/netif/gnrc_netif.c +++ b/sys/net/gnrc/netif/gnrc_netif.c @@ -637,7 +637,7 @@ int gnrc_netif_ipv6_addr_add_internal(gnrc_netif_t *netif, UINT32_MAX, UINT32_MAX); } } -#if GNRC_IPV6_NIB_CONF_SLAAC +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC) else if (!gnrc_netif_is_6ln(netif)) { /* cast to remove const qualifier (will still be used NIB internally as * const) */ diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.c index 19fa421eb7de..55a6da233cf6 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.c @@ -26,7 +26,7 @@ #define ENABLE_DEBUG (0) #include "debug.h" -#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || GNRC_IPV6_NIB_CONF_SLAAC +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC) static char addr_str[IPV6_ADDR_MAX_STR_LEN]; void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx, @@ -36,11 +36,11 @@ void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx, int idx; uint8_t flags = GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_TENTATIVE; -#if !GNRC_IPV6_NIB_CONF_SLAAC +#if !IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC) if (!gnrc_netif_is_6ln(netif)) { LOG_WARNING("SLAAC not activated; will not auto-configure IPv6 address " "for interface %u.\n" - " Use GNRC_IPV6_NIB_CONF_SLAAC=1 to activate.\n", + " Use CONFIG_GNRC_IPV6_NIB_SLAAC=1 to activate.\n", netif->pid); return; } @@ -89,9 +89,9 @@ void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx, (void)idx; #endif /* CONFIG_GNRC_IPV6_NIB_6LN */ } -#endif /* CONFIG_GNRC_IPV6_NIB_6LN || GNRC_IPV6_NIB_CONF_SLAAC */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN || CONFIG_GNRC_IPV6_NIB_SLAAC */ -#if GNRC_IPV6_NIB_CONF_SLAAC +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC) static bool _try_l2addr_reconfiguration(gnrc_netif_t *netif) { uint8_t hwaddr[GNRC_NETIF_L2ADDR_MAXLEN]; @@ -217,8 +217,8 @@ void _handle_valid_addr(const ipv6_addr_t *addr) gnrc_netif_release(netif); } } -#else /* GNRC_IPV6_NIB_CONF_SLAAC */ +#else /* CONFIG_GNRC_IPV6_NIB_SLAAC */ typedef int dont_be_pedantic; -#endif /* GNRC_IPV6_NIB_CONF_SLAAC */ +#endif /* CONFIG_GNRC_IPV6_NIB_SLAAC */ /** @} */ diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.h index 139753b3af25..1736f69cc7d2 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.h @@ -13,7 +13,7 @@ * * @file * @brief Definions related to SLAAC functionality of the NIB - * @see @ref GNRC_IPV6_NIB_CONF_SLAAC + * @see @ref CONFIG_GNRC_IPV6_NIB_SLAAC * @internal * * @author Martine Lenders @@ -21,6 +21,7 @@ #ifndef PRIV_NIB_SLAAC_H #define PRIV_NIB_SLAAC_H +#include #include #include "net/gnrc/ipv6/nib/conf.h" @@ -31,7 +32,7 @@ extern "C" { #endif -#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || GNRC_IPV6_NIB_CONF_SLAAC || defined(DOXYGEN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC) || defined(DOXYGEN) /** * @brief Auto-configures an address from a given prefix * @@ -41,11 +42,11 @@ extern "C" { */ void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx, uint8_t pfx_len); -#else /* CONFIG_GNRC_IPV6_NIB_6LN || GNRC_IPV6_NIB_CONF_SLAAC */ +#else /* CONFIG_GNRC_IPV6_NIB_6LN || CONFIG_GNRC_IPV6_NIB_SLAAC */ #define _auto_configure_addr(netif, pfx, pfx_len) \ (void)netif; (void)pfx; (void)pfx_len; -#endif /* CONFIG_GNRC_IPV6_NIB_6LN || GNRC_IPV6_NIB_CONF_SLAAC */ -#if GNRC_IPV6_NIB_CONF_SLAAC || defined(DOXYGEN) +#endif /* CONFIG_GNRC_IPV6_NIB_6LN || CONFIG_GNRC_IPV6_NIB_SLAAC */ +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC) || defined(DOXYGEN) /** * @brief Removes a tentative address from the interface and tries to * reconfigure a new address @@ -68,12 +69,12 @@ void _handle_dad(const ipv6_addr_t *addr); * @param[in] addr A TENTATIVE address. */ void _handle_valid_addr(const ipv6_addr_t *addr); -#else /* GNRC_IPV6_NIB_CONF_SLAAC */ +#else /* CONFIG_GNRC_IPV6_NIB_SLAAC */ #define _remove_tentative_addr(netif, addr) \ (void)netif; (void)addr #define _handle_dad(addr) (void)addr #define _handle_valid_addr(addr) (void)addr -#endif /* GNRC_IPV6_NIB_CONF_SLAAC */ +#endif /* CONFIG_GNRC_IPV6_NIB_SLAAC */ #ifdef __cplusplus } diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib.c b/sys/net/gnrc/network_layer/ipv6/nib/nib.c index 9c3682ff7bf6..5e230e5634c7 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib.c @@ -128,11 +128,11 @@ void gnrc_ipv6_nib_init_iface(gnrc_netif_t *netif) _init_iface_arsm(netif); netif->ipv6.retrans_time = NDP_RETRANS_TIMER_MS; -#if GNRC_IPV6_NIB_CONF_SLAAC || IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) - /* TODO: set differently dependent on GNRC_IPV6_NIB_CONF_SLAAC if +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC) || IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) + /* TODO: set differently dependent on CONFIG_GNRC_IPV6_NIB_SLAAC if * alternatives exist */ netif->ipv6.aac_mode = GNRC_NETIF_AAC_AUTO; -#endif /* GNRC_IPV6_NIB_CONF_SLAAC || CONFIG_GNRC_IPV6_NIB_6LN */ +#endif /* CONFIG_GNRC_IPV6_NIB_SLAAC || CONFIG_GNRC_IPV6_NIB_6LN */ _init_iface_router(netif); gnrc_netif_init_6ln(netif); #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) @@ -909,7 +909,7 @@ static void _handle_nbr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, ipv6_addr_to_str(addr_str, &ipv6->src, sizeof(addr_str))); DEBUG(" - Destination address: %s\n", ipv6_addr_to_str(addr_str, &ipv6->dst, sizeof(addr_str))); -#if GNRC_IPV6_NIB_CONF_SLAAC +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC) gnrc_netif_t *tgt_netif = gnrc_netif_get_by_ipv6_addr(&nbr_sol->tgt); if (tgt_netif != NULL) { @@ -929,7 +929,7 @@ static void _handle_nbr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, return; } } -#endif /* GNRC_IPV6_NIB_CONF_SLAAC */ +#endif /* CONFIG_GNRC_IPV6_NIB_SLAAC */ if (ipv6_addr_is_unspecified(&ipv6->src)) { gnrc_ndp_nbr_adv_send(&nbr_sol->tgt, netif, &ipv6->src, false, NULL); } @@ -1041,7 +1041,7 @@ static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, (nbr_adv->flags & NDP_NBR_ADV_FLAGS_R) ? 'R' : '-', (nbr_adv->flags & NDP_NBR_ADV_FLAGS_S) ? 'S' : '-', (nbr_adv->flags & NDP_NBR_ADV_FLAGS_O) ? 'O' : '-'); -#if GNRC_IPV6_NIB_CONF_SLAAC +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC) gnrc_netif_t *tgt_netif = gnrc_netif_get_by_ipv6_addr(&nbr_adv->tgt); if (tgt_netif != NULL) { @@ -1059,7 +1059,7 @@ static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, /* else case beyond scope of RFC4862: * https://tools.ietf.org/html/rfc4862#section-5.4.4 */ } -#endif /* GNRC_IPV6_NIB_CONF_SLAAC */ +#endif /* CONFIG_GNRC_IPV6_NIB_SLAAC */ if (((nce = _nib_onl_get(&nbr_adv->tgt, netif->pid)) != NULL) && (nce->mode & _NC)) { #if GNRC_IPV6_NIB_CONF_ARSM @@ -1101,7 +1101,7 @@ static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, _handle_adv_l2(netif, nce, (icmpv6_hdr_t *)nbr_adv, NULL); } #endif /* GNRC_IPV6_NIB_CONF_ARSM */ -#if GNRC_IPV6_NIB_CONF_SLAAC && IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC) && IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) /* 6Lo-ND duplicate address detection (DAD) was ignored by neighbor, try * traditional DAD */ if ((aro_status == _ADDR_REG_STATUS_UNAVAIL) && diff --git a/tests/gnrc_netif/Makefile b/tests/gnrc_netif/Makefile index 061bf00c2d6a..ebd8395f7897 100644 --- a/tests/gnrc_netif/Makefile +++ b/tests/gnrc_netif/Makefile @@ -13,7 +13,7 @@ USEMODULE += od # deactivate automatically emitted packets from IPv6 neighbor discovery CFLAGS += -DGNRC_IPV6_NIB_CONF_ARSM=0 -CFLAGS += -DGNRC_IPV6_NIB_CONF_SLAAC=0 +CFLAGS += -DCONFIG_GNRC_IPV6_NIB_SLAAC=0 CFLAGS += -DGNRC_IPV6_NIB_CONF_NO_RTR_SOL=1 CFLAGS += -DGNRC_NETIF_ADDRS_NUMOF=16 CFLAGS += -DGNRC_NETIF_GROUPS_NUMOF=8 From f23267b67b7461180af2dc0c4598cd4bcfd764fb Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 12 Mar 2020 14:09:10 +0100 Subject: [PATCH 06/24] gnrc/nib: Move GNRC_IPV6_NIB_CONF_QUEUE_PKT to 'CONFIG_' namespace Also evaluate it using IS_ACTIVE macro. --- sys/include/net/gnrc/ipv6/nib/conf.h | 10 +++++----- sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c | 4 ++-- .../gnrc/network_layer/ipv6/nib/_nib-internal.c | 4 ++-- .../gnrc/network_layer/ipv6/nib/_nib-internal.h | 4 ++-- sys/net/gnrc/network_layer/ipv6/nib/nib.c | 14 +++++++------- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index c464cb8935ee..792f2d144281 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -56,8 +56,8 @@ extern "C" { #ifndef CONFIG_GNRC_IPV6_NIB_SLAAC #define CONFIG_GNRC_IPV6_NIB_SLAAC 0 #endif -#ifndef GNRC_IPV6_NIB_CONF_QUEUE_PKT -#define GNRC_IPV6_NIB_CONF_QUEUE_PKT 0 +#ifndef CONFIG_GNRC_IPV6_NIB_QUEUE_PKT +#define CONFIG_GNRC_IPV6_NIB_QUEUE_PKT 0 #endif #if !CONFIG_GNRC_IPV6_NIB_6LR # ifndef GNRC_IPV6_NIB_CONF_ARSM @@ -145,11 +145,11 @@ extern "C" { /** * @brief queue packets for address resolution */ -#ifndef GNRC_IPV6_NIB_CONF_QUEUE_PKT +#ifndef CONFIG_GNRC_IPV6_NIB_QUEUE_PKT #if CONFIG_GNRC_IPV6_NIB_6LN -#define GNRC_IPV6_NIB_CONF_QUEUE_PKT 0 +#define CONFIG_GNRC_IPV6_NIB_QUEUE_PKT 0 #else -#define GNRC_IPV6_NIB_CONF_QUEUE_PKT 1 +#define CONFIG_GNRC_IPV6_NIB_QUEUE_PKT 1 #endif #endif diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c index a51d12172ff5..510591283a53 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c @@ -376,7 +376,7 @@ void _handle_adv_l2(gnrc_netif_t *netif, _nib_onl_entry_t *nce, nce->info &= ~GNRC_IPV6_NIB_NC_INFO_IS_ROUTER; } } -#if GNRC_IPV6_NIB_CONF_QUEUE_PKT && MODULE_GNRC_IPV6 +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_QUEUE_PKT) && MODULE_GNRC_IPV6 /* send queued packets */ gnrc_pktqueue_t *ptr; DEBUG("nib: Sending queued packets\n"); @@ -389,7 +389,7 @@ void _handle_adv_l2(gnrc_netif_t *netif, _nib_onl_entry_t *nce, } ptr->pkt = NULL; } -#endif /* GNRC_IPV6_NIB_CONF_QUEUE_PKT */ +#endif /* CONFIG_GNRC_IPV6_NIB_QUEUE_PKT */ if ((icmpv6->type == ICMPV6_NBR_ADV) && !_sflag_set((ndp_nbr_adv_t *)icmpv6) && (_get_nud_state(nce) == GNRC_IPV6_NIB_NC_INFO_NUD_STATE_REACHABLE) && diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c index 07a1d1ee941c..37a4a1ad5a9b 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c @@ -276,7 +276,7 @@ void _nib_nc_remove(_nib_onl_entry_t *node) #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) evtimer_del((evtimer_t *)&_nib_evtimer, &node->addr_reg_timeout.event); #endif /* CONFIG_GNRC_IPV6_NIB_6LR */ -#if GNRC_IPV6_NIB_CONF_QUEUE_PKT +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_QUEUE_PKT) gnrc_pktqueue_t *tmp; for (gnrc_pktqueue_t *ptr = node->pktqueue; (ptr != NULL) && (tmp = (ptr->next), 1); @@ -287,7 +287,7 @@ void _nib_nc_remove(_nib_onl_entry_t *node) gnrc_pktbuf_release_error(entry->pkt, EHOSTUNREACH); entry->pkt = NULL; } -#endif /* GNRC_IPV6_NIB_CONF_QUEUE_PKT */ +#endif /* CONFIG_GNRC_IPV6_NIB_QUEUE_PKT */ /* remove from cache-out procedure */ clist_remove(&_next_removable, (clist_node_t *)node); _nib_onl_clear(node); diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h index 75c6f6b60c78..d0ac4bbc9a48 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h @@ -92,11 +92,11 @@ extern "C" { */ typedef struct _nib_onl_entry { struct _nib_onl_entry *next; /**< next removable entry */ -#if GNRC_IPV6_NIB_CONF_QUEUE_PKT || defined(DOXYGEN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_QUEUE_PKT) || defined(DOXYGEN) /** * @brief queue for packets currently in address resolution * - * @note Only available if @ref GNRC_IPV6_NIB_CONF_QUEUE_PKT != 0. + * @note Only available if @ref CONFIG_GNRC_IPV6_NIB_QUEUE_PKT != 0. */ gnrc_pktqueue_t *pktqueue; #endif diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib.c b/sys/net/gnrc/network_layer/ipv6/nib/nib.c index 5e230e5634c7..a7c24adb96c3 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib.c @@ -47,9 +47,9 @@ static char addr_str[IPV6_ADDR_MAX_STR_LEN]; -#if GNRC_IPV6_NIB_CONF_QUEUE_PKT +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_QUEUE_PKT) static gnrc_pktqueue_t _queue_pool[GNRC_IPV6_NIB_NUMOF]; -#endif /* GNRC_IPV6_NIB_CONF_QUEUE_PKT */ +#endif /* CONFIG_GNRC_IPV6_NIB_QUEUE_PKT */ #if GNRC_IPV6_NIB_CONF_DNS static evtimer_msg_event_t _rdnss_timeout; @@ -1115,7 +1115,7 @@ static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, } } -#if GNRC_IPV6_NIB_CONF_QUEUE_PKT +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_QUEUE_PKT) static gnrc_pktqueue_t *_alloc_queue_entry(gnrc_pktsnip_t *pkt) { for (int i = 0; i < GNRC_IPV6_NIB_NUMOF; i++) { @@ -1126,7 +1126,7 @@ static gnrc_pktqueue_t *_alloc_queue_entry(gnrc_pktsnip_t *pkt) } return NULL; } -#endif /* GNRC_IPV6_NIB_CONF_QUEUE_PKT */ +#endif /* CONFIG_GNRC_IPV6_NIB_QUEUE_PKT */ static bool _resolve_addr(const ipv6_addr_t *dst, gnrc_netif_t *netif, gnrc_pktsnip_t *pkt, gnrc_ipv6_nib_nc_t *nce, @@ -1198,7 +1198,7 @@ static bool _resolve_addr(const ipv6_addr_t *dst, gnrc_netif_t *netif, } #endif /* GNRC_IPV6_NIB_CONF_ARSM */ if (pkt != NULL) { -#if GNRC_IPV6_NIB_CONF_QUEUE_PKT +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_QUEUE_PKT) if (_get_nud_state(entry) == GNRC_IPV6_NIB_NC_INFO_NUD_STATE_INCOMPLETE) { gnrc_pktqueue_t *queue_entry = _alloc_queue_entry(pkt); @@ -1231,11 +1231,11 @@ static bool _resolve_addr(const ipv6_addr_t *dst, gnrc_netif_t *netif, pkt); gnrc_pktbuf_release_error(pkt, EHOSTUNREACH); } -#else /* GNRC_IPV6_NIB_CONF_QUEUE_PKT */ +#else /* CONFIG_GNRC_IPV6_NIB_QUEUE_PKT */ gnrc_icmpv6_error_dst_unr_send(ICMPV6_ERROR_DST_UNR_ADDR, pkt); gnrc_pktbuf_release_error(pkt, EHOSTUNREACH); -#endif /* GNRC_IPV6_NIB_CONF_QUEUE_PKT */ +#endif /* CONFIG_GNRC_IPV6_NIB_QUEUE_PKT */ } #if GNRC_IPV6_NIB_CONF_ARSM _probe_nbr(entry, reset); From e52b93cef06c5f77bae342a8286167daeff15448 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 12 Mar 2020 15:48:08 +0100 Subject: [PATCH 07/24] gnrc/nib: Move GNRC_IPV6_NIB_CONF_ARSM to 'CONFIG_' namespace Also evaluate it using IS_ACTIVE macro. --- sys/include/net/gnrc/ipv6/nib.h | 6 +-- sys/include/net/gnrc/ipv6/nib/conf.h | 8 ++-- sys/include/net/gnrc/ipv6/nib/nc.h | 2 +- sys/include/net/gnrc/netif/ipv6.h | 14 +++---- sys/net/gnrc/netif/gnrc_netif.c | 8 ++-- .../gnrc/network_layer/ipv6/nib/_nib-arsm.c | 22 +++++----- .../gnrc/network_layer/ipv6/nib/_nib-arsm.h | 13 +++--- .../network_layer/ipv6/nib/_nib-internal.c | 20 ++++----- .../network_layer/ipv6/nib/_nib-internal.h | 12 +++--- sys/net/gnrc/network_layer/ipv6/nib/nib.c | 42 +++++++++---------- sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c | 6 +-- sys/net/gnrc/network_layer/ndp/gnrc_ndp.c | 4 +- tests/gnrc_netif/Makefile | 2 +- .../tests-gnrc_ipv6_nib-nc.c | 3 +- 14 files changed, 82 insertions(+), 80 deletions(-) diff --git a/sys/include/net/gnrc/ipv6/nib.h b/sys/include/net/gnrc/ipv6/nib.h index 64971912af97..574c77024be9 100644 --- a/sys/include/net/gnrc/ipv6/nib.h +++ b/sys/include/net/gnrc/ipv6/nib.h @@ -118,7 +118,7 @@ extern "C" { * The expected message context is a pointer to a valid on-link entry * representing the neighbor cache entry that faces a state change. * - * @note Only handled with @ref GNRC_IPV6_NIB_CONF_ARSM != 0 + * @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_ARSM != 0 */ #define GNRC_IPV6_NIB_REACH_TIMEOUT (0x4fc7U) @@ -129,7 +129,7 @@ extern "C" { * The expected message context is a pointer to a valid on-link entry * representing the neighbor cache entry that faces a state change. * - * @note Only handled with @ref GNRC_IPV6_NIB_CONF_ARSM != 0 + * @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_ARSM != 0 */ #define GNRC_IPV6_NIB_DELAY_TIMEOUT (0x4fc8U) @@ -178,7 +178,7 @@ extern "C" { * time. The expected message context is a valid * [interface](@ref net_gnrc_netif). * - * @note Only handled with @ref GNRC_IPV6_NIB_CONF_ARSM != 0 + * @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_ARSM != 0 */ #define GNRC_IPV6_NIB_RECALC_REACH_TIME (0x4fceU) diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index 792f2d144281..d55382fc8a34 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -60,8 +60,8 @@ extern "C" { #define CONFIG_GNRC_IPV6_NIB_QUEUE_PKT 0 #endif #if !CONFIG_GNRC_IPV6_NIB_6LR -# ifndef GNRC_IPV6_NIB_CONF_ARSM -# define GNRC_IPV6_NIB_CONF_ARSM 0 +# ifndef CONFIG_GNRC_IPV6_NIB_ARSM +# define CONFIG_GNRC_IPV6_NIB_ARSM 0 # endif # ifndef GNRC_IPV6_NIB_NUMOF /* only needs to store default router */ @@ -138,8 +138,8 @@ extern "C" { /** * @brief (de-)activate NDP address resolution state-machine */ -#ifndef GNRC_IPV6_NIB_CONF_ARSM -#define GNRC_IPV6_NIB_CONF_ARSM 1 +#ifndef CONFIG_GNRC_IPV6_NIB_ARSM +#define CONFIG_GNRC_IPV6_NIB_ARSM 1 #endif /** diff --git a/sys/include/net/gnrc/ipv6/nib/nc.h b/sys/include/net/gnrc/ipv6/nib/nc.h index c7182e36bb29..87b2b647aebc 100644 --- a/sys/include/net/gnrc/ipv6/nib/nc.h +++ b/sys/include/net/gnrc/ipv6/nib/nc.h @@ -222,7 +222,7 @@ static inline unsigned gnrc_ipv6_nib_nc_get_ar_state(const gnrc_ipv6_nib_nc_t *e * If an entry pointing to the same IPv6 address as @p ipv6 exists already it * will be overwritten and marked as unmanaged. * - * If @ref GNRC_IPV6_NIB_CONF_ARSM != 0 @p l2addr and @p l2addr_len won't be set. + * If @ref CONFIG_GNRC_IPV6_NIB_ARSM != 0 @p l2addr and @p l2addr_len won't be set. * * @return 0 on success. * @return -ENOMEM, if no space is left in neighbor cache. diff --git a/sys/include/net/gnrc/netif/ipv6.h b/sys/include/net/gnrc/netif/ipv6.h index d93771005df3..5953806540ec 100644 --- a/sys/include/net/gnrc/netif/ipv6.h +++ b/sys/include/net/gnrc/netif/ipv6.h @@ -135,16 +135,16 @@ typedef struct { */ evtimer_msg_event_t snd_mc_ra; #endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ -#if GNRC_IPV6_NIB_CONF_ARSM || DOXYGEN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) || DOXYGEN /** * @brief Event for @ref GNRC_IPV6_NIB_RECALC_REACH_TIME * * @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6". * and @ref net_gnrc_ipv6_nib "NIB" and if - * @ref GNRC_IPV6_NIB_CONF_ARSM != 0 + * @ref CONFIG_GNRC_IPV6_NIB_ARSM != 0 */ evtimer_msg_event_t recalc_reach_time; -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ /** * @brief Event for @ref GNRC_IPV6_NIB_SEARCH_RTR * @@ -177,7 +177,7 @@ typedef struct { */ uint32_t last_ra; #endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ -#if GNRC_IPV6_NIB_CONF_ARSM || defined(DOXYGEN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) || defined(DOXYGEN) /** * @brief Base for random reachable time calculation and advertised * reachable time in ms (if @ref GNRC_NETIF_FLAGS_IPV6_RTR_ADV is @@ -185,7 +185,7 @@ typedef struct { * * @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6". * and @ref net_gnrc_ipv6_nib "NIB" and if - * @ref GNRC_IPV6_NIB_CONF_ARSM != 0 + * @ref CONFIG_GNRC_IPV6_NIB_ARSM != 0 */ uint32_t reach_time_base; @@ -194,10 +194,10 @@ typedef struct { * * @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6". * and @ref net_gnrc_ipv6_nib "NIB" and if - * @ref GNRC_IPV6_NIB_CONF_ARSM != 0 + * @ref CONFIG_GNRC_IPV6_NIB_ARSM != 0 */ uint32_t reach_time; -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ /** * @brief Retransmission time and advertised retransmission time (in ms) * diff --git a/sys/net/gnrc/netif/gnrc_netif.c b/sys/net/gnrc/netif/gnrc_netif.c index a9d36e9d49ac..bee1d5732008 100644 --- a/sys/net/gnrc/netif/gnrc_netif.c +++ b/sys/net/gnrc/netif/gnrc_netif.c @@ -597,7 +597,7 @@ int gnrc_netif_ipv6_addr_add_internal(gnrc_netif_t *netif, gnrc_netif_release(netif); return -ENOMEM; } -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) ipv6_addr_t sol_nodes; int res; @@ -611,14 +611,14 @@ int gnrc_netif_ipv6_addr_add_internal(gnrc_netif_t *netif, netif->pid); return res; } -#else /* GNRC_IPV6_NIB_CONF_ARSM */ +#else /* CONFIG_GNRC_IPV6_NIB_ARSM */ if (!gnrc_netif_is_6ln(netif)) { LOG_WARNING("Address-resolution state-machine not activated. Neighbors " "from interface %u\nwill not be able to resolve address %s\n" - " Use GNRC_IPV6_NIB_CONF_ARSM=1 to activate.\n", + " Use CONFIG_GNRC_IPV6_NIB_ARSM=1 to activate.\n", netif->pid, ipv6_addr_to_str(addr_str, addr, sizeof(addr_str))); } -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ netif->ipv6.addrs_flags[idx] = flags; memcpy(&netif->ipv6.addrs[idx], addr, sizeof(netif->ipv6.addrs[idx])); #ifdef MODULE_GNRC_IPV6_NIB diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c index 510591283a53..6c87e3aaf7f4 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c @@ -71,20 +71,20 @@ void _snd_uc_ns(_nib_onl_entry_t *nbr, bool reset) DEBUG("nib: unicast to %s (retrans. timer = %ums)\n", ipv6_addr_to_str(addr_str, &nbr->ipv6, sizeof(addr_str)), (unsigned)netif->ipv6.retrans_time); -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) if (reset) { nbr->ns_sent = 0; } -#else /* GNRC_IPV6_NIB_CONF_ARSM */ +#else /* CONFIG_GNRC_IPV6_NIB_ARSM */ (void)reset; -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ _snd_ns(&nbr->ipv6, netif, NULL, &nbr->ipv6); _evtimer_add(nbr, GNRC_IPV6_NIB_SND_UC_NS, &nbr->nud_timeout, netif->ipv6.retrans_time); gnrc_netif_release(netif); -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) nbr->ns_sent++; -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ } void _handle_sl2ao(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, @@ -99,7 +99,7 @@ void _handle_sl2ao(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, DEBUG("nib: Unexpected SL2AO length. Ignoring SL2AO\n"); return; } -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) if ((nce != NULL) && (nce->mode & _NC) && ((nce->l2addr_len != l2addr_len) || (memcmp(nce->l2addr, sl2ao + 1, nce->l2addr_len) != 0)) && @@ -110,7 +110,7 @@ void _handle_sl2ao(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, evtimer_del(&_nib_evtimer, &nce->nud_timeout.event); _set_nud_state(netif, nce, GNRC_IPV6_NIB_NC_INFO_NUD_STATE_STALE); } -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ if ((nce == NULL) || !(nce->mode & _NC)) { DEBUG("nib: Creating NCE for (ipv6 = %s, iface = %u, nud_state = STALE)\n", ipv6_addr_to_str(addr_str, &ipv6->src, sizeof(addr_str)), @@ -151,18 +151,18 @@ void _handle_sl2ao(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, netif->pid); nce->info &= ~GNRC_IPV6_NIB_NC_INFO_IS_ROUTER; } -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) /* a 6LR MUST NOT modify an existing NCE based on an SL2AO in an RS * see https://tools.ietf.org/html/rfc6775#section-6.3 */ if (!_rtr_sol_on_6lr(netif, icmpv6)) { nce->l2addr_len = l2addr_len; memcpy(nce->l2addr, sl2ao + 1, l2addr_len); } -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ } } -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) /** * @brief Calculates exponential back-off for retransmission timer for * neighbor solicitations @@ -502,6 +502,6 @@ static inline bool _rflag_set(const ndp_nbr_adv_t *nbr_adv) return (nbr_adv->type == ICMPV6_NBR_ADV) && (nbr_adv->flags & NDP_NBR_ADV_FLAGS_R); } -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ /** @} */ diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.h index aa7210992b25..f51d88a51b54 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.h @@ -14,13 +14,14 @@ * @file * @brief Definitions related to the address resolution state machine (ARSM) * of the NIB - * @see @ref GNRC_IPV6_NIB_CONF_ARSM + * @see @ref CONFIG_GNRC_IPV6_NIB_ARSM * * @author Martine Lenders */ #ifndef PRIV_NIB_ARSM_H #define PRIV_NIB_ARSM_H +#include #include #include "net/gnrc/ipv6/nib/conf.h" @@ -58,7 +59,7 @@ void _snd_ns(const ipv6_addr_t *tgt, gnrc_netif_t *netif, * @note Neighbor solicitations are used *by* the ARSM, but also by other * mechanisms (e.g. duplicate address detection 6Lo address * resolution). This is why it is defined here, but not exclusively - * available when @ref GNRC_IPV6_NIB_CONF_ARSM is set. + * available when @ref CONFIG_GNRC_IPV6_NIB_ARSM is set. * * @param[in] nbr Neighbor to send neighbor solicitation to. * @param[in] reset Reset probe counter. @@ -69,7 +70,7 @@ void _snd_uc_ns(_nib_onl_entry_t *nbr, bool reset); * @brief Handles SL2AO * * @note This is here (but not only available with - * @ref GNRC_IPV6_NIB_CONF_ARSM set) since it is closely related + * @ref CONFIG_GNRC_IPV6_NIB_ARSM set) since it is closely related * to the ARSM, but ARSM isn't the only mechanism using it (e.g. the * 6Lo address registration uses it). * @@ -118,7 +119,7 @@ static inline uint32_t _exp_backoff_retrans_timer_factor(uint8_t ns_sent, return res; } -#if GNRC_IPV6_NIB_CONF_ARSM || defined(DOXYGEN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) || defined(DOXYGEN) /** * @brief Handler for @ref GNRC_IPV6_NIB_SND_UC_NS and * @ref GNRC_IPV6_NIB_SND_UC_NS event handler @@ -226,7 +227,7 @@ void _set_nud_state(gnrc_netif_t *netif, _nib_onl_entry_t *nbr, * @return false, if @p entry is not in a reachable state. */ bool _is_reachable(_nib_onl_entry_t *entry); -#else /* GNRC_IPV6_NIB_CONF_ARSM || defined(DOXYGEN) */ +#else /* CONFIG_GNRC_IPV6_NIB_ARSM || defined(DOXYGEN) */ #define _handle_snd_ns(ctx) (void)ctx #define _handle_state_timeout(ctx) (void)ctx #define _probe_nbr(nbr, reset) (void)nbr; (void)reset @@ -240,7 +241,7 @@ bool _is_reachable(_nib_onl_entry_t *entry); #define _get_nud_state(nbr) (GNRC_IPV6_NIB_NC_INFO_NUD_STATE_UNMANAGED) #define _set_nud_state(netif, nce, state) (void)netif; (void)nbr; (void)state #define _is_reachable(entry) (true) -#endif /* GNRC_IPV6_NIB_CONF_ARSM || defined(DOXYGEN) */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM || defined(DOXYGEN) */ #ifdef __cplusplus } diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c index 37a4a1ad5a9b..e4c3b32e5448 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c @@ -239,7 +239,7 @@ _nib_onl_entry_t *_nib_onl_get(const ipv6_addr_t *addr, unsigned iface) void _nib_nc_set_reachable(_nib_onl_entry_t *node) { -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) gnrc_netif_t *netif = gnrc_netif_get_by_pid(_nib_onl_get_if(node)); node->info &= ~GNRC_IPV6_NIB_NC_INFO_NUD_STATE_MASK; @@ -255,9 +255,9 @@ void _nib_nc_set_reachable(_nib_onl_entry_t *node) _nib_onl_get_if(node), (unsigned)netif->ipv6.reach_time); _evtimer_add(node, GNRC_IPV6_NIB_REACH_TIMEOUT, &node->nud_timeout, netif->ipv6.reach_time); -#else /* GNRC_IPV6_NIB_CONF_ARSM */ +#else /* CONFIG_GNRC_IPV6_NIB_ARSM */ (void)node; -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ } void _nib_nc_remove(_nib_onl_entry_t *node) @@ -267,9 +267,9 @@ void _nib_nc_remove(_nib_onl_entry_t *node) _nib_onl_get_if(node)); node->mode &= ~(_NC); evtimer_del((evtimer_t *)&_nib_evtimer, &node->snd_na.event); -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) evtimer_del((evtimer_t *)&_nib_evtimer, &node->nud_timeout.event); -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER) evtimer_del((evtimer_t *)&_nib_evtimer, &node->reply_rs.event); #endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ @@ -293,7 +293,7 @@ void _nib_nc_remove(_nib_onl_entry_t *node) _nib_onl_clear(node); } -#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || !GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || !IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) static inline int _get_l2addr_from_ipv6(const gnrc_netif_t *netif, const _nib_onl_entry_t *node, gnrc_ipv6_nib_nc_t *nce) @@ -309,14 +309,14 @@ static inline int _get_l2addr_from_ipv6(const gnrc_netif_t *netif, } return res; } -#endif /* CONFIG_GNRC_IPV6_NIB_6LN || !GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_6LN || !CONFIG_GNRC_IPV6_NIB_ARSM */ void _nib_nc_get(const _nib_onl_entry_t *node, gnrc_ipv6_nib_nc_t *nce) { assert((node != NULL) && (nce != NULL)); memcpy(&nce->ipv6, &node->ipv6, sizeof(nce->ipv6)); nce->info = node->info; -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) if (ipv6_addr_is_link_local(&nce->ipv6)) { gnrc_netif_t *netif = gnrc_netif_get_by_pid(_nib_onl_get_if(node)); @@ -330,12 +330,12 @@ void _nib_nc_get(const _nib_onl_entry_t *node, gnrc_ipv6_nib_nc_t *nce) #endif /* CONFIG_GNRC_IPV6_NIB_6LN */ nce->l2addr_len = node->l2addr_len; memcpy(&nce->l2addr, &node->l2addr, node->l2addr_len); -#else /* GNRC_IPV6_NIB_CONF_ARSM */ +#else /* CONFIG_GNRC_IPV6_NIB_ARSM */ gnrc_netif_t *netif = gnrc_netif_get_by_pid(_nib_onl_get_if(node)); assert(ipv6_addr_is_link_local(&nce->ipv6)); assert(netif != NULL); _get_l2addr_from_ipv6(netif, node, nce); -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ } _nib_dr_entry_t *_nib_drl_add(const ipv6_addr_t *router_addr, unsigned iface) diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h index d0ac4bbc9a48..61b78b67891d 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h @@ -112,11 +112,11 @@ typedef struct _nib_onl_entry { */ eui64_t eui64; #endif -#if GNRC_IPV6_NIB_CONF_ARSM || defined(DOXYGEN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) || defined(DOXYGEN) /** * @brief Link-layer address of _nib_onl_entry_t::next_hop * - * @note Only available if @ref GNRC_IPV6_NIB_CONF_ARSM != 0. + * @note Only available if @ref CONFIG_GNRC_IPV6_NIB_ARSM != 0. */ uint8_t l2addr[GNRC_IPV6_NIB_L2ADDR_MAX_LEN]; #endif @@ -133,7 +133,7 @@ typedef struct _nib_onl_entry { * one of these states). Because of this we can use one event * for all of them (but need the different types, since the * events are handled differently). - * @note This is also available with @ref GNRC_IPV6_NIB_CONF_ARSM == 0, + * @note This is also available with @ref CONFIG_GNRC_IPV6_NIB_ARSM == 0, * since 6Lo address registration uses it to time the sending of * neighbor solicitations. */ @@ -164,18 +164,18 @@ typedef struct _nib_onl_entry { * @see [Mode flags for entries](@ref net_gnrc_ipv6_nib_mode). */ uint8_t mode; -#if GNRC_IPV6_NIB_CONF_ARSM || defined(DOXYGEN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) || defined(DOXYGEN) /** * @brief Neighbor solicitations sent for probing * - * @note Only available if @ref GNRC_IPV6_NIB_CONF_ARSM != 0. + * @note Only available if @ref CONFIG_GNRC_IPV6_NIB_ARSM != 0. */ uint8_t ns_sent; /** * @brief length in bytes of _nib_onl_entry_t::l2addr * - * @note Only available if @ref GNRC_IPV6_NIB_CONF_ARSM != 0. + * @note Only available if @ref CONFIG_GNRC_IPV6_NIB_ARSM != 0. */ uint8_t l2addr_len; #endif diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib.c b/sys/net/gnrc/network_layer/ipv6/nib/nib.c index a7c24adb96c3..02c770b02e42 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib.c @@ -331,7 +331,7 @@ void gnrc_ipv6_nib_handle_timer_event(void *ctx, uint16_t type) ctx, type, (unsigned)evtimer_now_msec()); _nib_acquire(); switch (type) { -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) case GNRC_IPV6_NIB_SND_UC_NS: case GNRC_IPV6_NIB_SND_MC_NS: _handle_snd_ns(ctx); @@ -343,7 +343,7 @@ void gnrc_ipv6_nib_handle_timer_event(void *ctx, uint16_t type) case GNRC_IPV6_NIB_RECALC_REACH_TIME: _recalc_reach_time(ctx); break; -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ case GNRC_IPV6_NIB_SND_NA: _handle_snd_na(ctx); break; @@ -674,7 +674,7 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, if (rtr_adv->cur_hl != 0) { netif->cur_hl = rtr_adv->cur_hl; } -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) if (rtr_adv->reach_time.u32 != 0) { uint32_t reach_time = byteorder_ntohl(rtr_adv->reach_time); @@ -686,7 +686,7 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, _recalc_reach_time(&netif->ipv6); } } -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ if (rtr_adv->retrans_timer.u32 != 0) { netif->ipv6.retrans_time = byteorder_ntohl(rtr_adv->retrans_timer); } @@ -1062,9 +1062,9 @@ static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, #endif /* CONFIG_GNRC_IPV6_NIB_SLAAC */ if (((nce = _nib_onl_get(&nbr_adv->tgt, netif->pid)) != NULL) && (nce->mode & _NC)) { -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) bool tl2ao_avail = false; -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) uint8_t aro_status = _ADDR_REG_STATUS_UNAVAIL; #endif @@ -1072,12 +1072,12 @@ static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, tmp_len = icmpv6_len - sizeof(ndp_nbr_adv_t); FOREACH_OPT(nbr_adv, opt, tmp_len) { switch (opt->type) { -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) case NDP_OPT_TL2A: _handle_adv_l2(netif, nce, (icmpv6_hdr_t *)nbr_adv, opt); tl2ao_avail = true; break; -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) case NDP_OPT_AR: aro_status = _handle_aro(netif, ipv6, @@ -1091,7 +1091,7 @@ static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, opt->type); } } -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) if (!tl2ao_avail && (nbr_adv->flags & NDP_NBR_ADV_FLAGS_S) && (_get_nud_state(nce) != GNRC_IPV6_NIB_NC_INFO_NUD_STATE_INCOMPLETE)) { /* reachability confirmed without TL2AO */ @@ -1100,7 +1100,7 @@ static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, if (!(netif->flags & GNRC_NETIF_FLAGS_HAS_L2ADDR)) { _handle_adv_l2(netif, nce, (icmpv6_hdr_t *)nbr_adv, NULL); } -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC) && IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) /* 6Lo-ND duplicate address detection (DAD) was ignored by neighbor, try * traditional DAD */ @@ -1143,7 +1143,7 @@ static bool _resolve_addr(const ipv6_addr_t *dst, gnrc_netif_t *netif, nce->l2addr_len = 0; return true; } -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) if ((entry != NULL) && (entry->mode & _NC) && _is_reachable(entry)) { if (_get_nud_state(entry) == GNRC_IPV6_NIB_NC_INFO_NUD_STATE_STALE) { _set_nud_state(netif, entry, GNRC_IPV6_NIB_NC_INFO_NUD_STATE_DELAY); @@ -1156,7 +1156,7 @@ static bool _resolve_addr(const ipv6_addr_t *dst, gnrc_netif_t *netif, _nib_nc_get(entry, nce); res = true; } -#else /* GNRC_IPV6_NIB_CONF_ARSM */ +#else /* CONFIG_GNRC_IPV6_NIB_ARSM */ if (entry != NULL) { DEBUG("nib: resolve address %s%%%u from neighbor cache\n", ipv6_addr_to_str(addr_str, &entry->ipv6, sizeof(addr_str)), @@ -1164,11 +1164,11 @@ static bool _resolve_addr(const ipv6_addr_t *dst, gnrc_netif_t *netif, _nib_nc_get(entry, nce); res = true; } -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ else if (!(res = _resolve_addr_from_ipv6(dst, netif, nce))) { -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) bool reset = false; -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ DEBUG("nib: resolve address %s by probing neighbors\n", ipv6_addr_to_str(addr_str, dst, sizeof(addr_str))); @@ -1187,16 +1187,16 @@ static bool _resolve_addr(const ipv6_addr_t *dst, gnrc_netif_t *netif, (void *)GNRC_IPV6_NIB_NC_INFO_NUD_STATE_INCOMPLETE); } #endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) reset = true; -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ } -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) else if (_get_nud_state(entry) == GNRC_IPV6_NIB_NC_INFO_NUD_STATE_UNREACHABLE) { /* reduce back-off to possibly resolve neighbor sooner again */ entry->ns_sent = 3; } -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ if (pkt != NULL) { #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_QUEUE_PKT) if (_get_nud_state(entry) == GNRC_IPV6_NIB_NC_INFO_NUD_STATE_INCOMPLETE) { @@ -1237,9 +1237,9 @@ static bool _resolve_addr(const ipv6_addr_t *dst, gnrc_netif_t *netif, gnrc_pktbuf_release_error(pkt, EHOSTUNREACH); #endif /* CONFIG_GNRC_IPV6_NIB_QUEUE_PKT */ } -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) _probe_nbr(entry, reset); -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ } return res; } diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c b/sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c index b99ff537ec03..0c9543eebfb7 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c @@ -38,7 +38,7 @@ int gnrc_ipv6_nib_nc_set(const ipv6_addr_t *ipv6, unsigned iface, _nib_release(); return -ENOMEM; } -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) if ((l2addr != NULL) && (l2addr_len > 0)) { memcpy(node->l2addr, l2addr, l2addr_len); } @@ -105,7 +105,7 @@ bool gnrc_ipv6_nib_nc_iter(unsigned iface, void **state, return (*state != NULL); } -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) static const char *_nud_str[] = { [GNRC_IPV6_NIB_NC_INFO_NUD_STATE_UNMANAGED] = "-", [GNRC_IPV6_NIB_NC_INFO_NUD_STATE_UNREACHABLE] = "UNREACHABLE", @@ -143,7 +143,7 @@ void gnrc_ipv6_nib_nc_print(gnrc_ipv6_nib_nc_t *entry) if (gnrc_ipv6_nib_nc_is_router(entry)) { printf("router"); } -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) printf(" %s", _nud_str[gnrc_ipv6_nib_nc_get_nud_state(entry)]); #endif #if CONFIG_GNRC_IPV6_NIB_6LR diff --git a/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c b/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c index c7d5fe332b44..b0cd9ce5dfa8 100644 --- a/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c +++ b/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c @@ -528,7 +528,7 @@ void gnrc_ndp_rtr_adv_send(gnrc_netif_t *netif, const ipv6_addr_t *src, if (netif->flags & GNRC_NETIF_FLAGS_IPV6_ADV_CUR_HL) { cur_hl = netif->cur_hl; } -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) /* netif->ipv6.reach_time_base is only available with Address Resolution * State Machine */ if (netif->flags & GNRC_NETIF_FLAGS_IPV6_ADV_REACH_TIME) { @@ -540,7 +540,7 @@ void gnrc_ndp_rtr_adv_send(gnrc_netif_t *netif, const ipv6_addr_t *src, reach_time = netif->ipv6.reach_time_base; } } -#endif /* GNRC_IPV6_NIB_CONF_ARSM */ +#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ if (netif->flags & GNRC_NETIF_FLAGS_IPV6_ADV_RETRANS_TIMER) { retrans_timer = netif->ipv6.retrans_time; } diff --git a/tests/gnrc_netif/Makefile b/tests/gnrc_netif/Makefile index ebd8395f7897..70663e00b5ff 100644 --- a/tests/gnrc_netif/Makefile +++ b/tests/gnrc_netif/Makefile @@ -12,7 +12,7 @@ USEMODULE += netdev_test USEMODULE += od # deactivate automatically emitted packets from IPv6 neighbor discovery -CFLAGS += -DGNRC_IPV6_NIB_CONF_ARSM=0 +CFLAGS += -DCONFIG_GNRC_IPV6_NIB_ARSM=0 CFLAGS += -DCONFIG_GNRC_IPV6_NIB_SLAAC=0 CFLAGS += -DGNRC_IPV6_NIB_CONF_NO_RTR_SOL=1 CFLAGS += -DGNRC_NETIF_ADDRS_NUMOF=16 diff --git a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-nc.c b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-nc.c index e47c560c328d..027d02629283 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-nc.c +++ b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-nc.c @@ -14,6 +14,7 @@ */ #include +#include #include "net/gnrc/ipv6/nib.h" #include "net/gnrc/ipv6/nib/nc.h" @@ -294,7 +295,7 @@ static void test_nib_nc_mark_reachable__success(void) iter_state = NULL; TEST_ASSERT(gnrc_ipv6_nib_nc_iter(0, &iter_state, &nce)); -#if GNRC_IPV6_NIB_CONF_ARSM +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) /* check if entry is reachable */ TEST_ASSERT_EQUAL_INT(GNRC_IPV6_NIB_NC_INFO_NUD_STATE_REACHABLE, gnrc_ipv6_nib_nc_get_nud_state(&nce)); From bad9abd349be6f7d31c87aea99748b5c7293aba8 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 12 Mar 2020 15:53:47 +0100 Subject: [PATCH 08/24] gnrc/nib: Move GNRC_IPV6_NIB_CONF_DNS to 'CONFIG_' namespace Also evaluate using IS_ACTIVE macro. --- sys/include/net/gnrc/ipv6/nib.h | 2 +- sys/include/net/gnrc/ipv6/nib/conf.h | 6 +++--- .../gnrc/network_layer/ipv6/nib/_nib-router.c | 6 +++--- sys/net/gnrc/network_layer/ipv6/nib/nib.c | 16 ++++++++-------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sys/include/net/gnrc/ipv6/nib.h b/sys/include/net/gnrc/ipv6/nib.h index 574c77024be9..767a6fd0268b 100644 --- a/sys/include/net/gnrc/ipv6/nib.h +++ b/sys/include/net/gnrc/ipv6/nib.h @@ -230,7 +230,7 @@ extern "C" { * The expected message context is the [UDP end point](@ref sock_udp_ep_t) * representing the DNS server. * - * @note Only handled with @ref GNRC_IPV6_NIB_CONF_DNS != 0 + * @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_DNS != 0 */ #define GNRC_IPV6_NIB_RDNSS_TIMEOUT (0x4fd3U) /** @} */ diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index d55382fc8a34..fbd2fdcabce8 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -75,7 +75,7 @@ extern "C" { #endif #ifdef MODULE_GNRC_IPV6_NIB_DNS -#define GNRC_IPV6_NIB_CONF_DNS 1 +#define CONFIG_GNRC_IPV6_NIB_DNS 1 #endif /** @@ -186,8 +186,8 @@ extern "C" { * * @see [RFC 8106](https://tools.ietf.org/html/rfc8106) */ -#ifndef GNRC_IPV6_NIB_CONF_DNS -#define GNRC_IPV6_NIB_CONF_DNS 0 +#ifndef CONFIG_GNRC_IPV6_NIB_DNS +#define CONFIG_GNRC_IPV6_NIB_DNS 0 #endif /** diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c index 94960735d3bb..175044b87239 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c @@ -18,7 +18,7 @@ #include "net/gnrc/ndp.h" #include "net/gnrc/netif/internal.h" #include "net/gnrc/sixlowpan/nd.h" -#if GNRC_IPV6_NIB_CONF_DNS +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_DNS) #include "net/sock/dns.h" #endif @@ -142,7 +142,7 @@ static gnrc_pktsnip_t *_build_ext_opts(gnrc_netif_t *netif, _nib_offl_entry_t *pfx = NULL; unsigned id = netif->pid; -#if GNRC_IPV6_NIB_CONF_DNS && SOCK_HAS_IPV6 +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_DNS) && SOCK_HAS_IPV6 uint32_t rdnss_ltime = _evtimer_lookup(&sock_dns_server, GNRC_IPV6_NIB_RDNSS_TIMEOUT); @@ -161,7 +161,7 @@ static gnrc_pktsnip_t *_build_ext_opts(gnrc_netif_t *netif, } ext_opts = rdnsso; } -#endif /* GNRC_IPV6_NIB_CONF_DNS */ +#endif /* CONFIG_GNRC_IPV6_NIB_DNS */ #if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C uint16_t ltime; gnrc_pktsnip_t *abro; diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib.c b/sys/net/gnrc/network_layer/ipv6/nib/nib.c index 02c770b02e42..54607b3b5460 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib.c @@ -28,7 +28,7 @@ #include "net/gnrc/sixlowpan/nd.h" #include "net/ndp.h" #include "net/sixlowpan/nd.h" -#if GNRC_IPV6_NIB_CONF_DNS +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_DNS) #include "net/sock/dns.h" #endif @@ -51,7 +51,7 @@ static char addr_str[IPV6_ADDR_MAX_STR_LEN]; static gnrc_pktqueue_t _queue_pool[GNRC_IPV6_NIB_NUMOF]; #endif /* CONFIG_GNRC_IPV6_NIB_QUEUE_PKT */ -#if GNRC_IPV6_NIB_CONF_DNS +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_DNS) static evtimer_msg_event_t _rdnss_timeout; #endif @@ -79,7 +79,7 @@ static void _handle_rtr_timeout(_nib_dr_entry_t *router); static void _handle_snd_na(gnrc_pktsnip_t *pkt); /* needs to be exported for 6LN's ARO handling */ void _handle_search_rtr(gnrc_netif_t *netif); -#if GNRC_IPV6_NIB_CONF_DNS +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_DNS) static void _handle_rdnss_timeout(sock_udp_ep_t *dns_server); #endif /** @} */ @@ -388,7 +388,7 @@ void gnrc_ipv6_nib_handle_timer_event(void *ctx, uint16_t type) case GNRC_IPV6_NIB_VALID_ADDR: _handle_valid_addr(ctx); break; -#if GNRC_IPV6_NIB_CONF_DNS +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_DNS) case GNRC_IPV6_NIB_RDNSS_TIMEOUT: _handle_rdnss_timeout(ctx); #endif @@ -425,7 +425,7 @@ void gnrc_ipv6_nib_change_rtr_adv_iface(gnrc_netif_t *netif, bool enable) */ static void _handle_mtuo(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, const ndp_opt_mtu_t *mtuo); -#if GNRC_IPV6_NIB_CONF_DNS +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_DNS) static uint32_t _handle_rdnsso(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, const ndp_opt_rdnss_impl_t *rdnsso); #endif @@ -742,7 +742,7 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, #endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ break; #endif /* CONFIG_GNRC_IPV6_NIB_6LN */ -#if GNRC_IPV6_NIB_CONF_DNS +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_DNS) case NDP_OPT_RDNSS: next_timeout = _min(_handle_rdnsso(netif, (icmpv6_hdr_t *)rtr_adv, @@ -1346,7 +1346,7 @@ void _handle_search_rtr(gnrc_netif_t *netif) #endif /* !GNRC_IPV6_NIB_CONF_NO_RTR_SOL */ } -#if GNRC_IPV6_NIB_CONF_DNS +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_DNS) static void _handle_rdnss_timeout(sock_udp_ep_t *dns_server) { memset(dns_server, 0, sizeof(sock_udp_ep_t)); @@ -1364,7 +1364,7 @@ static void _handle_mtuo(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, } } -#if GNRC_IPV6_NIB_CONF_DNS +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_DNS) static uint32_t _handle_rdnsso(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, const ndp_opt_rdnss_impl_t *rdnsso) { From 42fb2fe09f31bfa60e4f3e798ee1c61e40854097 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 12 Mar 2020 15:58:39 +0100 Subject: [PATCH 09/24] gnrc/nib: Move GNRC_IPV6_NIB_CONF_ADV_ROUTER to 'CONFIG_' namespace --- sys/include/net/gnrc/ipv6/nib/conf.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index fbd2fdcabce8..39b77a07d057 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -126,12 +126,12 @@ extern "C" { /** * @brief (de-)activate router advertising at interface start-up */ -#ifndef GNRC_IPV6_NIB_CONF_ADV_ROUTER +#ifndef CONFIG_GNRC_IPV6_NIB_ADV_ROUTER #if CONFIG_GNRC_IPV6_NIB_ROUTER && \ (!CONFIG_GNRC_IPV6_NIB_6LR || CONFIG_GNRC_IPV6_NIB_6LBR) -#define GNRC_IPV6_NIB_CONF_ADV_ROUTER 1 +#define CONFIG_GNRC_IPV6_NIB_ADV_ROUTER 1 #else -#define GNRC_IPV6_NIB_CONF_ADV_ROUTER 0 +#define CONFIG_GNRC_IPV6_NIB_ADV_ROUTER 0 #endif #endif From 219d5a1de2d3a1b648289e27bc940d8c435a720d Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 12 Mar 2020 16:02:35 +0100 Subject: [PATCH 10/24] gnrc/nib: Move GNRC_IPV6_NIB_CONF_REDIRECT to 'CONFIG_' namspace Also evaluate using IS_ACTIVE macro. --- sys/include/net/gnrc/ipv6/nib/conf.h | 10 +++++----- sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c | 10 +++++----- sys/net/gnrc/network_layer/ipv6/nib/nib.c | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index 39b77a07d057..6b8ef128740c 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -166,18 +166,18 @@ extern "C" { /** * @brief handle Redirect Messages */ -#ifndef GNRC_IPV6_NIB_CONF_REDIRECT -#define GNRC_IPV6_NIB_CONF_REDIRECT 0 +#ifndef CONFIG_GNRC_IPV6_NIB_REDIRECT +#define CONFIG_GNRC_IPV6_NIB_REDIRECT 0 #endif /** * @brief (de-)activate destination cache */ #ifndef GNRC_IPV6_NIB_CONF_DC -#if GNRC_IPV6_NIB_CONF_REDIRECT -#define GNRC_IPV6_NIB_CONF_DC 1 +#if CONFIG_GNRC_IPV6_NIB_REDIRECT +#define GNRC_IPV6_NIB_CONF_DC 1 #else -#define GNRC_IPV6_NIB_CONF_DC 0 +#define GNRC_IPV6_NIB_CONF_DC 0 #endif #endif diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c index 6c87e3aaf7f4..e75fdcac5d3f 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c @@ -174,7 +174,7 @@ void _handle_sl2ao(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, */ static inline uint32_t _exp_backoff_retrans_timer(uint8_t ns_sent, uint32_t retrans_timer); -#if GNRC_IPV6_NIB_CONF_REDIRECT +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_REDIRECT) /** * @brief Checks if the carrier of the TL2AO was a redirect message * @@ -185,10 +185,10 @@ static inline uint32_t _exp_backoff_retrans_timer(uint8_t ns_sent, * ndp_opt_t::type == NDP_OPT_TL2A for @p tl2ao. */ static inline bool _redirect_with_tl2ao(icmpv6_hdr_t *icmpv6, ndp_opt_t *tl2ao); -#else /* GNRC_IPV6_NIB_CONF_REDIRECT */ +#else /* CONFIG_GNRC_IPV6_NIB_REDIRECT */ /* just fall through if redirect not handled */ #define _redirect_with_tl2ao(a, b) (false) -#endif /* GNRC_IPV6_NIB_CONF_REDIRECT */ +#endif /* CONFIG_GNRC_IPV6_NIB_REDIRECT */ static inline bool _oflag_set(const ndp_nbr_adv_t *nbr_adv); static inline bool _sflag_set(const ndp_nbr_adv_t *nbr_adv); @@ -467,12 +467,12 @@ static inline uint32_t _exp_backoff_retrans_timer(uint8_t ns_sent, return _exp_backoff_retrans_timer_factor(ns_sent, retrans_timer, factor); } -#if GNRC_IPV6_NIB_CONF_REDIRECT +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_REDIRECT) static inline bool _redirect_with_tl2ao(icmpv6_hdr_t *icmpv6, ndp_opt_t *tl2ao) { return (icmpv6->type == ICMPV6_REDIRECT) && (tl2ao != NULL); } -#endif /* GNRC_IPV6_NIB_CONF_REDIRECT */ +#endif /* CONFIG_GNRC_IPV6_NIB_REDIRECT */ static inline bool _tl2ao_changes_nce(_nib_onl_entry_t *nce, const ndp_opt_t *tl2ao, diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib.c b/sys/net/gnrc/network_layer/ipv6/nib/nib.c index 54607b3b5460..8df414092bff 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib.c @@ -307,11 +307,11 @@ void gnrc_ipv6_nib_handle_pkt(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, case ICMPV6_NBR_ADV: _handle_nbr_adv(netif, ipv6, (ndp_nbr_adv_t *)icmpv6, icmpv6_len); break; -#if GNRC_IPV6_NIB_CONF_REDIRECT +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_REDIRECT) case ICMPV6_REDIRECT: /* TODO */ break; -#endif /* GNRC_IPV6_NIB_CONF_REDIRECT */ +#endif /* CONFIG_GNRC_IPV6_NIB_REDIRECT */ #if GNRC_IPV6_NIB_CONF_MULTIHOP_DAD case ICMPV6_DAR: /* TODO */ From 3ec296400d1591736a18bb4867cd04160b318ed5 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 12 Mar 2020 16:09:12 +0100 Subject: [PATCH 11/24] gnrc/nib: Move GNRC_IPV6_NIB_CONF_DC to 'CONFIG_' namespace Also evaluate using IS_ACTIVE macro. --- sys/include/net/gnrc/ipv6/nib/conf.h | 6 +++--- sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h | 8 ++++---- sys/net/gnrc/network_layer/ipv6/nib/nib.c | 4 ++-- tests/unittests/tests-gnrc_ipv6_nib/Makefile.include | 2 +- .../tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c | 5 +++-- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index 6b8ef128740c..31b07559386f 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -173,11 +173,11 @@ extern "C" { /** * @brief (de-)activate destination cache */ -#ifndef GNRC_IPV6_NIB_CONF_DC +#ifndef CONFIG_GNRC_IPV6_NIB_DC #if CONFIG_GNRC_IPV6_NIB_REDIRECT -#define GNRC_IPV6_NIB_CONF_DC 1 +#define CONFIG_GNRC_IPV6_NIB_DC 1 #else -#define GNRC_IPV6_NIB_CONF_DC 0 +#define CONFIG_GNRC_IPV6_NIB_DC 0 #endif #endif diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h index 61b78b67891d..13493ef502c6 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h @@ -585,7 +585,7 @@ static inline void _nib_offl_remove(_nib_offl_entry_t *nib_offl, uint8_t mode) _nib_offl_clear(nib_offl); } -#if GNRC_IPV6_NIB_CONF_DC || DOXYGEN +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_DC) || DOXYGEN /** * @brief Creates or gets an existing destination cache entry by its addresses * @@ -596,7 +596,7 @@ static inline void _nib_offl_remove(_nib_offl_entry_t *nib_offl, uint8_t mode) * *May also be a global address!* * @param[in] iface The interface to the destination. * - * @note Only available if @ref GNRC_IPV6_NIB_CONF_DC. + * @note Only available if @ref CONFIG_GNRC_IPV6_NIB_DC. * * @return A new or existing off-link entry with _nib_offl_entry_t::pfx set to * @p pfx. @@ -617,13 +617,13 @@ static inline _nib_offl_entry_t *_nib_dc_add(const ipv6_addr_t *next_hop, * * Corresponding on-link entry is removed, too. * - * @note Only available if @ref GNRC_IPV6_NIB_CONF_DC. + * @note Only available if @ref CONFIG_GNRC_IPV6_NIB_DC. */ static inline void _nib_dc_remove(_nib_offl_entry_t *nib_offl) { _nib_offl_remove(nib_offl, _DC); } -#endif /* GNRC_IPV6_NIB_CONF_DC */ +#endif /* CONFIG_GNRC_IPV6_NIB_DC */ /** * @brief Creates or gets an existing prefix list entry by its prefix diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib.c b/sys/net/gnrc/network_layer/ipv6/nib/nib.c index 8df414092bff..c07f7cdb198e 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib.c @@ -269,9 +269,9 @@ int gnrc_ipv6_nib_get_next_hop_l2addr(const ipv6_addr_t *dst, GNRC_IPV6_NIB_ROUTE_INFO_TYPE_RN, &route.dst, (void *)((intptr_t)route.dst_len)); -#if GNRC_IPV6_NIB_CONF_DC +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_DC) _nib_dc_add(&route.next_hop, netif->pid, dst); -#endif /* GNRC_IPV6_NIB_CONF_DC */ +#endif /* CONFIG_GNRC_IPV6_NIB_DC */ } else { /* _resolve_addr releases pkt if not queued (in which case diff --git a/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include b/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include index ad400ce84ff5..fa8395dc49d8 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include +++ b/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include @@ -8,6 +8,6 @@ CFLAGS += -DGNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF=4 CFLAGS += -DGNRC_IPV6_NIB_ABR_NUMOF=4 CFLAGS += -DCONFIG_GNRC_IPV6_NIB_6LBR=1 CFLAGS += -DGNRC_IPV6_NIB_CONF_MULTIHOP_P6C=1 -CFLAGS += -DGNRC_IPV6_NIB_CONF_DC=1 +CFLAGS += -DCONFIG_GNRC_IPV6_NIB_DC=1 INCLUDES += -I$(RIOTBASE)/sys/net/gnrc/network_layer/ipv6/nib diff --git a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c index 166aefb14755..63b41922a11a 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c +++ b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c @@ -13,6 +13,7 @@ * @author Martine Lenders */ +#include #include #include "net/ipv6/addr.h" @@ -1634,7 +1635,7 @@ static void test_nib_offl_iter__three_elem_middle_removed(void) TEST_ASSERT_NULL(_nib_offl_iter(res)); } -#if GNRC_IPV6_NIB_CONF_DC +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_DC) /* * Creates a destination cache entry. * Expected result: new entry should contain the given address and interface @@ -2077,7 +2078,7 @@ Test *tests_gnrc_ipv6_nib_internal_tests(void) new_TestFixture(test_nib_offl_iter__one_elem), new_TestFixture(test_nib_offl_iter__three_elem), new_TestFixture(test_nib_offl_iter__three_elem_middle_removed), -#if GNRC_IPV6_NIB_CONF_DC +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_DC) new_TestFixture(test_nib_dc_add__success), new_TestFixture(test_nib_dc_remove), #endif From 22b4df953758fb4ccb22eee51cfec82b2a511a8d Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 12 Mar 2020 16:14:26 +0100 Subject: [PATCH 12/24] gnrc/nib: Move GNRC_IPV6_NIB_CONF_MULTIHOP_DAD to 'CONFIG_' namespace Also evaluate using IS_ACTIVE macro. --- sys/include/net/gnrc/ipv6/nib/conf.h | 4 ++-- sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.c | 8 ++++---- sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c | 4 ++-- sys/net/gnrc/network_layer/ipv6/nib/nib.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index 31b07559386f..95b9bdb0460d 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -208,8 +208,8 @@ extern "C" { * * @see [RFC 6775, section 8.2](https://tools.ietf.org/html/rfc6775#section-8.2) */ -#ifndef GNRC_IPV6_NIB_CONF_MULTIHOP_DAD -#define GNRC_IPV6_NIB_CONF_MULTIHOP_DAD 0 +#ifndef CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD +#define CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD 0 #endif /** @} */ diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.c index cdae02add1c1..c892fde2f43f 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.c @@ -62,9 +62,9 @@ uint8_t _reg_addr_upstream(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, aro->eui64.uint8[6], aro->eui64.uint8[7]); if ((nce == NULL) || !(nce->mode & _NC) || (memcmp(&nce->eui64, &aro->eui64, sizeof(aro->eui64)) == 0)) { -#if GNRC_IPV6_NIB_CONF_MULTIHOP_DAD +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD) /* TODO */ -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_DAD */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD */ if (aro->ltime.u16 != 0) { _handle_sl2ao(netif, ipv6, icmpv6, sl2ao); /* re-get NCE in case it was updated */ @@ -112,12 +112,12 @@ gnrc_pktsnip_t *_copy_and_handle_aro(gnrc_netif_t *netif, DEBUG("nib: No space left in packet buffer. Not replying NS"); } } -#if GNRC_IPV6_NIB_CONF_MULTIHOP_DAD +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD) else if (status != _ADDR_REG_STATUS_IGNORE) { DEBUG("nib: Address was marked TENTATIVE => not replying NS, " "waiting for DAC\n"); } -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_DAD */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD */ } return reply_aro; } diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c index e75fdcac5d3f..18770ac5fd13 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c @@ -121,7 +121,7 @@ void _handle_sl2ao(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, if (icmpv6->type == ICMPV6_NBR_SOL) { nce->info &= ~GNRC_IPV6_NIB_NC_INFO_IS_ROUTER; } -#if GNRC_IPV6_NIB_CONF_MULTIHOP_DAD && IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD) && IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) else if (_rtr_sol_on_6lr(netif, icmpv6)) { DEBUG("nib: Setting newly created entry to tentative\n"); _set_ar_state(nce, GNRC_IPV6_NIB_NC_INFO_AR_STATE_TENTATIVE); @@ -129,7 +129,7 @@ void _handle_sl2ao(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, &nce->addr_reg_timeout, SIXLOWPAN_ND_TENTATIVE_NCE_SEC_LTIME * MS_PER_SEC); } -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_DAD && CONFIG_GNRC_IPV6_NIB_6LR */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD && CONFIG_GNRC_IPV6_NIB_6LR */ } #if ENABLE_DEBUG else { diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib.c b/sys/net/gnrc/network_layer/ipv6/nib/nib.c index c07f7cdb198e..c6de0cc2f3dd 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib.c @@ -312,14 +312,14 @@ void gnrc_ipv6_nib_handle_pkt(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, /* TODO */ break; #endif /* CONFIG_GNRC_IPV6_NIB_REDIRECT */ -#if GNRC_IPV6_NIB_CONF_MULTIHOP_DAD +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD) case ICMPV6_DAR: /* TODO */ break; case ICMPV6_DAC: /* TODO */ break; -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_DAD */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD */ } _nib_release(); gnrc_netif_release(netif); From 53a522d642914f9e033b71cc861f791998328db6 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 12 Mar 2020 17:07:17 +0100 Subject: [PATCH 13/24] gnrc/nib: Move GNRC_IPV6_NIB_CONF_MULTIHOP_P6C to 'CONFIG_' namespace Also evaluate using IS_ACTIVE macro. --- sys/include/net/gnrc/ipv6/nib.h | 2 +- sys/include/net/gnrc/ipv6/nib/abr.h | 8 +-- sys/include/net/gnrc/ipv6/nib/conf.h | 8 +-- .../gnrc/application_layer/dhcpv6/client.c | 2 +- .../gnrc/application_layer/uhcpc/gnrc_uhcpc.c | 4 +- .../gnrc/network_layer/ipv6/nib/_nib-6ln.c | 14 +++--- .../gnrc/network_layer/ipv6/nib/_nib-6ln.h | 12 ++--- .../network_layer/ipv6/nib/_nib-internal.c | 20 ++++---- .../network_layer/ipv6/nib/_nib-internal.h | 2 +- .../gnrc/network_layer/ipv6/nib/_nib-router.c | 16 +++--- .../gnrc/network_layer/ipv6/nib/_nib-router.h | 2 +- sys/net/gnrc/network_layer/ipv6/nib/nib.c | 50 +++++++++---------- sys/net/gnrc/network_layer/ipv6/nib/nib_abr.c | 4 +- sys/net/gnrc/network_layer/ipv6/nib/nib_pl.c | 2 +- sys/shell/commands/sc_gnrc_ipv6_nib.c | 18 +++---- .../tests-gnrc_ipv6_nib/Makefile.include | 4 +- .../tests-gnrc_ipv6_nib-internal.c | 4 +- 17 files changed, 86 insertions(+), 86 deletions(-) diff --git a/sys/include/net/gnrc/ipv6/nib.h b/sys/include/net/gnrc/ipv6/nib.h index 767a6fd0268b..7e6c380eb676 100644 --- a/sys/include/net/gnrc/ipv6/nib.h +++ b/sys/include/net/gnrc/ipv6/nib.h @@ -151,7 +151,7 @@ extern "C" { * The expected message context is the NIB-internal state of the authoritative * border router. * - * @note Only handled with @ref GNRC_IPV6_NIB_CONF_MULTIHOP_P6C != 0 + * @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C != 0 */ #define GNRC_IPV6_NIB_ABR_TIMEOUT (0x4fcbU) diff --git a/sys/include/net/gnrc/ipv6/nib/abr.h b/sys/include/net/gnrc/ipv6/nib/abr.h index 4474fcc41793..dd9dbd4e3b3b 100644 --- a/sys/include/net/gnrc/ipv6/nib/abr.h +++ b/sys/include/net/gnrc/ipv6/nib/abr.h @@ -40,7 +40,7 @@ typedef struct { * information is valid */ } gnrc_ipv6_nib_abr_t; -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C || defined(DOXYGEN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) || defined(DOXYGEN) #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) || defined(DOXYGEN) /** * @brief Adds the address of an authoritative border router to the NIB @@ -50,7 +50,7 @@ typedef struct { * @return 0 on success. * @return -ENOMEM, if no space is left in the neighbor cache. * @return -ENOTSUP, if @ref CONFIG_GNRC_IPV6_NIB_6LBR or - * @ref GNRC_IPV6_NIB_CONF_MULTIHOP_P6C is not defined + * @ref CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C is not defined */ int gnrc_ipv6_nib_abr_add(const ipv6_addr_t *addr); @@ -107,12 +107,12 @@ bool gnrc_ipv6_nib_abr_iter(void **state, gnrc_ipv6_nib_abr_t *abr); * @param[in] abr An authoritative border router list entry */ void gnrc_ipv6_nib_abr_print(gnrc_ipv6_nib_abr_t *abr); -#else /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C || defined(DOXYGEN) */ +#else /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C || defined(DOXYGEN) */ #define gnrc_ipv6_nib_abr_add(addr) (-ENOTSUP) #define gnrc_ipv6_nib_abr_del(addr) (void)(addr) #define gnrc_ipv6_nib_abr_iter(state, abr) (false) #define gnrc_ipv6_nib_abr_print(abr) (void)(abr) -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C || defined(DOXYGEN) */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C || defined(DOXYGEN) */ #ifdef __cplusplus } diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index 95b9bdb0460d..8d4182701f81 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -195,11 +195,11 @@ extern "C" { * * @see [RFC 6775, section 8.1](https://tools.ietf.org/html/rfc6775#section-8.1) */ -#ifndef GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#ifndef CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C #if CONFIG_GNRC_IPV6_NIB_6LR -#define GNRC_IPV6_NIB_CONF_MULTIHOP_P6C 1 +#define CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C 1 #else -#define GNRC_IPV6_NIB_CONF_MULTIHOP_P6C 0 +#define CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C 0 #endif #endif @@ -268,7 +268,7 @@ extern "C" { #define GNRC_IPV6_NIB_OFFL_NUMOF (8) #endif -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C || defined(DOXYGEN) +#if CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C || defined(DOXYGEN) /** * @brief Number of authoritative border router entries in NIB */ diff --git a/sys/net/gnrc/application_layer/dhcpv6/client.c b/sys/net/gnrc/application_layer/dhcpv6/client.c index 80b7f23e69b2..d9d4fe80c62f 100644 --- a/sys/net/gnrc/application_layer/dhcpv6/client.c +++ b/sys/net/gnrc/application_layer/dhcpv6/client.c @@ -149,7 +149,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) && IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) && - GNRC_IPV6_NIB_CONF_MULTIHOP_P6C && + IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) && gnrc_netif_is_6ln(netif)) { if (IS_USED(MODULE_GNRC_SIXLOWPAN_CTX)) { _update_6ctx(pfx, pfx_len); diff --git a/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c b/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c index 678b90def13f..7a71ffbabeba 100644 --- a/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c +++ b/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c @@ -154,7 +154,7 @@ void uhcp_handle_prefix(uint8_t *prefix, uint8_t prefix_len, uint16_t lifetime, gnrc_netapi_set(gnrc_wireless_interface, NETOPT_IPV6_ADDR_REMOVE, 0, &_prefix, sizeof(_prefix)); #if defined(MODULE_GNRC_IPV6_NIB) && IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) && \ - GNRC_IPV6_NIB_CONF_MULTIHOP_P6C + IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) gnrc_ipv6_nib_abr_del(&_prefix); #endif LOG_INFO("gnrc_uhcpc: uhcp_handle_prefix(): removed old prefix %s/%u\n", @@ -174,7 +174,7 @@ void uhcp_handle_prefix(uint8_t *prefix, uint8_t prefix_len, uint16_t lifetime, _update_6ctx((ipv6_addr_t *)prefix, prefix_len); #endif #if defined(MODULE_GNRC_IPV6_NIB) && IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) && \ - GNRC_IPV6_NIB_CONF_MULTIHOP_P6C + IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) gnrc_ipv6_nib_abr_add((ipv6_addr_t *)prefix); #endif } diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c index ba25811b4985..7114c22a19b7 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c @@ -219,7 +219,7 @@ void _handle_rereg_address(const ipv6_addr_t *addr) } } -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) _nib_abr_entry_t *_handle_abro(const sixlowpan_nd_opt_abr_t *abro) { _nib_abr_entry_t *abr = NULL; @@ -245,16 +245,16 @@ _nib_abr_entry_t *_handle_abro(const sixlowpan_nd_opt_abr_t *abro) } return abr; } -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) uint32_t _handle_6co(const icmpv6_hdr_t *icmpv6, const sixlowpan_nd_opt_6ctx_t *sixco, _nib_abr_entry_t *abr) -#else /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#else /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ uint32_t _handle_6co(const icmpv6_hdr_t *icmpv6, const sixlowpan_nd_opt_6ctx_t *sixco) -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ { uint16_t ltime; @@ -279,7 +279,7 @@ uint32_t _handle_6co(const icmpv6_hdr_t *icmpv6, cid = sixlowpan_nd_opt_6ctx_get_cid(sixco); gnrc_sixlowpan_ctx_update(cid, (ipv6_addr_t *)(sixco + 1), sixco->ctx_len, ltime, sixlowpan_nd_opt_6ctx_is_comp(sixco)); -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) assert(abr != NULL); /* should have been set in _handle_abro() */ if (ltime == 0) { bf_unset(abr->ctxs, cid); @@ -287,7 +287,7 @@ uint32_t _handle_6co(const icmpv6_hdr_t *icmpv6, else { bf_set(abr->ctxs, cid); } -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ #else /* MODULE_GNRC_SIXLOWPAN_CTX */ (void)abr; #endif /* MODULE_GNRC_SIXLOWPAN_CTX */ diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.h index 37d84124447c..489450ba8b3c 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.h @@ -126,15 +126,15 @@ uint8_t _handle_aro(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, */ void _handle_rereg_address(const ipv6_addr_t *addr); -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C || defined(DOXYGEN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) || defined(DOXYGEN) _nib_abr_entry_t *_handle_abro(const sixlowpan_nd_opt_abr_t *abro); uint32_t _handle_6co(const icmpv6_hdr_t *icmpv6, const sixlowpan_nd_opt_6ctx_t *sixco, _nib_abr_entry_t *abr); -#else /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C || defined(DOXYGEN) */ +#else /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C || defined(DOXYGEN) */ uint32_t _handle_6co(const icmpv6_hdr_t *icmpv6, const sixlowpan_nd_opt_6ctx_t *sixco); -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C || defined(DOXYGEN) */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C || defined(DOXYGEN) */ #else /* CONFIG_GNRC_IPV6_NIB_6LN || defined(DOXYGEN) */ #define _resolve_addr_from_ipv6(dst, netif, nce) (false) /* _handle_aro() doesn't make sense without 6LR so don't even use it @@ -142,12 +142,12 @@ uint32_t _handle_6co(const icmpv6_hdr_t *icmpv6, */ #define _get_next_rs_interval(netif) (NDP_RS_MS_INTERVAL) #define _handle_rereg_address(netif) (void)netif -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C || defined(DOXYGEN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) || defined(DOXYGEN) #define _handle_abro(abro) (NULL) #define _handle_6co(icmpv6, sixco, abr) (UINT32_MAX) -#else /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C || defined(DOXYGEN) */ +#else /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C || defined(DOXYGEN) */ #define _handle_6co(icmpv6, sixco) (UINT32_MAX) -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C || defined(DOXYGEN) */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C || defined(DOXYGEN) */ #endif /* CONFIG_GNRC_IPV6_NIB_6LN || defined(DOXYGEN) */ diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c index e4c3b32e5448..8b3d09da7ba0 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c @@ -40,9 +40,9 @@ static _nib_onl_entry_t _nodes[GNRC_IPV6_NIB_NUMOF]; static _nib_offl_entry_t _dsts[GNRC_IPV6_NIB_OFFL_NUMOF]; static _nib_dr_entry_t _def_routers[GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF]; -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) static _nib_abr_entry_t _abrs[GNRC_IPV6_NIB_ABR_NUMOF]; -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ static rmutex_t _nib_mutex = RMUTEX_INIT; static char addr_str[IPV6_ADDR_MAX_STR_LEN]; @@ -61,9 +61,9 @@ void _nib_init(void) memset(_nodes, 0, sizeof(_nodes)); memset(_def_routers, 0, sizeof(_def_routers)); memset(_dsts, 0, sizeof(_dsts)); -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) memset(_abrs, 0, sizeof(_abrs)); -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ #endif /* TEST_SUITES */ evtimer_init_msg(&_nib_evtimer); /* TODO: load ABR information from persistent memory */ @@ -522,7 +522,7 @@ static inline bool _in_dsts(const _nib_offl_entry_t *dst) return (dst < (_dsts + GNRC_IPV6_NIB_OFFL_NUMOF)); } -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) static inline unsigned _idx_dsts(const _nib_offl_entry_t *dst) { return (dst - _dsts) / sizeof(*dst); @@ -532,7 +532,7 @@ static inline bool _in_abrs(const _nib_abr_entry_t *abr) { return (abr < (_abrs + GNRC_IPV6_NIB_ABR_NUMOF)); } -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ void _nib_offl_clear(_nib_offl_entry_t *dst) { @@ -660,7 +660,7 @@ int _nib_get_route(const ipv6_addr_t *dst, gnrc_pktsnip_t *pkt, void _nib_pl_remove(_nib_offl_entry_t *nib_offl) { _nib_offl_remove(nib_offl, _PL); -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) unsigned idx = _idx_dsts(nib_offl); if (idx < GNRC_IPV6_NIB_OFFL_NUMOF) { for (_nib_abr_entry_t *abr = _abrs; _in_abrs(abr); abr++) { @@ -675,10 +675,10 @@ void _nib_pl_remove(_nib_offl_entry_t *nib_offl) } } } -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ } -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) _nib_abr_entry_t *_nib_abr_add(const ipv6_addr_t *addr) { _nib_abr_entry_t *abr = NULL; @@ -780,7 +780,7 @@ _nib_abr_entry_t *_nib_abr_iter(const _nib_abr_entry_t *last) } return NULL; } -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ _nib_offl_entry_t *_nib_pl_add(unsigned iface, const ipv6_addr_t *pfx, diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h index 13493ef502c6..9ac7fa99a8f3 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h @@ -705,7 +705,7 @@ static inline void _nib_ft_remove(_nib_offl_entry_t *nib_offl) } #endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */ -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C || defined(DOXYGEN) +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) || defined(DOXYGEN) /** * @brief Creates or gets an existing authoritative border router. * diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c index 175044b87239..4d84e78e33cb 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c @@ -22,9 +22,9 @@ #include "net/sock/dns.h" #endif -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) #include "_nib-6ln.h" -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ #include "_nib-router.h" #define ENABLE_DEBUG (0) @@ -84,7 +84,7 @@ void _handle_snd_mc_ra(gnrc_netif_t *netif) void _snd_rtr_advs(gnrc_netif_t *netif, const ipv6_addr_t *dst, bool final) { -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) _nib_abr_entry_t *abr = NULL; DEBUG("nib: Send router advertisements for each border router:\n"); @@ -93,9 +93,9 @@ void _snd_rtr_advs(gnrc_netif_t *netif, const ipv6_addr_t *dst, bool final) sizeof(addr_str))); _snd_ra(netif, dst, final, abr); } -#else /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#else /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ _snd_ra(netif, dst, final, NULL); -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ } static gnrc_pktsnip_t *_offl_to_pio(_nib_offl_entry_t *offl, @@ -162,7 +162,7 @@ static gnrc_pktsnip_t *_build_ext_opts(gnrc_netif_t *netif, ext_opts = rdnsso; } #endif /* CONFIG_GNRC_IPV6_NIB_DNS */ -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) uint16_t ltime; gnrc_pktsnip_t *abro; @@ -200,7 +200,7 @@ static gnrc_pktsnip_t *_build_ext_opts(gnrc_netif_t *netif, return NULL; } ext_opts = abro; -#else /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#else /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ (void)abr; while ((pfx = _nib_offl_iter(pfx))) { if ((pfx->mode & _PL) && (_nib_onl_get_if(pfx->next_hop) == id)) { @@ -209,7 +209,7 @@ static gnrc_pktsnip_t *_build_ext_opts(gnrc_netif_t *netif, } } } -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ return ext_opts; } 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 76286fe335f6..51705029f9a0 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.h @@ -108,7 +108,7 @@ void _set_rtr_adv(gnrc_netif_t *netif); /** * @brief Send router advertisements * - * If @ref GNRC_IPV6_NIB_CONF_MULTIHOP_P6C is not 0 this sends one router + * If @ref CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C is not 0 this sends one router * advertisement per configured ABR, otherwise it just sends one single router * advertisement for the interface. * diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib.c b/sys/net/gnrc/network_layer/ipv6/nib/nib.c index c6de0cc2f3dd..48c7ab3fa341 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib.c @@ -366,11 +366,11 @@ void gnrc_ipv6_nib_handle_timer_event(void *ctx, uint16_t type) _nib_nc_remove(ctx); break; #endif /* CONFIG_GNRC_IPV6_NIB_6LR */ -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) case GNRC_IPV6_NIB_ABR_TIMEOUT: _nib_abr_remove(&((_nib_abr_entry_t *)ctx)->addr); break; -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ case GNRC_IPV6_NIB_PFX_TIMEOUT: _handle_pfx_timeout(ctx); break; @@ -429,14 +429,14 @@ static void _handle_mtuo(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, static uint32_t _handle_rdnsso(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, const ndp_opt_rdnss_impl_t *rdnsso); #endif -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, const ndp_opt_pi_t *pio, _nib_abr_entry_t *abr); -#else /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#else /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, const ndp_opt_pi_t *pio); -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ /** @} */ /* Iterator for NDP options in a packet */ @@ -561,10 +561,10 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, _nib_dr_entry_t *dr = NULL; ndp_opt_t *opt; -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) sixlowpan_nd_opt_abr_t *abro = NULL; _nib_abr_entry_t *abr = NULL; -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ uint32_t next_timeout = UINT32_MAX; assert(netif != NULL); @@ -600,7 +600,7 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, "Discarding router advertisement silently\n"); return; } -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) if (opt->type == NDP_OPT_ABR) { if (abro != NULL) { DEBUG("nib: More than one ABRO. " @@ -609,7 +609,7 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, } abro = (sixlowpan_nd_opt_abr_t *)opt; } -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ } DEBUG("nib: Received valid router advertisement:\n"); DEBUG(" - Source address: %s\n", @@ -625,7 +625,7 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, byteorder_ntohl(rtr_adv->reach_time)); DEBUG(" - Retrans Timer: %" PRIu32 "ms\n", byteorder_ntohl(rtr_adv->retrans_timer)); -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) if (abro != NULL) { if ((abr = _handle_abro(abro)) == NULL) { DEBUG("nib: could not allocate space for new border router or " @@ -645,7 +645,7 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, return; } #endif /* !CONFIG_GNRC_IPV6_NIB_6LBR */ -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ if (rtr_adv->ltime.u16 != 0) { uint16_t rtr_ltime = byteorder_ntohs(rtr_adv->ltime); @@ -716,30 +716,30 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, break; case NDP_OPT_PI: { uint32_t min_pfx_timeout; -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) min_pfx_timeout = _handle_pio(netif, (const icmpv6_hdr_t *)rtr_adv, (ndp_opt_pi_t *)opt, abr); -#else /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#else /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ min_pfx_timeout = _handle_pio(netif, (const icmpv6_hdr_t *)rtr_adv, (ndp_opt_pi_t *)opt); -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ next_timeout = _min(next_timeout, min_pfx_timeout); break; } /* ABRO was already secured in the option check above */ #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) case NDP_OPT_6CTX: -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) next_timeout = _min(_handle_6co((icmpv6_hdr_t *)rtr_adv, (sixlowpan_nd_opt_6ctx_t *)opt, abr), next_timeout); -#else /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#else /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ next_timeout = _min(_handle_6co((icmpv6_hdr_t *)rtr_adv, (sixlowpan_nd_opt_6ctx_t *)opt), next_timeout); -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ break; #endif /* CONFIG_GNRC_IPV6_NIB_6LN */ #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_DNS) @@ -1436,23 +1436,23 @@ static void _remove_prefix(const ipv6_addr_t *pfx, unsigned pfx_len) return; } -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) static inline bool _multihop_p6c(gnrc_netif_t *netif, _nib_abr_entry_t *abr) { (void)netif; /* gnrc_netif_is_6lr() might resolve to a NOP */ return (gnrc_netif_is_6lr(netif) && (abr != NULL)); } -#else /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#else /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ #define _multihop_p6c(netif, abr) (false) -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, const ndp_opt_pi_t *pio, _nib_abr_entry_t *abr) -#else /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#else /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, const ndp_opt_pi_t *pio) -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ { uint32_t valid_ltime; uint32_t pref_ltime; @@ -1505,11 +1505,11 @@ static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, } if ((pfx = _nib_pl_add(netif->pid, &pio->prefix, pio->prefix_len, valid_ltime, pref_ltime))) { -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) if (abr != NULL) { _nib_abr_add_pfx(abr, pfx); } -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ if (pio->flags & NDP_OPT_PI_FLAGS_L) { pfx->flags |= _PFX_ON_LINK; } 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 eaf64678df44..ddf69456091b 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib_abr.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib_abr.c @@ -21,7 +21,7 @@ #include "_nib-6ln.h" #include "_nib-internal.h" -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) int gnrc_ipv6_nib_abr_add(const ipv6_addr_t *addr) { @@ -89,6 +89,6 @@ void gnrc_ipv6_nib_abr_print(gnrc_ipv6_nib_abr_t *abr) } #else typedef int dont_be_pedantic; -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ /** @} */ 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 98e22b6a6413..5f286c1fbf2c 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib_pl.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib_pl.c @@ -72,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 IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) && GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) && IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_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 ad1d4bb7f684..3f3b6cbeeff1 100644 --- a/sys/shell/commands/sc_gnrc_ipv6_nib.c +++ b/sys/shell/commands/sc_gnrc_ipv6_nib.c @@ -24,9 +24,9 @@ static void _usage(char **argv); static int _nib_neigh(int argc, char **argv); static int _nib_prefix(int argc, char **argv); static int _nib_route(int argc, char **argv); -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) static int _nib_abr(int argc, char **argv); -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ int _gnrc_ipv6_nib(int argc, char **argv) { @@ -45,11 +45,11 @@ int _gnrc_ipv6_nib(int argc, char **argv) else if (strcmp(argv[1], "route") == 0) { res = _nib_route(argc, argv); } -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) else if (strcmp(argv[1], "abr") == 0) { res = _nib_abr(argc, argv); } -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ else { _usage(argv); } @@ -58,11 +58,11 @@ int _gnrc_ipv6_nib(int argc, char **argv) static void _usage(char **argv) { -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) printf("usage: %s {neigh|prefix|route|abr|help} ...\n", argv[0]); -#else /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#else /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ printf("usage: %s {neigh|prefix|route|help} ...\n", argv[0]); -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ } static void _usage_nib_neigh(char **argv) @@ -295,7 +295,7 @@ static int _nib_route(int argc, char **argv) return 0; } -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) static void _usage_nib_abr(char **argv) { if (IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR)) { @@ -363,6 +363,6 @@ static int _nib_abr(int argc, char **argv) } return 0; } -#endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ +#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ /** @} */ diff --git a/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include b/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include index fa8395dc49d8..da00d8886393 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include +++ b/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include @@ -1,5 +1,5 @@ USEMODULE += gnrc_ipv6_nib -USEMODULE += gnrc_sixlowpan_nd # required for GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +USEMODULE += gnrc_sixlowpan_nd # required for CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C CFLAGS += -DCONFIG_GNRC_IPV6_NIB_ROUTER=1 CFLAGS += -DGNRC_IPV6_NIB_NUMOF=16 @@ -7,7 +7,7 @@ CFLAGS += -DGNRC_IPV6_NIB_OFFL_NUMOF=25 CFLAGS += -DGNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF=4 CFLAGS += -DGNRC_IPV6_NIB_ABR_NUMOF=4 CFLAGS += -DCONFIG_GNRC_IPV6_NIB_6LBR=1 -CFLAGS += -DGNRC_IPV6_NIB_CONF_MULTIHOP_P6C=1 +CFLAGS += -DCONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C=1 CFLAGS += -DCONFIG_GNRC_IPV6_NIB_DC=1 INCLUDES += -I$(RIOTBASE)/sys/net/gnrc/network_layer/ipv6/nib diff --git a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c index 63b41922a11a..0ba1750b6201 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c +++ b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c @@ -1754,7 +1754,7 @@ static void test_nib_ft_remove(void) TEST_ASSERT_NULL(_nib_offl_iter(NULL)); } -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) /* * Creates GNRC_IPV6_NIB_ABR_NUMOF ABR entries with different addresses and * then tries to add another. @@ -2086,7 +2086,7 @@ Test *tests_gnrc_ipv6_nib_internal_tests(void) new_TestFixture(test_nib_pl_remove), new_TestFixture(test_nib_ft_add__success), new_TestFixture(test_nib_ft_remove), -#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C +#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) new_TestFixture(test_nib_abr_add__no_space_left), new_TestFixture(test_nib_abr_add__success_duplicate), new_TestFixture(test_nib_abr_add__success), From 1f20ffc15082e4adb0898e9124e9f58a1de2f91f Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 12 Mar 2020 17:12:07 +0100 Subject: [PATCH 14/24] gnrc/nib: Move GNRC_IPV6_NIB_CONF_NO_RTR_SOL to 'CONFIG_' namespace Also evaluate using IS_ACTIVE macro. --- sys/include/net/gnrc/ipv6/nib/conf.h | 4 ++-- sys/net/gnrc/network_layer/ipv6/nib/nib.c | 4 ++-- tests/gnrc_netif/Makefile | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index 8d4182701f81..62566467084b 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -227,8 +227,8 @@ extern "C" { * * @warning Only do this if you know what you're doing */ -#ifndef GNRC_IPV6_NIB_CONF_NO_RTR_SOL -#define GNRC_IPV6_NIB_CONF_NO_RTR_SOL 0 +#ifndef CONFIG_GNRC_IPV6_NIB_NO_RTR_SOL +#define CONFIG_GNRC_IPV6_NIB_NO_RTR_SOL 0 #endif /** diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib.c b/sys/net/gnrc/network_layer/ipv6/nib/nib.c index 48c7ab3fa341..4f5ef53f14ca 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib.c @@ -1318,7 +1318,7 @@ static void _handle_rtr_timeout(_nib_dr_entry_t *router) void _handle_search_rtr(gnrc_netif_t *netif) { -#if !GNRC_IPV6_NIB_CONF_NO_RTR_SOL +#if !IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_NO_RTR_SOL) gnrc_netif_acquire(netif); if (!(gnrc_netif_is_rtr_adv(netif)) || gnrc_netif_is_6ln(netif)) { uint32_t next_rs = _evtimer_lookup(netif, GNRC_IPV6_NIB_SEARCH_RTR); @@ -1343,7 +1343,7 @@ void _handle_search_rtr(gnrc_netif_t *netif) gnrc_netif_release(netif); #else (void)netif; -#endif /* !GNRC_IPV6_NIB_CONF_NO_RTR_SOL */ +#endif /* !CONFIG_GNRC_IPV6_NIB_NO_RTR_SOL */ } #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_DNS) diff --git a/tests/gnrc_netif/Makefile b/tests/gnrc_netif/Makefile index 70663e00b5ff..2e91ce872ad8 100644 --- a/tests/gnrc_netif/Makefile +++ b/tests/gnrc_netif/Makefile @@ -14,7 +14,7 @@ USEMODULE += od # deactivate automatically emitted packets from IPv6 neighbor discovery CFLAGS += -DCONFIG_GNRC_IPV6_NIB_ARSM=0 CFLAGS += -DCONFIG_GNRC_IPV6_NIB_SLAAC=0 -CFLAGS += -DGNRC_IPV6_NIB_CONF_NO_RTR_SOL=1 +CFLAGS += -DCONFIG_GNRC_IPV6_NIB_NO_RTR_SOL=1 CFLAGS += -DGNRC_NETIF_ADDRS_NUMOF=16 CFLAGS += -DGNRC_NETIF_GROUPS_NUMOF=8 CFLAGS += -DLOG_LEVEL=LOG_NONE From 07771de08fb878fc6d1a0b46aa56e91c485cabcb Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 12 Mar 2020 17:15:47 +0100 Subject: [PATCH 15/24] gnrc/nib: Move GNRC_IPV6_NIB_NUMOF to 'CONFIG_' namespace --- examples/gnrc_minimal/Makefile | 2 +- sys/include/net/gnrc/ipv6/nib/conf.h | 12 ++--- .../network_layer/ipv6/nib/_nib-internal.c | 8 +-- sys/net/gnrc/network_layer/ipv6/nib/nib.c | 4 +- tests/gnrc_sock_dns/Makefile | 2 +- .../tests-gnrc_ipv6_nib/Makefile.include | 2 +- .../tests-gnrc_ipv6_nib-ft.c | 6 +-- .../tests-gnrc_ipv6_nib-internal.c | 50 +++++++++---------- .../tests-gnrc_ipv6_nib-nc.c | 24 ++++----- .../tests-gnrc_ipv6_nib-pl.c | 8 +-- 10 files changed, 59 insertions(+), 59 deletions(-) diff --git a/examples/gnrc_minimal/Makefile b/examples/gnrc_minimal/Makefile index fcb32d78727e..24dea96fc897 100644 --- a/examples/gnrc_minimal/Makefile +++ b/examples/gnrc_minimal/Makefile @@ -25,7 +25,7 @@ USEMODULE += prng_minstd CFLAGS += -DLOG_LEVEL=LOG_NONE # disable log output CFLAGS += -DGNRC_PKTBUF_SIZE=512 -DCONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF=2 \ - -DGNRC_NETIF_IPV6_GROUPS_NUMOF=2 -DGNRC_IPV6_NIB_NUMOF=1 \ + -DGNRC_NETIF_IPV6_GROUPS_NUMOF=2 -DCONFIG_GNRC_IPV6_NIB_NUMOF=1 \ -DGNRC_IPV6_NIB_OFFL_NUMOF=1 # be able to configure at least one route # Enable single interface optimization. Set to 0 if more than one interface is diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index 62566467084b..7b9961a69bcd 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -35,8 +35,8 @@ extern "C" { #ifndef CONFIG_GNRC_IPV6_NIB_SLAAC #define CONFIG_GNRC_IPV6_NIB_SLAAC 1 #endif -#ifndef GNRC_IPV6_NIB_NUMOF -#define GNRC_IPV6_NIB_NUMOF (16) +#ifndef CONFIG_GNRC_IPV6_NIB_NUMOF +#define CONFIG_GNRC_IPV6_NIB_NUMOF (16) #endif #endif @@ -63,9 +63,9 @@ extern "C" { # ifndef CONFIG_GNRC_IPV6_NIB_ARSM # define CONFIG_GNRC_IPV6_NIB_ARSM 0 # endif -# ifndef GNRC_IPV6_NIB_NUMOF +# ifndef CONFIG_GNRC_IPV6_NIB_NUMOF /* only needs to store default router */ -# define GNRC_IPV6_NIB_NUMOF (1) +# define CONFIG_GNRC_IPV6_NIB_NUMOF (1) # endif #endif #endif @@ -254,8 +254,8 @@ extern "C" { * @attention This number has direct influence on the maximum number of * neighbors and duplicate address detection table entries */ -#ifndef GNRC_IPV6_NIB_NUMOF -#define GNRC_IPV6_NIB_NUMOF (4) +#ifndef CONFIG_GNRC_IPV6_NIB_NUMOF +#define CONFIG_GNRC_IPV6_NIB_NUMOF (4) #endif /** diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c index 8b3d09da7ba0..c152e892f839 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c @@ -36,7 +36,7 @@ _nib_dr_entry_t *_prime_def_router = NULL; static clist_node_t _next_removable = { NULL }; -static _nib_onl_entry_t _nodes[GNRC_IPV6_NIB_NUMOF]; +static _nib_onl_entry_t _nodes[CONFIG_GNRC_IPV6_NIB_NUMOF]; static _nib_offl_entry_t _dsts[GNRC_IPV6_NIB_OFFL_NUMOF]; static _nib_dr_entry_t _def_routers[GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF]; @@ -93,7 +93,7 @@ _nib_onl_entry_t *_nib_onl_alloc(const ipv6_addr_t *addr, unsigned iface) DEBUG("nib: Allocating on-link node entry (addr = %s, iface = %u)\n", (addr == NULL) ? "NULL" : ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)), iface); - for (unsigned i = 0; i < GNRC_IPV6_NIB_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_NUMOF; i++) { _nib_onl_entry_t *tmp = &_nodes[i]; if ((_nib_onl_get_if(tmp) == iface) && _addr_equals(addr, tmp)) { @@ -204,7 +204,7 @@ _nib_onl_entry_t *_nib_nc_add(const ipv6_addr_t *addr, unsigned iface, _nib_onl_entry_t *_nib_onl_iter(const _nib_onl_entry_t *last) { for (const _nib_onl_entry_t *node = (last) ? last + 1 : _nodes; - node < (_nodes + GNRC_IPV6_NIB_NUMOF); + node < (_nodes + CONFIG_GNRC_IPV6_NIB_NUMOF); node++) { if (node->mode != _EMPTY) { /* const modifier provided to assure internal consistency. @@ -220,7 +220,7 @@ _nib_onl_entry_t *_nib_onl_get(const ipv6_addr_t *addr, unsigned iface) assert(addr != NULL); DEBUG("nib: Getting on-link node entry (addr = %s, iface = %u)\n", ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)), iface); - for (unsigned i = 0; i < GNRC_IPV6_NIB_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_NUMOF; i++) { _nib_onl_entry_t *node = &_nodes[i]; if ((node->mode != _EMPTY) && diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib.c b/sys/net/gnrc/network_layer/ipv6/nib/nib.c index 4f5ef53f14ca..674df44dfc8f 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib.c @@ -48,7 +48,7 @@ static char addr_str[IPV6_ADDR_MAX_STR_LEN]; #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_QUEUE_PKT) -static gnrc_pktqueue_t _queue_pool[GNRC_IPV6_NIB_NUMOF]; +static gnrc_pktqueue_t _queue_pool[CONFIG_GNRC_IPV6_NIB_NUMOF]; #endif /* CONFIG_GNRC_IPV6_NIB_QUEUE_PKT */ #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_DNS) @@ -1118,7 +1118,7 @@ static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_QUEUE_PKT) static gnrc_pktqueue_t *_alloc_queue_entry(gnrc_pktsnip_t *pkt) { - for (int i = 0; i < GNRC_IPV6_NIB_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_NUMOF; i++) { if (_queue_pool[i].pkt == NULL) { _queue_pool[i].pkt = pkt; return &_queue_pool[i]; diff --git a/tests/gnrc_sock_dns/Makefile b/tests/gnrc_sock_dns/Makefile index ea4515e19da6..1a2f8238ef72 100644 --- a/tests/gnrc_sock_dns/Makefile +++ b/tests/gnrc_sock_dns/Makefile @@ -29,7 +29,7 @@ LOW_MEMORY_BOARDS := nucleo-f334r8 msb-430 msb-430h ifeq ($(BOARD),$(filter $(BOARD),$(LOW_MEMORY_BOARDS))) CFLAGS += -DGNRC_PKTBUF_SIZE=512 -DCONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF=2 \ - -DGNRC_NETIF_IPV6_GROUPS_NUMOF=2 -DGNRC_IPV6_NIB_NUMOF=1 \ + -DGNRC_NETIF_IPV6_GROUPS_NUMOF=2 -DCONFIG_GNRC_IPV6_NIB_NUMOF=1 \ -DNRC_IPV6_NIB_OFFL_NUMOF=1 endif diff --git a/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include b/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include index da00d8886393..bd4d6610875c 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include +++ b/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include @@ -2,7 +2,7 @@ USEMODULE += gnrc_ipv6_nib USEMODULE += gnrc_sixlowpan_nd # required for CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C CFLAGS += -DCONFIG_GNRC_IPV6_NIB_ROUTER=1 -CFLAGS += -DGNRC_IPV6_NIB_NUMOF=16 +CFLAGS += -DCONFIG_GNRC_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 diff --git a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-ft.c b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-ft.c index 5dfa4faeb79d..3de2720e9a11 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-ft.c +++ b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-ft.c @@ -212,9 +212,9 @@ static void test_nib_ft_add__EINVAL_iface0(void) &next_hop, 0, 0)); } -#if GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF -#define MAX_NUMOF (GNRC_IPV6_NIB_NUMOF) -#else /* GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF */ +#if CONFIG_GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF +#define MAX_NUMOF (CONFIG_GNRC_IPV6_NIB_NUMOF) +#else /* CONFIG_GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF */ #define MAX_NUMOF (GNRC_IPV6_NIB_OFFL_NUMOF) #endif diff --git a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c index 0ba1750b6201..9e473fa73512 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c +++ b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c @@ -39,7 +39,7 @@ static void set_up(void) } /* - * Creates GNRC_IPV6_NIB_NUMOF persistent entries with different IP addresses + * Creates CONFIG_GNRC_IPV6_NIB_NUMOF persistent entries with different IP addresses * and then tries to add another. * Expected result: should return NULL */ @@ -48,7 +48,7 @@ static void test_nib_alloc__no_space_left_diff_addr(void) ipv6_addr_t addr = { .u64 = { { .u8 = GLOBAL_PREFIX }, { .u64 = TEST_UINT64 } } }; - for (int i = 0; i < GNRC_IPV6_NIB_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_NUMOF; i++) { _nib_onl_entry_t *node; TEST_ASSERT_NOT_NULL((node = _nib_onl_alloc(&addr, IFACE))); @@ -59,7 +59,7 @@ static void test_nib_alloc__no_space_left_diff_addr(void) } /* - * Creates GNRC_IPV6_NIB_NUMOF persistent entries with different interface + * Creates CONFIG_GNRC_IPV6_NIB_NUMOF persistent entries with different interface * identifiers and then tries to add another. * Expected result: should return NULL */ @@ -69,7 +69,7 @@ static void test_nib_alloc__no_space_left_diff_iface(void) { .u64 = TEST_UINT64 } } }; unsigned iface = 1; - for (int i = 0; i < GNRC_IPV6_NIB_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_NUMOF; i++) { _nib_onl_entry_t *node; TEST_ASSERT_NOT_NULL((node = _nib_onl_alloc(&addr, iface))); @@ -80,7 +80,7 @@ static void test_nib_alloc__no_space_left_diff_iface(void) } /* - * Creates GNRC_IPV6_NIB_NUMOF persistent entries with different IP addresses + * Creates CONFIG_GNRC_IPV6_NIB_NUMOF persistent entries with different IP addresses * and interface identifiers and then tries to add another. * Expected result: should return NULL */ @@ -90,7 +90,7 @@ static void test_nib_alloc__no_space_left_diff_addr_iface(void) { .u64 = TEST_UINT64 } } }; unsigned iface = 1; - for (int i = 0; i < GNRC_IPV6_NIB_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_NUMOF; i++) { _nib_onl_entry_t *node; TEST_ASSERT_NOT_NULL((node = _nib_onl_alloc(&addr, iface))); @@ -102,7 +102,7 @@ static void test_nib_alloc__no_space_left_diff_addr_iface(void) } /* - * Creates GNRC_IPV6_NIB_NUMOF persistent entries with different IP addresses + * Creates CONFIG_GNRC_IPV6_NIB_NUMOF persistent entries with different IP addresses * and interface identifiers and then tries to add another that is equal to the * last. * Expected result: should return not NULL (the last) @@ -114,7 +114,7 @@ static void test_nib_alloc__success_duplicate(void) { .u64 = TEST_UINT64 } } }; unsigned iface = 1; - for (int i = 0; i < GNRC_IPV6_NIB_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_NUMOF; i++) { addr.u64[1].u64++; iface++; TEST_ASSERT_NOT_NULL((node = _nib_onl_alloc(&addr, iface))); @@ -362,7 +362,7 @@ static void test_nib_get__empty(void) } /* - * Creates GNRC_IPV6_NIB_NUMOF neighbor cache entries with different IP + * Creates CONFIG_GNRC_IPV6_NIB_NUMOF neighbor cache entries with different IP * addresses and a non-garbage-collectible AR state and then tries to add * another. * Expected result: should return NULL @@ -372,7 +372,7 @@ static void test_nib_nc_add__no_space_left_diff_addr(void) ipv6_addr_t addr = { .u64 = { { .u8 = GLOBAL_PREFIX }, { .u64 = TEST_UINT64 } } }; - for (int i = 0; i < GNRC_IPV6_NIB_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_NUMOF; i++) { _nib_onl_entry_t *node; TEST_ASSERT_NOT_NULL((node = _nib_nc_add(&addr, IFACE, @@ -385,7 +385,7 @@ static void test_nib_nc_add__no_space_left_diff_addr(void) } /* - * Creates GNRC_IPV6_NIB_NUMOF neighbor cache entries with different interface + * Creates CONFIG_GNRC_IPV6_NIB_NUMOF neighbor cache entries with different interface * identifiers and a non-garbage-collectible AR state and then tries to add * another. * Expected result: should return NULL @@ -396,7 +396,7 @@ static void test_nib_nc_add__no_space_left_diff_iface(void) { .u64 = TEST_UINT64 } } }; unsigned iface = 1; - for (int i = 0; i < GNRC_IPV6_NIB_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_NUMOF; i++) { _nib_onl_entry_t *node; TEST_ASSERT_NOT_NULL((node = _nib_nc_add(&addr, iface, @@ -409,7 +409,7 @@ static void test_nib_nc_add__no_space_left_diff_iface(void) } /* - * Creates GNRC_IPV6_NIB_NUMOF neighbor cache entries with different IP + * Creates CONFIG_GNRC_IPV6_NIB_NUMOF neighbor cache entries with different IP * addresses and interface identifiers and a non-garbage-collectible AR state * and then tries to add another. * Expected result: should return NULL @@ -420,7 +420,7 @@ static void test_nib_nc_add__no_space_left_diff_addr_iface(void) { .u64 = TEST_UINT64 } } }; unsigned iface = 1; - for (int i = 0; i < GNRC_IPV6_NIB_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_NUMOF; i++) { _nib_onl_entry_t *node; TEST_ASSERT_NOT_NULL((node = _nib_nc_add(&addr, iface, @@ -434,7 +434,7 @@ static void test_nib_nc_add__no_space_left_diff_addr_iface(void) } /* - * Creates GNRC_IPV6_NIB_NUMOF neighbor cache entries with different IP + * Creates CONFIG_GNRC_IPV6_NIB_NUMOF neighbor cache entries with different IP * addresses and interface identifiers and a non-garbage-collectible AR state * and then tries to add another that is equal to the last. * Expected result: should return not NULL (the last) @@ -446,7 +446,7 @@ static void test_nib_nc_add__success_duplicate(void) { .u64 = TEST_UINT64 } } }; unsigned iface = 0; - for (int i = 0; i < GNRC_IPV6_NIB_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_NUMOF; i++) { addr.u64[1].u64++; iface++; TEST_ASSERT_NOT_NULL((node = _nib_nc_add(&addr, iface, @@ -477,7 +477,7 @@ static void test_nib_nc_add__success(void) } /* - * Creates GNRC_IPV6_NIB_NUMOF neighbor cache entries with different IP address. + * Creates CONFIG_GNRC_IPV6_NIB_NUMOF neighbor cache entries with different IP address. * Expected result: new entries should still be able to be created and further * should be different than the previous created ones */ @@ -487,7 +487,7 @@ static void test_nib_nc_add__success_full_but_garbage_collectible(void) ipv6_addr_t addr = { .u64 = { { .u8 = GLOBAL_PREFIX }, { .u64 = TEST_UINT64 } } }; - for (int i = 0; i < (3 * GNRC_IPV6_NIB_NUMOF); i++) { + for (int i = 0; i < (3 * CONFIG_GNRC_IPV6_NIB_NUMOF); i++) { TEST_ASSERT_NOT_NULL((node = _nib_nc_add(&addr, IFACE, GNRC_IPV6_NIB_NC_INFO_NUD_STATE_STALE))); TEST_ASSERT(last != node); @@ -499,7 +499,7 @@ static void test_nib_nc_add__success_full_but_garbage_collectible(void) } /* - * Creates GNRC_IPV6_NIB_NUMOF neighbor cache entries with different IP + * Creates CONFIG_GNRC_IPV6_NIB_NUMOF neighbor cache entries with different IP * addresses and a garbage-collectible AR state and then tries to add * 3 more after removing two. * Expected result: should not crash @@ -512,7 +512,7 @@ static void test_nib_nc_add__cache_out_crash(void) ipv6_addr_t addr = { .u64 = { { .u8 = GLOBAL_PREFIX }, { .u64 = TEST_UINT64 } } }; - for (int i = 0; i < GNRC_IPV6_NIB_NUMOF - 2; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_NUMOF - 2; i++) { TEST_ASSERT_NOT_NULL(_nib_nc_add(&addr, IFACE, GNRC_IPV6_NIB_NC_INFO_NUD_STATE_STALE)); addr.u64[1].u64++; @@ -603,7 +603,7 @@ static void test_nib_drl_add__no_space_left_diff_addr(void) } /* - * Creates GNRC_IPV6_NIB_NUMOF persistent enties entries with + * Creates CONFIG_GNRC_IPV6_NIB_NUMOF persistent enties entries with * different IP addresses and then tries to add a default router list entry with * yet another address. * Expected result: should return NULL @@ -613,7 +613,7 @@ static void test_nib_drl_add__no_space_left_nib_full(void) ipv6_addr_t addr = { .u64 = { { .u8 = GLOBAL_PREFIX }, { .u64 = TEST_UINT64 } } }; - for (int i = 0; i < GNRC_IPV6_NIB_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_NUMOF; i++) { _nib_onl_entry_t *node; TEST_ASSERT_NOT_NULL((node = _nib_onl_alloc(&addr, IFACE))); @@ -1021,9 +1021,9 @@ static void test_nib_drl_get_dr__success4(void) TEST_ASSERT(nib_res != node2); } -#if GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF -#define MAX_NUMOF (GNRC_IPV6_NIB_NUMOF) -#else /* GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF */ +#if CONFIG_GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF +#define MAX_NUMOF (CONFIG_GNRC_IPV6_NIB_NUMOF) +#else /* CONFIG_GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF */ #define MAX_NUMOF (GNRC_IPV6_NIB_OFFL_NUMOF) #endif diff --git a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-nc.c b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-nc.c index 027d02629283..b7c769ee7957 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-nc.c +++ b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-nc.c @@ -36,7 +36,7 @@ static void set_up(void) } /* - * Creates GNRC_IPV6_NIB_NUMOF neighbor cache entries with different addresses + * Creates CONFIG_GNRC_IPV6_NIB_NUMOF neighbor cache entries with different addresses * and then tries to create another one * Expected result: gnrc_ipv6_nib_nc_set() returns -ENOMEM */ @@ -46,7 +46,7 @@ static void test_nib_nc_set__ENOMEM_diff_addr(void) { .u64 = TEST_UINT64 } } }; uint8_t l2addr[] = L2ADDR; - for (unsigned i = 0; i < GNRC_IPV6_NIB_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_NUMOF; i++) { TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_nc_set(&addr, IFACE, l2addr, sizeof(l2addr))); addr.u64[1].u64++; @@ -57,7 +57,7 @@ static void test_nib_nc_set__ENOMEM_diff_addr(void) } /* - * Creates GNRC_IPV6_NIB_NUMOF neighbor cache entries with different interfaces + * Creates CONFIG_GNRC_IPV6_NIB_NUMOF neighbor cache entries with different interfaces * and then tries to create another one * Expected result: gnrc_ipv6_nib_nc_set() returns -ENOMEM */ @@ -68,7 +68,7 @@ static void test_nib_nc_set__ENOMEM_diff_iface(void) static const uint8_t l2addr[] = L2ADDR; unsigned iface = IFACE; - for (unsigned i = 0; i < GNRC_IPV6_NIB_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_NUMOF; i++) { TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_nc_set(&addr, iface, l2addr, sizeof(l2addr))); iface++; @@ -78,7 +78,7 @@ static void test_nib_nc_set__ENOMEM_diff_iface(void) } /* - * Creates GNRC_IPV6_NIB_NUMOF neighbor cache entries with different addresses + * Creates CONFIG_GNRC_IPV6_NIB_NUMOF neighbor cache entries with different addresses * and interfaces and then tries to create another one * Expected result: gnrc_ipv6_nib_nc_set() returns -ENOMEM */ @@ -89,7 +89,7 @@ static void test_nib_nc_set__ENOMEM_diff_addr_iface(void) uint8_t l2addr[] = L2ADDR; unsigned iface = IFACE; - for (unsigned i = 0; i < GNRC_IPV6_NIB_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_NUMOF; i++) { TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_nc_set(&addr, iface, l2addr, sizeof(l2addr))); addr.u64[1].u64++; @@ -128,7 +128,7 @@ static void test_nib_nc_set__success(void) } /* - * Creates GNRC_IPV6_NIB_NUMOF neighbor cache entries with different IP + * Creates CONFIG_GNRC_IPV6_NIB_NUMOF neighbor cache entries with different IP * addresses and interface identifiers and then tries to add another that is * equal to the last. * Expected result: gnrc_ipv6_nib_nc_set() returns 0 @@ -140,7 +140,7 @@ static void test_nib_nc_set__success_duplicate(void) uint8_t l2addr[] = L2ADDR; unsigned iface = 0; - for (unsigned i = 0; i < GNRC_IPV6_NIB_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_NUMOF; i++) { addr.u64[1].u64++; iface++; l2addr[7]++; @@ -152,9 +152,9 @@ static void test_nib_nc_set__success_duplicate(void) } /* - * Creates GNRC_IPV6_NIB_NUMOF neighbor cache entries with different addresses + * Creates CONFIG_GNRC_IPV6_NIB_NUMOF neighbor cache entries with different addresses * and interfaces and then tries to delete one with yet another address. - * Expected result: There should be still GNRC_IPV6_NIB_NUMOF entries in the + * Expected result: There should be still CONFIG_GNRC_IPV6_NIB_NUMOF entries in the * neighbor cache */ static void test_nib_nc_del__unknown(void) @@ -166,7 +166,7 @@ static void test_nib_nc_del__unknown(void) gnrc_ipv6_nib_nc_t nce; unsigned iface = IFACE, count = 0; - for (unsigned i = 0; i < GNRC_IPV6_NIB_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_NUMOF; i++) { TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_nc_set(&addr, iface, l2addr, sizeof(l2addr))); addr.u64[1].u64++; @@ -177,7 +177,7 @@ static void test_nib_nc_del__unknown(void) while (gnrc_ipv6_nib_nc_iter(0, &iter_state, &nce)) { count++; } - TEST_ASSERT_EQUAL_INT(GNRC_IPV6_NIB_NUMOF, count); + TEST_ASSERT_EQUAL_INT(CONFIG_GNRC_IPV6_NIB_NUMOF, count); } /* diff --git a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-pl.c b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-pl.c index ed11e0d60e5a..ff5458db3877 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-pl.c +++ b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-pl.c @@ -96,9 +96,9 @@ static void test_nib_pl_set__EINVAL_pfx_len(void) UINT32_MAX)); } -#if GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF -#define MAX_NUMOF (GNRC_IPV6_NIB_NUMOF) -#else /* GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF */ +#if CONFIG_GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF +#define MAX_NUMOF (CONFIG_GNRC_IPV6_NIB_NUMOF) +#else /* CONFIG_GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF */ #define MAX_NUMOF (GNRC_IPV6_NIB_OFFL_NUMOF) #endif @@ -335,7 +335,7 @@ static void test_nib_pl_set__success(void) /* * Creates MAX_NUMOF prefix list entries with different prefix and interfaces * and then tries to delete one with yet another prefix and interface. - * Expected result: There should be still GNRC_IPV6_NIB_NUMOF entries in the + * Expected result: There should be still CONFIG_GNRC_IPV6_NIB_NUMOF entries in the * neighbor cache */ static void test_nib_pl_del__unknown(void) From acd789bd87d984f14b8b8ad01881e9f9487d6989 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 12 Mar 2020 17:19:08 +0100 Subject: [PATCH 16/24] gnrc/nib: Move GNRC_IPV6_NIB_CONF_REACH_TIME_RESET to 'CONFIG_' --- sys/include/net/gnrc/ipv6/nib/conf.h | 4 ++-- sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c | 2 +- sys/net/gnrc/network_layer/ipv6/nib/nib.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index 7b9961a69bcd..8b8157396d22 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -218,8 +218,8 @@ extern "C" { * * @see [RFC 4861, section 6.3.4](https://tools.ietf.org/html/rfc4861#section-6.3.4) */ -#ifndef GNRC_IPV6_NIB_CONF_REACH_TIME_RESET -#define GNRC_IPV6_NIB_CONF_REACH_TIME_RESET (7200000U) +#ifndef CONFIG_GNRC_IPV6_NIB_REACH_TIME_RESET +#define CONFIG_GNRC_IPV6_NIB_REACH_TIME_RESET (7200000U) #endif /** diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c index 18770ac5fd13..6e3686ed9726 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c @@ -415,7 +415,7 @@ void _recalc_reach_time(gnrc_netif_ipv6_t *netif) netif->reach_time_base + half); _evtimer_add(netif, GNRC_IPV6_NIB_RECALC_REACH_TIME, &netif->recalc_reach_time, - GNRC_IPV6_NIB_CONF_REACH_TIME_RESET); + CONFIG_GNRC_IPV6_NIB_REACH_TIME_RESET); } void _set_reachable(gnrc_netif_t *netif, _nib_onl_entry_t *nce) diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib.c b/sys/net/gnrc/network_layer/ipv6/nib/nib.c index 674df44dfc8f..73cfd24f11e0 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib.c @@ -681,7 +681,7 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, if (reach_time != netif->ipv6.reach_time_base) { _evtimer_add(netif, GNRC_IPV6_NIB_RECALC_REACH_TIME, &netif->ipv6.recalc_reach_time, - GNRC_IPV6_NIB_CONF_REACH_TIME_RESET); + CONFIG_GNRC_IPV6_NIB_REACH_TIME_RESET); netif->ipv6.reach_time_base = reach_time; _recalc_reach_time(&netif->ipv6); } From f2ed8b06c09f895d816f7db5d39ef92bb14ef766 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 12 Mar 2020 17:20:38 +0100 Subject: [PATCH 17/24] gnrc/nib: Move GNRC_IPV6_NIB_L2ADDR_MAX_LEN to 'CONFIG_' namespace --- sys/include/net/gnrc/ipv6/nib/conf.h | 4 ++-- sys/include/net/gnrc/ipv6/nib/nc.h | 4 ++-- sys/include/net/gnrc/netif/conf.h | 2 +- sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h | 2 +- sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c | 6 +++--- sys/shell/commands/sc_gnrc_ipv6_nib.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index 8b8157396d22..875e0bb8dd1d 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -234,8 +234,8 @@ extern "C" { /** * @brief Maximum link-layer address length (aligned) */ -#ifndef GNRC_IPV6_NIB_L2ADDR_MAX_LEN -#define GNRC_IPV6_NIB_L2ADDR_MAX_LEN (8U) +#ifndef CONFIG_GNRC_IPV6_NIB_L2ADDR_MAX_LEN +#define CONFIG_GNRC_IPV6_NIB_L2ADDR_MAX_LEN (8U) #endif /** diff --git a/sys/include/net/gnrc/ipv6/nib/nc.h b/sys/include/net/gnrc/ipv6/nib/nc.h index 87b2b647aebc..8f570085f5fb 100644 --- a/sys/include/net/gnrc/ipv6/nib/nc.h +++ b/sys/include/net/gnrc/ipv6/nib/nc.h @@ -144,7 +144,7 @@ typedef struct { /** * @brief Neighbor's link-layer address */ - uint8_t l2addr[GNRC_IPV6_NIB_L2ADDR_MAX_LEN]; + uint8_t l2addr[CONFIG_GNRC_IPV6_NIB_L2ADDR_MAX_LEN]; /** * @brief Neighbor information as defined in * @ref net_gnrc_ipv6_nib_nc_info "info values" @@ -208,7 +208,7 @@ static inline unsigned gnrc_ipv6_nib_nc_get_ar_state(const gnrc_ipv6_nib_nc_t *e * @brief Adds an unmanaged neighbor entry to NIB * * @pre `ipv6 != NULL` - * @pre `l2addr_len <= GNRC_IPV6_NIB_L2ADDR_MAX_LEN` + * @pre `l2addr_len <= CONFIG_GNRC_IPV6_NIB_L2ADDR_MAX_LEN` * @pre `(iface > KERNEL_PID_UNDEF) && (iface <= KERNEL_PID_LAST)` * * @param[in] ipv6 The neighbor's IPv6 address. diff --git a/sys/include/net/gnrc/netif/conf.h b/sys/include/net/gnrc/netif/conf.h index 66a9dfd98707..f749dae2b665 100644 --- a/sys/include/net/gnrc/netif/conf.h +++ b/sys/include/net/gnrc/netif/conf.h @@ -133,7 +133,7 @@ extern "C" { #elif MODULE_CC110X #define GNRC_NETIF_L2ADDR_MAXLEN (1U) #else -#define GNRC_NETIF_L2ADDR_MAXLEN (GNRC_IPV6_NIB_L2ADDR_MAX_LEN) +#define GNRC_NETIF_L2ADDR_MAXLEN (CONFIG_GNRC_IPV6_NIB_L2ADDR_MAX_LEN) #endif #endif diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h index 9ac7fa99a8f3..5b2d888b68f9 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h @@ -118,7 +118,7 @@ typedef struct _nib_onl_entry { * * @note Only available if @ref CONFIG_GNRC_IPV6_NIB_ARSM != 0. */ - uint8_t l2addr[GNRC_IPV6_NIB_L2ADDR_MAX_LEN]; + uint8_t l2addr[CONFIG_GNRC_IPV6_NIB_L2ADDR_MAX_LEN]; #endif /** * @brief Event for @ref GNRC_IPV6_NIB_SND_UC_NS, diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c b/sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c index 0c9543eebfb7..30e143ad5515 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c @@ -30,7 +30,7 @@ int gnrc_ipv6_nib_nc_set(const ipv6_addr_t *ipv6, unsigned iface, _nib_onl_entry_t *node; assert(ipv6 != NULL); - assert(l2addr_len <= GNRC_IPV6_NIB_L2ADDR_MAX_LEN); + assert(l2addr_len <= CONFIG_GNRC_IPV6_NIB_L2ADDR_MAX_LEN); assert((iface > KERNEL_PID_UNDEF) && (iface <= KERNEL_PID_LAST)); _nib_acquire(); node = _nib_nc_add(ipv6, iface, GNRC_IPV6_NIB_NC_INFO_NUD_STATE_UNMANAGED); @@ -130,8 +130,8 @@ static const char *_ar_str[] = { void gnrc_ipv6_nib_nc_print(gnrc_ipv6_nib_nc_t *entry) { - char addr_str[(IPV6_ADDR_MAX_STR_LEN > GNRC_IPV6_NIB_L2ADDR_MAX_LEN) ? - IPV6_ADDR_MAX_STR_LEN : GNRC_IPV6_NIB_L2ADDR_MAX_LEN]; + char addr_str[(IPV6_ADDR_MAX_STR_LEN > CONFIG_GNRC_IPV6_NIB_L2ADDR_MAX_LEN) ? + IPV6_ADDR_MAX_STR_LEN : CONFIG_GNRC_IPV6_NIB_L2ADDR_MAX_LEN]; printf("%s ", ipv6_addr_to_str(addr_str, &entry->ipv6, sizeof(addr_str))); if (gnrc_ipv6_nib_nc_get_iface(entry) != KERNEL_PID_UNDEF) { diff --git a/sys/shell/commands/sc_gnrc_ipv6_nib.c b/sys/shell/commands/sc_gnrc_ipv6_nib.c index 3f3b6cbeeff1..bbdfb3602437 100644 --- a/sys/shell/commands/sc_gnrc_ipv6_nib.c +++ b/sys/shell/commands/sc_gnrc_ipv6_nib.c @@ -119,7 +119,7 @@ static int _nib_neigh(int argc, char **argv) } else if ((argc > 4) && (strcmp(argv[2], "add") == 0)) { ipv6_addr_t ipv6_addr; - uint8_t l2addr[GNRC_IPV6_NIB_L2ADDR_MAX_LEN]; + uint8_t l2addr[CONFIG_GNRC_IPV6_NIB_L2ADDR_MAX_LEN]; size_t l2addr_len = 0; unsigned iface = atoi(argv[3]); From f6ee712e98974b0e9c83723bcee00f12442a1022 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 12 Mar 2020 17:22:22 +0100 Subject: [PATCH 18/24] gnrc/nib: Move GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF to 'CONFIG_' namespace --- sys/include/net/gnrc/ipv6/nib/conf.h | 4 ++-- .../gnrc/network_layer/ipv6/nib/_nib-internal.c | 8 ++++---- .../tests-gnrc_ipv6_nib/Makefile.include | 2 +- .../tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-ft.c | 4 ++-- .../tests-gnrc_ipv6_nib-internal.c | 16 ++++++++-------- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index 875e0bb8dd1d..930255781114 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -244,8 +244,8 @@ extern "C" { * @attention This number has direct influence on the maximum number of * default routers */ -#ifndef GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF -#define GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF (1) +#ifndef CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF +#define CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF (1) #endif /** diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c index c152e892f839..97e4d86190ac 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c @@ -38,7 +38,7 @@ static clist_node_t _next_removable = { NULL }; static _nib_onl_entry_t _nodes[CONFIG_GNRC_IPV6_NIB_NUMOF]; static _nib_offl_entry_t _dsts[GNRC_IPV6_NIB_OFFL_NUMOF]; -static _nib_dr_entry_t _def_routers[GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF]; +static _nib_dr_entry_t _def_routers[CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF]; #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) static _nib_abr_entry_t _abrs[GNRC_IPV6_NIB_ABR_NUMOF]; @@ -345,7 +345,7 @@ _nib_dr_entry_t *_nib_drl_add(const ipv6_addr_t *router_addr, unsigned iface) DEBUG("nib: Allocating default router list entry " "(router_addr = %s, iface = %u)\n", ipv6_addr_to_str(addr_str, router_addr, sizeof(addr_str)), iface); - for (unsigned i = 0; i < GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF; i++) { _nib_dr_entry_t *tmp = &_def_routers[i]; _nib_onl_entry_t *tmp_node = tmp->next_hop; @@ -389,7 +389,7 @@ void _nib_drl_remove(_nib_dr_entry_t *nib_dr) _nib_dr_entry_t *_nib_drl_iter(const _nib_dr_entry_t *last) { for (const _nib_dr_entry_t *def_router = (last) ? (last + 1) : _def_routers; - def_router < (_def_routers + GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF); + def_router < (_def_routers + CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF); def_router++) { _nib_onl_entry_t *node = def_router->next_hop; if ((node != NULL) && (node->mode != _EMPTY)) { @@ -403,7 +403,7 @@ _nib_dr_entry_t *_nib_drl_iter(const _nib_dr_entry_t *last) _nib_dr_entry_t *_nib_drl_get(const ipv6_addr_t *router_addr, unsigned iface) { - for (unsigned i = 0; i < GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF; i++) { _nib_dr_entry_t *def_router = &_def_routers[i]; _nib_onl_entry_t *node = def_router->next_hop; diff --git a/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include b/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include index bd4d6610875c..e63296af2db1 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include +++ b/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include @@ -4,7 +4,7 @@ USEMODULE += gnrc_sixlowpan_nd # required for CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C CFLAGS += -DCONFIG_GNRC_IPV6_NIB_ROUTER=1 CFLAGS += -DCONFIG_GNRC_IPV6_NIB_NUMOF=16 CFLAGS += -DGNRC_IPV6_NIB_OFFL_NUMOF=25 -CFLAGS += -DGNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF=4 +CFLAGS += -DCONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF=4 CFLAGS += -DGNRC_IPV6_NIB_ABR_NUMOF=4 CFLAGS += -DCONFIG_GNRC_IPV6_NIB_6LBR=1 CFLAGS += -DCONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C=1 diff --git a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-ft.c b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-ft.c index 3de2720e9a11..7b5a3a9415af 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-ft.c +++ b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-ft.c @@ -219,7 +219,7 @@ static void test_nib_ft_add__EINVAL_iface0(void) #endif /* - * Creates GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF default route entries and then + * Creates CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF default route entries and then * tries to create another one * Expected result: gnrc_ipv6_nib_ft_add() returns -ENOMEM */ @@ -228,7 +228,7 @@ static void test_nib_ft_add__ENOMEM_diff_def_router(void) ipv6_addr_t next_hop = { .u64 = { { .u8 = LINK_LOCAL_PREFIX }, { .u64 = TEST_UINT64 } } }; - for (unsigned i = 0; i < GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF; i++) { TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_ft_add(NULL, 0, &next_hop, IFACE, 0)); next_hop.u64[1].u64++; diff --git a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c index 9e473fa73512..eeca88f376d9 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c +++ b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c @@ -586,7 +586,7 @@ static void test_nib_nc_remove__cleared(void) } /* - * Creates GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF default router list entries with + * Creates CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF default router list entries with * different IP addresses and then tries to add another. * Expected result: should return NULL */ @@ -595,7 +595,7 @@ static void test_nib_drl_add__no_space_left_diff_addr(void) ipv6_addr_t addr = { .u64 = { { .u8 = GLOBAL_PREFIX }, { .u64 = TEST_UINT64 } } }; - for (int i = 0; i < GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF; i++) { TEST_ASSERT_NOT_NULL(_nib_drl_add(&addr, IFACE)); addr.u64[1].u64++; } @@ -624,7 +624,7 @@ static void test_nib_drl_add__no_space_left_nib_full(void) } /* - * Creates GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF default router list entries with + * Creates CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF default router list entries with * different interface identifiers and then tries to add another. * Expected result: should return NULL */ @@ -634,7 +634,7 @@ static void test_nib_drl_add__no_space_left_diff_iface(void) { .u64 = TEST_UINT64 } } }; unsigned iface = 1; - for (int i = 0; i < GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF; i++) { TEST_ASSERT_NOT_NULL(_nib_drl_add(&addr, iface)); iface++; } @@ -642,7 +642,7 @@ static void test_nib_drl_add__no_space_left_diff_iface(void) } /* - * Creates GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF default router list entries with + * Creates CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF default router list entries with * different IP addresses and interface identifiers and then tries to add * another. * Expected result: should return NULL @@ -653,7 +653,7 @@ static void test_nib_drl_add__no_space_left_diff_addr_iface(void) { .u64 = TEST_UINT64 } } }; unsigned iface = 1; - for (int i = 0; i < GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF; i++) { TEST_ASSERT_NOT_NULL(_nib_drl_add(&addr, iface)); addr.u64[1].u64++; iface++; @@ -662,7 +662,7 @@ static void test_nib_drl_add__no_space_left_diff_addr_iface(void) } /* - * Creates GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF default router list entries with + * Creates CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF default router list entries with * different IP addresses and interface identifiers and then tries to add * another that is equal to the last. * Expected result: should return not NULL (the last) @@ -674,7 +674,7 @@ static void test_nib_drl_add__success_duplicate(void) { .u64 = TEST_UINT64 } } }; unsigned iface = 1; - for (int i = 0; i < GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF; i++) { addr.u64[1].u64++; iface++; TEST_ASSERT_NOT_NULL((nib_dr = _nib_drl_add(&addr, iface))); From a77d0dd9c5971867fe0be30ceccb2723c0b73ea9 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 12 Mar 2020 17:24:26 +0100 Subject: [PATCH 19/24] gnrc/nib: Move GNRC_IPV6_NIB_OFFL_NUMOF to 'CONFIG_' namespace --- examples/gnrc_minimal/Makefile | 2 +- sys/include/net/gnrc/ipv6/nib/conf.h | 6 +++--- .../network_layer/ipv6/nib/_nib-internal.c | 14 ++++++------- .../network_layer/ipv6/nib/_nib-internal.h | 2 +- .../tests-gnrc_ipv6_nib/Makefile.include | 2 +- .../tests-gnrc_ipv6_nib-ft.c | 18 ++++++++--------- .../tests-gnrc_ipv6_nib-internal.c | 18 ++++++++--------- .../tests-gnrc_ipv6_nib-pl.c | 20 +++++++++---------- 8 files changed, 41 insertions(+), 41 deletions(-) diff --git a/examples/gnrc_minimal/Makefile b/examples/gnrc_minimal/Makefile index 24dea96fc897..aae86ca5e8aa 100644 --- a/examples/gnrc_minimal/Makefile +++ b/examples/gnrc_minimal/Makefile @@ -26,7 +26,7 @@ USEMODULE += prng_minstd CFLAGS += -DLOG_LEVEL=LOG_NONE # disable log output CFLAGS += -DGNRC_PKTBUF_SIZE=512 -DCONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF=2 \ -DGNRC_NETIF_IPV6_GROUPS_NUMOF=2 -DCONFIG_GNRC_IPV6_NIB_NUMOF=1 \ - -DGNRC_IPV6_NIB_OFFL_NUMOF=1 # be able to configure at least one route + -DCONFIG_GNRC_IPV6_NIB_OFFL_NUMOF=1 # be able to configure at least one route # Enable single interface optimization. Set to 0 if more than one interface is # present diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index 930255781114..5d6b8fdd0d9b 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -255,7 +255,7 @@ extern "C" { * neighbors and duplicate address detection table entries */ #ifndef CONFIG_GNRC_IPV6_NIB_NUMOF -#define CONFIG_GNRC_IPV6_NIB_NUMOF (4) +#define CONFIG_GNRC_IPV6_NIB_NUMOF (4) #endif /** @@ -264,8 +264,8 @@ extern "C" { * @attention This number is equal to the maximum number of forwarding table * and prefix list entries in NIB */ -#ifndef GNRC_IPV6_NIB_OFFL_NUMOF -#define GNRC_IPV6_NIB_OFFL_NUMOF (8) +#ifndef CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF +#define CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF (8) #endif #if CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C || defined(DOXYGEN) diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c index 97e4d86190ac..3da882b54d63 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c @@ -37,7 +37,7 @@ _nib_dr_entry_t *_prime_def_router = NULL; static clist_node_t _next_removable = { NULL }; static _nib_onl_entry_t _nodes[CONFIG_GNRC_IPV6_NIB_NUMOF]; -static _nib_offl_entry_t _dsts[GNRC_IPV6_NIB_OFFL_NUMOF]; +static _nib_offl_entry_t _dsts[CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF]; static _nib_dr_entry_t _def_routers[CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF]; #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) @@ -480,7 +480,7 @@ _nib_offl_entry_t *_nib_offl_alloc(const ipv6_addr_t *next_hop, unsigned iface, iface); DEBUG("pfx = %s/%u)\n", ipv6_addr_to_str(addr_str, pfx, sizeof(addr_str)), pfx_len); - for (unsigned i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) { _nib_offl_entry_t *tmp = &_dsts[i]; _nib_onl_entry_t *tmp_node = tmp->next_hop; @@ -519,7 +519,7 @@ _nib_offl_entry_t *_nib_offl_alloc(const ipv6_addr_t *next_hop, unsigned iface, static inline bool _in_dsts(const _nib_offl_entry_t *dst) { - return (dst < (_dsts + GNRC_IPV6_NIB_OFFL_NUMOF)); + return (dst < (_dsts + CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF)); } #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) @@ -662,7 +662,7 @@ void _nib_pl_remove(_nib_offl_entry_t *nib_offl) _nib_offl_remove(nib_offl, _PL); #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) unsigned idx = _idx_dsts(nib_offl); - if (idx < GNRC_IPV6_NIB_OFFL_NUMOF) { + if (idx < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF) { for (_nib_abr_entry_t *abr = _abrs; _in_abrs(abr); abr++) { if (bf_isset(abr->pfxs, idx)) { DEBUG("nib: Removing prefix %s/%u ", @@ -717,7 +717,7 @@ void _nib_abr_remove(const ipv6_addr_t *addr) sizeof(addr_str))); for (_nib_abr_entry_t *abr = _abrs; _in_abrs(abr); abr++) { if (ipv6_addr_equal(addr, &abr->addr)) { - for (int i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) { if (bf_isset(abr->pfxs, i)) { _nib_pl_remove(&_dsts[i]); } @@ -744,7 +744,7 @@ void _nib_abr_add_pfx(_nib_abr_entry_t *abr, const _nib_offl_entry_t *offl) offl->pfx_len); DEBUG("came from border router %s\n", ipv6_addr_to_str(addr_str, &abr->addr, sizeof(addr_str))); - if (idx < GNRC_IPV6_NIB_OFFL_NUMOF) { + if (idx < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF) { bf_set(abr->pfxs, idx); } } @@ -753,7 +753,7 @@ _nib_offl_entry_t *_nib_abr_iter_pfx(const _nib_abr_entry_t *abr, const _nib_offl_entry_t *last) { if ((last == NULL) || - (_idx_dsts(last) < GNRC_IPV6_NIB_OFFL_NUMOF)) { + (_idx_dsts(last) < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF)) { /* we don't change `ptr`, so dropping const qualifier for now is okay */ _nib_offl_entry_t *ptr = (_nib_offl_entry_t *)last; diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h index 5b2d888b68f9..786fafb55078 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h @@ -234,7 +234,7 @@ typedef struct { * @brief Bitfield marking the prefixes in the NIB's off-link entries * disseminated by _nib_abr_entry_t::addr */ - BITFIELD(pfxs, GNRC_IPV6_NIB_OFFL_NUMOF); + BITFIELD(pfxs, CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF); /** * @brief Bitfield marking the contexts disseminated by * _nib_abr_entry_t::addr diff --git a/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include b/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include index e63296af2db1..8eeb84f2c3c8 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include +++ b/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include @@ -3,7 +3,7 @@ USEMODULE += gnrc_sixlowpan_nd # required for CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C CFLAGS += -DCONFIG_GNRC_IPV6_NIB_ROUTER=1 CFLAGS += -DCONFIG_GNRC_IPV6_NIB_NUMOF=16 -CFLAGS += -DGNRC_IPV6_NIB_OFFL_NUMOF=25 +CFLAGS += -DCONFIG_GNRC_IPV6_NIB_OFFL_NUMOF=25 CFLAGS += -DCONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF=4 CFLAGS += -DGNRC_IPV6_NIB_ABR_NUMOF=4 CFLAGS += -DCONFIG_GNRC_IPV6_NIB_6LBR=1 diff --git a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-ft.c b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-ft.c index 7b5a3a9415af..2c74b2887cc6 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-ft.c +++ b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-ft.c @@ -212,10 +212,10 @@ static void test_nib_ft_add__EINVAL_iface0(void) &next_hop, 0, 0)); } -#if CONFIG_GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF +#if CONFIG_GNRC_IPV6_NIB_NUMOF < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF #define MAX_NUMOF (CONFIG_GNRC_IPV6_NIB_NUMOF) -#else /* CONFIG_GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF */ -#define MAX_NUMOF (GNRC_IPV6_NIB_OFFL_NUMOF) +#else /* CONFIG_GNRC_IPV6_NIB_NUMOF < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF */ +#define MAX_NUMOF (CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF) #endif /* @@ -238,7 +238,7 @@ static void test_nib_ft_add__ENOMEM_diff_def_router(void) } /* - * Creates GNRC_IPV6_NIB_OFFL_NUMOF routes with different destinations of same + * Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF routes with different destinations of same * prefix lengths to the same next hop and then tries to create another one * Expected result: gnrc_ipv6_nib_ft_add() returns -ENOMEM */ @@ -246,7 +246,7 @@ static void test_nib_ft_add__ENOMEM_diff_dst(void) { ipv6_addr_t dst = { .u64 = { { .u8 = GLOBAL_PREFIX } } }; - for (unsigned i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) { TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_ft_add(&dst, GLOBAL_PREFIX_LEN, NULL, IFACE, 0)); dst.u16[0].u16--; @@ -256,7 +256,7 @@ static void test_nib_ft_add__ENOMEM_diff_dst(void) } /* - * Creates GNRC_IPV6_NIB_OFFL_NUMOF routes with destinations of different + * Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF routes with destinations of different * prefix lengths to the same next hop and then tries to create another one * Expected result: gnrc_ipv6_nib_ft_add() returns -ENOMEM */ @@ -265,7 +265,7 @@ static void test_nib_ft_add__ENOMEM_diff_dst_len(void) static const ipv6_addr_t dst = { .u64 = { { .u8 = GLOBAL_PREFIX } } }; unsigned dst_len = GLOBAL_PREFIX_LEN; - for (unsigned i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) { TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_ft_add(&dst, dst_len, NULL, IFACE, 0)); dst_len--; @@ -275,7 +275,7 @@ static void test_nib_ft_add__ENOMEM_diff_dst_len(void) } /* - * Creates GNRC_IPV6_NIB_OFFL_NUMOF routes with different destination of + * Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF routes with different destination of * different prefix lengths to the same next hop and then tries to create * another one * Expected result: gnrc_ipv6_nib_ft_add() returns -ENOMEM @@ -285,7 +285,7 @@ static void test_nib_ft_add__ENOMEM_diff_dst_dst_len(void) ipv6_addr_t dst = { .u64 = { { .u8 = GLOBAL_PREFIX } } }; unsigned dst_len = GLOBAL_PREFIX_LEN; - for (unsigned i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) { TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_ft_add(&dst, dst_len, NULL, IFACE, 0)); dst.u16[0].u16--; diff --git a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c index eeca88f376d9..da3d2e3ed5a6 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c +++ b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c @@ -1021,10 +1021,10 @@ static void test_nib_drl_get_dr__success4(void) TEST_ASSERT(nib_res != node2); } -#if CONFIG_GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF +#if CONFIG_GNRC_IPV6_NIB_NUMOF < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF #define MAX_NUMOF (CONFIG_GNRC_IPV6_NIB_NUMOF) -#else /* CONFIG_GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF */ -#define MAX_NUMOF (GNRC_IPV6_NIB_OFFL_NUMOF) +#else /* CONFIG_GNRC_IPV6_NIB_NUMOF < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF */ +#define MAX_NUMOF (CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF) #endif /* @@ -1099,7 +1099,7 @@ static void test_nib_offl_alloc__no_space_left_diff_next_hop_iface(void) } /* - * Creates GNRC_IPV6_NIB_OFFL_NUMOF off-link entries with different prefixes + * Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF off-link entries with different prefixes * of the same length and then tries to add another. * Expected result: should return NULL */ @@ -1109,7 +1109,7 @@ static void test_nib_offl_alloc__no_space_left_diff_pfx(void) { .u64 = TEST_UINT64 } } }; ipv6_addr_t pfx = { .u64 = { { .u8 = GLOBAL_PREFIX } } }; - for (int i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) { _nib_offl_entry_t *dst; TEST_ASSERT_NOT_NULL((dst = _nib_offl_alloc(&next_hop, IFACE, &pfx, @@ -1198,7 +1198,7 @@ static void test_nib_offl_alloc__no_space_left_diff_next_hop_iface_pfx(void) } /* - * Creates GNRC_IPV6_NIB_OFFL_NUMOF off-link entries with different prefix + * Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF off-link entries with different prefix * lengths and then tries to add another. * Expected result: should return NULL */ @@ -1209,7 +1209,7 @@ static void test_nib_offl_alloc__no_space_left_diff_pfx_len(void) static const ipv6_addr_t pfx = { .u64 = { { .u8 = GLOBAL_PREFIX } } }; unsigned pfx_len = GLOBAL_PREFIX_LEN; - for (int i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) { _nib_offl_entry_t *dst; TEST_ASSERT_NOT_NULL((dst = _nib_offl_alloc(&next_hop, IFACE, &pfx, pfx_len))); @@ -1294,7 +1294,7 @@ static void test_nib_offl_alloc__no_space_left_diff_next_hop_iface_pfx_len(void) } /* - * Creates GNRC_IPV6_NIB_OFFL_NUMOF off-link entries with different prefixes + * Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF off-link entries with different prefixes * and then tries to add another. * Expected result: should return NULL */ @@ -1305,7 +1305,7 @@ static void test_nib_offl_alloc__no_space_left_diff_pfx_pfx_len(void) ipv6_addr_t pfx = { .u64 = { { .u8 = GLOBAL_PREFIX } } }; unsigned pfx_len = GLOBAL_PREFIX_LEN; - for (int i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) { _nib_offl_entry_t *dst; TEST_ASSERT_NOT_NULL((dst = _nib_offl_alloc(&next_hop, IFACE, &pfx, diff --git a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-pl.c b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-pl.c index ff5458db3877..9cd8528033ab 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-pl.c +++ b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-pl.c @@ -96,10 +96,10 @@ static void test_nib_pl_set__EINVAL_pfx_len(void) UINT32_MAX)); } -#if CONFIG_GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF +#if CONFIG_GNRC_IPV6_NIB_NUMOF < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF #define MAX_NUMOF (CONFIG_GNRC_IPV6_NIB_NUMOF) -#else /* CONFIG_GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF */ -#define MAX_NUMOF (GNRC_IPV6_NIB_OFFL_NUMOF) +#else /* CONFIG_GNRC_IPV6_NIB_NUMOF < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF */ +#define MAX_NUMOF (CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF) #endif /* @@ -126,7 +126,7 @@ static void test_nib_pl_set__ENOMEM_diff_iface(void) } /* - * Creates GNRC_IPV6_NIB_OFFL_NUMOF prefix list entries with different prefix of + * Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF prefix list entries with different prefix of * the same length and then tries to create another one * Expected result: gnrc_ipv6_nib_pl_set() returns -ENOMEM */ @@ -135,7 +135,7 @@ static void test_nib_pl_set__ENOMEM_diff_pfx(void) ipv6_addr_t pfx = { .u64 = { { .u8 = GLOBAL_PREFIX }, { .u64 = TEST_UINT64 } } }; - for (unsigned i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) { TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_pl_set(IFACE, &pfx, GLOBAL_PREFIX_LEN, UINT32_MAX, UINT32_MAX)); @@ -148,7 +148,7 @@ static void test_nib_pl_set__ENOMEM_diff_pfx(void) } /* - * Creates GNRC_IPV6_NIB_OFFL_NUMOF prefix list entries with different prefix of + * Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF prefix list entries with different prefix of * the same length and different interfaces and then tries to create another one * Expected result: gnrc_ipv6_nib_pl_set() returns -ENOMEM */ @@ -172,7 +172,7 @@ static void test_nib_pl_set__ENOMEM_diff_iface_pfx(void) } /* - * Creates GNRC_IPV6_NIB_OFFL_NUMOF prefix list entries with prefixes of + * Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF prefix list entries with prefixes of * different length and then tries to create another one * Expected result: gnrc_ipv6_nib_pl_set() returns -ENOMEM */ @@ -182,7 +182,7 @@ static void test_nib_pl_set__ENOMEM_diff_pfx_len(void) { .u64 = TEST_UINT64 } } }; unsigned pfx_len = GLOBAL_PREFIX_LEN; - for (unsigned i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) { TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_pl_set(IFACE, &pfx, pfx_len, UINT32_MAX, UINT32_MAX)); pfx_len--; @@ -215,7 +215,7 @@ static void test_nib_pl_set__ENOMEM_diff_iface_pfx_len(void) } /* - * Creates GNRC_IPV6_NIB_OFFL_NUMOF prefix list entries with different prefixes + * Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF prefix list entries with different prefixes * and then tries to create another one * Expected result: gnrc_ipv6_nib_pl_set() returns -ENOMEM */ @@ -225,7 +225,7 @@ static void test_nib_pl_set__ENOMEM_diff_pfx_pfx_len(void) { .u64 = TEST_UINT64 } } }; unsigned pfx_len = GLOBAL_PREFIX_LEN; - for (unsigned i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) { TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_pl_set(IFACE, &pfx, pfx_len, UINT32_MAX, UINT32_MAX)); pfx_len--; From 64dde8f3179d5f9a14078b1a5f61832d787dbbbe Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 12 Mar 2020 17:26:21 +0100 Subject: [PATCH 20/24] gnrc/nib: Move GNRC_IPV6_NIB_ABR_NUMOF to 'CONFIG_' namespace --- sys/include/net/gnrc/ipv6/nib/conf.h | 4 ++-- sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c | 6 +++--- tests/unittests/tests-gnrc_ipv6_nib/Makefile.include | 2 +- .../tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-abr.c | 8 ++++---- .../tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index 5d6b8fdd0d9b..66973f0290a4 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -272,8 +272,8 @@ extern "C" { /** * @brief Number of authoritative border router entries in NIB */ -#ifndef GNRC_IPV6_NIB_ABR_NUMOF -#define GNRC_IPV6_NIB_ABR_NUMOF (1) +#ifndef CONFIG_GNRC_IPV6_NIB_ABR_NUMOF +#define CONFIG_GNRC_IPV6_NIB_ABR_NUMOF (1) #endif #endif diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c index 3da882b54d63..3a3f374daeee 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c @@ -41,7 +41,7 @@ static _nib_offl_entry_t _dsts[CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF]; static _nib_dr_entry_t _def_routers[CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF]; #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) -static _nib_abr_entry_t _abrs[GNRC_IPV6_NIB_ABR_NUMOF]; +static _nib_abr_entry_t _abrs[CONFIG_GNRC_IPV6_NIB_ABR_NUMOF]; #endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ static rmutex_t _nib_mutex = RMUTEX_INIT; @@ -530,7 +530,7 @@ static inline unsigned _idx_dsts(const _nib_offl_entry_t *dst) static inline bool _in_abrs(const _nib_abr_entry_t *abr) { - return (abr < (_abrs + GNRC_IPV6_NIB_ABR_NUMOF)); + return (abr < (_abrs + CONFIG_GNRC_IPV6_NIB_ABR_NUMOF)); } #endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */ @@ -686,7 +686,7 @@ _nib_abr_entry_t *_nib_abr_add(const ipv6_addr_t *addr) assert(addr != NULL); DEBUG("nib: Allocating authoritative border router entry (addr = %s)\n", ipv6_addr_to_str(addr_str, addr, sizeof(addr_str))); - for (unsigned i = 0; i < GNRC_IPV6_NIB_ABR_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_ABR_NUMOF; i++) { _nib_abr_entry_t *tmp = &_abrs[i]; if (ipv6_addr_equal(addr, &tmp->addr)) { diff --git a/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include b/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include index 8eeb84f2c3c8..c2054947a2f2 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include +++ b/tests/unittests/tests-gnrc_ipv6_nib/Makefile.include @@ -5,7 +5,7 @@ CFLAGS += -DCONFIG_GNRC_IPV6_NIB_ROUTER=1 CFLAGS += -DCONFIG_GNRC_IPV6_NIB_NUMOF=16 CFLAGS += -DCONFIG_GNRC_IPV6_NIB_OFFL_NUMOF=25 CFLAGS += -DCONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF=4 -CFLAGS += -DGNRC_IPV6_NIB_ABR_NUMOF=4 +CFLAGS += -DCONFIG_GNRC_IPV6_NIB_ABR_NUMOF=4 CFLAGS += -DCONFIG_GNRC_IPV6_NIB_6LBR=1 CFLAGS += -DCONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C=1 CFLAGS += -DCONFIG_GNRC_IPV6_NIB_DC=1 diff --git a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-abr.c b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-abr.c index bc2f191982c5..8d3e6dc0fee1 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-abr.c +++ b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-abr.c @@ -40,7 +40,7 @@ static void set_up(void) } /* - * Creates GNRC_IPV6_NIB_ABR_NUMOF authoritative border router list entries with + * Creates CONFIG_GNRC_IPV6_NIB_ABR_NUMOF authoritative border router list entries with * different addresses and then tries to create another one * Expected result: gnrc_ipv6_nib_abr_add() returns -ENOMEM */ @@ -51,7 +51,7 @@ static void test_nib_abr_add__ENOMEM(void) { .u64 = TEST_UINT64 } } }; gnrc_ipv6_nib_abr_t abr; - for (unsigned i = 0; i < GNRC_IPV6_NIB_ABR_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_ABR_NUMOF; i++) { TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_abr_add(&addr)); addr.u16[0].u16++; TEST_ASSERT(gnrc_ipv6_nib_abr_iter(&iter_state, &abr)); @@ -61,7 +61,7 @@ static void test_nib_abr_add__ENOMEM(void) } /* - * Creates GNRC_IPV6_NIB_ABR_NUMOF authoritative border router list entries with + * Creates CONFIG_GNRC_IPV6_NIB_ABR_NUMOF authoritative border router list entries with * different addresses and then tries to add another equal to the last. * Expected result: should return 0. */ @@ -72,7 +72,7 @@ static void test_nib_abr_add__success(void) { .u64 = TEST_UINT64 } } }; gnrc_ipv6_nib_abr_t abr; - for (unsigned i = 0; i < GNRC_IPV6_NIB_ABR_NUMOF; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_ABR_NUMOF; i++) { addr.u16[0].u16++; TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_abr_add(&addr)); TEST_ASSERT(gnrc_ipv6_nib_abr_iter(&iter_state, &abr)); diff --git a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c index da3d2e3ed5a6..e29d0b7973c4 100644 --- a/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c +++ b/tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c @@ -1756,7 +1756,7 @@ static void test_nib_ft_remove(void) #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) /* - * Creates GNRC_IPV6_NIB_ABR_NUMOF ABR entries with different addresses and + * Creates CONFIG_GNRC_IPV6_NIB_ABR_NUMOF ABR entries with different addresses and * then tries to add another. * Expected result: should return NULL */ @@ -1765,7 +1765,7 @@ static void test_nib_abr_add__no_space_left(void) ipv6_addr_t addr = { .u64 = { { .u8 = LINK_LOCAL_PREFIX }, { .u64 = TEST_UINT64 } } }; - for (int i = 0; i < GNRC_IPV6_NIB_ABR_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_ABR_NUMOF; i++) { TEST_ASSERT_NOT_NULL(_nib_abr_add(&addr)); addr.u64[1].u64++; } @@ -1773,7 +1773,7 @@ static void test_nib_abr_add__no_space_left(void) } /* - * Creates GNRC_IPV6_NIB_ABR_NUMOF ABR entries with different addresses and then + * Creates CONFIG_GNRC_IPV6_NIB_ABR_NUMOF ABR entries with different addresses and then * tries to add another that is equal to the last. * Expected result: should return not NULL (the last) */ @@ -1783,7 +1783,7 @@ static void test_nib_abr_add__success_duplicate(void) ipv6_addr_t addr = { .u64 = { { .u8 = GLOBAL_PREFIX }, { .u64 = TEST_UINT64 } } }; - for (int i = 0; i < GNRC_IPV6_NIB_ABR_NUMOF; i++) { + for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_ABR_NUMOF; i++) { addr.u64[1].u64++; TEST_ASSERT_NOT_NULL((abr = _nib_abr_add(&addr))); } From 87ac1a652d55dd109c5244d47f4c8e57e304b90c Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Fri, 13 Dec 2019 11:54:42 +0100 Subject: [PATCH 21/24] gnrc/nib: Expose configurations to Kconfig --- sys/include/net/gnrc/ipv6/nib/conf.h | 5 + sys/net/gnrc/Kconfig | 1 + sys/net/gnrc/network_layer/ipv6/nib/Kconfig | 121 ++++++++++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 sys/net/gnrc/network_layer/ipv6/nib/Kconfig diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index 66973f0290a4..a361a60a5160 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -27,6 +27,9 @@ extern "C" { #endif +/* Apply configurations only if not using Kconfig for this module */ +#if !IS_ACTIVE(CONFIG_KCONFIG_MODULE_GNRC_IPV6_NIB) || defined(DOXYGEN) + /* some pseudo-module based configuration, doc: see below */ #ifdef MODULE_GNRC_IPV6_NIB_6LBR #ifndef CONFIG_GNRC_IPV6_NIB_6LBR @@ -277,6 +280,8 @@ extern "C" { #endif #endif +#endif /* !CONFIG_KCONFIG_MODULE_GNRC_IPV6_NIB || DOXYGEN */ + #ifdef __cplusplus } #endif diff --git a/sys/net/gnrc/Kconfig b/sys/net/gnrc/Kconfig index eef5446323cb..5a46339636be 100644 --- a/sys/net/gnrc/Kconfig +++ b/sys/net/gnrc/Kconfig @@ -13,6 +13,7 @@ rsource "netif/Kconfig" rsource "network_layer/ipv6/Kconfig" rsource "network_layer/ipv6/blacklist/Kconfig" rsource "network_layer/ipv6/ext/frag/Kconfig" +rsource "network_layer/ipv6/nib/Kconfig" rsource "network_layer/ipv6/whitelist/Kconfig" rsource "network_layer/sixlowpan/Kconfig" diff --git a/sys/net/gnrc/network_layer/ipv6/nib/Kconfig b/sys/net/gnrc/network_layer/ipv6/nib/Kconfig new file mode 100644 index 000000000000..050125ceeb05 --- /dev/null +++ b/sys/net/gnrc/network_layer/ipv6/nib/Kconfig @@ -0,0 +1,121 @@ +# Copyright (c) 2020 HAW Hamburg +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# +menuconfig KCONFIG_MODULE_GNRC_IPV6_NIB + bool "Configure GNRC IPv6 NIB" + +if KCONFIG_MODULE_GNRC_IPV6_NIB + +config GNRC_IPV6_NIB_6LBR + bool "6LoWPAN border router features" + default y if MODULE_GNRC_IPV6_NIB_6LBR + help + Enable 6LoWPAN Border Router (6LBR) features. + @see https://tools.ietf.org/html/rfc6775#section-2 + +config GNRC_IPV6_NIB_6LR + bool "6LoWPAN router features" + default y if MODULE_GNRC_IPV6_NIB_6LR || GNRC_IPV6_NIB_6LBR + help + Enable 6LoWPAN Router (6LR) features. + @see https://tools.ietf.org/html/rfc6775#section-2 + +config GNRC_IPV6_NIB_6LN + bool "6LoWPAN node features" + default y if MODULE_GNRC_IPV6_NIB_6LN || GNRC_IPV6_NIB_6LR + help + Enable 6LoWPAN Node (6LN) features. + @see https://tools.ietf.org/html/rfc6775#section-2 + +config GNRC_IPV6_NIB_ROUTER + bool "Router features" + default y if MODULE_GNRC_IPV6_NIB_ROUTER || GNRC_IPV6_NIB_6LR + +config GNRC_IPV6_NIB_SLAAC + bool "Stateless address auto-configuration" + default y if MODULE_GNRC_IPV6_NIB_6LBR + default n if MODULE_GNRC_IPV6_NIB_6LR || MODULE_GNRC_IPV6_NIB_6LN + default y + +config GNRC_IPV6_NIB_QUEUE_PKT + bool "Use packet queue with address resolution" + default n if MODULE_GNRC_IPV6_NIB_6LN || GNRC_IPV6_NIB_6LN + default y + +config GNRC_IPV6_NIB_ARSM + bool "Use classic NDP address resolution state-machine" + default n if MODULE_GNRC_IPV6_NIB_6LN && !GNRC_IPV6_NIB_6LR + default y + +config GNRC_IPV6_NIB_DNS + bool "Support for DNS configuration options" + default y if MODULE_GNRC_IPV6_NIB_DNS + +config GNRC_IPV6_NIB_ADV_ROUTER + bool "Activate router advertising at interface start-up" + default y if GNRC_IPV6_NIB_ROUTER && (!GNRC_IPV6_NIB_6LR || GNRC_IPV6_NIB_6LBR) + +config GNRC_IPV6_NIB_DC + bool "Destination cache" + +config GNRC_IPV6_NIB_MULTIHOP_P6C + bool "Multihop prefix and 6LoWPAN context distribution" + default y if GNRC_IPV6_NIB_6LR + +config GNRC_IPV6_NIB_NO_RTR_SOL + bool "Disable router solicitations" + help + @warning Only set this if you know what you're doing. + +if GNRC_IPV6_NIB_NO_RTR_SOL +comment "Disabling router solicitations will make your host have to wait longer" +comment "for router advertisements. This option is only meant for testing and" +comment "experimentation and should not be activated in production." +endif + +config GNRC_IPV6_NIB_NUMOF + int "Number of entries in NIB" + default 16 if MODULE_GNRC_IPV6_NIB_6LBR + default 1 if MODULE_GNRC_IPV6_NIB_6LN && !GNRC_IPV6_NIB_6LR + default 4 + +config GNRC_IPV6_NIB_REACH_TIME_RESET + int "Reset time for the reachability time (milliseconds)" + default 7200000 + help + @see [RFC 4861, section 6.3.4](https://tools.ietf.org/html/rfc4861#section-6.3.4). + +config GNRC_IPV6_NIB_L2ADDR_MAX_LEN + int "Maximum link-layer address length (aligned)" + default 8 + +config GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF + int "Number of default routers in the default router list" + default 1 + help + @attention This number has direct influence on the maximum number of + neighbors and duplicate address detection table entries. + +config GNRC_IPV6_NIB_OFFL_NUMOF + int "Number of off-link entries in NIB" + default 8 + help + @attention This number is equal to the maximum number of forwarding + table and prefix list entries in NIB. + +config GNRC_IPV6_NIB_ABR_NUMOF + int "Number of authoritative border router entries in NIB" + default 1 + depends on GNRC_IPV6_NIB_MULTIHOP_P6C + help + @warning Behavior for >2 currently not specified or tested. + +if GNRC_IPV6_NIB_ABR_NUMOF > 2 +comment "Warning: Behavior for more than 2 Authoritative Border Router entries" +comment "is currently not specified or tested." +endif + +endif # KCONFIG_MODULE_GNRC_IPV6_NIB From 184bbd32e50cf8e55892f8b659a5a3bcdc91b663 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Mon, 30 Mar 2020 21:42:29 +0200 Subject: [PATCH 22/24] gnrc/netif: Fix lines lengths --- sys/net/gnrc/netif/gnrc_netif.c | 65 +++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/sys/net/gnrc/netif/gnrc_netif.c b/sys/net/gnrc/netif/gnrc_netif.c index bee1d5732008..428c1e27111d 100644 --- a/sys/net/gnrc/netif/gnrc_netif.c +++ b/sys/net/gnrc/netif/gnrc_netif.c @@ -45,8 +45,9 @@ static void _configure_netdev(netdev_t *dev); static void *_gnrc_netif_thread(void *args); static void _event_cb(netdev_t *dev, netdev_event_t event); -int gnrc_netif_create(gnrc_netif_t *netif, char *stack, int stacksize, char priority, - const char *name, netdev_t *netdev, const gnrc_netif_ops_t *ops) +int gnrc_netif_create(gnrc_netif_t *netif, char *stack, int stacksize, + char priority, const char *name, netdev_t *netdev, + const gnrc_netif_ops_t *ops) { int res; @@ -149,7 +150,8 @@ int gnrc_netif_get_from_netdev(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt) res = 0; for (unsigned i = 0; - (res < (int)opt->data_len) && (i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF); + (res < (int)opt->data_len) && + (i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF); i++) { if (netif->ipv6.addrs_flags[i] != 0) { memcpy(tgt, &netif->ipv6.addrs[i], sizeof(ipv6_addr_t)); @@ -165,7 +167,8 @@ int gnrc_netif_get_from_netdev(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt) res = 0; for (unsigned i = 0; - (res < (int)opt->data_len) && (i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF); + (res < (int)opt->data_len) && + (i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF); i++) { if (netif->ipv6.addrs_flags[i] != 0) { *tgt = netif->ipv6.addrs_flags[i]; @@ -181,10 +184,12 @@ int gnrc_netif_get_from_netdev(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt) res = 0; for (unsigned i = 0; - (res < (int)opt->data_len) && (i < GNRC_NETIF_IPV6_GROUPS_NUMOF); + (res < (int)opt->data_len) && + (i < GNRC_NETIF_IPV6_GROUPS_NUMOF); i++) { if (!ipv6_addr_is_unspecified(&netif->ipv6.groups[i])) { - memcpy(tgt, &netif->ipv6.groups[i], sizeof(ipv6_addr_t)); + memcpy(tgt, &netif->ipv6.groups[i], + sizeof(ipv6_addr_t)); res += sizeof(ipv6_addr_t); tgt++; } @@ -221,8 +226,9 @@ int gnrc_netif_get_from_netdev(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt) #ifdef MODULE_GNRC_SIXLOWPAN_IPHC case NETOPT_6LO_IPHC: assert(opt->data_len == sizeof(netopt_enable_t)); - *((netopt_enable_t *)opt->data) = (netif->flags & GNRC_NETIF_FLAGS_6LO_HC) ? - NETOPT_ENABLE : NETOPT_DISABLE; + *((netopt_enable_t *)opt->data) = (netif->flags & + GNRC_NETIF_FLAGS_6LO_HC) + ? NETOPT_ENABLE : NETOPT_DISABLE; res = sizeof(netopt_enable_t); break; #endif /* MODULE_GNRC_SIXLOWPAN_IPHC */ @@ -230,7 +236,8 @@ int gnrc_netif_get_from_netdev(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt) break; } if (res == -ENOTSUP) { - res = netif->dev->driver->get(netif->dev, opt->opt, opt->data, opt->data_len); + res = netif->dev->driver->get(netif->dev, opt->opt, opt->data, + opt->data_len); } gnrc_netif_release(netif); return res; @@ -606,7 +613,8 @@ int gnrc_netif_ipv6_addr_add_internal(gnrc_netif_t *netif, ipv6_addr_set_solicited_nodes(&sol_nodes, addr); res = gnrc_netif_ipv6_group_join_internal(netif, &sol_nodes); if (res < 0) { - DEBUG("gnrc_netif: Can't join solicited-nodes of %s on interface %" PRIkernel_pid "\n", + DEBUG("gnrc_netif: Can't join solicited-nodes of %s on interface %" + PRIkernel_pid "\n", ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)), netif->pid); return res; @@ -614,9 +622,11 @@ int gnrc_netif_ipv6_addr_add_internal(gnrc_netif_t *netif, #else /* CONFIG_GNRC_IPV6_NIB_ARSM */ if (!gnrc_netif_is_6ln(netif)) { LOG_WARNING("Address-resolution state-machine not activated. Neighbors " - "from interface %u\nwill not be able to resolve address %s\n" + "from interface %u\nwill not be able to resolve address " + "%s\n" " Use CONFIG_GNRC_IPV6_NIB_ARSM=1 to activate.\n", - netif->pid, ipv6_addr_to_str(addr_str, addr, sizeof(addr_str))); + netif->pid, ipv6_addr_to_str(addr_str, addr, + sizeof(addr_str))); } #endif /* CONFIG_GNRC_IPV6_NIB_ARSM */ netif->ipv6.addrs_flags[idx] = flags; @@ -780,7 +790,8 @@ int gnrc_netif_ipv6_group_join_internal(gnrc_netif_t *netif, gnrc_netif_release(netif); return i; } - if ((idx == UINT_MAX) && (ipv6_addr_is_unspecified(&netif->ipv6.groups[i]))) { + if ((idx == UINT_MAX) && + (ipv6_addr_is_unspecified(&netif->ipv6.groups[i]))) { idx = i; } } @@ -826,8 +837,10 @@ int gnrc_netif_ipv6_group_idx(gnrc_netif_t *netif, const ipv6_addr_t *addr) static int _idx(const gnrc_netif_t *netif, const ipv6_addr_t *addr, bool mcast) { if (!ipv6_addr_is_unspecified(addr)) { - const ipv6_addr_t *iplist = (mcast) ? netif->ipv6.groups : netif->ipv6.addrs; - unsigned ipmax = (mcast) ? GNRC_NETIF_IPV6_GROUPS_NUMOF : CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF; + const ipv6_addr_t *iplist = (mcast) ? netif->ipv6.groups : + netif->ipv6.addrs; + unsigned ipmax = (mcast) ? GNRC_NETIF_IPV6_GROUPS_NUMOF : + CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF; for (unsigned i = 0; i < ipmax; i++) { if (ipv6_addr_equal(&iplist[i], addr)) { return i; @@ -885,7 +898,8 @@ static int _match_to_idx(const gnrc_netif_t *netif, best_match); } else { - DEBUG("gnrc_netif: Did not found any address on interface %" PRIkernel_pid + DEBUG("gnrc_netif: Did not found any address on interface %" + PRIkernel_pid " matching %s\n", netif->pid, ipv6_addr_to_str(addr_str, addr, sizeof(addr_str))); @@ -951,8 +965,8 @@ static int _create_candidate_set(const gnrc_netif_t *netif, DEBUG("Checking address: %s\n", ipv6_addr_to_str(addr_str, tmp, sizeof(addr_str))); - /* "In any case, multicast addresses and the unspecified address MUST NOT - * be included in a candidate set." + /* "In any case, multicast addresses and the unspecified address MUST + * NOT be included in a candidate set." * * flags are set if not unspecfied and multicast addresses are in * `netif->ipv6.groups` so not considered here. @@ -996,7 +1010,8 @@ static int _create_candidate_set(const gnrc_netif_t *netif, /* number of "points" assigned to an source address candidate with equal scope * than destination address */ #define RULE_2_PTS (IPV6_ADDR_MCAST_SCP_GLOBAL + 1) -/* number of "points" assigned to an source address candidate in preferred state */ +/* number of "points" assigned to an source address candidate in preferred + * state */ #define RULE_3_PTS (1) /** @@ -1094,7 +1109,8 @@ static ipv6_addr_t *_src_addr_selection(gnrc_netif_t *netif, } /* Rule 3: Avoid deprecated addresses. */ - if (_get_state(netif, i) != GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_DEPRECATED) { + if (_get_state(netif, i) != + GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_DEPRECATED) { DEBUG("winner for rule 3 found\n"); winner_set[i] += RULE_3_PTS; } @@ -1399,8 +1415,10 @@ static void *_gnrc_netif_thread(void *args) } #endif #if (CONFIG_GNRC_NETIF_MIN_WAIT_AFTER_SEND_US > 0U) - xtimer_periodic_wakeup(&last_wakeup, - CONFIG_GNRC_NETIF_MIN_WAIT_AFTER_SEND_US); + xtimer_periodic_wakeup( + &last_wakeup, + CONFIG_GNRC_NETIF_MIN_WAIT_AFTER_SEND_US + ); /* override last_wakeup in case last_wakeup + * CONFIG_GNRC_NETIF_MIN_WAIT_AFTER_SEND_US was in the past */ last_wakeup = xtimer_now(); @@ -1456,7 +1474,8 @@ static void *_gnrc_netif_thread(void *args) static void _pass_on_packet(gnrc_pktsnip_t *pkt) { /* throw away packet if no one is interested */ - if (!gnrc_netapi_dispatch_receive(pkt->type, GNRC_NETREG_DEMUX_CTX_ALL, pkt)) { + if (!gnrc_netapi_dispatch_receive(pkt->type, GNRC_NETREG_DEMUX_CTX_ALL, + pkt)) { DEBUG("gnrc_netif: unable to forward packet of type %i\n", pkt->type); gnrc_pktbuf_release(pkt); return; From 4476e0681407dfff14f368e4d8cfd2d15f4f0f74 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Mon, 30 Mar 2020 21:46:33 +0200 Subject: [PATCH 23/24] gnrc/uhcpc: Fix lines lengths --- .../gnrc/application_layer/uhcpc/gnrc_uhcpc.c | 50 +++++++++++-------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c b/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c index 7a71ffbabeba..0672d7ac55f8 100644 --- a/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c +++ b/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c @@ -42,16 +42,17 @@ static void set_interface_roles(void) gnrc_border_interface = dev; ipv6_addr_from_str(&addr, "fe80::2"); - gnrc_netapi_set(dev, NETOPT_IPV6_ADDR, 64 << 8, &addr, sizeof(addr)); + gnrc_netapi_set(dev, NETOPT_IPV6_ADDR, 64 << 8, &addr, + 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. + /* 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); } @@ -64,7 +65,8 @@ static void set_interface_roles(void) } } - LOG_INFO("gnrc_uhcpc: Using %u as border interface and %u as wireless interface.\n", gnrc_border_interface, gnrc_wireless_interface); + LOG_INFO("gnrc_uhcpc: Using %u as border interface and %u as wireless " + "interface.\n", gnrc_border_interface, gnrc_wireless_interface); } static ipv6_addr_t _prefix; @@ -112,19 +114,22 @@ static void _update_6ctx(const ipv6_addr_t *prefix, uint8_t prefix_len) } #endif -void uhcp_handle_prefix(uint8_t *prefix, uint8_t prefix_len, uint16_t lifetime, uint8_t *src, uhcp_iface_t iface) +void uhcp_handle_prefix(uint8_t *prefix, uint8_t prefix_len, uint16_t lifetime, + uint8_t *src, uhcp_iface_t iface) { (void)lifetime; (void)src; eui64_t iid; if (!gnrc_wireless_interface) { - LOG_WARNING("gnrc_uhcpc: uhcp_handle_prefix(): received prefix, but don't know any wireless interface\n"); + LOG_WARNING("gnrc_uhcpc: uhcp_handle_prefix(): received prefix, but " + "don't know any wireless interface\n"); return; } if ((kernel_pid_t)iface != gnrc_border_interface) { - LOG_WARNING("gnrc_uhcpc: uhcp_handle_prefix(): received prefix from unexpected interface\n"); + LOG_WARNING("gnrc_uhcpc: uhcp_handle_prefix(): received prefix from " + "unexpected interface\n"); return; } @@ -133,14 +138,16 @@ void uhcp_handle_prefix(uint8_t *prefix, uint8_t prefix_len, uint16_t lifetime, ipv6_addr_set_aiid((ipv6_addr_t*)prefix, iid.uint8); } else { - LOG_WARNING("gnrc_uhcpc: uhcp_handle_prefix(): cannot get IID of wireless interface\n"); + LOG_WARNING("gnrc_uhcpc: uhcp_handle_prefix(): cannot get IID of " + "wireless interface\n"); return; } if ((_prefix_len == prefix_len) && (ipv6_addr_match_prefix(&_prefix, (ipv6_addr_t *)prefix) >= prefix_len)) { - LOG_WARNING("gnrc_uhcpc: uhcp_handle_prefix(): got same prefix again\n"); + LOG_WARNING("gnrc_uhcpc: uhcp_handle_prefix(): got same prefix " + "again\n"); #ifdef MODULE_GNRC_SIXLOWPAN_CTX if (gnrc_netif_is_6ln(gnrc_netif_get_by_pid(gnrc_wireless_interface))) { /* always update 6LoWPAN compression context so it does not time @@ -163,8 +170,8 @@ void uhcp_handle_prefix(uint8_t *prefix, uint8_t prefix_len, uint16_t lifetime, } memcpy(&_prefix, prefix, sizeof(_prefix)); _prefix_len = prefix_len; - gnrc_netapi_set(gnrc_wireless_interface, NETOPT_IPV6_ADDR, (prefix_len << 8), - prefix, sizeof(ipv6_addr_t)); + gnrc_netapi_set(gnrc_wireless_interface, NETOPT_IPV6_ADDR, + (prefix_len << 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))) { @@ -180,20 +187,23 @@ void uhcp_handle_prefix(uint8_t *prefix, uint8_t prefix_len, uint16_t lifetime, } #ifdef MODULE_GNRC_RPL gnrc_rpl_init(gnrc_wireless_interface); - gnrc_rpl_instance_t *inst = gnrc_rpl_instance_get(GNRC_RPL_DEFAULT_INSTANCE); + gnrc_rpl_instance_t *inst = gnrc_rpl_instance_get( + GNRC_RPL_DEFAULT_INSTANCE); if (inst) { gnrc_rpl_instance_remove(inst); } - gnrc_rpl_root_init(GNRC_RPL_DEFAULT_INSTANCE, (ipv6_addr_t*)prefix, false, false); + gnrc_rpl_root_init(GNRC_RPL_DEFAULT_INSTANCE, (ipv6_addr_t*)prefix, false, + false); #endif LOG_INFO("gnrc_uhcpc: uhcp_handle_prefix(): configured new prefix %s/%u\n", - ipv6_addr_to_str(addr_str, (ipv6_addr_t *)prefix, sizeof(addr_str)), - prefix_len); + ipv6_addr_to_str(addr_str, (ipv6_addr_t *)prefix, + sizeof(addr_str)), prefix_len); } extern void uhcp_client(uhcp_iface_t iface); -static char _uhcp_client_stack[THREAD_STACKSIZE_DEFAULT + THREAD_EXTRA_STACKSIZE_PRINTF]; +static char _uhcp_client_stack[THREAD_STACKSIZE_DEFAULT + + THREAD_EXTRA_STACKSIZE_PRINTF]; static msg_t _uhcp_msg_queue[4]; static void* uhcp_client_thread(void *arg) From aa2ec68c9c80a289144d7195b24bf8f066371474 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Mon, 30 Mar 2020 21:51:07 +0200 Subject: [PATCH 24/24] gnrc/nib/conf.h: Align configuration values --- sys/include/net/gnrc/ipv6/nib/conf.h | 78 ++++++++++++++-------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index a361a60a5160..a97c31ed0a11 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -33,52 +33,52 @@ extern "C" { /* some pseudo-module based configuration, doc: see below */ #ifdef MODULE_GNRC_IPV6_NIB_6LBR #ifndef CONFIG_GNRC_IPV6_NIB_6LBR -#define CONFIG_GNRC_IPV6_NIB_6LBR 1 +#define CONFIG_GNRC_IPV6_NIB_6LBR 1 #endif #ifndef CONFIG_GNRC_IPV6_NIB_SLAAC -#define CONFIG_GNRC_IPV6_NIB_SLAAC 1 +#define CONFIG_GNRC_IPV6_NIB_SLAAC 1 #endif #ifndef CONFIG_GNRC_IPV6_NIB_NUMOF -#define CONFIG_GNRC_IPV6_NIB_NUMOF (16) +#define CONFIG_GNRC_IPV6_NIB_NUMOF (16) #endif #endif #ifdef MODULE_GNRC_IPV6_NIB_6LR #ifndef CONFIG_GNRC_IPV6_NIB_6LR -#define CONFIG_GNRC_IPV6_NIB_6LR 1 +#define CONFIG_GNRC_IPV6_NIB_6LR 1 #endif #ifndef CONFIG_GNRC_IPV6_NIB_SLAAC -#define CONFIG_GNRC_IPV6_NIB_SLAAC 0 +#define CONFIG_GNRC_IPV6_NIB_SLAAC 0 #endif #endif #ifdef MODULE_GNRC_IPV6_NIB_6LN #ifndef CONFIG_GNRC_IPV6_NIB_6LN -#define CONFIG_GNRC_IPV6_NIB_6LN 1 +#define CONFIG_GNRC_IPV6_NIB_6LN 1 #endif #ifndef CONFIG_GNRC_IPV6_NIB_SLAAC -#define CONFIG_GNRC_IPV6_NIB_SLAAC 0 +#define CONFIG_GNRC_IPV6_NIB_SLAAC 0 #endif #ifndef CONFIG_GNRC_IPV6_NIB_QUEUE_PKT -#define CONFIG_GNRC_IPV6_NIB_QUEUE_PKT 0 +#define CONFIG_GNRC_IPV6_NIB_QUEUE_PKT 0 #endif #if !CONFIG_GNRC_IPV6_NIB_6LR # ifndef CONFIG_GNRC_IPV6_NIB_ARSM -# define CONFIG_GNRC_IPV6_NIB_ARSM 0 +# define CONFIG_GNRC_IPV6_NIB_ARSM 0 # endif # ifndef CONFIG_GNRC_IPV6_NIB_NUMOF /* only needs to store default router */ -# define CONFIG_GNRC_IPV6_NIB_NUMOF (1) +# define CONFIG_GNRC_IPV6_NIB_NUMOF (1) # endif #endif #endif #ifdef MODULE_GNRC_IPV6_NIB_ROUTER -#define CONFIG_GNRC_IPV6_NIB_ROUTER 1 +#define CONFIG_GNRC_IPV6_NIB_ROUTER 1 #endif #ifdef MODULE_GNRC_IPV6_NIB_DNS -#define CONFIG_GNRC_IPV6_NIB_DNS 1 +#define CONFIG_GNRC_IPV6_NIB_DNS 1 #endif /** @@ -90,7 +90,7 @@ extern "C" { * @brief enable features for 6Lo border router */ #ifndef CONFIG_GNRC_IPV6_NIB_6LBR -#define CONFIG_GNRC_IPV6_NIB_6LBR 0 +#define CONFIG_GNRC_IPV6_NIB_6LBR 0 #endif /** @@ -98,9 +98,9 @@ extern "C" { */ #ifndef CONFIG_GNRC_IPV6_NIB_6LR #if CONFIG_GNRC_IPV6_NIB_6LBR -#define CONFIG_GNRC_IPV6_NIB_6LR 1 +#define CONFIG_GNRC_IPV6_NIB_6LR 1 #else -#define CONFIG_GNRC_IPV6_NIB_6LR 0 +#define CONFIG_GNRC_IPV6_NIB_6LR 0 #endif #endif @@ -109,9 +109,9 @@ extern "C" { */ #ifndef CONFIG_GNRC_IPV6_NIB_6LN #if CONFIG_GNRC_IPV6_NIB_6LR -#define CONFIG_GNRC_IPV6_NIB_6LN 1 +#define CONFIG_GNRC_IPV6_NIB_6LN 1 #else -#define CONFIG_GNRC_IPV6_NIB_6LN 0 +#define CONFIG_GNRC_IPV6_NIB_6LN 0 #endif #endif @@ -120,9 +120,9 @@ extern "C" { */ #ifndef CONFIG_GNRC_IPV6_NIB_ROUTER #if CONFIG_GNRC_IPV6_NIB_6LR -#define CONFIG_GNRC_IPV6_NIB_ROUTER 1 +#define CONFIG_GNRC_IPV6_NIB_ROUTER 1 #else -#define CONFIG_GNRC_IPV6_NIB_ROUTER 0 +#define CONFIG_GNRC_IPV6_NIB_ROUTER 0 #endif #endif @@ -132,9 +132,9 @@ extern "C" { #ifndef CONFIG_GNRC_IPV6_NIB_ADV_ROUTER #if CONFIG_GNRC_IPV6_NIB_ROUTER && \ (!CONFIG_GNRC_IPV6_NIB_6LR || CONFIG_GNRC_IPV6_NIB_6LBR) -#define CONFIG_GNRC_IPV6_NIB_ADV_ROUTER 1 +#define CONFIG_GNRC_IPV6_NIB_ADV_ROUTER 1 #else -#define CONFIG_GNRC_IPV6_NIB_ADV_ROUTER 0 +#define CONFIG_GNRC_IPV6_NIB_ADV_ROUTER 0 #endif #endif @@ -142,7 +142,7 @@ extern "C" { * @brief (de-)activate NDP address resolution state-machine */ #ifndef CONFIG_GNRC_IPV6_NIB_ARSM -#define CONFIG_GNRC_IPV6_NIB_ARSM 1 +#define CONFIG_GNRC_IPV6_NIB_ARSM 1 #endif /** @@ -150,9 +150,9 @@ extern "C" { */ #ifndef CONFIG_GNRC_IPV6_NIB_QUEUE_PKT #if CONFIG_GNRC_IPV6_NIB_6LN -#define CONFIG_GNRC_IPV6_NIB_QUEUE_PKT 0 +#define CONFIG_GNRC_IPV6_NIB_QUEUE_PKT 0 #else -#define CONFIG_GNRC_IPV6_NIB_QUEUE_PKT 1 +#define CONFIG_GNRC_IPV6_NIB_QUEUE_PKT 1 #endif #endif @@ -163,14 +163,14 @@ extern "C" { * @see [RFC 4862](https://tools.ietf.org/html/rfc4862) */ #ifndef CONFIG_GNRC_IPV6_NIB_SLAAC -#define CONFIG_GNRC_IPV6_NIB_SLAAC 1 +#define CONFIG_GNRC_IPV6_NIB_SLAAC 1 #endif /** * @brief handle Redirect Messages */ #ifndef CONFIG_GNRC_IPV6_NIB_REDIRECT -#define CONFIG_GNRC_IPV6_NIB_REDIRECT 0 +#define CONFIG_GNRC_IPV6_NIB_REDIRECT 0 #endif /** @@ -178,9 +178,9 @@ extern "C" { */ #ifndef CONFIG_GNRC_IPV6_NIB_DC #if CONFIG_GNRC_IPV6_NIB_REDIRECT -#define CONFIG_GNRC_IPV6_NIB_DC 1 +#define CONFIG_GNRC_IPV6_NIB_DC 1 #else -#define CONFIG_GNRC_IPV6_NIB_DC 0 +#define CONFIG_GNRC_IPV6_NIB_DC 0 #endif #endif @@ -190,7 +190,7 @@ extern "C" { * @see [RFC 8106](https://tools.ietf.org/html/rfc8106) */ #ifndef CONFIG_GNRC_IPV6_NIB_DNS -#define CONFIG_GNRC_IPV6_NIB_DNS 0 +#define CONFIG_GNRC_IPV6_NIB_DNS 0 #endif /** @@ -200,9 +200,9 @@ extern "C" { */ #ifndef CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C #if CONFIG_GNRC_IPV6_NIB_6LR -#define CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C 1 +#define CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C 1 #else -#define CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C 0 +#define CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C 0 #endif #endif @@ -212,7 +212,7 @@ extern "C" { * @see [RFC 6775, section 8.2](https://tools.ietf.org/html/rfc6775#section-8.2) */ #ifndef CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD -#define CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD 0 +#define CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD 0 #endif /** @} */ @@ -222,7 +222,7 @@ extern "C" { * @see [RFC 4861, section 6.3.4](https://tools.ietf.org/html/rfc4861#section-6.3.4) */ #ifndef CONFIG_GNRC_IPV6_NIB_REACH_TIME_RESET -#define CONFIG_GNRC_IPV6_NIB_REACH_TIME_RESET (7200000U) +#define CONFIG_GNRC_IPV6_NIB_REACH_TIME_RESET (7200000U) #endif /** @@ -231,14 +231,14 @@ extern "C" { * @warning Only do this if you know what you're doing */ #ifndef CONFIG_GNRC_IPV6_NIB_NO_RTR_SOL -#define CONFIG_GNRC_IPV6_NIB_NO_RTR_SOL 0 +#define CONFIG_GNRC_IPV6_NIB_NO_RTR_SOL 0 #endif /** * @brief Maximum link-layer address length (aligned) */ #ifndef CONFIG_GNRC_IPV6_NIB_L2ADDR_MAX_LEN -#define CONFIG_GNRC_IPV6_NIB_L2ADDR_MAX_LEN (8U) +#define CONFIG_GNRC_IPV6_NIB_L2ADDR_MAX_LEN (8U) #endif /** @@ -248,7 +248,7 @@ extern "C" { * default routers */ #ifndef CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF -#define CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF (1) +#define CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF (1) #endif /** @@ -258,7 +258,7 @@ extern "C" { * neighbors and duplicate address detection table entries */ #ifndef CONFIG_GNRC_IPV6_NIB_NUMOF -#define CONFIG_GNRC_IPV6_NIB_NUMOF (4) +#define CONFIG_GNRC_IPV6_NIB_NUMOF (4) #endif /** @@ -268,7 +268,7 @@ extern "C" { * and prefix list entries in NIB */ #ifndef CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF -#define CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF (8) +#define CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF (8) #endif #if CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C || defined(DOXYGEN) @@ -276,7 +276,7 @@ extern "C" { * @brief Number of authoritative border router entries in NIB */ #ifndef CONFIG_GNRC_IPV6_NIB_ABR_NUMOF -#define CONFIG_GNRC_IPV6_NIB_ABR_NUMOF (1) +#define CONFIG_GNRC_IPV6_NIB_ABR_NUMOF (1) #endif #endif