Skip to content

Commit

Permalink
Merge pull request #13626 from leandrolanzieri/pr/kconfig_migrate/gnr…
Browse files Browse the repository at this point in the history
…c/ipv6_nib_rebased

gnrc/ipv6/nib: Expose configurations to Kconfig
  • Loading branch information
miri64 authored Mar 31, 2020
2 parents 9f220e1 + aa2ec68 commit eca9d3d
Show file tree
Hide file tree
Showing 45 changed files with 855 additions and 660 deletions.
4 changes: 2 additions & 2 deletions examples/gnrc_minimal/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ USEMODULE += prng_minstd

CFLAGS += -DLOG_LEVEL=LOG_NONE # disable log output
CFLAGS += -DGNRC_PKTBUF_SIZE=512 -DCONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF=2 \
-DGNRC_NETIF_IPV6_GROUPS_NUMOF=2 -DGNRC_IPV6_NIB_NUMOF=1 \
-DGNRC_IPV6_NIB_OFFL_NUMOF=1 # be able to configure at least one route
-DGNRC_NETIF_IPV6_GROUPS_NUMOF=2 -DCONFIG_GNRC_IPV6_NIB_NUMOF=1 \
-DCONFIG_GNRC_IPV6_NIB_OFFL_NUMOF=1 # be able to configure at least one route

# Enable single interface optimization. Set to 0 if more than one interface is
# present
Expand Down
4 changes: 2 additions & 2 deletions examples/suit_update/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkg/nimble/README.ipv6-over-ble.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
26 changes: 13 additions & 13 deletions sys/include/net/gnrc/ipv6/nib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

Expand All @@ -118,7 +118,7 @@ extern "C" {
* The expected message context is a pointer to a valid on-link entry
* representing the neighbor cache entry that faces a state change.
*
* @note Only handled with @ref GNRC_IPV6_NIB_CONF_ARSM != 0
* @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_ARSM != 0
*/
#define GNRC_IPV6_NIB_REACH_TIMEOUT (0x4fc7U)

Expand All @@ -129,7 +129,7 @@ extern "C" {
* The expected message context is a pointer to a valid on-link entry
* representing the neighbor cache entry that faces a state change.
*
* @note Only handled with @ref GNRC_IPV6_NIB_CONF_ARSM != 0
* @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_ARSM != 0
*/
#define GNRC_IPV6_NIB_DELAY_TIMEOUT (0x4fc8U)

Expand All @@ -140,7 +140,7 @@ extern "C" {
* timeout. The expected message context is a pointer to a valid on-link entry
* representing the neighbor which faces a timeout of its address registration.
*
* @note Only handled with @ref GNRC_IPV6_NIB_CONF_6LR != 0
* @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_6LR != 0
*/
#define GNRC_IPV6_NIB_ADDR_REG_TIMEOUT (0x4fc9U)

Expand All @@ -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)

Expand All @@ -178,7 +178,7 @@ extern "C" {
* time. The expected message context is a valid
* [interface](@ref net_gnrc_netif).
*
* @note Only handled with @ref GNRC_IPV6_NIB_CONF_ARSM != 0
* @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_ARSM != 0
*/
#define GNRC_IPV6_NIB_RECALC_REACH_TIME (0x4fceU)

Expand All @@ -189,7 +189,7 @@ extern "C" {
* upstream router. The expected message context is an IPv6 address assigned to
* one of the nodes interfaces.
*
* @note Only handled with @ref GNRC_IPV6_NIB_CONF_6LN != 0
* @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_6LN != 0
*/
#define GNRC_IPV6_NIB_REREG_ADDRESS (0x4fcfU)

Expand All @@ -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)

Expand All @@ -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)

Expand All @@ -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)

Expand All @@ -230,7 +230,7 @@ extern "C" {
* The expected message context is the [UDP end point](@ref sock_udp_ep_t)
* representing the DNS server.
*
* @note Only handled with @ref GNRC_IPV6_NIB_CONF_DNS != 0
* @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_DNS != 0
*/
#define GNRC_IPV6_NIB_RDNSS_TIMEOUT (0x4fd3U)
/** @} */
Expand Down Expand Up @@ -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
Expand Down
18 changes: 10 additions & 8 deletions sys/include/net/gnrc/ipv6/nib/abr.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#ifndef NET_GNRC_IPV6_NIB_ABR_H
#define NET_GNRC_IPV6_NIB_ABR_H

#include <kernel_defines.h>

#include "net/ipv6/addr.h"
#include "net/gnrc/ipv6/nib/conf.h"

Expand All @@ -38,17 +40,17 @@ typedef struct {
* information is valid */
} gnrc_ipv6_nib_abr_t;

#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C || defined(DOXYGEN)
#if GNRC_IPV6_NIB_CONF_6LBR || 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
*
* @param[in] addr The address of an authoritative border router.
*
* @return 0 on success.
* @return -ENOMEM, if no space is left in the neighbor cache.
* @return -ENOTSUP, if @ref GNRC_IPV6_NIB_CONF_6LBR or
* @ref GNRC_IPV6_NIB_CONF_MULTIHOP_P6C is not defined
* @return -ENOTSUP, if @ref CONFIG_GNRC_IPV6_NIB_6LBR or
* @ref CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C is not defined
*/
int gnrc_ipv6_nib_abr_add(const ipv6_addr_t *addr);

Expand All @@ -58,10 +60,10 @@ int gnrc_ipv6_nib_abr_add(const ipv6_addr_t *addr);
* @param[in] addr The address of an authoritative border router.
*/
void gnrc_ipv6_nib_abr_del(const ipv6_addr_t *addr);
#else /* GNRC_IPV6_NIB_CONF_6LBR || defined(DOXYGEN) */
#else /* CONFIG_GNRC_IPV6_NIB_6LBR || defined(DOXYGEN) */
#define gnrc_ipv6_nib_abr_add(addr) (-ENOTSUP)
#define gnrc_ipv6_nib_abr_del(addr) (void)(addr)
#endif /* GNRC_IPV6_NIB_CONF_6LBR || defined(DOXYGEN) */
#endif /* CONFIG_GNRC_IPV6_NIB_6LBR || defined(DOXYGEN) */

/**
* @brief Iterates over all authoritative border router in the NIB
Expand Down Expand Up @@ -105,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
}
Expand Down
Loading

0 comments on commit eca9d3d

Please sign in to comment.