1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

gnrc/nib: Move GNRC_IPV6_NIB_CONF_ROUTER to 'CONFIG_' namespace

Also evaluate it using IS_ACTIVE macro.
This commit is contained in:
Leandro Lanzieri 2020-03-12 13:50:13 +01:00
parent 1acfe7ae19
commit 49ec28867c
No known key found for this signature in database
GPG Key ID: 39607DE6080007A3
16 changed files with 73 additions and 69 deletions

View File

@ -95,7 +95,7 @@ extern "C" {
* pointer to a valid on-link entry representing the neighbor that sent the * pointer to a valid on-link entry representing the neighbor that sent the
* Router Solicitation. * 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) #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 * which the Router Advertisement will be sent and by which parameters it will
* be configured. * 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) #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 * This message type is for the event of a route timeout. The expected message
* context is a valid off-link entry representing the route. * 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) #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); 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 * @brief Changes the state if an interface advertises itself as a router
* or not * or not

View File

@ -71,7 +71,7 @@ extern "C" {
#endif #endif
#ifdef MODULE_GNRC_IPV6_NIB_ROUTER #ifdef MODULE_GNRC_IPV6_NIB_ROUTER
#define GNRC_IPV6_NIB_CONF_ROUTER 1 #define CONFIG_GNRC_IPV6_NIB_ROUTER 1
#endif #endif
#ifdef MODULE_GNRC_IPV6_NIB_DNS #ifdef MODULE_GNRC_IPV6_NIB_DNS
@ -115,11 +115,11 @@ extern "C" {
/** /**
* @brief enable features for IPv6 routers * @brief enable features for IPv6 routers
*/ */
#ifndef GNRC_IPV6_NIB_CONF_ROUTER #ifndef CONFIG_GNRC_IPV6_NIB_ROUTER
#if CONFIG_GNRC_IPV6_NIB_6LR #if CONFIG_GNRC_IPV6_NIB_6LR
#define GNRC_IPV6_NIB_CONF_ROUTER 1 #define CONFIG_GNRC_IPV6_NIB_ROUTER 1
#else #else
#define GNRC_IPV6_NIB_CONF_ROUTER 0 #define CONFIG_GNRC_IPV6_NIB_ROUTER 0
#endif #endif
#endif #endif
@ -127,7 +127,7 @@ extern "C" {
* @brief (de-)activate router advertising at interface start-up * @brief (de-)activate router advertising at interface start-up
*/ */
#ifndef GNRC_IPV6_NIB_CONF_ADV_ROUTER #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) (!CONFIG_GNRC_IPV6_NIB_6LR || CONFIG_GNRC_IPV6_NIB_6LBR)
#define GNRC_IPV6_NIB_CONF_ADV_ROUTER 1 #define GNRC_IPV6_NIB_CONF_ADV_ROUTER 1
#else #else

View File

@ -20,6 +20,8 @@
#ifndef NET_GNRC_NETIF_CONF_H #ifndef NET_GNRC_NETIF_CONF_H
#define NET_GNRC_NETIF_CONF_H #define NET_GNRC_NETIF_CONF_H
#include <kernel_defines.h>
#include "net/ieee802154.h" #include "net/ieee802154.h"
#include "net/ethernet/hdr.h" #include "net/ethernet/hdr.h"
#include "net/gnrc/ipv6/nib/conf.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 * @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) #define GNRC_NETIF_IPV6_RTR_ADDR (1)
#else #else
#define GNRC_NETIF_IPV6_RTR_ADDR (0) #define GNRC_NETIF_IPV6_RTR_ADDR (0)

View File

@ -108,7 +108,7 @@ typedef struct {
netstats_t stats; netstats_t stats;
#endif #endif
#if defined(MODULE_GNRC_IPV6_NIB) || DOXYGEN #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 * @brief Route info callback
* *
@ -131,10 +131,10 @@ typedef struct {
* *
* @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6". * @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6".
* and @ref net_gnrc_ipv6_nib "NIB" and if * 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; 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 #if GNRC_IPV6_NIB_CONF_ARSM || DOXYGEN
/** /**
* @brief Event for @ref GNRC_IPV6_NIB_RECALC_REACH_TIME * @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]; evtimer_msg_event_t addrs_timers[CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF];
#endif #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 * @brief Timestamp in milliseconds of last unsolicited router
* advertisement * advertisement
* *
* @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6". * @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6".
* and @ref net_gnrc_ipv6_nib "NIB" and if * 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; uint32_t last_ra;
#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ #endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */
#if GNRC_IPV6_NIB_CONF_ARSM || defined(DOXYGEN) #if GNRC_IPV6_NIB_CONF_ARSM || defined(DOXYGEN)
/** /**
* @brief Base for random reachable time calculation and advertised * @brief Base for random reachable time calculation and advertised
@ -205,13 +205,13 @@ typedef struct {
* @ref net_gnrc_ipv6_nib "NIB" * @ref net_gnrc_ipv6_nib "NIB"
*/ */
uint32_t retrans_time; 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). * @brief (Advertised) Router lifetime (default 1800).
* *
* @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6". * @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6".
* and @ref net_gnrc_ipv6_nib "NIB" and if * 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; uint16_t rtr_ltime;
/** /**
@ -223,7 +223,7 @@ typedef struct {
* *
* @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6". * @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6".
* and @ref net_gnrc_ipv6_nib "NIB" and if * 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; uint8_t ra_sent;
#endif #endif

View File

@ -203,7 +203,7 @@ int gnrc_netif_get_from_netdev(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt)
} }
/* else ask device */ /* else ask device */
break; break;
#if GNRC_IPV6_NIB_CONF_ROUTER #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER)
case NETOPT_IPV6_FORWARDING: case NETOPT_IPV6_FORWARDING:
assert(opt->data_len == sizeof(netopt_enable_t)); assert(opt->data_len == sizeof(netopt_enable_t));
*((netopt_enable_t *)opt->data) = (gnrc_netif_is_rtr(netif)) ? *((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; NETOPT_ENABLE : NETOPT_DISABLE;
res = sizeof(netopt_enable_t); res = sizeof(netopt_enable_t);
break; break;
#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ #endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */
#endif /* MODULE_GNRC_IPV6 */ #endif /* MODULE_GNRC_IPV6 */
#ifdef MODULE_GNRC_SIXLOWPAN_IPHC #ifdef MODULE_GNRC_SIXLOWPAN_IPHC
case NETOPT_6LO_IPHC: case NETOPT_6LO_IPHC:
@ -296,7 +296,7 @@ int gnrc_netif_set_from_netdev(gnrc_netif_t *netif,
} }
/* else set device */ /* else set device */
break; break;
#if GNRC_IPV6_NIB_CONF_ROUTER #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER)
case NETOPT_IPV6_FORWARDING: case NETOPT_IPV6_FORWARDING:
assert(opt->data_len == sizeof(netopt_enable_t)); assert(opt->data_len == sizeof(netopt_enable_t));
if (*(((netopt_enable_t *)opt->data)) == NETOPT_ENABLE) { 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)); (*(((netopt_enable_t *)opt->data)) == NETOPT_ENABLE));
res = sizeof(netopt_enable_t); res = sizeof(netopt_enable_t);
break; break;
#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ #endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */
#endif /* MODULE_GNRC_IPV6 */ #endif /* MODULE_GNRC_IPV6 */
#ifdef MODULE_GNRC_SIXLOWPAN_IPHC #ifdef MODULE_GNRC_SIXLOWPAN_IPHC
case NETOPT_6LO_IPHC: case NETOPT_6LO_IPHC:

View File

@ -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 &= ~GNRC_IPV6_NIB_NC_INFO_NUD_STATE_MASK;
nce->info |= state; nce->info |= state;
#if GNRC_IPV6_NIB_CONF_ROUTER #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER)
gnrc_netif_acquire(netif); gnrc_netif_acquire(netif);
if (netif != NULL) { if (netif != NULL) {
_call_route_info_cb(netif, GNRC_IPV6_NIB_ROUTE_INFO_TYPE_NSC, _call_route_info_cb(netif, GNRC_IPV6_NIB_ROUTE_INFO_TYPE_NSC,
&nce->ipv6, (void *)((intptr_t)state)); &nce->ipv6, (void *)((intptr_t)state));
} }
gnrc_netif_release(netif); gnrc_netif_release(netif);
#else /* GNRC_IPV6_NIB_CONF_ROUTER */ #else /* CONFIG_GNRC_IPV6_NIB_ROUTER */
(void)netif; (void)netif;
#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ #endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */
} }
bool _is_reachable(_nib_onl_entry_t *entry) bool _is_reachable(_nib_onl_entry_t *entry)

View File

@ -270,9 +270,9 @@ void _nib_nc_remove(_nib_onl_entry_t *node)
#if GNRC_IPV6_NIB_CONF_ARSM #if GNRC_IPV6_NIB_CONF_ARSM
evtimer_del((evtimer_t *)&_nib_evtimer, &node->nud_timeout.event); evtimer_del((evtimer_t *)&_nib_evtimer, &node->nud_timeout.event);
#endif /* GNRC_IPV6_NIB_CONF_ARSM */ #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); 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) #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR)
evtimer_del((evtimer_t *)&_nib_evtimer, &node->addr_reg_timeout.event); evtimer_del((evtimer_t *)&_nib_evtimer, &node->addr_reg_timeout.event);
#endif /* CONFIG_GNRC_IPV6_NIB_6LR */ #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(); _nib_dr_entry_t *router = _nib_drl_get_dr();
if ((router == NULL) && (offl == NULL)) { if ((router == NULL) && (offl == NULL)) {
#if GNRC_IPV6_NIB_CONF_ROUTER #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER)
gnrc_netif_t *ptr = NULL; gnrc_netif_t *ptr = NULL;
while ((ptr = gnrc_netif_iter(ptr))) { 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, GNRC_IPV6_NIB_ROUTE_INFO_TYPE_RRQ,
dst, pkt); dst, pkt);
} }
#else /* GNRC_IPV6_NIB_CONF_ROUTER */ #else /* CONFIG_GNRC_IPV6_NIB_ROUTER */
(void)pkt; (void)pkt;
#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ #endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */
return -ENETUNREACH; return -ENETUNREACH;
} }
else if (router != NULL) { else if (router != NULL) {

View File

@ -142,7 +142,7 @@ typedef struct _nib_onl_entry {
* @brief Event for @ref GNRC_IPV6_NIB_SND_NA * @brief Event for @ref GNRC_IPV6_NIB_SND_NA
*/ */
evtimer_msg_event_t 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 */ evtimer_msg_event_t reply_rs; /**< Event for @ref GNRC_IPV6_NIB_REPLY_RS */
#endif #endif
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) || defined(DOXYGEN) #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 * @brief Event for @ref GNRC_IPV6_NIB_PFX_TIMEOUT
*/ */
evtimer_msg_event_t 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 * @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); 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 * @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. * @ref _nib_drl_add() for default route destinations.
* @param[in] pfx_len The length in bits of @p pfx in bits. * @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 * @return A new or existing off-link entry with _nib_offl_entry_t::pfx set to
* @p pfx. * @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. * 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) static inline void _nib_ft_remove(_nib_offl_entry_t *nib_offl)
{ {
_nib_offl_remove(nib_offl, _FT); _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) #if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C || defined(DOXYGEN)
/** /**

View File

@ -12,6 +12,7 @@
* @file * @file
* @author Martine Lenders <m.lenders@fu-berlin.de> * @author Martine Lenders <m.lenders@fu-berlin.de>
*/ */
#include <kernel_defines.h>
#include "net/gnrc/ipv6/nib.h" #include "net/gnrc/ipv6/nib.h"
#include "net/gnrc/ndp.h" #include "net/gnrc/ndp.h"
@ -29,7 +30,7 @@
#define ENABLE_DEBUG (0) #define ENABLE_DEBUG (0)
#include "debug.h" #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 char addr_str[IPV6_ADDR_MAX_STR_LEN];
static void _snd_ra(gnrc_netif_t *netif, const ipv6_addr_t *dst, 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); 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; typedef int dont_be_pedantic;
#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ #endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */
/** @} */ /** @} */

View File

@ -33,7 +33,7 @@
extern "C" { extern "C" {
#endif #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 * @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, void _snd_rtr_advs(gnrc_netif_t *netif, const ipv6_addr_t *dst,
bool final); bool final);
#else /* GNRC_IPV6_NIB_CONF_ROUTER */ #else /* CONFIG_GNRC_IPV6_NIB_ROUTER */
#define _init_iface_router(netif) (void)netif #define _init_iface_router(netif) (void)netif
#define _call_route_info_cb(netif, type, ctx_addr, ctx) (void)netif; \ #define _call_route_info_cb(netif, type, ctx_addr, ctx) (void)netif; \
(void)type; \ (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; \ #define _snd_rtr_advs(netif, dst, final) (void)netif; \
(void)dst; \ (void)dst; \
(void)final (void)final
#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ #endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -59,10 +59,10 @@ static evtimer_msg_event_t _rdnss_timeout;
* @internal * @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, 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); 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, 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); 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, 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, _evtimer_add(netif, GNRC_IPV6_NIB_SEARCH_RTR, &netif->ipv6.search_rtr,
next_rs_time); next_rs_time);
} }
#if GNRC_IPV6_NIB_CONF_ROUTER #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER)
else { else {
_handle_snd_mc_ra(netif); _handle_snd_mc_ra(netif);
} }
#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ #endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */
gnrc_netif_release(netif); 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); gnrc_netif_acquire(netif);
_nib_acquire(); _nib_acquire();
switch (icmpv6->type) { switch (icmpv6->type) {
#if GNRC_IPV6_NIB_CONF_ROUTER #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER)
case ICMPV6_RTR_SOL: case ICMPV6_RTR_SOL:
_handle_rtr_sol(netif, ipv6, (ndp_rtr_sol_t *)icmpv6, icmpv6_len); _handle_rtr_sol(netif, ipv6, (ndp_rtr_sol_t *)icmpv6, icmpv6_len);
break; break;
#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ #endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */
case ICMPV6_RTR_ADV: case ICMPV6_RTR_ADV:
_handle_rtr_adv(netif, ipv6, (ndp_rtr_adv_t *)icmpv6, icmpv6_len); _handle_rtr_adv(netif, ipv6, (ndp_rtr_adv_t *)icmpv6, icmpv6_len);
break; break;
@ -350,7 +350,7 @@ void gnrc_ipv6_nib_handle_timer_event(void *ctx, uint16_t type)
case GNRC_IPV6_NIB_SEARCH_RTR: case GNRC_IPV6_NIB_SEARCH_RTR:
_handle_search_rtr(ctx); _handle_search_rtr(ctx);
break; break;
#if GNRC_IPV6_NIB_CONF_ROUTER #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER)
case GNRC_IPV6_NIB_REPLY_RS: case GNRC_IPV6_NIB_REPLY_RS:
_handle_reply_rs(ctx); _handle_reply_rs(ctx);
break; break;
@ -360,7 +360,7 @@ void gnrc_ipv6_nib_handle_timer_event(void *ctx, uint16_t type)
case GNRC_IPV6_NIB_ROUTE_TIMEOUT: case GNRC_IPV6_NIB_ROUTE_TIMEOUT:
_nib_ft_remove(ctx); _nib_ft_remove(ctx);
break; break;
#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ #endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR) #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR)
case GNRC_IPV6_NIB_ADDR_REG_TIMEOUT: case GNRC_IPV6_NIB_ADDR_REG_TIMEOUT:
_nib_nc_remove(ctx); _nib_nc_remove(ctx);
@ -398,7 +398,7 @@ void gnrc_ipv6_nib_handle_timer_event(void *ctx, uint16_t type)
_nib_release(); _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) void gnrc_ipv6_nib_change_rtr_adv_iface(gnrc_netif_t *netif, bool enable)
{ {
gnrc_netif_acquire(netif); 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); gnrc_netif_release(netif);
} }
#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ #endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */
/* /*
* @internal * @internal
@ -446,7 +446,7 @@ static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
icmpv6_len -= (opt->len << 3), \ icmpv6_len -= (opt->len << 3), \
opt = (ndp_opt_t *)(((uint8_t *)opt) + (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, 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) 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 */ (void)nce; /* NCE is not used */
#endif #endif
} }
#endif /* GNRC_IPV6_NIB_CONF_ROUTER */ #endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */
static inline uint32_t _min(uint32_t a, uint32_t b) 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); gnrc_pktbuf_release(payload);
return; return;
} }
#if GNRC_IPV6_NIB_CONF_ROUTER #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER)
if (gnrc_netif_is_rtr(netif)) { if (gnrc_netif_is_rtr(netif)) {
reply_flags |= NDP_NBR_ADV_FLAGS_R; 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 GNRC_NETIF_L2ADDR_MAXLEN > 0
if (ipv6_addr_is_multicast(&ipv6_hdr->dst)) { if (ipv6_addr_is_multicast(&ipv6_hdr->dst)) {
uint8_t l2addr[GNRC_NETIF_L2ADDR_MAXLEN]; 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); gnrc_pktbuf_release(pkt);
return false; return false;
} }
#if GNRC_IPV6_NIB_CONF_ROUTER #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER)
if (netif != NULL) { if (netif != NULL) {
_call_route_info_cb(netif, _call_route_info_cb(netif,
GNRC_IPV6_NIB_ROUTE_INFO_TYPE_NSC, GNRC_IPV6_NIB_ROUTE_INFO_TYPE_NSC,
dst, dst,
(void *)GNRC_IPV6_NIB_NC_INFO_NUD_STATE_INCOMPLETE); (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 #if GNRC_IPV6_NIB_CONF_ARSM
reset = true; reset = true;
#endif /* GNRC_IPV6_NIB_CONF_ARSM */ #endif /* GNRC_IPV6_NIB_CONF_ARSM */

View File

@ -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 { else {
_nib_offl_entry_t *ptr; _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); &ptr->route_timeout, ltime * MS_PER_SEC);
} }
} }
#else /* GNRC_IPV6_NIB_CONF_ROUTER */ #else /* CONFIG_GNRC_IPV6_NIB_ROUTER */
else { else {
res = -ENOTSUP; res = -ENOTSUP;
} }
@ -92,7 +92,7 @@ void gnrc_ipv6_nib_ft_del(const ipv6_addr_t *dst, unsigned dst_len)
_nib_drl_remove(entry); _nib_drl_remove(entry);
} }
} }
#if GNRC_IPV6_NIB_CONF_ROUTER #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER)
else { else {
_nib_offl_entry_t *entry = NULL; _nib_offl_entry_t *entry = NULL;

View File

@ -85,7 +85,7 @@ int gnrc_ipv6_nib_pl_set(unsigned iface,
gnrc_netif_release(netif); gnrc_netif_release(netif);
#endif /* MODULE_GNRC_NETIF */ #endif /* MODULE_GNRC_NETIF */
_nib_release(); _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 */ /* update prefixes down-stream */
_handle_snd_mc_ra(netif); _handle_snd_mc_ra(netif);
#endif #endif
@ -106,7 +106,7 @@ void gnrc_ipv6_nib_pl_del(unsigned iface,
(ipv6_addr_match_prefix(pfx, &dst->pfx) >= pfx_len)) { (ipv6_addr_match_prefix(pfx, &dst->pfx) >= pfx_len)) {
_nib_pl_remove(dst); _nib_pl_remove(dst);
_nib_release(); _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); gnrc_netif_t *netif = gnrc_netif_get_by_pid(iface);
if (netif) { if (netif) {

View File

@ -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, const ipv6_addr_t *dst, bool fin,
gnrc_pktsnip_t *ext_opts) 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; gnrc_pktsnip_t *hdr = NULL, *pkt = ext_opts;
uint32_t reach_time = 0, retrans_timer = 0; uint32_t reach_time = 0, retrans_timer = 0;
uint16_t adv_ltime = 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; (void)fin;
DEBUG("ndp: not a router, dropping ext_opts\n"); DEBUG("ndp: not a router, dropping ext_opts\n");
gnrc_pktbuf_release(ext_opts); 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, static gnrc_pktsnip_t *_build_headers(gnrc_netif_t *netif,

View File

@ -18,6 +18,7 @@
* @} * @}
*/ */
#include <kernel_defines.h>
#include <stdio.h> #include <stdio.h>
#include "byteorder.h" #include "byteorder.h"
@ -888,7 +889,7 @@ static void test_rtr_sol_send__pktbuf_full4(void)
TEST_ASSERT(gnrc_pktbuf_is_empty()); 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, static void test_rtr_adv_send(const ipv6_addr_t *src, const ipv6_addr_t *dst,
bool fin, gnrc_pktsnip_t *exp_ext_opts) 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_full2),
new_TestFixture(test_rtr_sol_send__pktbuf_full3), new_TestFixture(test_rtr_sol_send__pktbuf_full3),
new_TestFixture(test_rtr_sol_send__pktbuf_full4), 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_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_no_fin_ext_opts),
new_TestFixture(test_rtr_adv_send__src_NULL_dst_NULL_fin_no_ext_opts), new_TestFixture(test_rtr_adv_send__src_NULL_dst_NULL_fin_no_ext_opts),

View File

@ -1,7 +1,7 @@
USEMODULE += gnrc_ipv6_nib USEMODULE += gnrc_ipv6_nib
USEMODULE += gnrc_sixlowpan_nd # required for GNRC_IPV6_NIB_CONF_MULTIHOP_P6C 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_NUMOF=16
CFLAGS += -DGNRC_IPV6_NIB_OFFL_NUMOF=25 CFLAGS += -DGNRC_IPV6_NIB_OFFL_NUMOF=25
CFLAGS += -DGNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF=4 CFLAGS += -DGNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF=4