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_SLAAC to 'CONFIG_' namespace

Also evaluate it using IS_ACTIVE macro.
This commit is contained in:
Leandro Lanzieri 2020-03-12 14:04:20 +01:00
parent 49ec28867c
commit ce931f179c
No known key found for this signature in database
GPG Key ID: 39607DE6080007A3
10 changed files with 41 additions and 40 deletions

View File

@ -213,7 +213,7 @@ the prefix (`2001:db8::`) and the EUI64 suffix, in this case `7b7e:3255:1313:8d9
- Provision the wireless ble device:
```
$ CFLAGS=-DGNRC_IPV6_NIB_CONF_SLAAC=1 USEMODULE+=nimble_autoconn_ipsp USE_ETHOS=0 BOARD=nrf52dk make -C examples/suit_update clean flash -j4
$ CFLAGS=-DCONFIG_GNRC_IPV6_NIB_SLAAC=1 USEMODULE+=nimble_autoconn_ipsp USE_ETHOS=0 BOARD=nrf52dk make -C examples/suit_update clean flash -j4
```
- Open a serial terminal on the device to get its local address:
@ -237,7 +237,7 @@ the prefix (`2001:db8::`) and the EUI64 suffix, in this case `7b7e:3255:1313:8d9
**NOTE 2:** Currently, Linux does not support 6LoWPAN neighbor discovery (which
RIOT uses per default with BLE), so RIOT needs to be compiled to use stateless
address auto configuration (SLAAC) -> `CFLAGS=-DGNRC_IPV6_NIB_CONF_SLAAC=1`.
address auto configuration (SLAAC) -> `CFLAGS=-DCONFIG_GNRC_IPV6_NIB_SLAAC=1`.
- Use `bluetoothctl` on Linux to scan for the device. Once `bluetoothctl` has
started, issue `scan on` to start scanning. The default name for the RIOT

View File

@ -8,7 +8,7 @@ the moment and does suffer stability issues!
**NOTE 2:** Currently, Linux does not support 6LoWPAN neighbor discovery (which
RIOT uses per default with BLE), so RIOT needs to be compiled to use stateless
address auto configuration (SLAAC) -> `CFLAGS=-DGNRC_IPV6_NIB_CONF_SLAAC=1`.
address auto configuration (SLAAC) -> `CFLAGS=-DCONFIG_GNRC_IPV6_NIB_SLAAC=1`.
## Prerequisites
@ -27,7 +27,7 @@ following:
First, you compile and flash the `examples/gnrc_networking` application to your
RIOT device. When doing this, make sure to enable SLAAC
(`CFLAGS=-DGNRC_IPV6_NIB_CONF_SLAAC=1`), see note above.
(`CFLAGS=-DCONFIG_GNRC_IPV6_NIB_SLAAC=1`), see note above.
Once the firmware is running, you can verify it by typing

View File

