summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2015-10-07 17:48:47 -0400
committerDavid S. Miller <davem@davemloft.net>2015-10-08 07:27:03 -0400
commitede2059dbaf9c6557a49d466c8c7778343b208ff (patch)
treed6d15cbeb675b52ef22890a2228b5301b1396c45
parent33224b16ffccb49cf798317670389e0bfba0024c (diff)
dst: Pass net into dst->output
The network namespace is already passed into dst_output pass it into dst->output lwt->output and friends. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/vrf.c3
-rw-r--r--include/net/dst.h8
-rw-r--r--include/net/ip.h4
-rw-r--r--include/net/ipv6.h2
-rw-r--r--include/net/lwtunnel.h8
-rw-r--r--include/net/xfrm.h6
-rw-r--r--net/core/dst.c14
-rw-r--r--net/core/lwtunnel.c4
-rw-r--r--net/decnet/dn_route.c6
-rw-r--r--net/ipv4/ip_output.c6
-rw-r--r--net/ipv4/route.c4
-rw-r--r--net/ipv4/xfrm4_output.c4
-rw-r--r--net/ipv6/ila.c4
-rw-r--r--net/ipv6/ip6_output.c3
-rw-r--r--net/ipv6/route.c14
-rw-r--r--net/ipv6/xfrm6_output.c4
-rw-r--r--net/mpls/mpls_iptunnel.c2
-rw-r--r--net/xfrm/xfrm_policy.c2
18 files changed, 45 insertions, 53 deletions
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 21bb7deb6d58..191579aeab16 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -312,10 +312,9 @@ err:
312 return ret; 312 return ret;
313} 313}
314 314
315static int vrf_output(struct sock *sk, struct sk_buff *skb) 315static int vrf_output(struct net *net, struct sock *sk, struct sk_buff *skb)
316{ 316{
317 struct net_device *dev = skb_dst(skb)->dev; 317 struct net_device *dev = skb_dst(skb)->dev;
318 struct net *net = dev_net(dev);
319 318
320 IP_UPD_PO_STATS(net, IPSTATS_MIB_OUT, skb->len); 319 IP_UPD_PO_STATS(net, IPSTATS_MIB_OUT, skb->len);
321 320
diff --git a/include/net/dst.h b/include/net/dst.h
index fdd01fed1a7b..1279f9b09791 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -45,7 +45,7 @@ struct dst_entry {
45 void *__pad1; 45 void *__pad1;
46#endif 46#endif
47 int (*input)(struct sk_buff *); 47 int (*input)(struct sk_buff *);
48 int (*output)(struct sock *sk, struct sk_buff *skb); 48 int (*output)(struct net *net, struct sock *sk, struct sk_buff *skb);
49 49
50 unsigned short flags; 50 unsigned short flags;
51#define DST_HOST 0x0001 51#define DST_HOST 0x0001
@@ -365,10 +365,10 @@ static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev,
365 __skb_tunnel_rx(skb, dev, net); 365 __skb_tunnel_rx(skb, dev, net);
366} 366}
367 367
368int dst_discard_sk(struct sock *sk, struct sk_buff *skb); 368int dst_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb);
369static inline int dst_discard(struct sk_buff *skb) 369static inline int dst_discard(struct sk_buff *skb)
370{ 370{
371 return dst_discard_sk(skb->sk, skb); 371 return dst_discard_out(&init_net, skb->sk, skb);
372} 372}
373void *dst_alloc(struct dst_ops *ops, struct net_device *dev, int initial_ref, 373void *dst_alloc(struct dst_ops *ops, struct net_device *dev, int initial_ref,
374 int initial_obsolete, unsigned short flags); 374 int initial_obsolete, unsigned short flags);
@@ -456,7 +456,7 @@ static inline void dst_set_expires(struct dst_entry *dst, int timeout)
456/* Output packet to network from transport. */ 456/* Output packet to network from transport. */
457static inline int dst_output(struct net *net, struct sock *sk, struct sk_buff *skb) 457static inline int dst_output(struct net *net, struct sock *sk, struct sk_buff *skb)
458{ 458{
459 return skb_dst(skb)->output(sk, skb); 459 return skb_dst(skb)->output(net, sk, skb);
460} 460}
461 461
462/* Input packet from network to transport. */ 462/* Input packet from network to transport. */
diff --git a/include/net/ip.h b/include/net/ip.h
index 7febbab784cd..3c904a28d5e5 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -107,8 +107,8 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
107 struct net_device *orig_dev); 107 struct net_device *orig_dev);
108int ip_local_deliver(struct sk_buff *skb); 108int ip_local_deliver(struct sk_buff *skb);
109int ip_mr_input(struct sk_buff *skb); 109int ip_mr_input(struct sk_buff *skb);
110int ip_output(struct sock *sk, struct sk_buff *skb); 110int ip_output(struct net *net, struct sock *sk, struct sk_buff *skb);
111int ip_mc_output(struct sock *sk, struct sk_buff *skb); 111int ip_mc_output(struct net *net, struct sock *sk, struct sk_buff *skb);
112int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, 112int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
113 int (*output)(struct net *, struct sock *, struct sk_buff *)); 113 int (*output)(struct net *, struct sock *, struct sk_buff *));
114void ip_send_check(struct iphdr *ip); 114void ip_send_check(struct iphdr *ip);
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index fce8120c2be3..e1a10b0ac0b0 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -860,7 +860,7 @@ struct dst_entry *ip6_blackhole_route(struct net *net,
860 * skb processing functions 860 * skb processing functions
861 */ 861 */
862 862
863int ip6_output(struct sock *sk, struct sk_buff *skb); 863int ip6_output(struct net *net, struct sock *sk, struct sk_buff *skb);
864int ip6_forward(struct sk_buff *skb); 864int ip6_forward(struct sk_buff *skb);
865int ip6_input(struct sk_buff *skb); 865int ip6_input(struct sk_buff *skb);
866int ip6_mc_input(struct sk_buff *skb); 866int ip6_mc_input(struct sk_buff *skb);
diff --git a/include/net/lwtunnel.h b/include/net/lwtunnel.h
index fce0e35e74d0..66350ce3e955 100644
--- a/include/net/lwtunnel.h
+++ b/include/net/lwtunnel.h
@@ -18,7 +18,7 @@ struct lwtunnel_state {
18 __u16 type; 18 __u16 type;
19 __u16 flags; 19 __u16 flags;
20 atomic_t refcnt; 20 atomic_t refcnt;
21 int (*orig_output)(struct sock *sk, struct sk_buff *skb); 21 int (*orig_output)(struct net *net, struct sock *sk, struct sk_buff *skb);
22 int (*orig_input)(struct sk_buff *); 22 int (*orig_input)(struct sk_buff *);
23 int len; 23 int len;
24 __u8 data[0]; 24 __u8 data[0];
@@ -28,7 +28,7 @@ struct lwtunnel_encap_ops {
28 int (*build_state)(struct net_device *dev, struct nlattr *encap, 28 int (*build_state)(struct net_device *dev, struct nlattr *encap,
29 unsigned int family, const void *cfg, 29 unsigned int family, const void *cfg,
30 struct lwtunnel_state **ts); 30 struct lwtunnel_state **ts);
31 int (*output)(struct sock *sk, struct sk_buff *skb); 31 int (*output)(struct net *net, struct sock *sk, struct sk_buff *skb);
32 int (*input)(struct sk_buff *skb); 32 int (*input)(struct sk_buff *skb);
33 int (*fill_encap)(struct sk_buff *skb, 33 int (*fill_encap)(struct sk_buff *skb,
34 struct lwtunnel_state *lwtstate); 34 struct lwtunnel_state *lwtstate);
@@ -88,7 +88,7 @@ int lwtunnel_fill_encap(struct sk_buff *skb,
88int lwtunnel_get_encap_size(struct lwtunnel_state *lwtstate); 88int lwtunnel_get_encap_size(struct lwtunnel_state *lwtstate);
89struct lwtunnel_state *lwtunnel_state_alloc(int hdr_len); 89struct lwtunnel_state *lwtunnel_state_alloc(int hdr_len);
90int lwtunnel_cmp_encap(struct lwtunnel_state *a, struct lwtunnel_state *b); 90int lwtunnel_cmp_encap(struct lwtunnel_state *a, struct lwtunnel_state *b);
91int lwtunnel_output(struct sock *sk, struct sk_buff *skb); 91int lwtunnel_output(struct net *net, struct sock *sk, struct sk_buff *skb);
92int lwtunnel_input(struct sk_buff *skb); 92int lwtunnel_input(struct sk_buff *skb);
93 93
94#else 94#else
@@ -160,7 +160,7 @@ static inline int lwtunnel_cmp_encap(struct lwtunnel_state *a,
160 return 0; 160 return 0;
161} 161}
162 162
163static inline int lwtunnel_output(struct sock *sk, struct sk_buff *skb) 163static inline int lwtunnel_output(struct net *net, struct sock *sk, struct sk_buff *skb)
164{ 164{
165 return -EOPNOTSUPP; 165 return -EOPNOTSUPP;
166} 166}
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index fd176106909a..4a9c21f9b4ea 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -333,7 +333,7 @@ struct xfrm_state_afinfo {
333 const xfrm_address_t *saddr); 333 const xfrm_address_t *saddr);
334 int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); 334 int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n);
335 int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); 335 int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n);
336 int (*output)(struct sock *sk, struct sk_buff *skb); 336 int (*output)(struct net *net, struct sock *sk, struct sk_buff *skb);
337 int (*output_finish)(struct sock *sk, struct sk_buff *skb); 337 int (*output_finish)(struct sock *sk, struct sk_buff *skb);
338 int (*extract_input)(struct xfrm_state *x, 338 int (*extract_input)(struct xfrm_state *x,
339 struct sk_buff *skb); 339 struct sk_buff *skb);
@@ -1527,7 +1527,7 @@ static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi)
1527 1527
1528int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1528int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1529int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb); 1529int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
1530int xfrm4_output(struct sock *sk, struct sk_buff *skb); 1530int xfrm4_output(struct net *net, struct sock *sk, struct sk_buff *skb);
1531int xfrm4_output_finish(struct sock *sk, struct sk_buff *skb); 1531int xfrm4_output_finish(struct sock *sk, struct sk_buff *skb);
1532int xfrm4_rcv_cb(struct sk_buff *skb, u8 protocol, int err); 1532int xfrm4_rcv_cb(struct sk_buff *skb, u8 protocol, int err);
1533int xfrm4_protocol_register(struct xfrm4_protocol *handler, unsigned char protocol); 1533int xfrm4_protocol_register(struct xfrm4_protocol *handler, unsigned char protocol);
@@ -1552,7 +1552,7 @@ __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr);
1552__be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr); 1552__be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr);
1553int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1553int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1554int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); 1554int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
1555int xfrm6_output(struct sock *sk, struct sk_buff *skb); 1555int xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb);
1556int xfrm6_output_finish(struct sock *sk, struct sk_buff *skb); 1556int xfrm6_output_finish(struct sock *sk, struct sk_buff *skb);
1557int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, 1557int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb,
1558 u8 **prevhdr); 1558 u8 **prevhdr);
diff --git a/net/core/dst.c b/net/core/dst.c
index 0771c8cb9307..2a1818065e12 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -144,12 +144,12 @@ loop:
144 mutex_unlock(&dst_gc_mutex); 144 mutex_unlock(&dst_gc_mutex);
145} 145}
146 146
147int dst_discard_sk(struct sock *sk, struct sk_buff *skb) 147int dst_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb)
148{ 148{
149 kfree_skb(skb); 149 kfree_skb(skb);
150 return 0; 150 return 0;
151} 151}
152EXPORT_SYMBOL(dst_discard_sk); 152EXPORT_SYMBOL(dst_discard_out);
153 153
154const u32 dst_default_metrics[RTAX_MAX + 1] = { 154const u32 dst_default_metrics[RTAX_MAX + 1] = {
155 /* This initializer is needed to force linker to place this variable 155 /* This initializer is needed to force linker to place this variable
@@ -177,7 +177,7 @@ void dst_init(struct dst_entry *dst, struct dst_ops *ops,
177 dst->xfrm = NULL; 177 dst->xfrm = NULL;
178#endif 178#endif
179 dst->input = dst_discard; 179 dst->input = dst_discard;
180 dst->output = dst_discard_sk; 180 dst->output = dst_discard_out;
181 dst->error = 0; 181 dst->error = 0;
182 dst->obsolete = initial_obsolete; 182 dst->obsolete = initial_obsolete;
183 dst->header_len = 0; 183 dst->header_len = 0;
@@ -224,7 +224,7 @@ static void ___dst_free(struct dst_entry *dst)
224 */ 224 */
225 if (dst->dev == NULL || !(dst->dev->flags&IFF_UP)) { 225 if (dst->dev == NULL || !(dst->dev->flags&IFF_UP)) {
226 dst->input = dst_discard; 226 dst->input = dst_discard;
227 dst->output = dst_discard_sk; 227 dst->output = dst_discard_out;
228 } 228 }
229 dst->obsolete = DST_OBSOLETE_DEAD; 229 dst->obsolete = DST_OBSOLETE_DEAD;
230} 230}
@@ -352,7 +352,7 @@ static struct dst_ops md_dst_ops = {
352 .family = AF_UNSPEC, 352 .family = AF_UNSPEC,
353}; 353};
354 354
355static int dst_md_discard_sk(struct sock *sk, struct sk_buff *skb) 355static int dst_md_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb)
356{ 356{
357 WARN_ONCE(1, "Attempting to call output on metadata dst\n"); 357 WARN_ONCE(1, "Attempting to call output on metadata dst\n");
358 kfree_skb(skb); 358 kfree_skb(skb);
@@ -375,7 +375,7 @@ static void __metadata_dst_init(struct metadata_dst *md_dst, u8 optslen)
375 DST_METADATA | DST_NOCACHE | DST_NOCOUNT); 375 DST_METADATA | DST_NOCACHE | DST_NOCOUNT);
376 376
377 dst->input = dst_md_discard; 377 dst->input = dst_md_discard;
378 dst->output = dst_md_discard_sk; 378 dst->output = dst_md_discard_out;
379 379
380 memset(dst + 1, 0, sizeof(*md_dst) + optslen - sizeof(*dst)); 380 memset(dst + 1, 0, sizeof(*md_dst) + optslen - sizeof(*dst));
381} 381}
@@ -430,7 +430,7 @@ static void dst_ifdown(struct dst_entry *dst, struct net_device *dev,
430 430
431 if (!unregister) { 431 if (!unregister) {
432 dst->input = dst_discard; 432 dst->input = dst_discard;
433 dst->output = dst_discard_sk; 433 dst->output = dst_discard_out;
434 } else { 434 } else {
435 dst->dev = dev_net(dst->dev)->loopback_dev; 435 dst->dev = dev_net(dst->dev)->loopback_dev;
436 dev_hold(dst->dev); 436 dev_hold(dst->dev);
diff --git a/net/core/lwtunnel.c b/net/core/lwtunnel.c
index dfb1a9ca0835..299cfc24d888 100644
--- a/net/core/lwtunnel.c
+++ b/net/core/lwtunnel.c
@@ -180,7 +180,7 @@ int lwtunnel_cmp_encap(struct lwtunnel_state *a, struct lwtunnel_state *b)
180} 180}
181EXPORT_SYMBOL(lwtunnel_cmp_encap); 181EXPORT_SYMBOL(lwtunnel_cmp_encap);
182 182
183int lwtunnel_output(struct sock *sk, struct sk_buff *skb) 183int lwtunnel_output(struct net *net, struct sock *sk, struct sk_buff *skb)
184{ 184{
185 struct dst_entry *dst = skb_dst(skb); 185 struct dst_entry *dst = skb_dst(skb);
186 const struct lwtunnel_encap_ops *ops; 186 const struct lwtunnel_encap_ops *ops;
@@ -199,7 +199,7 @@ int lwtunnel_output(struct sock *sk, struct sk_buff *skb)
199 rcu_read_lock(); 199 rcu_read_lock();
200 ops = rcu_dereference(lwtun_encaps[lwtstate->type]); 200 ops = rcu_dereference(lwtun_encaps[lwtstate->type]);
201 if (likely(ops && ops->output)) 201 if (likely(ops && ops->output))
202 ret = ops->output(sk, skb); 202 ret = ops->output(net, sk, skb);
203 rcu_read_unlock(); 203 rcu_read_unlock();
204 204
205 if (ret == -EOPNOTSUPP) 205 if (ret == -EOPNOTSUPP)
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index e930321e2c1d..27fce283117b 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -744,7 +744,7 @@ out:
744 return NET_RX_DROP; 744 return NET_RX_DROP;
745} 745}
746 746
747static int dn_output(struct sock *sk, struct sk_buff *skb) 747static int dn_output(struct net *net, struct sock *sk, struct sk_buff *skb)
748{ 748{
749 struct dst_entry *dst = skb_dst(skb); 749 struct dst_entry *dst = skb_dst(skb);
750 struct dn_route *rt = (struct dn_route *)dst; 750 struct dn_route *rt = (struct dn_route *)dst;
@@ -832,7 +832,7 @@ drop:
832 * Used to catch bugs. This should never normally get 832 * Used to catch bugs. This should never normally get
833 * called. 833 * called.
834 */ 834 */
835static int dn_rt_bug_sk(struct sock *sk, struct sk_buff *skb) 835static int dn_rt_bug_out(struct net *net, struct sock *sk, struct sk_buff *skb)
836{ 836{
837 struct dn_skb_cb *cb = DN_SKB_CB(skb); 837 struct dn_skb_cb *cb = DN_SKB_CB(skb);
838 838
@@ -1469,7 +1469,7 @@ make_route:
1469 1469
1470 rt->n = neigh; 1470 rt->n = neigh;
1471 rt->dst.lastuse = jiffies; 1471 rt->dst.lastuse = jiffies;
1472 rt->dst.output = dn_rt_bug_sk; 1472 rt->dst.output = dn_rt_bug_out;
1473 switch (res.type) { 1473 switch (res.type) {
1474 case RTN_UNICAST: 1474 case RTN_UNICAST:
1475 rt->dst.input = dn_forward; 1475 rt->dst.input = dn_forward;
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 9fe100a41e5d..67404e1fe7d4 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -284,11 +284,10 @@ static int ip_finish_output(struct net *net, struct sock *sk, struct sk_buff *sk
284 return ip_finish_output2(net, sk, skb); 284 return ip_finish_output2(net, sk, skb);
285} 285}
286 286
287int ip_mc_output(struct sock *sk, struct sk_buff *skb) 287int ip_mc_output(struct net *net, struct sock *sk, struct sk_buff *skb)
288{ 288{
289 struct rtable *rt = skb_rtable(skb); 289 struct rtable *rt = skb_rtable(skb);
290 struct net_device *dev = rt->dst.dev; 290 struct net_device *dev = rt->dst.dev;
291 struct net *net = dev_net(dev);
292 291
293 /* 292 /*
294 * If the indicated interface is up and running, send the packet. 293 * If the indicated interface is up and running, send the packet.
@@ -347,10 +346,9 @@ int ip_mc_output(struct sock *sk, struct sk_buff *skb)
347 !(IPCB(skb)->flags & IPSKB_REROUTED)); 346 !(IPCB(skb)->flags & IPSKB_REROUTED));
348} 347}
349 348
350int ip_output(struct sock *sk, struct sk_buff *skb) 349int ip_output(struct net *net, struct sock *sk, struct sk_buff *skb)
351{ 350{
352 struct net_device *dev = skb_dst(skb)->dev; 351 struct net_device *dev = skb_dst(skb)->dev;
353 struct net *net = dev_net(dev);
354 352
355 IP_UPD_PO_STATS(net, IPSTATS_MIB_OUT, skb->len); 353 IP_UPD_PO_STATS(net, IPSTATS_MIB_OUT, skb->len);
356 354
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index bf1486bd7e81..4be5ff08f98d 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1152,7 +1152,7 @@ static void ipv4_link_failure(struct sk_buff *skb)
1152 dst_set_expires(&rt->dst, 0); 1152 dst_set_expires(&rt->dst, 0);
1153} 1153}
1154 1154
1155static int ip_rt_bug(struct sock *sk, struct sk_buff *skb) 1155static int ip_rt_bug(struct net *net, struct sock *sk, struct sk_buff *skb)
1156{ 1156{
1157 pr_debug("%s: %pI4 -> %pI4, %s\n", 1157 pr_debug("%s: %pI4 -> %pI4, %s\n",
1158 __func__, &ip_hdr(skb)->saddr, &ip_hdr(skb)->daddr, 1158 __func__, &ip_hdr(skb)->saddr, &ip_hdr(skb)->daddr,
@@ -2303,7 +2303,7 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or
2303 2303
2304 new->__use = 1; 2304 new->__use = 1;
2305 new->input = dst_discard; 2305 new->input = dst_discard;
2306 new->output = dst_discard_sk; 2306 new->output = dst_discard_out;
2307 2307
2308 new->dev = ort->dst.dev; 2308 new->dev = ort->dst.dev;
2309 if (new->dev) 2309 if (new->dev)
diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c
index 17db61f4b439..9f298d0dc9a1 100644
--- a/net/ipv4/xfrm4_output.c
+++ b/net/ipv4/xfrm4_output.c
@@ -94,10 +94,8 @@ static int __xfrm4_output(struct net *net, struct sock *sk, struct sk_buff *skb)
94 return x->outer_mode->afinfo->output_finish(sk, skb); 94 return x->outer_mode->afinfo->output_finish(sk, skb);
95} 95}
96 96
97int xfrm4_output(struct sock *sk, struct sk_buff *skb) 97int xfrm4_output(struct net *net, struct sock *sk, struct sk_buff *skb)
98{ 98{
99 struct net *net = dev_net(skb_dst(skb)->dev);
100
101 return NF_HOOK_COND(NFPROTO_IPV4, NF_INET_POST_ROUTING, 99 return NF_HOOK_COND(NFPROTO_IPV4, NF_INET_POST_ROUTING,
102 net, sk, skb, NULL, skb_dst(skb)->dev, 100 net, sk, skb, NULL, skb_dst(skb)->dev,
103 __xfrm4_output, 101 __xfrm4_output,
diff --git a/net/ipv6/ila.c b/net/ipv6/ila.c
index 678d2df4b8d9..1a6852e1ac69 100644
--- a/net/ipv6/ila.c
+++ b/net/ipv6/ila.c
@@ -91,7 +91,7 @@ static void update_ipv6_locator(struct sk_buff *skb, struct ila_params *p)
91 *(__be64 *)&ip6h->daddr = p->locator; 91 *(__be64 *)&ip6h->daddr = p->locator;
92} 92}
93 93
94static int ila_output(struct sock *sk, struct sk_buff *skb) 94static int ila_output(struct net *net, struct sock *sk, struct sk_buff *skb)
95{ 95{
96 struct dst_entry *dst = skb_dst(skb); 96 struct dst_entry *dst = skb_dst(skb);
97 97
@@ -100,7 +100,7 @@ static int ila_output(struct sock *sk, struct sk_buff *skb)
100 100
101 update_ipv6_locator(skb, ila_params_lwtunnel(dst->lwtstate)); 101 update_ipv6_locator(skb, ila_params_lwtunnel(dst->lwtstate));
102 102
103 return dst->lwtstate->orig_output(sk, skb); 103 return dst->lwtstate->orig_output(net, sk, skb);
104 104
105drop: 105drop:
106 kfree_skb(skb); 106 kfree_skb(skb);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 98510fac94e9..32583b507c2e 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -130,11 +130,10 @@ static int ip6_finish_output(struct net *net, struct sock *sk, struct sk_buff *s
130 return ip6_finish_output2(net, sk, skb); 130 return ip6_finish_output2(net, sk, skb);
131} 131}
132 132
133int ip6_output(struct sock *sk, struct sk_buff *skb) 133int ip6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
134{ 134{
135 struct net_device *dev = skb_dst(skb)->dev; 135 struct net_device *dev = skb_dst(skb)->dev;
136 struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb)); 136 struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb));
137 struct net *net = dev_net(dev);
138 137
139 if (unlikely(idev->cnf.disable_ipv6)) { 138 if (unlikely(idev->cnf.disable_ipv6)) {
140 IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS); 139 IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS);
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index d3d946773a3e..4320ddcac33f 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -86,9 +86,9 @@ static void ip6_dst_ifdown(struct dst_entry *,
86static int ip6_dst_gc(struct dst_ops *ops); 86static int ip6_dst_gc(struct dst_ops *ops);
87 87
88static int ip6_pkt_discard(struct sk_buff *skb); 88static int ip6_pkt_discard(struct sk_buff *skb);
89static int ip6_pkt_discard_out(struct sock *sk, struct sk_buff *skb); 89static int ip6_pkt_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb);
90static int ip6_pkt_prohibit(struct sk_buff *skb); 90static int ip6_pkt_prohibit(struct sk_buff *skb);
91static int ip6_pkt_prohibit_out(struct sock *sk, struct sk_buff *skb); 91static int ip6_pkt_prohibit_out(struct net *net, struct sock *sk, struct sk_buff *skb);
92static void ip6_link_failure(struct sk_buff *skb); 92static void ip6_link_failure(struct sk_buff *skb);
93static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, 93static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
94 struct sk_buff *skb, u32 mtu); 94 struct sk_buff *skb, u32 mtu);
@@ -308,7 +308,7 @@ static const struct rt6_info ip6_blk_hole_entry_template = {
308 .obsolete = DST_OBSOLETE_FORCE_CHK, 308 .obsolete = DST_OBSOLETE_FORCE_CHK,
309 .error = -EINVAL, 309 .error = -EINVAL,
310 .input = dst_discard, 310 .input = dst_discard,
311 .output = dst_discard_sk, 311 .output = dst_discard_out,
312 }, 312 },
313 .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP), 313 .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP),
314 .rt6i_protocol = RTPROT_KERNEL, 314 .rt6i_protocol = RTPROT_KERNEL,
@@ -1195,7 +1195,7 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori
1195 1195
1196 new->__use = 1; 1196 new->__use = 1;
1197 new->input = dst_discard; 1197 new->input = dst_discard;
1198 new->output = dst_discard_sk; 1198 new->output = dst_discard_out;
1199 1199
1200 if (dst_metrics_read_only(&ort->dst)) 1200 if (dst_metrics_read_only(&ort->dst))
1201 new->_metrics = ort->dst._metrics; 1201 new->_metrics = ort->dst._metrics;
@@ -1853,7 +1853,7 @@ int ip6_route_info_create(struct fib6_config *cfg, struct rt6_info **rt_ret)
1853 switch (cfg->fc_type) { 1853 switch (cfg->fc_type) {
1854 case RTN_BLACKHOLE: 1854 case RTN_BLACKHOLE:
1855 rt->dst.error = -EINVAL; 1855 rt->dst.error = -EINVAL;
1856 rt->dst.output = dst_discard_sk; 1856 rt->dst.output = dst_discard_out;
1857 rt->dst.input = dst_discard; 1857 rt->dst.input = dst_discard;
1858 break; 1858 break;
1859 case RTN_PROHIBIT: 1859 case RTN_PROHIBIT:
@@ -2446,7 +2446,7 @@ static int ip6_pkt_discard(struct sk_buff *skb)
2446 return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_INNOROUTES); 2446 return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_INNOROUTES);
2447} 2447}
2448 2448
2449static int ip6_pkt_discard_out(struct sock *sk, struct sk_buff *skb) 2449static int ip6_pkt_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb)
2450{ 2450{
2451 skb->dev = skb_dst(skb)->dev; 2451 skb->dev = skb_dst(skb)->dev;
2452 return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_OUTNOROUTES); 2452 return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_OUTNOROUTES);
@@ -2457,7 +2457,7 @@ static int ip6_pkt_prohibit(struct sk_buff *skb)
2457 return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_INNOROUTES); 2457 return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_INNOROUTES);
2458} 2458}
2459 2459
2460static int ip6_pkt_prohibit_out(struct sock *sk, struct sk_buff *skb) 2460static int ip6_pkt_prohibit_out(struct net *net, struct sock *sk, struct sk_buff *skb)
2461{ 2461{
2462 skb->dev = skb_dst(skb)->dev; 2462 skb->dev = skb_dst(skb)->dev;
2463 return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); 2463 return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES);
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
index c9a5bd5fea9c..9db067a11b52 100644
--- a/net/ipv6/xfrm6_output.c
+++ b/net/ipv6/xfrm6_output.c
@@ -173,10 +173,8 @@ static int __xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
173 return x->outer_mode->afinfo->output_finish(sk, skb); 173 return x->outer_mode->afinfo->output_finish(sk, skb);
174} 174}
175 175
176int xfrm6_output(struct sock *sk, struct sk_buff *skb) 176int xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
177{ 177{
178 struct net *net = dev_net(skb_dst(skb)->dev);
179
180 return NF_HOOK_COND(NFPROTO_IPV6, NF_INET_POST_ROUTING, 178 return NF_HOOK_COND(NFPROTO_IPV6, NF_INET_POST_ROUTING,
181 net, sk, skb, NULL, skb_dst(skb)->dev, 179 net, sk, skb, NULL, skb_dst(skb)->dev,
182 __xfrm6_output, 180 __xfrm6_output,
diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c
index 21e70bc9af98..67591aef9cae 100644
--- a/net/mpls/mpls_iptunnel.c
+++ b/net/mpls/mpls_iptunnel.c
@@ -37,7 +37,7 @@ static unsigned int mpls_encap_size(struct mpls_iptunnel_encap *en)
37 return en->labels * sizeof(struct mpls_shim_hdr); 37 return en->labels * sizeof(struct mpls_shim_hdr);
38} 38}
39 39
40int mpls_output(struct sock *sk, struct sk_buff *skb) 40int mpls_output(struct net *net, struct sock *sk, struct sk_buff *skb)
41{ 41{
42 struct mpls_iptunnel_encap *tun_encap_info; 42 struct mpls_iptunnel_encap *tun_encap_info;
43 struct mpls_shim_hdr *hdr; 43 struct mpls_shim_hdr *hdr;
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index f4f2d987f8f0..09bfcbac63bb 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1957,7 +1957,7 @@ purge_queue:
1957 xfrm_pol_put(pol); 1957 xfrm_pol_put(pol);
1958} 1958}
1959 1959
1960static int xdst_queue_output(struct sock *sk, struct sk_buff *skb) 1960static int xdst_queue_output(struct net *net, struct sock *sk, struct sk_buff *skb)
1961{ 1961{
1962 unsigned long sched_next; 1962 unsigned long sched_next;
1963 struct dst_entry *dst = skb_dst(skb); 1963 struct dst_entry *dst = skb_dst(skb);