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

Merge pull request #13065 from PeterKietzmann/pr_kconf_netif

Kconfig: Expose gnrc/netif configurations
This commit is contained in:
Leandro Lanzieri 2020-01-13 13:25:17 +01:00 committed by GitHub
commit 8e6f6ee460
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 100 additions and 60 deletions

View File

@ -24,7 +24,7 @@ USEMODULE += gnrc_icmpv6_echo
USEMODULE += prng_minstd
CFLAGS += -DLOG_LEVEL=LOG_NONE # disable log output
CFLAGS += -DGNRC_PKTBUF_SIZE=512 -DGNRC_NETIF_IPV6_ADDRS_NUMOF=2 \
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

View File

@ -33,7 +33,7 @@ int main(void)
/* get interfaces and print their addresses */
gnrc_netif_t *netif = NULL;
while ((netif = gnrc_netif_iter(netif))) {
ipv6_addr_t ipv6_addrs[GNRC_NETIF_IPV6_ADDRS_NUMOF];
ipv6_addr_t ipv6_addrs[CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF];
int res = gnrc_netapi_get(netif->pid, NETOPT_IPV6_ADDR, 0, ipv6_addrs,
sizeof(ipv6_addrs));

View File

@ -26,7 +26,7 @@
#include "cc110x_params.h"
#include "log.h"
#include "msg.h"
#include "net/gnrc/netif/conf.h" /* <- GNRC_NETIF_MSG_QUEUE_SIZE */
#include "net/gnrc/netif/conf.h" /* <- CONFIG_GNRC_NETIF_MSG_QUEUE_SIZE */
#define ENABLE_DEBUG (0)
#include "debug.h"
@ -34,11 +34,11 @@
/**
* @brief Additional stack size required by the driver
*
* With increasing of GNRC_NETIF_MSG_QUEUE_SIZE the required stack size
* With increasing of CONFIG_GNRC_NETIF_MSG_QUEUE_SIZE the required stack size
* increases as well. A queue size of 8 messages works with default stack size,
* so we increase the stack by `sizeof(msg_t)` for each additional element
*/
#define CC110X_EXTRA_STACKSIZE ((GNRC_NETIF_MSG_QUEUE_SIZE - 8) * sizeof(msg_t))
#define CC110X_EXTRA_STACKSIZE ((CONFIG_GNRC_NETIF_MSG_QUEUE_SIZE - 8) * sizeof(msg_t))
#endif
/**

View File

@ -296,7 +296,7 @@ gnrc_netif_t *gnrc_netif_get_by_pid(kernel_pid_t pid);
* addresses assigned to @p netif. May not be `NULL`
* @param[in] max_len Number of *bytes* available in @p addrs. Must be at
* least `sizeof(ipv6_addr_t)`. It is recommended to use
* @p GNRC_NETIF_IPV6_ADDRS_NUMOF `* sizeof(ipv6_addr_t)
* @p CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF `* sizeof(ipv6_addr_t)
* here (and have @p addrs of the according length).
*
* @return Number of addresses in @p addrs times `sizeof(ipv6_addr_t)` on

View File

@ -53,8 +53,8 @@ extern "C" {
* the thread's stack size might need to be adapted if this is
* changed.
*/
#ifndef GNRC_NETIF_MSG_QUEUE_SIZE
#define GNRC_NETIF_MSG_QUEUE_SIZE (16U)
#ifndef CONFIG_GNRC_NETIF_MSG_QUEUE_SIZE
#define CONFIG_GNRC_NETIF_MSG_QUEUE_SIZE (16U)
#endif
/**
@ -89,8 +89,8 @@ extern "C" {
*
* Default: 2 (1 link-local + 1 global address)
*/
#ifndef GNRC_NETIF_IPV6_ADDRS_NUMOF
#define GNRC_NETIF_IPV6_ADDRS_NUMOF (2)
#ifndef CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF
#define CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF (2)
#endif
/**
@ -100,7 +100,7 @@ extern "C" {
* address) + @ref GNRC_NETIF_RPL_ADDR + @ref GNRC_NETIF_IPV6_RTR_ADDR
*/
#ifndef GNRC_NETIF_IPV6_GROUPS_NUMOF
#define GNRC_NETIF_IPV6_GROUPS_NUMOF (GNRC_NETIF_IPV6_ADDRS_NUMOF + \
#define GNRC_NETIF_IPV6_GROUPS_NUMOF (CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF + \
GNRC_NETIF_RPL_ADDR + \
GNRC_NETIF_IPV6_RTR_ADDR + 1)
#endif
@ -133,8 +133,8 @@ extern "C" {
#endif
#endif
#ifndef GNRC_NETIF_DEFAULT_HL
#define GNRC_NETIF_DEFAULT_HL (64U) /**< default hop limit */
#ifndef CONFIG_GNRC_NETIF_DEFAULT_HL
#define CONFIG_GNRC_NETIF_DEFAULT_HL (64U) /**< default hop limit */
#endif
/**
@ -144,8 +144,8 @@ extern "C" {
*
* This is purely meant as a debugging feature to slow down a radios sending.
*/
#ifndef GNRC_NETIF_MIN_WAIT_AFTER_SEND_US
#define GNRC_NETIF_MIN_WAIT_AFTER_SEND_US (0U)
#ifndef CONFIG_GNRC_NETIF_MIN_WAIT_AFTER_SEND_US
#define CONFIG_GNRC_NETIF_MIN_WAIT_AFTER_SEND_US (0U)
#endif
#ifdef __cplusplus

View File

@ -83,14 +83,14 @@ typedef struct {
*
* @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6".
*/
uint8_t addrs_flags[GNRC_NETIF_IPV6_ADDRS_NUMOF];
uint8_t addrs_flags[CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF];
/**
* @brief IPv6 unicast and anycast addresses of the interface
*
* @note Only available with module @ref net_gnrc_ipv6 "gnrc_ipv6".
*/
ipv6_addr_t addrs[GNRC_NETIF_IPV6_ADDRS_NUMOF];
ipv6_addr_t addrs[CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF];
/**
* @brief IPv6 multicast groups of the interface
@ -162,7 +162,7 @@ typedef struct {
* @note Might also be usable in the later default SLAAC implementation
* for NS retransmission timers.
*/
evtimer_msg_event_t addrs_timers[GNRC_NETIF_IPV6_ADDRS_NUMOF];
evtimer_msg_event_t addrs_timers[CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF];
#endif
#if GNRC_IPV6_NIB_CONF_ROUTER || DOXYGEN

View File

@ -8,6 +8,7 @@ menu "GNRC Network stack"
depends on MODULE_GNRC
rsource "link_layer/lorawan/Kconfig"
rsource "netif/Kconfig"
rsource "network_layer/ipv6/Kconfig"
rsource "network_layer/ipv6/blacklist/Kconfig"
rsource "network_layer/ipv6/whitelist/Kconfig"

View File

@ -0,0 +1,39 @@
# Copyright (c) 2020 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
menuconfig KCONFIG_MODULE_GNRC_NETIF
bool "Configure GNRC network interface"
depends on MODULE_GNRC_NETIF
help
Configure GNRC network interface using Kconfig.
if KCONFIG_MODULE_GNRC_NETIF
config GNRC_NETIF_MSG_QUEUE_SIZE
int "Message queue size for network interface threads"
default 16
config GNRC_NETIF_IPV6_ADDRS_NUMOF
int "Maximum number of unicast and anycast addresses per interface"
default 2
help
If you change this, please make sure that
@ref CONFIG_GNRC_NETIF_IPV6_GROUPS_NUMOF is also large enough to fit the
addresses' solicited nodes multicast addresses.
Default: 2 (1 link-local + 1 global address).
config GNRC_NETIF_DEFAULT_HL
int "Default hop limit"
default 64
config GNRC_NETIF_MIN_WAIT_AFTER_SEND_US
int "Minimum wait time after a send operation"
default 0
help
This value is expressed in microseconds. It is purely meant as a debugging
feature to slow down a radios sending.
endif # KCONFIG_MODULE_GNRC_NETIF

View File

@ -146,7 +146,7 @@ int gnrc_netif_get_from_netdev(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt)
res = 0;
for (unsigned i = 0;
(res < (int)opt->data_len) && (i < GNRC_NETIF_IPV6_ADDRS_NUMOF);
(res < (int)opt->data_len) && (i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF);
i++) {
if (netif->ipv6.addrs_flags[i] != 0) {
memcpy(tgt, &netif->ipv6.addrs[i], sizeof(ipv6_addr_t));
@ -162,7 +162,7 @@ int gnrc_netif_get_from_netdev(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt)
res = 0;
for (unsigned i = 0;
(res < (int)opt->data_len) && (i < GNRC_NETIF_IPV6_ADDRS_NUMOF);
(res < (int)opt->data_len) && (i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF);
i++) {
if (netif->ipv6.addrs_flags[i] != 0) {
*tgt = netif->ipv6.addrs_flags[i];
@ -581,7 +581,7 @@ int gnrc_netif_ipv6_addr_add_internal(gnrc_netif_t *netif,
flags &= ~GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_TENTATIVE;
flags |= 0x1;
}
for (unsigned i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
for (unsigned i = 0; i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
if (ipv6_addr_equal(&netif->ipv6.addrs[i], addr)) {
gnrc_netif_release(netif);
return i;
@ -660,7 +660,7 @@ void gnrc_netif_ipv6_addr_remove_internal(gnrc_netif_t *netif,
assert((netif != NULL) && (addr != NULL));
ipv6_addr_set_solicited_nodes(&sol_nodes, addr);
gnrc_netif_acquire(netif);
for (unsigned i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
for (unsigned i = 0; i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
if (ipv6_addr_equal(&netif->ipv6.addrs[i], addr)) {
netif->ipv6.addrs_flags[i] = 0;
ipv6_addr_set_unspecified(&netif->ipv6.addrs[i]);
@ -713,7 +713,7 @@ ipv6_addr_t *gnrc_netif_ipv6_addr_best_src(gnrc_netif_t *netif,
{
ipv6_addr_t *best_src = NULL;
BITFIELD(candidate_set, GNRC_NETIF_IPV6_ADDRS_NUMOF);
BITFIELD(candidate_set, CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF);
assert((netif != NULL) && (dst != NULL));
DEBUG("gnrc_netif: get best source address for %s\n",
@ -824,7 +824,7 @@ static int _idx(const gnrc_netif_t *netif, const ipv6_addr_t *addr, bool mcast)
{
if (!ipv6_addr_is_unspecified(addr)) {
const ipv6_addr_t *iplist = (mcast) ? netif->ipv6.groups : netif->ipv6.addrs;
unsigned ipmax = (mcast) ? GNRC_NETIF_IPV6_GROUPS_NUMOF : GNRC_NETIF_IPV6_ADDRS_NUMOF;
unsigned ipmax = (mcast) ? GNRC_NETIF_IPV6_GROUPS_NUMOF : CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF;
for (unsigned i = 0; i < ipmax; i++) {
if (ipv6_addr_equal(&iplist[i], addr)) {
return i;
@ -860,7 +860,7 @@ static int _match_to_idx(const gnrc_netif_t *netif,
int idx = -1;
unsigned best_match = 0;
for (int i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
for (int i = 0; i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
unsigned match;
if (netif->ipv6.addrs_flags[i] == 0) {
@ -938,7 +938,7 @@ static int _create_candidate_set(const gnrc_netif_t *netif,
* candidates assigned to this interface. Thus we assume all addresses to be
* on interface @p netif */
(void) dst;
for (int i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
for (int i = 0; i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
const ipv6_addr_t *tmp = &(netif->ipv6.addrs[i]);
DEBUG("Checking address: %s\n",
@ -1037,16 +1037,16 @@ static ipv6_addr_t *_src_addr_selection(gnrc_netif_t *netif,
/* create temporary set for assigning "points" to candidates winning in the
* corresponding rules.
*/
uint8_t winner_set[GNRC_NETIF_IPV6_ADDRS_NUMOF];
uint8_t winner_set[CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF];
memset(winner_set, 0, GNRC_NETIF_IPV6_ADDRS_NUMOF);
memset(winner_set, 0, CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF);
uint8_t max_pts = 0;
/* _create_candidate_set() assures that `dst` is not unspecified and if
* `dst` is loopback rule 1 will fire anyway. */
uint8_t dst_scope = _get_scope(dst);
DEBUG("finding the best match within the source address candidates\n");
for (unsigned i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
for (unsigned i = 0; i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
ipv6_addr_t *ptr = &(netif->ipv6.addrs[i]);
DEBUG("Checking address: %s\n",
@ -1116,7 +1116,7 @@ static ipv6_addr_t *_src_addr_selection(gnrc_netif_t *netif,
* rule 8: Use longest matching prefix.*/
uint8_t best_match = 0;
/* collect candidates with maximum points */
for (int i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
for (int i = 0; i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
if (winner_set[i] == max_pts) {
const ipv6_addr_t *addr = &netif->ipv6.addrs[i];
unsigned match = ipv6_addr_match_prefix(addr, dst);
@ -1329,7 +1329,7 @@ void gnrc_netif_default_init(gnrc_netif_t *netif)
#ifdef DEVELHELP
_test_options(netif);
#endif
netif->cur_hl = GNRC_NETIF_DEFAULT_HL;
netif->cur_hl = CONFIG_GNRC_NETIF_DEFAULT_HL;
#ifdef MODULE_GNRC_IPV6_NIB
gnrc_ipv6_nib_init_iface(netif);
#endif
@ -1342,7 +1342,7 @@ static void *_gnrc_netif_thread(void *args)
netdev_t *dev;
int res;
msg_t reply = { .type = GNRC_NETAPI_MSG_TYPE_ACK };
msg_t msg, msg_queue[GNRC_NETIF_MSG_QUEUE_SIZE];
msg_t msg, msg_queue[CONFIG_GNRC_NETIF_MSG_QUEUE_SIZE];
DEBUG("gnrc_netif: starting thread %i\n", sched_active_pid);
netif = args;
@ -1350,7 +1350,7 @@ static void *_gnrc_netif_thread(void *args)
dev = netif->dev;
netif->pid = sched_active_pid;
/* setup the link-layer's message queue */
msg_init_queue(msg_queue, GNRC_NETIF_MSG_QUEUE_SIZE);
msg_init_queue(msg_queue, CONFIG_GNRC_NETIF_MSG_QUEUE_SIZE);
/* register the event callback with the device driver */
dev->event_callback = _event_cb;
dev->context = netif;
@ -1376,7 +1376,7 @@ static void *_gnrc_netif_thread(void *args)
#endif
/* now let rest of GNRC use the interface */
gnrc_netif_release(netif);
#if (GNRC_NETIF_MIN_WAIT_AFTER_SEND_US > 0U)
#if (CONFIG_GNRC_NETIF_MIN_WAIT_AFTER_SEND_US > 0U)
xtimer_ticks32_t last_wakeup = xtimer_now();
#endif
@ -1401,11 +1401,11 @@ static void *_gnrc_netif_thread(void *args)
netif->stats.tx_bytes += res;
}
#endif
#if (GNRC_NETIF_MIN_WAIT_AFTER_SEND_US > 0U)
#if (CONFIG_GNRC_NETIF_MIN_WAIT_AFTER_SEND_US > 0U)
xtimer_periodic_wakeup(&last_wakeup,
GNRC_NETIF_MIN_WAIT_AFTER_SEND_US);
CONFIG_GNRC_NETIF_MIN_WAIT_AFTER_SEND_US);
/* override last_wakeup in case last_wakeup +
* GNRC_NETIF_MIN_WAIT_AFTER_SEND_US was in the past */
* CONFIG_GNRC_NETIF_MIN_WAIT_AFTER_SEND_US was in the past */
last_wakeup = xtimer_now();
#endif
break;

View File

@ -354,7 +354,7 @@ static int _fill_ipv6_hdr(gnrc_netif_t *netif, gnrc_pktsnip_t *ipv6)
if (hdr->hl == 0) {
if (netif == NULL) {
hdr->hl = GNRC_NETIF_DEFAULT_HL;
hdr->hl = CONFIG_GNRC_NETIF_DEFAULT_HL;
}
else {
hdr->hl = netif->cur_hl;

View File

@ -134,7 +134,7 @@ static bool _try_addr_reconfiguration(gnrc_netif_t *netif)
gnrc_netif_acquire(netif);
if (hwaddr_reconf) {
if (remove_old) {
for (unsigned i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
for (unsigned i = 0; i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
ipv6_addr_t *addr = &netif->ipv6.addrs[i];
if (addr->u64[1].u64 == orig_iid.uint64.u64) {
gnrc_netif_ipv6_addr_remove_internal(netif, addr);

View File

@ -670,7 +670,7 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
if ((dr != NULL) && gnrc_netif_is_6ln(netif) &&
!gnrc_netif_is_6lbr(netif)) {
/* (register addresses already assigned but not valid yet)*/
for (int i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
for (int i = 0; i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
if ((netif->ipv6.addrs_flags[i] != 0) &&
(netif->ipv6.addrs_flags[i] != GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID)) {
_handle_rereg_address(&netif->ipv6.addrs[i]);
@ -1243,7 +1243,7 @@ static void _handle_pfx_timeout(_nib_offl_entry_t *pfx)
gnrc_netif_acquire(netif);
if (now >= pfx->valid_until) {
evtimer_del(&_nib_evtimer, &pfx->pfx_timeout.event);
for (int i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
for (int i = 0; i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
if (ipv6_addr_match_prefix(&netif->ipv6.addrs[i],
&pfx->pfx) >= pfx->pfx_len) {
gnrc_netif_ipv6_addr_remove_internal(netif,
@ -1254,7 +1254,7 @@ static void _handle_pfx_timeout(_nib_offl_entry_t *pfx)
_nib_offl_clear(pfx);
}
else if (now >= pfx->pref_until) {
for (int i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
for (int i = 0; i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
if (ipv6_addr_match_prefix(&netif->ipv6.addrs[i],
&pfx->pfx) >= pfx->pfx_len) {
netif->ipv6.addrs_flags[i] &= ~GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_MASK;

View File

@ -442,7 +442,7 @@ static void _netif_list_groups(ipv6_addr_t *addr)
static void _netif_list(netif_t *iface)
{
#ifdef MODULE_GNRC_IPV6
ipv6_addr_t ipv6_addrs[GNRC_NETIF_IPV6_ADDRS_NUMOF];
ipv6_addr_t ipv6_addrs[CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF];
ipv6_addr_t ipv6_groups[GNRC_NETIF_IPV6_GROUPS_NUMOF];
#endif
uint8_t hwaddr[GNRC_NETIF_L2ADDR_MAXLEN];
@ -614,7 +614,7 @@ static void _netif_list(netif_t *iface)
res = netif_get_opt(iface, NETOPT_IPV6_ADDR, 0, ipv6_addrs,
sizeof(ipv6_addrs));
if (res >= 0) {
uint8_t ipv6_addrs_flags[GNRC_NETIF_IPV6_ADDRS_NUMOF];
uint8_t ipv6_addrs_flags[CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF];
memset(ipv6_addrs_flags, 0, sizeof(ipv6_addrs_flags));
/* assume it to succeed (otherwise array will stay 0) */

View File

@ -542,7 +542,7 @@ static gnrc_pktsnip_t *_build_udp_packet(const ipv6_addr_t *dst,
ipv6_hdr = hdr->data;
ipv6_hdr->len = byteorder_htons(gnrc_pkt_len(payload));
ipv6_hdr->nh = PROTNUM_UDP;
ipv6_hdr->hl = GNRC_NETIF_DEFAULT_HL;
ipv6_hdr->hl = CONFIG_GNRC_NETIF_DEFAULT_HL;
gnrc_udp_calc_csum(payload, hdr);
payload = hdr;
hdr = gnrc_netif_hdr_build(NULL, 0, NULL, 0);
@ -618,7 +618,7 @@ static int send_test_pkt(int argc, char **argv)
(void) argv;
printf("Sending UDP test packets to port %u\n", TEST_PORT);
for (unsigned i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
for (unsigned i = 0; i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
if (ipv6_addr_is_link_local(&eth_netif->ipv6.addrs[i])) {
local_addr = &eth_netif->ipv6.addrs[i];
}

View File

@ -78,7 +78,7 @@ static void _set_up(void)
gnrc_netif_acquire(_mock_netif);
/* reset some fields not set by the nib interface initializer */
_mock_netif->ipv6.mtu = ETHERNET_DATA_LEN;
_mock_netif->cur_hl = GNRC_NETIF_DEFAULT_HL;
_mock_netif->cur_hl = CONFIG_GNRC_NETIF_DEFAULT_HL;
gnrc_netif_ipv6_addr_remove_internal(_mock_netif, &_loc_gb);
gnrc_netif_release(_mock_netif);
memset(_buffer, 0, sizeof(_buffer));
@ -887,7 +887,7 @@ static uint8_t _netif_addr_count(const gnrc_netif_t *netif)
{
unsigned count = 0U;
for (int i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
for (int i = 0; i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
if (netif->ipv6.addrs_flags[i] != 0) {
count++;
}

View File

@ -87,7 +87,7 @@ static void _set_up(void)
gnrc_netif_acquire(_mock_netif);
/* reset some fields not set by the nib interface initializer */
_mock_netif->ipv6.mtu = IPV6_MIN_MTU;
_mock_netif->cur_hl = GNRC_NETIF_DEFAULT_HL;
_mock_netif->cur_hl = CONFIG_GNRC_NETIF_DEFAULT_HL;
gnrc_netif_ipv6_addr_remove_internal(_mock_netif, &_loc_gb);
gnrc_netif_release(_mock_netif);
memset(_buffer, 0, sizeof(_buffer));
@ -797,7 +797,7 @@ static uint8_t _netif_addr_count(const gnrc_netif_t *netif)
{
unsigned count = 0U;
for (int i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
for (int i = 0; i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
if (netif->ipv6.addrs_flags[i] != 0) {
count++;
}

View File

@ -126,7 +126,7 @@ static void test_creation(void)
TEST_ASSERT_NOT_NULL(ethernet_netif->ops);
TEST_ASSERT_NOT_NULL(ethernet_netif->dev);
TEST_ASSERT_EQUAL_INT(ETHERNET_DATA_LEN, ethernet_netif->ipv6.mtu);
TEST_ASSERT_EQUAL_INT(GNRC_NETIF_DEFAULT_HL, ethernet_netif->cur_hl);
TEST_ASSERT_EQUAL_INT(CONFIG_GNRC_NETIF_DEFAULT_HL, ethernet_netif->cur_hl);
TEST_ASSERT_EQUAL_INT(NETDEV_TYPE_ETHERNET, ethernet_netif->device_type);
TEST_ASSERT(ethernet_netif->pid > KERNEL_PID_UNDEF);
#ifdef DEVELHELP
@ -147,7 +147,7 @@ static void test_creation(void)
TEST_ASSERT_EQUAL_INT(IPV6_MIN_MTU, ieee802154_netif->ipv6.mtu);
TEST_ASSERT_EQUAL_INT(TEST_IEEE802154_MAX_FRAG_SIZE,
ieee802154_netif->sixlo.max_frag_size);
TEST_ASSERT_EQUAL_INT(GNRC_NETIF_DEFAULT_HL, ieee802154_netif->cur_hl);
TEST_ASSERT_EQUAL_INT(CONFIG_GNRC_NETIF_DEFAULT_HL, ieee802154_netif->cur_hl);
TEST_ASSERT_EQUAL_INT(NETDEV_TYPE_IEEE802154,
ieee802154_netif->device_type);
TEST_ASSERT(ieee802154_netif->pid > KERNEL_PID_UNDEF);
@ -163,7 +163,7 @@ static void test_creation(void)
)));
TEST_ASSERT_NOT_NULL(netifs[i]->ops);
TEST_ASSERT_NOT_NULL(netifs[i]->dev);
TEST_ASSERT_EQUAL_INT(GNRC_NETIF_DEFAULT_HL, netifs[i]->cur_hl);
TEST_ASSERT_EQUAL_INT(CONFIG_GNRC_NETIF_DEFAULT_HL, netifs[i]->cur_hl);
TEST_ASSERT_EQUAL_INT(NETDEV_TYPE_TEST, netifs[i]->device_type);
TEST_ASSERT(netifs[i]->pid > KERNEL_PID_UNDEF);
TEST_ASSERT(thread_has_msg_queue(sched_threads[netifs[i]->pid]));
@ -239,7 +239,7 @@ static void test_ipv6_addr_add__ENOMEM(void)
{
ipv6_addr_t addr = { .u8 = NETIF0_IPV6_G };
for (unsigned i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF;
for (unsigned i = 0; i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF;
i++, addr.u16[3].u16++) {
TEST_ASSERT(0 <= gnrc_netif_ipv6_addr_add_internal(netifs[0], &addr, 64U,
GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID));
@ -509,7 +509,7 @@ static void test_ipv6_addr_best_src__deprecated_addr(void)
test_ipv6_addr_add__success(); /* adds EUI-64 based link-local address */
/* ensure that current addresses have smaller matches */
for (unsigned i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
for (unsigned i = 0; i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
ipv6_addr_t *addr = &netifs[0]->ipv6.addrs[i];
TEST_ASSERT(exp_match > ipv6_addr_match_prefix(addr, &dst));
}
@ -747,7 +747,7 @@ static void test_netapi_get__HOP_LIMIT(void)
static void test_netapi_get__IPV6_ADDR(void)
{
static const ipv6_addr_t exp = { NETIF0_IPV6_LL };
ipv6_addr_t value[GNRC_NETIF_IPV6_ADDRS_NUMOF];
ipv6_addr_t value[CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF];
test_ipv6_addr_add__success();
TEST_ASSERT_EQUAL_INT(sizeof(ipv6_addr_t), gnrc_netapi_get(netifs[0]->pid,
@ -759,7 +759,7 @@ static void test_netapi_get__IPV6_ADDR(void)
static void test_netapi_get__IPV6_ADDR_FLAGS(void)
{
uint8_t value[GNRC_NETIF_IPV6_ADDRS_NUMOF];
uint8_t value[CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF];
test_ipv6_addr_add__success();
TEST_ASSERT_EQUAL_INT(sizeof(uint8_t), gnrc_netapi_get(netifs[0]->pid,

View File

@ -31,7 +31,7 @@ USEMODULE += posix_inet
LOW_MEMORY_BOARDS := nucleo-f334r8 msb-430 msb-430h
ifeq ($(BOARD),$(filter $(BOARD),$(LOW_MEMORY_BOARDS)))
CFLAGS += -DGNRC_PKTBUF_SIZE=512 -DGNRC_NETIF_IPV6_ADDRS_NUMOF=2 \
CFLAGS += -DGNRC_PKTBUF_SIZE=512 -DCONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF=2 \
-DGNRC_NETIF_IPV6_GROUPS_NUMOF=2 -DGNRC_IPV6_NIB_NUMOF=1 \
-DNRC_IPV6_NIB_OFFL_NUMOF=1
endif

View File

@ -86,12 +86,12 @@ static int _list_all_inet6(int argc, char **argv)
unsigned addr_qty = 0;
while ((netif = gnrc_netif_iter(netif))) {
ipv6_addr_t ipv6_addrs[GNRC_NETIF_IPV6_ADDRS_NUMOF];
ipv6_addr_t ipv6_addrs[CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF];
int res = gnrc_netapi_get(netif->pid, NETOPT_IPV6_ADDR, 0, ipv6_addrs,
sizeof(ipv6_addrs));
if (res >= 0) {
uint8_t ipv6_addrs_flags[GNRC_NETIF_IPV6_ADDRS_NUMOF];
uint8_t ipv6_addrs_flags[CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF];
memset(ipv6_addrs_flags, 0, sizeof(ipv6_addrs_flags));
/* assume it to succeed (otherwise array will stay 0) */