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

gnrc/nib: Move GNRC_IPV6_NIB_CONF_6LR to 'CONFIG_' namespace

Also evaluate it using IS_ACTIVE
This commit is contained in:
Leandro Lanzieri 2020-03-12 12:15:26 +01:00
parent 40c78f1c75
commit 398bb6d025
No known key found for this signature in database
GPG Key ID: 39607DE6080007A3
12 changed files with 62 additions and 51 deletions

View File

@ -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)

View File

@ -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

View File

@ -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 {

View File

@ -12,6 +12,7 @@
* @file
* @author Martine Lenders <m.lenders@fu-berlin.de>
*/
#include <kernel_defines.h>
#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) {

View File

@ -12,6 +12,7 @@
* @file
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#include <kernel_defines.h>
#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 */
/** @} */

View File

@ -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 <m.lenders@fu-berlin.de>
*/
#ifndef PRIV_NIB_6LR_H
#define PRIV_NIB_6LR_H
#include <kernel_defines.h>
#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
}

View File

@ -12,6 +12,7 @@
* @file
* @author Martine Lenders <m.lenders@fu-berlin.de>
*/
#include <kernel_defines.h>
#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 {

View File

@ -16,6 +16,7 @@
#include <errno.h>
#include <stdbool.h>
#include <string.h>
#include <kernel_defines.h>
#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;

View File

@ -23,6 +23,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <kernel_defines.h>
#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

View File

@ -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);
}

View File

@ -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);

View File

@ -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("");