mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #16530 from benpicco/gnrc_dhcpv6_client_6lbr-generic
gnrc_dhcpv6_client_6lbr: choose downstream if as !upstream
This commit is contained in:
commit
a20790b0ef
@ -257,10 +257,10 @@ void auto_init(void)
|
||||
dhcpv6_client_auto_init();
|
||||
}
|
||||
|
||||
if (IS_USED(MODULE_GNRC_DHCPV6_CLIENT_6LBR)) {
|
||||
LOG_DEBUG("Auto init 6LoWPAN border router DHCPv6 client\n");
|
||||
extern void gnrc_dhcpv6_client_6lbr_init(void);
|
||||
gnrc_dhcpv6_client_6lbr_init();
|
||||
if (IS_USED(MODULE_GNRC_DHCPV6_CLIENT_SIMPLE_PD)) {
|
||||
LOG_DEBUG("Auto init DHCPv6 client for simple prefix delegation\n");
|
||||
extern void gnrc_dhcpv6_client_simple_pd_init(void);
|
||||
gnrc_dhcpv6_client_simple_pd_init();
|
||||
}
|
||||
|
||||
if (IS_USED(MODULE_AUTO_INIT_MULTIMEDIA)) {
|
||||
|
@ -7,9 +7,10 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup net_dhcpv6_client_6lbr DHCPv6 client for 6LoWPAN border routers
|
||||
* @defgroup net_dhcpv6_client_6lbr DHCPv6 client for simple prefix
|
||||
* delegation
|
||||
* @ingroup net_dhcpv6_client
|
||||
* @brief DHCPv6 client bootstrapping for 6LoWPAN border routers
|
||||
* @brief DHCPv6 client bootstrapping for routers & 6LoWPAN border routers
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
@ -17,8 +18,8 @@
|
||||
*
|
||||
* @author Martine S. Lenders <m.lenders@fu-berlin.de>
|
||||
*/
|
||||
#ifndef NET_GNRC_DHCPV6_CLIENT_6LBR_H
|
||||
#define NET_GNRC_DHCPV6_CLIENT_6LBR_H
|
||||
#ifndef NET_GNRC_DHCPV6_CLIENT_SIMPLE_PD_H
|
||||
#define NET_GNRC_DHCPV6_CLIENT_SIMPLE_PD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -60,15 +61,15 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Initializes the DHCPv6 client for 6LoWPAN border router
|
||||
* @brief Initializes the DHCPv6 client for simple prefix delegation
|
||||
*
|
||||
* @note Called by `auto_init` when included
|
||||
*/
|
||||
void gnrc_dhcpv6_client_6lbr_init(void);
|
||||
void gnrc_dhcpv6_client_simple_pd_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* NET_GNRC_DHCPV6_CLIENT_6LBR_H */
|
||||
#endif /* NET_GNRC_DHCPV6_CLIENT_SIMPLE_PD_H */
|
||||
/** @} */
|
@ -52,6 +52,10 @@ ifneq (,$(filter gnrc_dhcpv6_client,$(USEMODULE)))
|
||||
endif
|
||||
|
||||
ifneq (,$(filter gnrc_dhcpv6_client_6lbr,$(USEMODULE)))
|
||||
USEMODULE += gnrc_dhcpv6_client_simple_pd
|
||||
endif
|
||||
|
||||
ifneq (,$(filter gnrc_dhcpv6_client_simple_pd,$(USEMODULE)))
|
||||
USEMODULE += gnrc_dhcpv6_client
|
||||
endif
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "log.h"
|
||||
#include "net/arp.h"
|
||||
#include "net/dhcpv6.h"
|
||||
#include "net/gnrc/dhcpv6/client/6lbr.h"
|
||||
#include "net/gnrc/dhcpv6/client/simple_pd.h"
|
||||
#include "net/gnrc/ipv6/nib/pl.h"
|
||||
#include "net/gnrc/sixlowpan/ctx.h"
|
||||
#include "net/gnrc/netif.h"
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "net/gnrc/ipv6/nib/ft.h"
|
||||
#include "net/gnrc/netif/internal.h"
|
||||
|
||||
#include "net/gnrc/dhcpv6/client/6lbr.h"
|
||||
#include "net/gnrc/dhcpv6/client/simple_pd.h"
|
||||
|
||||
#if IS_USED(MODULE_AUTO_INIT_DHCPV6_CLIENT)
|
||||
#error "Module `gnrc_dhcpv6_client_6lbr` is mutually exclusive to \
|
||||
@ -101,8 +101,13 @@ static void _configure_upstream_netif(gnrc_netif_t *upstream_netif)
|
||||
static void _configure_dhcpv6_client(void)
|
||||
{
|
||||
gnrc_netif_t *netif = NULL;
|
||||
gnrc_netif_t *upstream = _find_upstream_netif();
|
||||
while ((netif = gnrc_netif_iter(netif))) {
|
||||
if (gnrc_netif_is_6lo(netif)) {
|
||||
if (IS_USED(MODULE_GNRC_DHCPV6_CLIENT_6LBR)
|
||||
&& !gnrc_netif_is_6lo(netif)) {
|
||||
continue;
|
||||
}
|
||||
if (netif != upstream) {
|
||||
dhcpv6_client_req_ia_pd(netif->pid, 64U);
|
||||
}
|
||||
}
|
||||
@ -135,7 +140,7 @@ static void *_dhcpv6_cl_6lbr_thread(void *args)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void gnrc_dhcpv6_client_6lbr_init(void)
|
||||
void gnrc_dhcpv6_client_simple_pd_init(void)
|
||||
{
|
||||
/* start DHCPv6 client thread to request prefix for WPAN */
|
||||
thread_create(_stack, DHCPV6_CLIENT_STACK_SIZE,
|
Loading…
Reference in New Issue
Block a user