netfilter: Pass socket pointer down through okfn().
authorDavid Miller <davem@davemloft.net>
Mon, 6 Apr 2015 02:19:04 +0000 (22:19 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 7 Apr 2015 19:25:55 +0000 (15:25 -0400)
commit7026b1ddb6b8d4e6ee33dc2bd06c0ca8746fa7ab
tree3e11ed0f186ea6066a3f7efecb88d85bc732ee51
parent1c984f8a5df085bcf35364a8a870bd4db4da4ed3
netfilter: Pass socket pointer down through okfn().

On the output paths in particular, we have to sometimes deal with two
socket contexts.  First, and usually skb->sk, is the local socket that
generated the frame.

And second, is potentially the socket used to control a tunneling
socket, such as one the encapsulates using UDP.

We do not want to disassociate skb->sk when encapsulating in order
to fix this, because that would break socket memory accounting.

The most extreme case where this can cause huge problems is an
AF_PACKET socket transmitting over a vxlan device.  We hit code
paths doing checks that assume they are dealing with an ipv4
socket, but are actually operating upon the AF_PACKET one.

Signed-off-by: David S. Miller <davem@davemloft.net>
39 files changed:
include/linux/netdevice.h
include/linux/netfilter.h
include/linux/netfilter_bridge.h
include/net/dn_neigh.h
include/net/ip.h
include/net/ip6_route.h
include/net/ipv6.h
include/net/xfrm.h
net/bridge/br_forward.c
net/bridge/br_input.c
net/bridge/br_multicast.c
net/bridge/br_netfilter.c
net/bridge/br_private.h
net/bridge/br_stp_bpdu.c
net/core/dev.c
net/decnet/dn_neigh.c
net/decnet/dn_nsp_in.c
net/decnet/dn_route.c
net/ipv4/arp.c
net/ipv4/ip_forward.c
net/ipv4/ip_input.c
net/ipv4/ip_output.c
net/ipv4/ipmr.c
net/ipv4/raw.c
net/ipv4/xfrm4_input.c
net/ipv4/xfrm4_output.c
net/ipv6/ip6_input.c
net/ipv6/ip6_output.c
net/ipv6/ip6mr.c
net/ipv6/mcast.c
net/ipv6/ndisc.c
net/ipv6/netfilter/nf_defrag_ipv6_hooks.c
net/ipv6/output_core.c
net/ipv6/raw.c
net/ipv6/xfrm6_input.c
net/ipv6/xfrm6_output.c
net/netfilter/ipvs/ip_vs_xmit.c
net/netfilter/nf_queue.c
net/xfrm/xfrm_output.c