Babel: Do not try to remove multicast seqno request objects from neighbour list

The Babel seqno request code keeps track of which seqno requests are
outstanding for a neighbour by putting them onto a per-neighbour list. When
reusing a seqno request, it will try to remove this node, but if the seqno
request in question was a multicast request with no neighbour attached this
will result in a crash because it tries to remove a list node that wasn't
added to any list.

Fix this by making the list remove conditional. Also fix neighbor removal
which were changing seqno requests to multicast ones instead of removing
them.

Fixes: ebd5751cde ("Babel: Seqno requests are properly decoupled from
neighbors when the underlying interface disappears").

Based on the patch from Toke Høiland-Jørgensen <toke@toke.dk>,
bug reported by Stefan Haller <stefan.haller@stha.de>, thanks.
This commit is contained in:
Ondrej Zajicek 2022-06-05 04:03:43 +02:00
parent f39e9aa203
commit ad686c55c3

View file

@ -312,6 +312,8 @@ babel_add_seqno_request(struct babel_proto *p, struct babel_entry *e,
/* Found older */ /* Found older */
rem_node(NODE sr); rem_node(NODE sr);
if (sr->nbr)
rem_node(&sr->nbr_node); rem_node(&sr->nbr_node);
goto found; goto found;
@ -452,10 +454,7 @@ babel_flush_neighbor(struct babel_proto *p, struct babel_neighbor *nbr)
struct babel_seqno_request *sr; struct babel_seqno_request *sr;
WALK_LIST_FIRST2(sr, nbr_node, nbr->requests) WALK_LIST_FIRST2(sr, nbr_node, nbr->requests)
{ babel_remove_seqno_request(p, sr);
sr->nbr = NULL;
rem_node(&sr->nbr_node);
}
nbr->ifa = NULL; nbr->ifa = NULL;
rem_node(NODE nbr); rem_node(NODE nbr);