]> git.baikalelectronics.ru Git - kernel.git/commit
ipv4: Fix ip_skb_dst_mtu to use the sk passed by ip_finish_output
authorShmulik Ladkani <shmulik.ladkani@gmail.com>
Wed, 29 Jun 2016 18:47:03 +0000 (21:47 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 30 Jun 2016 13:02:48 +0000 (09:02 -0400)
commit5cd9615d313ec1ad9a8595a6a9616ec8441baeec
treeaec9b6ddce0a103d82704f52a693f1d3cd238dbb
parentaa915417b7bc2b07c257b086f71114d607ae2ec3
ipv4: Fix ip_skb_dst_mtu to use the sk passed by ip_finish_output

ip_skb_dst_mtu uses skb->sk, assuming it is an AF_INET socket (e.g. it
calls ip_sk_use_pmtu which casts sk as an inet_sk).

However, in the case of UDP tunneling, the skb->sk is not necessarily an
inet socket (could be AF_PACKET socket, or AF_UNSPEC if arriving from
tun/tap).

OTOH, the sk passed as an argument throughout IP stack's output path is
the one which is of PMTU interest:
 - In case of local sockets, sk is same as skb->sk;
 - In case of a udp tunnel, sk is the tunneling socket.

Fix, by passing ip_finish_output's sk to ip_skb_dst_mtu.
This augments a6afdbba58 'netfilter: Pass socket pointer down through okfn().'

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Reviewed-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ip.h
net/bridge/br_netfilter_hooks.c
net/ipv4/ip_output.c