mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
nib.c: allow selection of interfaces for static link local addresses
This commit is contained in:
parent
3d5582d563
commit
7240d37fc2
@ -181,6 +181,28 @@ extern "C" {
|
||||
#define CONFIG_GNRC_IPV6_STATIC_LLADDR_IS_FIXED 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Select interfaces by driver types for setting static link local
|
||||
* addresses
|
||||
*
|
||||
* This option allows to explicitly include interfaces by matching their
|
||||
* netdev driver types, encoded in a bitmask.
|
||||
* See @ref netdev_type_t for possible values of netdev driver types.
|
||||
* Matching NETDEV_ANY will include all netdev driver types.
|
||||
*
|
||||
* Example usage, includes AT86RF215 and MRF24J40 driver types:
|
||||
*
|
||||
* @code{.c}
|
||||
* #define CONFIG_GNRC_IPV6_STATIC_LLADDR_NETDEV_MASK \
|
||||
* ((1UL << NETDEV_AT86RF215) | (1UL << NETDEV_MRF24J40))
|
||||
* @endcode
|
||||
*
|
||||
* A value of 0 will switch this selection feature off.
|
||||
*/
|
||||
#ifndef CONFIG_GNRC_IPV6_STATIC_LLADDR_NETDEV_MASK
|
||||
#define CONFIG_GNRC_IPV6_STATIC_LLADDR_NETDEV_MASK 0ULL
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Message queue size to use for the IPv6 thread.
|
||||
*/
|
||||
|
@ -116,6 +116,23 @@ void gnrc_ipv6_nib_init(void)
|
||||
static void _add_static_lladdr(gnrc_netif_t *netif)
|
||||
{
|
||||
#ifdef CONFIG_GNRC_IPV6_STATIC_LLADDR
|
||||
#if (CONFIG_GNRC_IPV6_STATIC_LLADDR_NETDEV_MASK) > 0
|
||||
#ifndef MODULE_NETDEV_REGISTER
|
||||
#error "Use of CONFIG_GNRC_IPV6_STATIC_LLADDR_NETDEV_MASK requires MODULE_NETDEV_REGISTER"
|
||||
#endif
|
||||
if (! (((CONFIG_GNRC_IPV6_STATIC_LLADDR_NETDEV_MASK) & (1ULL << netif->dev->type)) ||
|
||||
((CONFIG_GNRC_IPV6_STATIC_LLADDR_NETDEV_MASK) & (1ULL << NETDEV_ANY)))) {
|
||||
DEBUG("nib: interface #%u: not setting static link-local address "
|
||||
"(netdev type %u not included)\n",
|
||||
netif->pid, netif->dev->type);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
DEBUG("nib: interface #%u: adding static link-local address \"%s\"%s\n",
|
||||
netif->pid,
|
||||
CONFIG_GNRC_IPV6_STATIC_LLADDR,
|
||||
IS_ACTIVE(CONFIG_GNRC_IPV6_STATIC_LLADDR_IS_FIXED) ?
|
||||
" (fixed)" : " (+ interface number)");
|
||||
/* parse addr from string and explicitly set a link local prefix
|
||||
* if ifnum > 1 each interface will get its own link local address
|
||||
* with CONFIG_GNRC_IPV6_STATIC_LLADDR + i
|
||||
|
Loading…
Reference in New Issue
Block a user