Skip to content

Commit

Permalink
nl_l3::del_l3_unicast_route(): delete nh_unreach notifications
Browse files Browse the repository at this point in the history
When deleting a route, we need to make sure to also remove any
next unreachable notifications we did, else we may call del_l3_neigh too
often.

Fixes: 590c33d ("nl_l3: handle neigh unreachable * Adds nh unreachable container to track nexthop unreachability changes * In case that nexthop is not anymore reachable, update route that has nexthop to point to controller and delete the reference * Thus, when NH becomes again reachable, we can update the egress reference and the route")
Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
  • Loading branch information
KanjiMonster committed Apr 29, 2024
1 parent 0f21cbe commit 7d2139a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/netlink/nl_l3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2022,7 +2022,6 @@ int nl_l3::del_l3_unicast_route(rtnl_route *r, bool keep_route) {
auto vid = vlan->get_vid(link.get());

struct nl_addr *s_mac = rtnl_link_get_addr(link.get());
struct nl_addr *d_mac = rtnl_neigh_get_lladdr(n);

// For the Bridge SVI, the l3 interface already exists
// so we can just get that one
Expand Down Expand Up @@ -2055,6 +2054,20 @@ int nl_l3::del_l3_unicast_route(rtnl_route *r, bool keep_route) {

// remove egress references
for (auto n : neighs) {
int ifindex = rtnl_neigh_get_ifindex(n);
struct nl_addr *addr = rtnl_neigh_get_dst(n);

auto it =
std::find_if(nh_unreach_callbacks.begin(), nh_unreach_callbacks.end(),
[&](std::pair<nh_unreachable *, nh_params> &cb) {
return cb.first == this &&
cb.second.nh.ifindex == ifindex &&
!nl_addr_cmp(cb.second.nh.nh, addr) &&
!nl_addr_cmp(cb.second.np.addr, dst);
});

if (it != nh_unreach_callbacks.end())
nh_unreach_callbacks.erase(it);
rv = del_l3_neigh_egress(n);

if (rv < 0 and rv != -EEXIST) {
Expand Down

0 comments on commit 7d2139a

Please sign in to comment.