Skip to content

Commit

Permalink
fixup! net/gnrc_netif: add bus for interface events
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Sep 21, 2022
1 parent 027a955 commit 8882777
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
15 changes: 10 additions & 5 deletions sys/include/net/gnrc/netif.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,18 @@ typedef enum {
*/
typedef enum {
/**
* @brief Link state changed
* @brief Link state changed to UP
*
* The event is generated when the link state on the interface changed.
* The message payload is either NULL if the link is down, otherwise
* the link is up.
* The event is generated when the link state on the interface became online.
*/
GNRC_NETIF_EVENT_LINK_STATE_CHANGED,
GNRC_NETIF_EVENT_LINK_STATE_CHANGED_DOWN,

/**
* @brief Link state changed to DOWN
*
* The event is generated when the link state on the interface become offline.
*/
GNRC_NETIF_EVENT_LINK_STATE_CHANGED_UP,
} gnrc_netif_event_t;

/**
Expand Down
4 changes: 2 additions & 2 deletions sys/net/gnrc/netif/gnrc_netif.c
Original file line number Diff line number Diff line change
Expand Up @@ -2117,15 +2117,15 @@ static void _event_cb(netdev_t *dev, netdev_event_t event)
gnrc_ipv6_nib_iface_up(netif);
}
gnrc_netif_event_bus_post(netif,
GNRC_NETIF_EVENT_LINK_STATE_CHANGED,
GNRC_NETIF_EVENT_LINK_STATE_CHANGED_UP,
(void *)1);
break;
case NETDEV_EVENT_LINK_DOWN:
if (IS_USED(MODULE_GNRC_IPV6_NIB)) {
gnrc_ipv6_nib_iface_down(netif, false);
}
gnrc_netif_event_bus_post(netif,
GNRC_NETIF_EVENT_LINK_STATE_CHANGED,
GNRC_NETIF_EVENT_LINK_STATE_CHANGED_DOWN,
(void *)0);
break;
case NETDEV_EVENT_RX_COMPLETE:
Expand Down

0 comments on commit 8882777

Please sign in to comment.