Skip to content

Commit

Permalink
cnetlink: properly handle ll neigh handable changes
Browse files Browse the repository at this point in the history
With ae62117 ("cnetlink: pass on layer 2 neigh updates"), we make
sure to handle updates only on neighs we support, so we check both old
and new to be usable.

But this misses the transitions where a ll neigh becomes usable due to
updates or vice versa.

Fix this by treating those changes as a new or deleted ll neigh insted
of ignoring it alltogether.

Fixes: ae62117 ("cnetlink: pass on layer 2 neigh updates")
Signed-off-by: Jonas Gorski <[email protected]>
  • Loading branch information
KanjiMonster committed Feb 11, 2025
1 parent 1a20b25 commit 9825df5
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/netlink/cnetlink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1750,8 +1750,24 @@ void cnetlink::neigh_ll_created(rtnl_neigh *neigh) noexcept {

void cnetlink::neigh_ll_updated(rtnl_neigh *old_neigh,
rtnl_neigh *new_neigh) noexcept {
if (!check_ll_neigh(old_neigh) || !check_ll_neigh(new_neigh))
bool handle_old = check_ll_neigh(old_neigh);
bool handle_new = check_ll_neigh(new_neigh);

// nothing to do here
if (!handle_old && !handle_new)
return;

// we ignored the previous one, so this is like a new neigh
if (!handle_old) {
neigh_ll_created(new_neigh);
return;
}

// we won't handle the neigh anymore
if (!handle_new) {
neigh_ll_deleted(old_neigh);
return;
}

int old_ifindex = rtnl_neigh_get_ifindex(old_neigh);
rtnl_link *old_base_link =
Expand Down

0 comments on commit 9825df5

Please sign in to comment.