1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-16 01:53:51 +01:00

Merge pull request #21437 from benpicco/CONFIG_GNRC_IPV6_NIB_SOL_ROUTER

gnrc/ipv6/nib: add option to disable router solicitations
This commit is contained in:
benpicco 2025-04-28 16:08:10 +00:00 committed by GitHub
commit d973ca18a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 98 additions and 86 deletions

View File

@ -32,51 +32,50 @@ extern "C" {
/* some pseudo-module based configuration, doc: see below */ /* some pseudo-module based configuration, doc: see below */
#ifdef MODULE_GNRC_IPV6_NIB_6LBR #ifdef MODULE_GNRC_IPV6_NIB_6LBR
#ifndef CONFIG_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 # endif
#ifndef CONFIG_GNRC_IPV6_NIB_NUMOF # ifndef CONFIG_GNRC_IPV6_NIB_NUMOF
#define CONFIG_GNRC_IPV6_NIB_NUMOF (16) # define CONFIG_GNRC_IPV6_NIB_NUMOF (16)
#endif # endif
#endif #endif
#ifdef MODULE_GNRC_IPV6_NIB_6LR #ifdef MODULE_GNRC_IPV6_NIB_6LR
#ifndef CONFIG_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 # endif
#endif #endif
#ifdef MODULE_GNRC_IPV6_NIB_6LN #ifdef MODULE_GNRC_IPV6_NIB_6LN
#ifndef CONFIG_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 # endif
# ifndef MODULE_GNRC_IPV6_CLASSIC
/* We are only a 6lo node with no 'classic' IPv6 interface */ /* We are only a 6lo node with no 'classic' IPv6 interface */
#ifndef MODULE_GNRC_IPV6_CLASSIC # ifndef CONFIG_GNRC_IPV6_NIB_QUEUE_PKT
#ifndef CONFIG_GNRC_IPV6_NIB_QUEUE_PKT # define CONFIG_GNRC_IPV6_NIB_QUEUE_PKT 0
#define CONFIG_GNRC_IPV6_NIB_QUEUE_PKT 0 # endif
#endif # ifndef CONFIG_GNRC_IPV6_NIB_SLAAC
#ifndef CONFIG_GNRC_IPV6_NIB_SLAAC # define CONFIG_GNRC_IPV6_NIB_SLAAC 0
#define CONFIG_GNRC_IPV6_NIB_SLAAC 0 # endif
#endif # if !CONFIG_GNRC_IPV6_NIB_6LR
#if !CONFIG_GNRC_IPV6_NIB_6LR # ifndef CONFIG_GNRC_IPV6_NIB_ARSM
# ifndef CONFIG_GNRC_IPV6_NIB_ARSM # define CONFIG_GNRC_IPV6_NIB_ARSM 0
# define CONFIG_GNRC_IPV6_NIB_ARSM 0 # endif
# endif # ifndef CONFIG_GNRC_IPV6_NIB_NUMOF
# ifndef CONFIG_GNRC_IPV6_NIB_NUMOF /* only needs to store default router */
/* only needs to store default router */ # define CONFIG_GNRC_IPV6_NIB_NUMOF (1)
# define CONFIG_GNRC_IPV6_NIB_NUMOF (1) # endif
# endif # endif
#endif # endif
#endif
#endif #endif
#ifdef MODULE_GNRC_IPV6_NIB_ROUTER #ifdef MODULE_GNRC_IPV6_NIB_ROUTER
#define CONFIG_GNRC_IPV6_NIB_ROUTER 1 # define CONFIG_GNRC_IPV6_NIB_ROUTER 1
#endif #endif
#ifdef MODULE_GNRC_IPV6_NIB_DNS #ifdef MODULE_GNRC_IPV6_NIB_DNS
#define CONFIG_GNRC_IPV6_NIB_DNS 1 # define CONFIG_GNRC_IPV6_NIB_DNS 1
#endif #endif
/** /**
@ -88,47 +87,54 @@ extern "C" {
* @brief enable features for 6Lo border router * @brief enable features for 6Lo border router
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_6LBR #ifndef CONFIG_GNRC_IPV6_NIB_6LBR
#define CONFIG_GNRC_IPV6_NIB_6LBR 0 # define CONFIG_GNRC_IPV6_NIB_6LBR 0
#endif #endif
/** /**
* @brief enable features for 6Lo router * @brief enable features for 6Lo router
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_6LR #ifndef CONFIG_GNRC_IPV6_NIB_6LR
#if CONFIG_GNRC_IPV6_NIB_6LBR # if CONFIG_GNRC_IPV6_NIB_6LBR
#define CONFIG_GNRC_IPV6_NIB_6LR 1 # define CONFIG_GNRC_IPV6_NIB_6LR 1
#else # else
#define CONFIG_GNRC_IPV6_NIB_6LR 0 # define CONFIG_GNRC_IPV6_NIB_6LR 0
#endif # endif
#endif #endif
/** /**
* @brief enable features for 6Lo node * @brief enable features for 6Lo node
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_6LN #ifndef CONFIG_GNRC_IPV6_NIB_6LN
#if CONFIG_GNRC_IPV6_NIB_6LR # if CONFIG_GNRC_IPV6_NIB_6LR
#define CONFIG_GNRC_IPV6_NIB_6LN 1 # define CONFIG_GNRC_IPV6_NIB_6LN 1
#else # else
#define CONFIG_GNRC_IPV6_NIB_6LN 0 # define CONFIG_GNRC_IPV6_NIB_6LN 0
#endif # endif
#endif #endif
/** /**
* @brief enable features for IPv6 routers * @brief enable features for IPv6 routers
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_ROUTER #ifndef CONFIG_GNRC_IPV6_NIB_ROUTER
#if CONFIG_GNRC_IPV6_NIB_6LR # if CONFIG_GNRC_IPV6_NIB_6LR
#define CONFIG_GNRC_IPV6_NIB_ROUTER 1 # define CONFIG_GNRC_IPV6_NIB_ROUTER 1
#else # else
#define CONFIG_GNRC_IPV6_NIB_ROUTER 0 # define CONFIG_GNRC_IPV6_NIB_ROUTER 0
#endif # endif
#endif #endif
/** /**
* @brief activate router advertising at interface start-up * @brief activate router advertising at interface start-up
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_ADV_ROUTER #ifndef CONFIG_GNRC_IPV6_NIB_ADV_ROUTER
#define CONFIG_GNRC_IPV6_NIB_ADV_ROUTER 0 # define CONFIG_GNRC_IPV6_NIB_ADV_ROUTER 0
#endif
/**
* @brief enable periodic router solicitations
*/
#ifndef CONFIG_GNRC_IPV6_NIB_SOL_ROUTER
# define CONFIG_GNRC_IPV6_NIB_SOL_ROUTER 1
#endif #endif
/** /**
@ -144,7 +150,7 @@ extern "C" {
* Requires the `gnrc_ipv6_nib_rio` module. * Requires the `gnrc_ipv6_nib_rio` module.
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_ADD_RIO_IN_RA #ifndef CONFIG_GNRC_IPV6_NIB_ADD_RIO_IN_RA
#define CONFIG_GNRC_IPV6_NIB_ADD_RIO_IN_RA 0 # define CONFIG_GNRC_IPV6_NIB_ADD_RIO_IN_RA 0
#endif #endif
/** /**
@ -155,25 +161,25 @@ extern "C" {
* Requires the `gnrc_ipv6_nib_rio` module. * Requires the `gnrc_ipv6_nib_rio` module.
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_ADD_RIO_IN_LAST_RA #ifndef CONFIG_GNRC_IPV6_NIB_ADD_RIO_IN_LAST_RA
#if IS_USED(MODULE_GNRC_IPV6_AUTO_SUBNETS) # if IS_USED(MODULE_GNRC_IPV6_AUTO_SUBNETS)
#define CONFIG_GNRC_IPV6_NIB_ADD_RIO_IN_LAST_RA 1 # define CONFIG_GNRC_IPV6_NIB_ADD_RIO_IN_LAST_RA 1
#else # else
#define CONFIG_GNRC_IPV6_NIB_ADD_RIO_IN_LAST_RA 0 # define CONFIG_GNRC_IPV6_NIB_ADD_RIO_IN_LAST_RA 0
#endif # endif
#endif #endif
/** /**
* @brief (de-)activate NDP address resolution state-machine * @brief (de-)activate NDP address resolution state-machine
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_ARSM #ifndef CONFIG_GNRC_IPV6_NIB_ARSM
#define CONFIG_GNRC_IPV6_NIB_ARSM 1 # define CONFIG_GNRC_IPV6_NIB_ARSM 1
#endif #endif
/** /**
* @brief queue packets for address resolution * @brief queue packets for address resolution
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_QUEUE_PKT #ifndef CONFIG_GNRC_IPV6_NIB_QUEUE_PKT
#define CONFIG_GNRC_IPV6_NIB_QUEUE_PKT 1 # define CONFIG_GNRC_IPV6_NIB_QUEUE_PKT 1
#endif #endif
/** /**
@ -183,25 +189,25 @@ extern "C" {
* @see [RFC 4862](https://tools.ietf.org/html/rfc4862) * @see [RFC 4862](https://tools.ietf.org/html/rfc4862)
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_SLAAC #ifndef CONFIG_GNRC_IPV6_NIB_SLAAC
#define CONFIG_GNRC_IPV6_NIB_SLAAC 1 # define CONFIG_GNRC_IPV6_NIB_SLAAC 1
#endif #endif
/** /**
* @brief handle Redirect Messages * @brief handle Redirect Messages
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_REDIRECT #ifndef CONFIG_GNRC_IPV6_NIB_REDIRECT
#define CONFIG_GNRC_IPV6_NIB_REDIRECT 0 # define CONFIG_GNRC_IPV6_NIB_REDIRECT 0
#endif #endif
/** /**
* @brief (de-)activate destination cache * @brief (de-)activate destination cache
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_DC #ifndef CONFIG_GNRC_IPV6_NIB_DC
#if CONFIG_GNRC_IPV6_NIB_REDIRECT # if CONFIG_GNRC_IPV6_NIB_REDIRECT
#define CONFIG_GNRC_IPV6_NIB_DC 1 # define CONFIG_GNRC_IPV6_NIB_DC 1
#else # else
#define CONFIG_GNRC_IPV6_NIB_DC 0 # define CONFIG_GNRC_IPV6_NIB_DC 0
#endif # endif
#endif #endif
/** /**
@ -210,7 +216,7 @@ extern "C" {
* @see [RFC 8106](https://tools.ietf.org/html/rfc8106) * @see [RFC 8106](https://tools.ietf.org/html/rfc8106)
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_DNS #ifndef CONFIG_GNRC_IPV6_NIB_DNS
#define CONFIG_GNRC_IPV6_NIB_DNS 0 # define CONFIG_GNRC_IPV6_NIB_DNS 0
#endif #endif
/** /**
@ -219,11 +225,11 @@ extern "C" {
* @see [RFC 6775, section 8.1](https://tools.ietf.org/html/rfc6775#section-8.1) * @see [RFC 6775, section 8.1](https://tools.ietf.org/html/rfc6775#section-8.1)
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C #ifndef CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C
#if CONFIG_GNRC_IPV6_NIB_6LR # if CONFIG_GNRC_IPV6_NIB_6LR
#define CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C 1 # define CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C 1
#else # else
#define CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C 0 # define CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C 0
#endif # endif
#endif #endif
/** /**
@ -232,7 +238,7 @@ extern "C" {
* @see [RFC 6775, section 8.2](https://tools.ietf.org/html/rfc6775#section-8.2) * @see [RFC 6775, section 8.2](https://tools.ietf.org/html/rfc6775#section-8.2)
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD #ifndef CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD
#define CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD 0 # define CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD 0
#endif #endif
/** @} */ /** @} */
@ -242,7 +248,7 @@ extern "C" {
* @see [RFC 4861, section 6.3.4](https://tools.ietf.org/html/rfc4861#section-6.3.4) * @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 #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 #endif
/** /**
@ -251,14 +257,14 @@ extern "C" {
* @warning Only do this if you know what you're doing * @warning Only do this if you know what you're doing
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_NO_RTR_SOL #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 #endif
/** /**
* @brief Maximum link-layer address length (aligned) * @brief Maximum link-layer address length (aligned)
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_L2ADDR_MAX_LEN #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 #endif
/** /**
@ -268,7 +274,7 @@ extern "C" {
* default routers * default routers
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF #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 #endif
/** /**
@ -278,7 +284,7 @@ extern "C" {
* neighbors and duplicate address detection table entries * neighbors and duplicate address detection table entries
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_NUMOF #ifndef CONFIG_GNRC_IPV6_NIB_NUMOF
#define CONFIG_GNRC_IPV6_NIB_NUMOF (4) # define CONFIG_GNRC_IPV6_NIB_NUMOF (4)
#endif #endif
/** /**
@ -290,7 +296,7 @@ extern "C" {
* @attention This MUST be leq UINT8_MAX * @attention This MUST be leq UINT8_MAX
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_NBR_QUEUE_CAP #ifndef CONFIG_GNRC_IPV6_NIB_NBR_QUEUE_CAP
#define CONFIG_GNRC_IPV6_NIB_NBR_QUEUE_CAP (16) # define CONFIG_GNRC_IPV6_NIB_NBR_QUEUE_CAP (16)
#endif #endif
/** /**
@ -300,16 +306,16 @@ extern "C" {
* and prefix list entries in NIB * and prefix list entries in NIB
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF #ifndef CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF
#define CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF (8) # define CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF (8)
#endif #endif
#if CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C || defined(DOXYGEN) #if CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C || defined(DOXYGEN)
/** /**
* @brief Number of authoritative border router entries in NIB * @brief Number of authoritative border router entries in NIB
*/ */
#ifndef CONFIG_GNRC_IPV6_NIB_ABR_NUMOF # 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
#endif #endif
#endif /* !CONFIG_KCONFIG_MODULE_GNRC_IPV6_NIB || DOXYGEN */ #endif /* !CONFIG_KCONFIG_MODULE_GNRC_IPV6_NIB || DOXYGEN */

View File

@ -105,11 +105,17 @@ static void _handle_rdnss_timeout(sock_udp_ep_t *dns_server);
static inline bool _should_search_rtr(const gnrc_netif_t *netif) static inline bool _should_search_rtr(const gnrc_netif_t *netif)
{ {
/* 6LBR interface does not send RS. /* RS are globally disabled */
A non-advertising router sends RS or a 6LN that is advertising or not if (!CONFIG_GNRC_IPV6_NIB_SOL_ROUTER) {
return false;
}
/* 6LBR interface does not send RS. */
if (gnrc_netif_is_6lbr(netif)) {
return false;
}
/* A non-advertising router sends RS or a 6LN that is advertising or not
has to refetch router information */ has to refetch router information */
return !gnrc_netif_is_6lbr(netif) && return !gnrc_netif_is_rtr_adv(netif) || gnrc_netif_is_6ln(netif);
(!gnrc_netif_is_rtr_adv(netif) || gnrc_netif_is_6ln(netif));
} }
void gnrc_ipv6_nib_init(void) void gnrc_ipv6_nib_init(void)