diff options
| author | David Miller <davem@davemloft.net> | 2015-04-05 22:19:04 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2015-04-07 15:25:55 -0400 |
| commit | 7026b1ddb6b8d4e6ee33dc2bd06c0ca8746fa7ab (patch) | |
| tree | 3e11ed0f186ea6066a3f7efecb88d85bc732ee51 /include/net | |
| parent | 1c984f8a5df085bcf35364a8a870bd4db4da4ed3 (diff) | |
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>
Diffstat (limited to 'include/net')
| -rw-r--r-- | include/net/dn_neigh.h | 6 | ||||
| -rw-r--r-- | include/net/ip.h | 3 | ||||
| -rw-r--r-- | include/net/ip6_route.h | 3 | ||||
| -rw-r--r-- | include/net/ipv6.h | 2 | ||||
| -rw-r--r-- | include/net/xfrm.h | 8 |
5 files changed, 12 insertions, 10 deletions
diff --git a/include/net/dn_neigh.h b/include/net/dn_neigh.h index 0f26aa707e62..d0424269313f 100644 --- a/include/net/dn_neigh.h +++ b/include/net/dn_neigh.h | |||
| @@ -18,11 +18,11 @@ struct dn_neigh { | |||
| 18 | 18 | ||
| 19 | void dn_neigh_init(void); | 19 | void dn_neigh_init(void); |
| 20 | void dn_neigh_cleanup(void); | 20 | void dn_neigh_cleanup(void); |
| 21 | int dn_neigh_router_hello(struct sk_buff *skb); | 21 | int dn_neigh_router_hello(struct sock *sk, struct sk_buff *skb); |
| 22 | int dn_neigh_endnode_hello(struct sk_buff *skb); | 22 | int dn_neigh_endnode_hello(struct sock *sk, struct sk_buff *skb); |
| 23 | void dn_neigh_pointopoint_hello(struct sk_buff *skb); | 23 | void dn_neigh_pointopoint_hello(struct sk_buff *skb); |
| 24 | int dn_neigh_elist(struct net_device *dev, unsigned char *ptr, int n); | 24 | int dn_neigh_elist(struct net_device *dev, unsigned char *ptr, int n); |
| 25 | int dn_to_neigh_output(struct sk_buff *skb); | 25 | int dn_to_neigh_output(struct sock *sk, struct sk_buff *skb); |
| 26 | 26 | ||
| 27 | extern struct neigh_table dn_neigh_table; | 27 | extern struct neigh_table dn_neigh_table; |
| 28 | 28 | ||
diff --git a/include/net/ip.h b/include/net/ip.h index 69cd9cb8400c..d14af7edd197 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
| @@ -108,7 +108,8 @@ int ip_local_deliver(struct sk_buff *skb); | |||
| 108 | int ip_mr_input(struct sk_buff *skb); | 108 | int ip_mr_input(struct sk_buff *skb); |
| 109 | int ip_output(struct sock *sk, struct sk_buff *skb); | 109 | int ip_output(struct sock *sk, struct sk_buff *skb); |
| 110 | int ip_mc_output(struct sock *sk, struct sk_buff *skb); | 110 | int ip_mc_output(struct sock *sk, struct sk_buff *skb); |
| 111 | int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); | 111 | int ip_fragment(struct sock *sk, struct sk_buff *skb, |
| 112 | int (*output)(struct sock *, struct sk_buff *)); | ||
| 112 | int ip_do_nat(struct sk_buff *skb); | 113 | int ip_do_nat(struct sk_buff *skb); |
| 113 | void ip_send_check(struct iphdr *ip); | 114 | void ip_send_check(struct iphdr *ip); |
| 114 | int __ip_local_out(struct sk_buff *skb); | 115 | int __ip_local_out(struct sk_buff *skb); |
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index eda131d179d9..5e192068e6cb 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
| @@ -170,7 +170,8 @@ static inline bool ipv6_anycast_destination(const struct sk_buff *skb) | |||
| 170 | return rt->rt6i_flags & RTF_ANYCAST; | 170 | return rt->rt6i_flags & RTF_ANYCAST; |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); | 173 | int ip6_fragment(struct sock *sk, struct sk_buff *skb, |
| 174 | int (*output)(struct sock *, struct sk_buff *)); | ||
| 174 | 175 | ||
| 175 | static inline int ip6_skb_dst_mtu(struct sk_buff *skb) | 176 | static inline int ip6_skb_dst_mtu(struct sk_buff *skb) |
| 176 | { | 177 | { |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 65142e6af440..b6ae959824ff 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
| @@ -769,7 +769,7 @@ static inline u8 ip6_tclass(__be32 flowinfo) | |||
| 769 | int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, | 769 | int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, |
| 770 | struct packet_type *pt, struct net_device *orig_dev); | 770 | struct packet_type *pt, struct net_device *orig_dev); |
| 771 | 771 | ||
| 772 | int ip6_rcv_finish(struct sk_buff *skb); | 772 | int ip6_rcv_finish(struct sock *sk, struct sk_buff *skb); |
| 773 | 773 | ||
| 774 | /* | 774 | /* |
| 775 | * upper-layer output functions | 775 | * upper-layer output functions |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 461f83539493..36ac102c97c7 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
| @@ -332,7 +332,7 @@ struct xfrm_state_afinfo { | |||
| 332 | int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); | 332 | int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); |
| 333 | int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); | 333 | int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); |
| 334 | int (*output)(struct sock *sk, struct sk_buff *skb); | 334 | int (*output)(struct sock *sk, struct sk_buff *skb); |
| 335 | int (*output_finish)(struct sk_buff *skb); | 335 | int (*output_finish)(struct sock *sk, struct sk_buff *skb); |
| 336 | int (*extract_input)(struct xfrm_state *x, | 336 | int (*extract_input)(struct xfrm_state *x, |
| 337 | struct sk_buff *skb); | 337 | struct sk_buff *skb); |
| 338 | int (*extract_output)(struct xfrm_state *x, | 338 | int (*extract_output)(struct xfrm_state *x, |
| @@ -1503,7 +1503,7 @@ int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb); | |||
| 1503 | int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type); | 1503 | int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type); |
| 1504 | int xfrm_input_resume(struct sk_buff *skb, int nexthdr); | 1504 | int xfrm_input_resume(struct sk_buff *skb, int nexthdr); |
| 1505 | int xfrm_output_resume(struct sk_buff *skb, int err); | 1505 | int xfrm_output_resume(struct sk_buff *skb, int err); |
| 1506 | int xfrm_output(struct sk_buff *skb); | 1506 | int xfrm_output(struct sock *sk, struct sk_buff *skb); |
| 1507 | int xfrm_inner_extract_output(struct xfrm_state *x, struct sk_buff *skb); | 1507 | int xfrm_inner_extract_output(struct xfrm_state *x, struct sk_buff *skb); |
| 1508 | void xfrm_local_error(struct sk_buff *skb, int mtu); | 1508 | void xfrm_local_error(struct sk_buff *skb, int mtu); |
| 1509 | int xfrm4_extract_header(struct sk_buff *skb); | 1509 | int xfrm4_extract_header(struct sk_buff *skb); |
| @@ -1524,7 +1524,7 @@ static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) | |||
| 1524 | int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb); | 1524 | int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb); |
| 1525 | int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb); | 1525 | int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb); |
| 1526 | int xfrm4_output(struct sock *sk, struct sk_buff *skb); | 1526 | int xfrm4_output(struct sock *sk, struct sk_buff *skb); |
| 1527 | int xfrm4_output_finish(struct sk_buff *skb); | 1527 | int xfrm4_output_finish(struct sock *sk, struct sk_buff *skb); |
| 1528 | int xfrm4_rcv_cb(struct sk_buff *skb, u8 protocol, int err); | 1528 | int xfrm4_rcv_cb(struct sk_buff *skb, u8 protocol, int err); |
| 1529 | int xfrm4_protocol_register(struct xfrm4_protocol *handler, unsigned char protocol); | 1529 | int xfrm4_protocol_register(struct xfrm4_protocol *handler, unsigned char protocol); |
| 1530 | int xfrm4_protocol_deregister(struct xfrm4_protocol *handler, unsigned char protocol); | 1530 | int xfrm4_protocol_deregister(struct xfrm4_protocol *handler, unsigned char protocol); |
| @@ -1549,7 +1549,7 @@ __be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr); | |||
| 1549 | int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); | 1549 | int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); |
| 1550 | int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); | 1550 | int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); |
| 1551 | int xfrm6_output(struct sock *sk, struct sk_buff *skb); | 1551 | int xfrm6_output(struct sock *sk, struct sk_buff *skb); |
| 1552 | int xfrm6_output_finish(struct sk_buff *skb); | 1552 | int xfrm6_output_finish(struct sock *sk, struct sk_buff *skb); |
| 1553 | int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, | 1553 | int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, |
| 1554 | u8 **prevhdr); | 1554 | u8 **prevhdr); |
| 1555 | 1555 | ||
