mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
gnrc_static: auto-select interface if there is only one
This commit is contained in:
parent
3f2d36d14f
commit
a473ca9ed5
@ -113,10 +113,17 @@ static void _config_downstream(gnrc_netif_t *downstream)
|
||||
|
||||
void auto_init_gnrc_ipv6_static_addr(void)
|
||||
{
|
||||
gnrc_netif_t *netif = NULL;
|
||||
gnrc_netif_t *upstream = NULL;
|
||||
gnrc_netif_t *downstream = NULL;
|
||||
|
||||
if (gnrc_netif_highlander() || gnrc_netif_numof() == 1) {
|
||||
upstream = gnrc_netif_iter(NULL);
|
||||
|
||||
if (IS_ACTIVE(CONFIG_GNRC_IPV6_STATIC_ADDR_UPSTREAM)) {
|
||||
assert(upstream->pid == CONFIG_GNRC_IPV6_STATIC_ADDR_UPSTREAM);
|
||||
}
|
||||
} else {
|
||||
|
||||
if (IS_ACTIVE(CONFIG_GNRC_IPV6_STATIC_ADDR_UPSTREAM)) {
|
||||
upstream = gnrc_netif_get_by_pid(CONFIG_GNRC_IPV6_STATIC_ADDR_UPSTREAM);
|
||||
}
|
||||
@ -125,6 +132,7 @@ void auto_init_gnrc_ipv6_static_addr(void)
|
||||
downstream = gnrc_netif_get_by_pid(CONFIG_GNRC_IPV6_STATIC_ADDR_DOWNSTREAM);
|
||||
}
|
||||
|
||||
gnrc_netif_t *netif = NULL;
|
||||
while ((netif = gnrc_netif_iter(netif))) {
|
||||
bool is_wired = gnrc_netapi_get(netif->pid, NETOPT_IS_WIRED, 0, NULL, 0) == 1;
|
||||
|
||||
@ -134,6 +142,7 @@ void auto_init_gnrc_ipv6_static_addr(void)
|
||||
downstream = netif;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (upstream) {
|
||||
_config_upstream(upstream);
|
||||
|
Loading…
Reference in New Issue
Block a user