@ -209,7 +209,7 @@ extern "C" {
* This message type is for performing DAD for a given address. The expected
* message context is a TENTATIVE IPv6 address.
*
* @note Only handled with @ref GNRC_IPV6_NIB_CONF_SLAAC != 0
* @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_SLAAC != 0
*/
#define GNRC_IPV6_NIB_DAD (0x4fd1U)
@ -219,7 +219,7 @@ extern "C" {
* Moves a TENTATIVE address to VALID state. The expected message context is a
* TENTATIVE IPv6 address.
*
* @note Only handled with @ref GNRC_IPV6_NIB_CONF_SLAAC != 0
* @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_SLAAC != 0
*/
#define GNRC_IPV6_NIB_VALID_ADDR (0x4fd2U)

View File

@ -32,8 +32,8 @@ extern "C" {
#ifndef CONFIG_GNRC_IPV6_NIB_6LBR
#define CONFIG_GNRC_IPV6_NIB_6LBR 1
#endif
#ifndef GNRC_IPV6_NIB_CONF_SLAAC
#define GNRC_IPV6_NIB_CONF_SLAAC 1
#ifndef CONFIG_GNRC_IPV6_NIB_SLAAC
#define CONFIG_GNRC_IPV6_NIB_SLAAC 1
#endif
#ifndef GNRC_IPV6_NIB_NUMOF
#define GNRC_IPV6_NIB_NUMOF (16)
@ -44,8 +44,8 @@ extern "C" {
#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
#ifndef CONFIG_GNRC_IPV6_NIB_SLAAC
#define CONFIG_GNRC_IPV6_NIB_SLAAC 0
#endif
#endif
@ -53,8 +53,8 @@ extern "C" {
#ifndef CONFIG_GNRC_IPV6_NIB_6LN
#define CONFIG_GNRC_IPV6_NIB_6LN 1
#endif
#ifndef GNRC_IPV6_NIB_CONF_SLAAC
#define GNRC_IPV6_NIB_CONF_SLAAC 0
#ifndef CONFIG_GNRC_IPV6_NIB_SLAAC
#define CONFIG_GNRC_IPV6_NIB_SLAAC 0
#endif
#ifndef GNRC_IPV6_NIB_CONF_QUEUE_PKT
#define GNRC_IPV6_NIB_CONF_QUEUE_PKT 0
@ -159,8 +159,8 @@ extern "C" {
*
* @see [RFC 4862](https://tools.ietf.org/html/rfc4862)
*/
#ifndef GNRC_IPV6_NIB_CONF_SLAAC
#define GNRC_IPV6_NIB_CONF_SLAAC 1
#ifndef CONFIG_GNRC_IPV6_NIB_SLAAC
#define CONFIG_GNRC_IPV6_NIB_SLAAC 1
#endif
/**

View File

@ -152,14 +152,14 @@ typedef struct {
* and @ref net_gnrc_ipv6_nib "NIB"
*/
evtimer_msg_event_t search_rtr;
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || GNRC_IPV6_NIB_CONF_SLAAC || DOXYGEN
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC) || DOXYGEN
/**
* @brief Timers for address re-registration
*
* @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6" and
* @ref net_gnrc_ipv6_nib "NIB" and if
* @ref CONFIG_GNRC_IPV6_NIB_6LN != 0 or
* @ref GNRC_IPV6_NIB_CONF_SLAAC != 0
* @ref CONFIG_GNRC_IPV6_NIB_SLAAC != 0
* @note Might also be usable in the later default SLAAC implementation
* for NS retransmission timers.
*/

View File

@ -637,7 +637,7 @@ int gnrc_netif_ipv6_addr_add_internal(gnrc_netif_t *netif,
UINT32_MAX, UINT32_MAX);
}
}
#if GNRC_IPV6_NIB_CONF_SLAAC
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC)
else if (!gnrc_netif_is_6ln(netif)) {
/* cast to remove const qualifier (will still be used NIB internally as
* const) */

View File

@ -26,7 +26,7 @@
#define ENABLE_DEBUG (0)
#include "debug.h"
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || GNRC_IPV6_NIB_CONF_SLAAC
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC)
static char addr_str[IPV6_ADDR_MAX_STR_LEN];
void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx,
@ -36,11 +36,11 @@ void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx,
int idx;
uint8_t flags = GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_TENTATIVE;
#if !GNRC_IPV6_NIB_CONF_SLAAC
#if !IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC)
if (!gnrc_netif_is_6ln(netif)) {
LOG_WARNING("SLAAC not activated; will not auto-configure IPv6 address "
"for interface %u.\n"
" Use GNRC_IPV6_NIB_CONF_SLAAC=1 to activate.\n",
" Use CONFIG_GNRC_IPV6_NIB_SLAAC=1 to activate.\n",
netif->pid);
return;
}
@ -89,9 +89,9 @@ void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx,
(void)idx;
#endif /* CONFIG_GNRC_IPV6_NIB_6LN */
}
#endif /* CONFIG_GNRC_IPV6_NIB_6LN || GNRC_IPV6_NIB_CONF_SLAAC */
#endif /* CONFIG_GNRC_IPV6_NIB_6LN || CONFIG_GNRC_IPV6_NIB_SLAAC */
#if GNRC_IPV6_NIB_CONF_SLAAC
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC)
static bool _try_l2addr_reconfiguration(gnrc_netif_t *netif)
{
uint8_t hwaddr[GNRC_NETIF_L2ADDR_MAXLEN];
@ -217,8 +217,8 @@ void _handle_valid_addr(const ipv6_addr_t *addr)
gnrc_netif_release(netif);
}
}
#else /* GNRC_IPV6_NIB_CONF_SLAAC */
#else /* CONFIG_GNRC_IPV6_NIB_SLAAC */
typedef int dont_be_pedantic;
#endif /* GNRC_IPV6_NIB_CONF_SLAAC */
#endif /* CONFIG_GNRC_IPV6_NIB_SLAAC */
/** @} */

