Skip to content

Commit 2d44234

Browse files
dsaherndavem330
authored andcommitted
ipv6: Handle all fib6_nh in a nexthop in mtu updates
Use nexthop_for_each_fib6_nh to call fib6_nh_mtu_change for each fib6_nh in a nexthop for rt6_mtu_change_route. For __ip6_rt_update_pmtu, we need to find the nexthop that correlates to the device and gateway in the rt6_info. Signed-off-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 49d5b8e commit 2d44234

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

net/ipv6/route.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2679,10 +2679,31 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,
26792679
rcu_read_unlock();
26802680
return;
26812681
}
2682-
res.nh = res.f6i->fib6_nh;
26832682
res.fib6_flags = res.f6i->fib6_flags;
26842683
res.fib6_type = res.f6i->fib6_type;
26852684

2685+
if (res.f6i->nh) {
2686+
struct fib6_nh_match_arg arg = {
2687+
.dev = dst->dev,
2688+
.gw = &rt6->rt6i_gateway,
2689+
};
2690+
2691+
nexthop_for_each_fib6_nh(res.f6i->nh,
2692+
fib6_nh_find_match, &arg);
2693+
2694+
/* fib6_info uses a nexthop that does not have fib6_nh
2695+
* using the dst->dev + gw. Should be impossible.
2696+
*/
2697+
if (!arg.match) {
2698+
rcu_read_unlock();
2699+
return;
2700+
}
2701+
2702+
res.nh = arg.match;
2703+
} else {
2704+
res.nh = res.f6i->fib6_nh;
2705+
}
2706+
26862707
nrt6 = ip6_rt_cache_alloc(&res, daddr, saddr);
26872708
if (nrt6) {
26882709
rt6_do_update_pmtu(nrt6, mtu);
@@ -4650,6 +4671,12 @@ static int rt6_mtu_change_route(struct fib6_info *f6i, void *p_arg)
46504671
return 0;
46514672

46524673
arg->f6i = f6i;
4674+
if (f6i->nh) {
4675+
/* fib6_nh_mtu_change only returns 0, so this is safe */
4676+
return nexthop_for_each_fib6_nh(f6i->nh, fib6_nh_mtu_change,
4677+
arg);
4678+
}
4679+
46534680
return fib6_nh_mtu_change(f6i->fib6_nh, arg);
46544681
}
46554682

0 commit comments

Comments
 (0)