Skip to content

Commit

Permalink
ipv6/route: Don't match on fc_nh_id if not set in ip6_route_del()
Browse files Browse the repository at this point in the history
If fc_nh_id isn't set, we shouldn't try to match against it. This
actually matters just for the RTF_CACHE below (where this case is
already handled): if iproute2 gets a route exception and tries to
delete it, it won't reference it by fc_nh_id, even if a nexthop
object might be associated to the originating route.

Fixes: 5b98324 ("ipv6: Allow routes to use nexthop objects")
Signed-off-by: Stefano Brivio <[email protected]>
Reviewed-by: David Ahern <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
sbrivio-rh authored and davem330 committed Jun 24, 2019
1 parent ef11209 commit 3401bfb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -3840,7 +3840,8 @@ static int ip6_route_del(struct fib6_config *cfg,
for_each_fib6_node_rt_rcu(fn) {
struct fib6_nh *nh;

if (rt->nh && rt->nh->id != cfg->fc_nh_id)
if (rt->nh && cfg->fc_nh_id &&
rt->nh->id != cfg->fc_nh_id)
continue;

if (cfg->fc_flags & RTF_CACHE) {
Expand Down

0 comments on commit 3401bfb

Please sign in to comment.