View File

@ -13,7 +13,7 @@
*
* @file
* @brief Definions related to SLAAC functionality of the NIB
* @see @ref GNRC_IPV6_NIB_CONF_SLAAC
* @see @ref CONFIG_GNRC_IPV6_NIB_SLAAC
* @internal
*
* @author Martine Lenders <m.lenders@fu-berlin.de>
@ -21,6 +21,7 @@
#ifndef PRIV_NIB_SLAAC_H
#define PRIV_NIB_SLAAC_H
#include <kernel_defines.h>
#include <stdint.h>
#include "net/gnrc/ipv6/nib/conf.h"
@ -31,7 +32,7 @@
extern "C" {
#endif
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || GNRC_IPV6_NIB_CONF_SLAAC || defined(DOXYGEN)
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC) || defined(DOXYGEN)
/**
* @brief Auto-configures an address from a given prefix
*
@ -41,11 +42,11 @@ extern "C" {
*/
void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx,
uint8_t pfx_len);
#else /* CONFIG_GNRC_IPV6_NIB_6LN || GNRC_IPV6_NIB_CONF_SLAAC */
#else /* CONFIG_GNRC_IPV6_NIB_6LN || CONFIG_GNRC_IPV6_NIB_SLAAC */
#define _auto_configure_addr(netif, pfx, pfx_len) \
(void)netif; (void)pfx; (void)pfx_len;
#endif /* CONFIG_GNRC_IPV6_NIB_6LN || GNRC_IPV6_NIB_CONF_SLAAC */
#if GNRC_IPV6_NIB_CONF_SLAAC || defined(DOXYGEN)
#endif /* CONFIG_GNRC_IPV6_NIB_6LN || CONFIG_GNRC_IPV6_NIB_SLAAC */
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC) || defined(DOXYGEN)
/**
* @brief Removes a tentative address from the interface and tries to
* reconfigure a new address
@ -68,12 +69,12 @@ void _handle_dad(const ipv6_addr_t *addr);
* @param[in] addr A TENTATIVE address.
*/
void _handle_valid_addr(const ipv6_addr_t *addr);
#else /* GNRC_IPV6_NIB_CONF_SLAAC */
#else /* CONFIG_GNRC_IPV6_NIB_SLAAC */
#define _remove_tentative_addr(netif, addr) \
(void)netif; (void)addr
#define _handle_dad(addr) (void)addr
#define _handle_valid_addr(addr) (void)addr
#endif /* GNRC_IPV6_NIB_CONF_SLAAC */
#endif /* CONFIG_GNRC_IPV6_NIB_SLAAC */
#ifdef __cplusplus
}

View File

