gnrc/nib: Move GNRC_IPV6_NIB_CONF_MULTIHOP_P6C to 'CONFIG_' namespace
Also evaluate using IS_ACTIVE macro.
This commit is contained in:
parent
22b4df9537
commit
53a522d642
@ -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)
|
||||
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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
|
||||
*/
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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) */
|
||||
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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.
|
||||
*
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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.
|
||||
*
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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 */
|
||||
|
||||
/** @} */
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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 */
|
||||
|
||||
/** @} */
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user