On Wed, Mar 16, 2016 at 8:34 PM, Eric Dumazet <eric.duma...@gmail.com> wrote: > On Wed, 2016-03-16 at 22:38 -0400, David Miller wrote: >> From: Eric Dumazet <eric.duma...@gmail.com> >> Date: Wed, 16 Mar 2016 17:22:07 -0700 >> >> > One of the issue is that IPV6_MTU getsockopt() will not check the dst, >> > but simply use __sk_dst_get() : It will then report old mtu. >> >> That's a bug. >> >> ipv4 does it right with a proper sk_dst_get() and so should >> ipv6. > > Using rcu + __sk_dst_get() (in IPv6) is absolutely equivalent to > sk_dst_get() + dst_release() (in IPv4), modulo atomic ops on dst > refcnt... > > Presumably IPv6 implementation using rcu is slightly better if this > getsockopt() is badly needed, but apparently nobody cares. > > sk_dst_check() is a different beast. > > The problem is that dst_mtu(dst) is not able to perform a route lookup > by itself. > > Do we really want to use ip6_sk_dst_lookup_flow() and its associated > setup for this IP6_MTU thing, and maybe other points we might use an > obsolete dst ? > > Looking at the complexity of udpv6_sendmsg() and rawv6_sendmsg() I > really wonder if it is worth extracting the route logic.
I think the reason why IPv4 does this correctly is ipv4_sk_update_pmtu() takes care of the sk cached dst, while the similar part for IPv6, ip6_sk_update_pmtu() does not that. As Martin already points it out in the previous version.