net: iface: Remove expired router from list of active routers

An expired IPv6 router would cause an infinite loop where
iface_router_run_timer() repeatedly scheduled a work item. In some
conditions it would schedule with negative delay, in other conditions
the infinite loop wouldn't happen until a router was added again.

Get rid of the router from active_router_timers when it is removed.

Fixes #21339

Signed-off-by: Jonas Norling <jonas.norling@greeneggs.se>
This commit is contained in:
Jonas Norling 2019-12-12 16:49:02 +01:00 committed by Jukka Rissanen
parent 2f982b3bc2
commit 0ef4634bc5

View file

@ -576,6 +576,7 @@ static void iface_router_expired(struct k_work *work)
{
u32_t current_time = k_uptime_get_32();
struct net_if_router *router, *next;
sys_snode_t *prev_node = NULL;
ARG_UNUSED(work);
@ -587,11 +588,13 @@ static void iface_router_expired(struct k_work *work)
/* We have to loop on all active routers as their
* lifetime differ from each other.
*/
prev_node = &router->node;
continue;
}
iface_router_notify_deletion(router, "has expired");
sys_slist_remove(&active_router_timers,
prev_node, &router->node);
router->is_used = false;
}