Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/jogo_fix_nh_notification_update'…
Browse files Browse the repository at this point in the history
… into rf_merge_jogo
  • Loading branch information
rubensfig committed Apr 30, 2024
2 parents fe0708c + 02904a8 commit 648c82a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/netlink/nl_l3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1998,9 +1998,8 @@ int nl_l3::del_l3_unicast_route(rtnl_route *r, bool keep_route) {
for (auto i : unresolved_nh) {
auto it = std::find_if(nh_callbacks.begin(), nh_callbacks.end(),
[&](std::pair<nh_reachable *, nh_params> &cb) {
return cb.first == this &&
cb.second.nh.ifindex == i.ifindex &&
!nl_addr_cmp_prefix(cb.second.np.addr, dst);
return cb.first == this && cb.second.nh == i &&
!nl_addr_cmp(cb.second.np.addr, dst);
});

if (it != nh_callbacks.end())
Expand Down Expand Up @@ -2056,6 +2055,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
7 changes: 7 additions & 0 deletions src/netlink/nl_l3_interfaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ struct nh_stub {
return ifindex < other.ifindex;
}

bool operator==(const nh_stub &other) const {
if (nl_addr_cmp(nh, other.nh) != 0)
return false;

return ifindex == other.ifindex;
}

nl_addr *nh;
int ifindex;
};
Expand Down

0 comments on commit 648c82a

Please sign in to comment.