mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #20343 from fabian18/pr/fix_ipv6_nib_cancel_timers
ipv6/nib: cancel timers when NIB entry gets deleted
This commit is contained in:
commit
a16199f846
@ -376,6 +376,7 @@ _nib_dr_entry_t *_nib_drl_add(const ipv6_addr_t *router_addr, unsigned iface)
|
||||
void _nib_drl_remove(_nib_dr_entry_t *nib_dr)
|
||||
{
|
||||
if (nib_dr->next_hop != NULL) {
|
||||
_evtimer_del(&nib_dr->rtr_timeout);
|
||||
nib_dr->next_hop->mode &= ~(_DRL);
|
||||
_nib_onl_clear(nib_dr->next_hop);
|
||||
memset(nib_dr, 0, sizeof(_nib_dr_entry_t));
|
||||
@ -660,6 +661,7 @@ int _nib_get_route(const ipv6_addr_t *dst, gnrc_pktsnip_t *pkt,
|
||||
|
||||
void _nib_pl_remove(_nib_offl_entry_t *nib_offl)
|
||||
{
|
||||
_evtimer_del(&nib_offl->pfx_timeout);
|
||||
_nib_offl_remove(nib_offl, _PL);
|
||||
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C)
|
||||
unsigned idx = _idx_dsts(nib_offl);
|
||||
|
@ -258,6 +258,51 @@ extern evtimer_msg_t _nib_evtimer;
|
||||
*/
|
||||
extern _nib_dr_entry_t *_prime_def_router;
|
||||
|
||||
/**
|
||||
* @brief Looks up if an event is queued in the event timer
|
||||
*
|
||||
* @param[in] ctx Context of the event. May be NULL for any event context.
|
||||
* @param[in] type [Type of the event](@ref net_gnrc_ipv6_nib_msg).
|
||||
*
|
||||
* @return Milliseconds to the event, if event in queue.
|
||||
* @return UINT32_MAX, event is not in queue.
|
||||
*/
|
||||
uint32_t _evtimer_lookup(const void *ctx, uint16_t type);
|
||||
|
||||
/**
|
||||
* @brief Removes an event from the event timer
|
||||
*
|
||||
* @param[in] event Representation of the event.
|
||||
*/
|
||||
static inline void _evtimer_del(evtimer_msg_event_t *event)
|
||||
{
|
||||
evtimer_del(&_nib_evtimer, &event->event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Adds an event to the event timer
|
||||
*
|
||||
* @param[in] ctx The context of the event
|
||||
* @param[in] type [Type of the event](@ref net_gnrc_ipv6_nib_msg).
|
||||
* @param[in,out] event Representation of the event.
|
||||
* @param[in] offset Offset in milliseconds to the event.
|
||||
*/
|
||||
static inline void _evtimer_add(void *ctx, int16_t type,
|
||||
evtimer_msg_event_t *event, uint32_t offset)
|
||||
{
|
||||
#ifdef MODULE_GNRC_IPV6
|
||||
kernel_pid_t target_pid = gnrc_ipv6_pid;
|
||||
#else
|
||||
kernel_pid_t target_pid = KERNEL_PID_LAST; /* just for testing */
|
||||
#endif
|
||||
_evtimer_del(event);
|
||||
event->event.next = NULL;
|
||||
event->event.offset = offset;
|
||||
event->msg.type = type;
|
||||
event->msg.content.ptr = ctx;
|
||||
evtimer_add_msg(&_nib_evtimer, event, target_pid);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes NIB internally
|
||||
*/
|
||||
@ -733,6 +778,7 @@ static inline _nib_offl_entry_t *_nib_ft_add(const ipv6_addr_t *next_hop,
|
||||
*/
|
||||
static inline void _nib_ft_remove(_nib_offl_entry_t *nib_offl)
|
||||
{
|
||||
_evtimer_del(&nib_offl->route_timeout);
|
||||
_nib_offl_remove(nib_offl, _FT);
|
||||
}
|
||||
#endif /* CONFIG_GNRC_IPV6_NIB_ROUTER */
|
||||
@ -826,51 +872,6 @@ void _nib_ft_get(const _nib_offl_entry_t *dst, gnrc_ipv6_nib_ft_t *fte);
|
||||
int _nib_get_route(const ipv6_addr_t *dst, gnrc_pktsnip_t *ctx,
|
||||
gnrc_ipv6_nib_ft_t *entry);
|
||||
|
||||
/**
|
||||
* @brief Looks up if an event is queued in the event timer
|
||||
*
|
||||
* @param[in] ctx Context of the event. May be NULL for any event context.
|
||||
* @param[in] type [Type of the event](@ref net_gnrc_ipv6_nib_msg).
|
||||
*
|
||||
* @return Milliseconds to the event, if event in queue.
|
||||
* @return UINT32_MAX, event is not in queue.
|
||||
*/
|
||||
uint32_t _evtimer_lookup(const void *ctx, uint16_t type);
|
||||
|
||||
/**
|
||||
* @brief Removes an event from the event timer
|
||||
*
|
||||
* @param[in] event Representation of the event.
|
||||
*/
|
||||
static inline void _evtimer_del(evtimer_msg_event_t *event)
|
||||
{
|
||||
evtimer_del(&_nib_evtimer, &event->event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Adds an event to the event timer
|
||||
*
|
||||
* @param[in] ctx The context of the event
|
||||
* @param[in] type [Type of the event](@ref net_gnrc_ipv6_nib_msg).
|
||||
* @param[in,out] event Representation of the event.
|
||||
* @param[in] offset Offset in milliseconds to the event.
|
||||
*/
|
||||
static inline void _evtimer_add(void *ctx, int16_t type,
|
||||
evtimer_msg_event_t *event, uint32_t offset)
|
||||
{
|
||||
#ifdef MODULE_GNRC_IPV6
|
||||
kernel_pid_t target_pid = gnrc_ipv6_pid;
|
||||
#else
|
||||
kernel_pid_t target_pid = KERNEL_PID_LAST; /* just for testing */
|
||||
#endif
|
||||
_evtimer_del(event);
|
||||
event->event.next = NULL;
|
||||
event->event.offset = offset;
|
||||
event->msg.type = type;
|
||||
event->msg.content.ptr = ctx;
|
||||
evtimer_add_msg(&_nib_evtimer, event, target_pid);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user