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:
parent
1acfe7ae19
commit
49ec28867c
@ -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
|
||||
|
@ -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
|
||||
|
@ -20,6 +20,8 @@
|
||||
#ifndef NET_GNRC_NETIF_CONF_H
|
||||
#define NET_GNRC_NETIF_CONF_H
|
||||
|
||||
#include <kernel_defines.h>
|
||||
|
||||
#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)
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
/**
|
||||
|
@ -12,6 +12,7 @@
|
||||
* @file
|
||||
* @author Martine Lenders <m.lenders@fu-berlin.de>
|
||||
*/
|
||||
#include <kernel_defines.h>
|
||||
|
||||
#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 */
|
||||
|
||||
/** @} */
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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,
|
||||
|
@ -18,6 +18,7 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <kernel_defines.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#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),
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user