]> git.baikalelectronics.ru Git - kernel.git/commit
ipv6: udp: set dst cache for a connected sk if current not valid
authorAlexey Kodanev <alexey.kodanev@oracle.com>
Tue, 3 Apr 2018 12:00:10 +0000 (15:00 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 Apr 2018 15:31:57 +0000 (11:31 -0400)
commit262178a578599ad89a7bf5efaeca292ab6804fd5
treec3b3e194c19bdeb9ab3ea1630ddc35c13736f962
parent944a8ad52c92caac7086547932948bab1d815b22
ipv6: udp: set dst cache for a connected sk if current not valid

A new RTF_CACHE route can be created between ip6_sk_dst_lookup_flow()
and ip6_dst_store() calls in udpv6_sendmsg(), when datagram sending
results to ICMPV6_PKT_TOOBIG error:

    udp_v6_send_skb(), for example with vti6 tunnel:
        vti6_xmit(), get ICMPV6_PKT_TOOBIG error
            skb_dst_update_pmtu(), can create a RTF_CACHE clone
            icmpv6_send()
    ...
    udpv6_err()
        ip6_sk_update_pmtu()
           ip6_update_pmtu(), can create a RTF_CACHE clone
           ...
           ip6_datagram_dst_update()
                ip6_dst_store()

And after commit ff76b4efdd41 ("ipv6: datagram: Update dst cache of
a connected datagram sk during pmtu update"), the UDPv6 error handler
can update socket's dst cache, but it can happen before the update in
the end of udpv6_sendmsg(), preventing getting the new dst cache on
the next udpv6_sendmsg() calls.

In order to fix it, save dst in a connected socket only if the current
socket's dst cache is invalid.

The previous patch prepared ip6_sk_dst_lookup_flow() to do that with
the new argument, and this patch enables it in udpv6_sendmsg().

Fixes: ff76b4efdd41 ("ipv6: datagram: Update dst cache of a connected datagram sk during pmtu update")
Fixes: a7bf6f4b7a43 ("ipv6: Only create RTF_CACHE routes after encountering pmtu exception")
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/udp.c