diff options
author | David Miller <davem@davemloft.net> | 2015-04-05 22:19:09 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-04-07 15:29:08 -0400 |
commit | 79b16aadea32cce077acbe9e229fcb58a7801687 (patch) | |
tree | 8cfacda45a2b3d12a3831511199a13d33f245890 /net/ipv6 | |
parent | 7026b1ddb6b8d4e6ee33dc2bd06c0ca8746fa7ab (diff) |
udp_tunnel: Pass UDP socket down through udp_tunnel{, 6}_xmit_skb().
That was we can make sure the output path of ipv4/ipv6 operate on
the UDP socket rather than whatever random thing happens to be in
skb->sk.
Based upon a patch by Jiri Pirko.
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/ip6_gre.c | 2 | ||||
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 2 | ||||
-rw-r--r-- | net/ipv6/ip6_udp_tunnel.c | 5 | ||||
-rw-r--r-- | net/ipv6/output_core.c | 21 |
4 files changed, 21 insertions, 9 deletions
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index f724329d7436..b5e6cc1d4a73 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
@@ -760,7 +760,7 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb, | |||
760 | 760 | ||
761 | skb_set_inner_protocol(skb, protocol); | 761 | skb_set_inner_protocol(skb, protocol); |
762 | 762 | ||
763 | ip6tunnel_xmit(skb, dev); | 763 | ip6tunnel_xmit(NULL, skb, dev); |
764 | if (ndst) | 764 | if (ndst) |
765 | ip6_tnl_dst_store(tunnel, ndst); | 765 | ip6_tnl_dst_store(tunnel, ndst); |
766 | return 0; | 766 | return 0; |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index b6a211a150b2..5cafd92c2312 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -1100,7 +1100,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, | |||
1100 | ipv6h->nexthdr = proto; | 1100 | ipv6h->nexthdr = proto; |
1101 | ipv6h->saddr = fl6->saddr; | 1101 | ipv6h->saddr = fl6->saddr; |
1102 | ipv6h->daddr = fl6->daddr; | 1102 | ipv6h->daddr = fl6->daddr; |
1103 | ip6tunnel_xmit(skb, dev); | 1103 | ip6tunnel_xmit(NULL, skb, dev); |
1104 | if (ndst) | 1104 | if (ndst) |
1105 | ip6_tnl_dst_store(t, ndst); | 1105 | ip6_tnl_dst_store(t, ndst); |
1106 | return 0; | 1106 | return 0; |
diff --git a/net/ipv6/ip6_udp_tunnel.c b/net/ipv6/ip6_udp_tunnel.c index 32d9b268e7d8..bba8903e871f 100644 --- a/net/ipv6/ip6_udp_tunnel.c +++ b/net/ipv6/ip6_udp_tunnel.c | |||
@@ -62,7 +62,8 @@ error: | |||
62 | } | 62 | } |
63 | EXPORT_SYMBOL_GPL(udp_sock_create6); | 63 | EXPORT_SYMBOL_GPL(udp_sock_create6); |
64 | 64 | ||
65 | int udp_tunnel6_xmit_skb(struct dst_entry *dst, struct sk_buff *skb, | 65 | int udp_tunnel6_xmit_skb(struct dst_entry *dst, struct sock *sk, |
66 | struct sk_buff *skb, | ||
66 | struct net_device *dev, struct in6_addr *saddr, | 67 | struct net_device *dev, struct in6_addr *saddr, |
67 | struct in6_addr *daddr, | 68 | struct in6_addr *daddr, |
68 | __u8 prio, __u8 ttl, __be16 src_port, | 69 | __u8 prio, __u8 ttl, __be16 src_port, |
@@ -97,7 +98,7 @@ int udp_tunnel6_xmit_skb(struct dst_entry *dst, struct sk_buff *skb, | |||
97 | ip6h->daddr = *daddr; | 98 | ip6h->daddr = *daddr; |
98 | ip6h->saddr = *saddr; | 99 | ip6h->saddr = *saddr; |
99 | 100 | ||
100 | ip6tunnel_xmit(skb, dev); | 101 | ip6tunnel_xmit(sk, skb, dev); |
101 | return 0; | 102 | return 0; |
102 | } | 103 | } |
103 | EXPORT_SYMBOL_GPL(udp_tunnel6_xmit_skb); | 104 | EXPORT_SYMBOL_GPL(udp_tunnel6_xmit_skb); |
diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c index 7d1131dc29fe..85892af57364 100644 --- a/net/ipv6/output_core.c +++ b/net/ipv6/output_core.c | |||
@@ -136,7 +136,7 @@ int ip6_dst_hoplimit(struct dst_entry *dst) | |||
136 | EXPORT_SYMBOL(ip6_dst_hoplimit); | 136 | EXPORT_SYMBOL(ip6_dst_hoplimit); |
137 | #endif | 137 | #endif |
138 | 138 | ||
139 | int __ip6_local_out(struct sk_buff *skb) | 139 | static int __ip6_local_out_sk(struct sock *sk, struct sk_buff *skb) |
140 | { | 140 | { |
141 | int len; | 141 | int len; |
142 | 142 | ||
@@ -146,19 +146,30 @@ int __ip6_local_out(struct sk_buff *skb) | |||
146 | ipv6_hdr(skb)->payload_len = htons(len); | 146 | ipv6_hdr(skb)->payload_len = htons(len); |
147 | IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr); | 147 | IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr); |
148 | 148 | ||
149 | return nf_hook(NFPROTO_IPV6, NF_INET_LOCAL_OUT, skb->sk, skb, | 149 | return nf_hook(NFPROTO_IPV6, NF_INET_LOCAL_OUT, sk, skb, |
150 | NULL, skb_dst(skb)->dev, dst_output_sk); | 150 | NULL, skb_dst(skb)->dev, dst_output_sk); |
151 | } | 151 | } |
152 | |||
153 | int __ip6_local_out(struct sk_buff *skb) | ||
154 | { | ||
155 | return __ip6_local_out_sk(skb->sk, skb); | ||
156 | } | ||
152 | EXPORT_SYMBOL_GPL(__ip6_local_out); | 157 | EXPORT_SYMBOL_GPL(__ip6_local_out); |
153 | 158 | ||
154 | int ip6_local_out(struct sk_buff *skb) | 159 | int ip6_local_out_sk(struct sock *sk, struct sk_buff *skb) |
155 | { | 160 | { |
156 | int err; | 161 | int err; |
157 | 162 | ||
158 | err = __ip6_local_out(skb); | 163 | err = __ip6_local_out_sk(sk, skb); |
159 | if (likely(err == 1)) | 164 | if (likely(err == 1)) |
160 | err = dst_output(skb); | 165 | err = dst_output_sk(sk, skb); |
161 | 166 | ||
162 | return err; | 167 | return err; |
163 | } | 168 | } |
169 | EXPORT_SYMBOL_GPL(ip6_local_out_sk); | ||
170 | |||
171 | int ip6_local_out(struct sk_buff *skb) | ||
172 | { | ||
173 | return ip6_local_out_sk(skb->sk, skb); | ||
174 | } | ||
164 | EXPORT_SYMBOL_GPL(ip6_local_out); | 175 | EXPORT_SYMBOL_GPL(ip6_local_out); |