mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
gnrc/ipv6/nib: add Kconfig for static link-local address
This commit is contained in:
parent
7196b0a2ae
commit
4a5757b9af
@ -54,7 +54,7 @@ endif
|
|||||||
# this might be useful for testing, in cases where you cannot or do not want to
|
# this might be useful for testing, in cases where you cannot or do not want to
|
||||||
# run a shell with ifconfig to get the real link lokal address.
|
# run a shell with ifconfig to get the real link lokal address.
|
||||||
#IPV6_STATIC_LLADDR ?= '"fe80::cafe:cafe:cafe:1"'
|
#IPV6_STATIC_LLADDR ?= '"fe80::cafe:cafe:cafe:1"'
|
||||||
#CFLAGS += -DGNRC_IPV6_STATIC_LLADDR=$(IPV6_STATIC_LLADDR)
|
#CFLAGS += -DCONFIG_GNRC_IPV6_STATIC_LLADDR=$(IPV6_STATIC_LLADDR)
|
||||||
|
|
||||||
# Uncomment this to join RPL DODAGs even if DIOs do not contain
|
# Uncomment this to join RPL DODAGs even if DIOs do not contain
|
||||||
# DODAG Configuration Options (see the doc for more info)
|
# DODAG Configuration Options (see the doc for more info)
|
||||||
|
@ -49,7 +49,7 @@ DEVELHELP ?= 1
|
|||||||
# this might be useful for testing, in cases where you cannot or do not want to
|
# this might be useful for testing, in cases where you cannot or do not want to
|
||||||
# run a shell with ifconfig to get the real link lokal address.
|
# run a shell with ifconfig to get the real link lokal address.
|
||||||
#IPV6_STATIC_LLADDR ?= '"fe80::cafe:cafe:cafe:1"'
|
#IPV6_STATIC_LLADDR ?= '"fe80::cafe:cafe:cafe:1"'
|
||||||
#CFLAGS += -DGNRC_IPV6_STATIC_LLADDR=$(IPV6_STATIC_LLADDR)
|
#CFLAGS += -DCONFIG_GNRC_IPV6_STATIC_LLADDR=$(IPV6_STATIC_LLADDR)
|
||||||
|
|
||||||
# Uncomment this to join RPL DODAGs even if DIOs do not contain
|
# Uncomment this to join RPL DODAGs even if DIOs do not contain
|
||||||
# DODAG Configuration Options (see the doc for more info)
|
# DODAG Configuration Options (see the doc for more info)
|
||||||
|
@ -164,18 +164,18 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.mk}
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.mk}
|
||||||
* IPV6_STATIC_LLADDR ?= '"fe80::cafe:cafe:cafe:1"'
|
* IPV6_STATIC_LLADDR ?= '"fe80::cafe:cafe:cafe:1"'
|
||||||
* CFLAGS += -DGNRC_IPV6_STATIC_LLADDR=$(STATIC_IPV6_LLADDR)
|
* CFLAGS += -DCONFIG_GNRC_IPV6_STATIC_LLADDR=$(STATIC_IPV6_LLADDR)
|
||||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
*/
|
*/
|
||||||
#define GNRC_IPV6_STATIC_LLADDR
|
#define CONFIG_GNRC_IPV6_STATIC_LLADDR
|
||||||
#endif /* DOXYGEN */
|
#endif /* DOXYGEN */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Use the same static IPv6 link local address on every network interface
|
* @brief Use the same static IPv6 link local address on every network interface
|
||||||
*
|
*
|
||||||
* When GNRC_IPV6_STATIC_LLADDR is used, to not add the interface pid to the set
|
* When CONFIG_GNRC_IPV6_STATIC_LLADDR is used, to not add the interface pid to the
|
||||||
* static address but use the same static link local address for all interfaces.
|
* set static address but use the same static link local address for all interfaces.
|
||||||
*/
|
*/
|
||||||
#ifndef CONFIG_GNRC_IPV6_STATIC_LLADDR_IS_FIXED
|
#ifndef CONFIG_GNRC_IPV6_STATIC_LLADDR_IS_FIXED
|
||||||
#define CONFIG_GNRC_IPV6_STATIC_LLADDR_IS_FIXED 0
|
#define CONFIG_GNRC_IPV6_STATIC_LLADDR_IS_FIXED 0
|
||||||
|
@ -22,6 +22,29 @@ config GNRC_IPV6_MSG_QUEUE_SIZE_EXP
|
|||||||
represents the exponent of 2^n, which will be used as the size of
|
represents the exponent of 2^n, which will be used as the size of
|
||||||
the queue.
|
the queue.
|
||||||
|
|
||||||
|
config GNRC_IPV6_STATIC_LLADDR_ENABLE
|
||||||
|
bool "Add a static IPv6 link local address to any network interface"
|
||||||
|
help
|
||||||
|
This allows to specify a certain link local IPv6 address to be assigned
|
||||||
|
to a network interface on startup, which might be handy for testing.
|
||||||
|
|
||||||
|
A interface will keep its auto-generated link local address, too.
|
||||||
|
|
||||||
|
config GNRC_IPV6_STATIC_LLADDR
|
||||||
|
string "Static link-local address"
|
||||||
|
depends on GNRC_IPV6_STATIC_LLADDR_ENABLE
|
||||||
|
default "fe80::cafe:cafe:cafe:1"
|
||||||
|
help
|
||||||
|
The address is configured on each interface and incremented by the
|
||||||
|
interface PID.
|
||||||
|
|
||||||
|
config GNRC_IPV6_STATIC_LLADDR_IS_FIXED
|
||||||
|
bool "Same link-local address on every interface"
|
||||||
|
depends on GNRC_IPV6_STATIC_LLADDR_ENABLE
|
||||||
|
help
|
||||||
|
Don't add the interface PID to the least significant byte
|
||||||
|
of the address.
|
||||||
|
|
||||||
endif # KCONFIG_USEMODULE_GNRC_IPV6
|
endif # KCONFIG_USEMODULE_GNRC_IPV6
|
||||||
|
|
||||||
rsource "blacklist/Kconfig"
|
rsource "blacklist/Kconfig"
|
||||||
|
@ -115,12 +115,12 @@ void gnrc_ipv6_nib_init(void)
|
|||||||
|
|
||||||
static void _add_static_lladdr(gnrc_netif_t *netif)
|
static void _add_static_lladdr(gnrc_netif_t *netif)
|
||||||
{
|
{
|
||||||
#ifdef GNRC_IPV6_STATIC_LLADDR
|
#ifdef CONFIG_GNRC_IPV6_STATIC_LLADDR
|
||||||
/* parse addr from string and explicitly set a link local prefix
|
/* parse addr from string and explicitly set a link local prefix
|
||||||
* if ifnum > 1 each interface will get its own link local address
|
* if ifnum > 1 each interface will get its own link local address
|
||||||
* with GNRC_IPV6_STATIC_LLADDR + i
|
* with CONFIG_GNRC_IPV6_STATIC_LLADDR + i
|
||||||
*/
|
*/
|
||||||
char lladdr_str[] = GNRC_IPV6_STATIC_LLADDR;
|
const char lladdr_str[] = CONFIG_GNRC_IPV6_STATIC_LLADDR;
|
||||||
ipv6_addr_t lladdr;
|
ipv6_addr_t lladdr;
|
||||||
|
|
||||||
if (ipv6_addr_from_str(&lladdr, lladdr_str) != NULL) {
|
if (ipv6_addr_from_str(&lladdr, lladdr_str) != NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user