mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-15 09:33:50 +01:00
gnrc_ipv6_nib: handle iface_up/iface_down in IPv6 thread
This commit is contained in:
parent
a49863e95c
commit
47aaa94157
@ -233,6 +233,16 @@ extern "C" {
|
||||
* @note Only handled with @ref CONFIG_GNRC_IPV6_NIB_DNS != 0
|
||||
*/
|
||||
#define GNRC_IPV6_NIB_RDNSS_TIMEOUT (0x4fd3U)
|
||||
|
||||
/**
|
||||
* @brief Interface up event
|
||||
*/
|
||||
#define GNRC_IPV6_NIB_IFACE_UP (0x4fd4U)
|
||||
|
||||
/**
|
||||
* @brief Interface down event
|
||||
*/
|
||||
#define GNRC_IPV6_NIB_IFACE_DOWN (0x4fd5U)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
|
||||
@ -25,10 +25,8 @@
|
||||
#include "net/ethernet.h"
|
||||
#include "net/ipv6.h"
|
||||
#include "net/gnrc.h"
|
||||
#if IS_USED(MODULE_GNRC_IPV6_NIB)
|
||||
#include "net/gnrc/ipv6/nib.h"
|
||||
#include "net/gnrc/ipv6.h"
|
||||
#endif /* IS_USED(MODULE_GNRC_IPV6_NIB) */
|
||||
#if IS_USED(MODULE_GNRC_NETIF_PKTQ)
|
||||
#include "net/gnrc/netif/pktq.h"
|
||||
#endif /* IS_USED(MODULE_GNRC_NETIF_PKTQ) */
|
||||
@ -2052,14 +2050,20 @@ static void _event_cb(netdev_t *dev, netdev_event_t event)
|
||||
DEBUG("gnrc_netif: event triggered -> %i\n", event);
|
||||
gnrc_pktsnip_t *pkt = NULL;
|
||||
switch (event) {
|
||||
#if IS_USED(MODULE_GNRC_IPV6_NIB)
|
||||
case NETDEV_EVENT_LINK_UP:
|
||||
gnrc_ipv6_nib_iface_up(netif);
|
||||
if (IS_USED(MODULE_GNRC_IPV6)) {
|
||||
msg_t msg = { .type = GNRC_IPV6_NIB_IFACE_UP, .content = { .ptr = netif } };
|
||||
|
||||
msg_send(&msg, gnrc_ipv6_pid);
|
||||
}
|
||||
break;
|
||||
case NETDEV_EVENT_LINK_DOWN:
|
||||
gnrc_ipv6_nib_iface_down(netif, false);
|
||||
if (IS_USED(MODULE_GNRC_IPV6)) {
|
||||
msg_t msg = { .type = GNRC_IPV6_NIB_IFACE_DOWN, .content = { .ptr = netif } };
|
||||
|
||||
msg_send(&msg, gnrc_ipv6_pid);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case NETDEV_EVENT_RX_COMPLETE:
|
||||
pkt = netif->ops->recv(netif);
|
||||
/* send packet previously queued within netif due to the lower
|
||||
|
||||
@ -244,6 +244,12 @@ static void *_event_loop(void *args)
|
||||
DEBUG("ipv6: NIB timer event received\n");
|
||||
gnrc_ipv6_nib_handle_timer_event(msg.content.ptr, msg.type);
|
||||
break;
|
||||
case GNRC_IPV6_NIB_IFACE_UP:
|
||||
gnrc_ipv6_nib_iface_up(msg.content.ptr);
|
||||
break;
|
||||
case GNRC_IPV6_NIB_IFACE_DOWN:
|
||||
gnrc_ipv6_nib_iface_down(msg.content.ptr, false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user