@ -128,11 +128,11 @@ void gnrc_ipv6_nib_init_iface(gnrc_netif_t *netif)
_init_iface_arsm(netif);
netif->ipv6.retrans_time = NDP_RETRANS_TIMER_MS;
#if GNRC_IPV6_NIB_CONF_SLAAC || IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN)
/* TODO: set differently dependent on GNRC_IPV6_NIB_CONF_SLAAC if
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC) || IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN)
/* TODO: set differently dependent on CONFIG_GNRC_IPV6_NIB_SLAAC if
* alternatives exist */
netif->ipv6.aac_mode = GNRC_NETIF_AAC_AUTO;
#endif /* GNRC_IPV6_NIB_CONF_SLAAC || CONFIG_GNRC_IPV6_NIB_6LN */
#endif /* CONFIG_GNRC_IPV6_NIB_SLAAC || CONFIG_GNRC_IPV6_NIB_6LN */
_init_iface_router(netif);
gnrc_netif_init_6ln(netif);
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN)
@ -909,7 +909,7 @@ static void _handle_nbr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
ipv6_addr_to_str(addr_str, &ipv6->src, sizeof(addr_str)));
DEBUG(" - Destination address: %s\n",
ipv6_addr_to_str(addr_str, &ipv6->dst, sizeof(addr_str)));
#if GNRC_IPV6_NIB_CONF_SLAAC
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC)
gnrc_netif_t *tgt_netif = gnrc_netif_get_by_ipv6_addr(&nbr_sol->tgt);
if (tgt_netif != NULL) {
@ -929,7 +929,7 @@ static void _handle_nbr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
return;
}
}
#endif /* GNRC_IPV6_NIB_CONF_SLAAC */
#endif /* CONFIG_GNRC_IPV6_NIB_SLAAC */
if (ipv6_addr_is_unspecified(&ipv6->src)) {
gnrc_ndp_nbr_adv_send(&nbr_sol->tgt, netif, &ipv6->src, false, NULL);
}
@ -1041,7 +1041,7 @@ static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
(nbr_adv->flags & NDP_NBR_ADV_FLAGS_R) ? 'R' : '-',
(nbr_adv->flags & NDP_NBR_ADV_FLAGS_S) ? 'S' : '-',
(nbr_adv->flags & NDP_NBR_ADV_FLAGS_O) ? 'O' : '-');
#if GNRC_IPV6_NIB_CONF_SLAAC
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC)
gnrc_netif_t *tgt_netif = gnrc_netif_get_by_ipv6_addr(&nbr_adv->tgt);
if (tgt_netif != NULL) {
@ -1059,7 +1059,7 @@ static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
/* else case beyond scope of RFC4862:
* https://tools.ietf.org/html/rfc4862#section-5.4.4 */
}
#endif /* GNRC_IPV6_NIB_CONF_SLAAC */
#endif /* CONFIG_GNRC_IPV6_NIB_SLAAC */
if (((nce = _nib_onl_get(&nbr_adv->tgt, netif->pid)) != NULL) &&
(nce->mode & _NC)) {
#if GNRC_IPV6_NIB_CONF_ARSM
@ -1101,7 +1101,7 @@ static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
_handle_adv_l2(netif, nce, (icmpv6_hdr_t *)nbr_adv, NULL);
}
#endif /* GNRC_IPV6_NIB_CONF_ARSM */
#if GNRC_IPV6_NIB_CONF_SLAAC && IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN)
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC) && IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN)
/* 6Lo-ND duplicate address detection (DAD) was ignored by neighbor, try
* traditional DAD */
if ((aro_status == _ADDR_REG_STATUS_UNAVAIL) &&

View File

@ -13,7 +13,7 @@ USEMODULE += od
# deactivate automatically emitted packets from IPv6 neighbor discovery
CFLAGS += -DGNRC_IPV6_NIB_CONF_ARSM=0
CFLAGS += -DGNRC_IPV6_NIB_CONF_SLAAC=0
CFLAGS += -DCONFIG_GNRC_IPV6_NIB_SLAAC=0
CFLAGS += -DGNRC_IPV6_NIB_CONF_NO_RTR_SOL=1
CFLAGS += -DGNRC_NETIF_ADDRS_NUMOF=16
CFLAGS += -DGNRC_NETIF_GROUPS_NUMOF=8