Commit 13206b6b authored by Eric W. Biederman's avatar Eric W. Biederman Committed by David S. Miller

net: Pass net into dst_output and remove dst_output_okfn

Replace dst_output_okfn with dst_output
Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3f5312ae
...@@ -454,14 +454,10 @@ static inline void dst_set_expires(struct dst_entry *dst, int timeout) ...@@ -454,14 +454,10 @@ static inline void dst_set_expires(struct dst_entry *dst, int timeout)
} }
/* Output packet to network from transport. */ /* Output packet to network from transport. */
static inline int dst_output(struct sock *sk, struct sk_buff *skb) static inline int dst_output(struct net *net, struct sock *sk, struct sk_buff *skb)
{ {
return skb_dst(skb)->output(sk, skb); return skb_dst(skb)->output(sk, skb);
} }
static inline int dst_output_okfn(struct net *net, struct sock *sk, struct sk_buff *skb)
{
return dst_output(sk, skb);
}
/* Input packet from network to transport. */ /* Input packet from network to transport. */
static inline int dst_input(struct sk_buff *skb) static inline int dst_input(struct sk_buff *skb)
......
...@@ -85,7 +85,7 @@ static void dn_nsp_send(struct sk_buff *skb) ...@@ -85,7 +85,7 @@ static void dn_nsp_send(struct sk_buff *skb)
if (dst) { if (dst) {
try_again: try_again:
skb_dst_set(skb, dst); skb_dst_set(skb, dst);
dst_output(skb->sk, skb); dst_output(&init_net, skb->sk, skb);
return; return;
} }
...@@ -582,7 +582,7 @@ static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg, ...@@ -582,7 +582,7 @@ static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
* associations. * associations.
*/ */
skb_dst_set(skb, dst_clone(dst)); skb_dst_set(skb, dst_clone(dst));
dst_output(skb->sk, skb); dst_output(&init_net, skb->sk, skb);
} }
......
...@@ -72,7 +72,7 @@ static int ip_forward_finish(struct net *net, struct sock *sk, struct sk_buff *s ...@@ -72,7 +72,7 @@ static int ip_forward_finish(struct net *net, struct sock *sk, struct sk_buff *s
ip_forward_options(skb); ip_forward_options(skb);
skb_sender_cpu_clear(skb); skb_sender_cpu_clear(skb);
return dst_output(sk, skb); return dst_output(net, sk, skb);
} }
int ip_forward(struct sk_buff *skb) int ip_forward(struct sk_buff *skb)
......
...@@ -105,7 +105,7 @@ static int __ip_local_out_sk(struct sock *sk, struct sk_buff *skb) ...@@ -105,7 +105,7 @@ static int __ip_local_out_sk(struct sock *sk, struct sk_buff *skb)
ip_send_check(iph); ip_send_check(iph);
return nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT, return nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT,
net, sk, skb, NULL, skb_dst(skb)->dev, net, sk, skb, NULL, skb_dst(skb)->dev,
dst_output_okfn); dst_output);
} }
int __ip_local_out(struct sk_buff *skb) int __ip_local_out(struct sk_buff *skb)
...@@ -115,11 +115,12 @@ int __ip_local_out(struct sk_buff *skb) ...@@ -115,11 +115,12 @@ int __ip_local_out(struct sk_buff *skb)
int ip_local_out_sk(struct sock *sk, struct sk_buff *skb) int ip_local_out_sk(struct sock *sk, struct sk_buff *skb)
{ {
struct net *net = dev_net(skb_dst(skb)->dev);
int err; int err;
err = __ip_local_out_sk(sk, skb); err = __ip_local_out_sk(sk, skb);
if (likely(err == 1)) if (likely(err == 1))
err = dst_output(sk, skb); err = dst_output(net, sk, skb);
return err; return err;
} }
...@@ -276,7 +277,7 @@ static int ip_finish_output(struct net *net, struct sock *sk, struct sk_buff *sk ...@@ -276,7 +277,7 @@ static int ip_finish_output(struct net *net, struct sock *sk, struct sk_buff *sk
/* Policy lookup after SNAT yielded a new policy */ /* Policy lookup after SNAT yielded a new policy */
if (skb_dst(skb)->xfrm) { if (skb_dst(skb)->xfrm) {
IPCB(skb)->flags |= IPSKB_REROUTED; IPCB(skb)->flags |= IPSKB_REROUTED;
return dst_output(sk, skb); return dst_output(net, sk, skb);
} }
#endif #endif
mtu = ip_skb_dst_mtu(skb); mtu = ip_skb_dst_mtu(skb);
......
...@@ -197,7 +197,7 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev, ...@@ -197,7 +197,7 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev,
skb_dst_set(skb, dst); skb_dst_set(skb, dst);
skb->dev = skb_dst(skb)->dev; skb->dev = skb_dst(skb)->dev;
err = dst_output(skb->sk, skb); err = dst_output(tunnel->net, skb->sk, skb);
if (net_xmit_eval(err) == 0) if (net_xmit_eval(err) == 0)
err = skb->len; err = skb->len;
iptunnel_xmit_stats(err, &dev->stats, dev->tstats); iptunnel_xmit_stats(err, &dev->stats, dev->tstats);
......
...@@ -1689,7 +1689,7 @@ static inline int ipmr_forward_finish(struct net *net, struct sock *sk, ...@@ -1689,7 +1689,7 @@ static inline int ipmr_forward_finish(struct net *net, struct sock *sk,
if (unlikely(opt->optlen)) if (unlikely(opt->optlen))
ip_forward_options(skb); ip_forward_options(skb);
return dst_output(sk, skb); return dst_output(net, sk, skb);
} }
/* /*
......
...@@ -413,7 +413,7 @@ static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4, ...@@ -413,7 +413,7 @@ static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4,
err = NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_OUT, err = NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_OUT,
net, sk, skb, NULL, rt->dst.dev, net, sk, skb, NULL, rt->dst.dev,
dst_output_okfn); dst_output);
if (err > 0) if (err > 0)
err = net_xmit_errno(err); err = net_xmit_errno(err);
if (err) if (err)
......
...@@ -87,7 +87,7 @@ static int __xfrm4_output(struct net *net, struct sock *sk, struct sk_buff *skb) ...@@ -87,7 +87,7 @@ static int __xfrm4_output(struct net *net, struct sock *sk, struct sk_buff *skb)
#ifdef CONFIG_NETFILTER #ifdef CONFIG_NETFILTER
if (!x) { if (!x) {
IPCB(skb)->flags |= IPSKB_REROUTED; IPCB(skb)->flags |= IPSKB_REROUTED;
return dst_output(sk, skb); return dst_output(net, sk, skb);
} }
#endif #endif
......
...@@ -233,7 +233,7 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6, ...@@ -233,7 +233,7 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
*/ */
return NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, return NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT,
net, (struct sock *)sk, skb, NULL, dst->dev, net, (struct sock *)sk, skb, NULL, dst->dev,
dst_output_okfn); dst_output);
} }
skb->dev = dst->dev; skb->dev = dst->dev;
...@@ -333,7 +333,7 @@ static inline int ip6_forward_finish(struct net *net, struct sock *sk, ...@@ -333,7 +333,7 @@ static inline int ip6_forward_finish(struct net *net, struct sock *sk,
struct sk_buff *skb) struct sk_buff *skb)
{ {
skb_sender_cpu_clear(skb); skb_sender_cpu_clear(skb);
return dst_output(sk, skb); return dst_output(net, sk, skb);
} }
static unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst) static unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst)
......
...@@ -482,7 +482,7 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) ...@@ -482,7 +482,7 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
return -EMSGSIZE; return -EMSGSIZE;
} }
err = dst_output(skb->sk, skb); err = dst_output(t->net, skb->sk, skb);
if (net_xmit_eval(err) == 0) { if (net_xmit_eval(err) == 0) {
struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
......
...@@ -1991,7 +1991,7 @@ static inline int ip6mr_forward2_finish(struct net *net, struct sock *sk, struct ...@@ -1991,7 +1991,7 @@ static inline int ip6mr_forward2_finish(struct net *net, struct sock *sk, struct
IPSTATS_MIB_OUTFORWDATAGRAMS); IPSTATS_MIB_OUTFORWDATAGRAMS);
IP6_ADD_STATS_BH(net, ip6_dst_idev(skb_dst(skb)), IP6_ADD_STATS_BH(net, ip6_dst_idev(skb_dst(skb)),
IPSTATS_MIB_OUTOCTETS, skb->len); IPSTATS_MIB_OUTOCTETS, skb->len);
return dst_output(sk, skb); return dst_output(net, sk, skb);
} }
/* /*
......
...@@ -1646,7 +1646,7 @@ static void mld_sendpack(struct sk_buff *skb) ...@@ -1646,7 +1646,7 @@ static void mld_sendpack(struct sk_buff *skb)
err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT,
net, net->ipv6.igmp_sk, skb, NULL, skb->dev, net, net->ipv6.igmp_sk, skb, NULL, skb->dev,
dst_output_okfn); dst_output);
out: out:
if (!err) { if (!err) {
ICMP6MSGOUT_INC_STATS(net, idev, ICMPV6_MLD2_REPORT); ICMP6MSGOUT_INC_STATS(net, idev, ICMPV6_MLD2_REPORT);
...@@ -2010,7 +2010,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) ...@@ -2010,7 +2010,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
skb_dst_set(skb, dst); skb_dst_set(skb, dst);
err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT,
net, sk, skb, NULL, skb->dev, net, sk, skb, NULL, skb->dev,
dst_output_okfn); dst_output);
out: out:
if (!err) { if (!err) {
ICMP6MSGOUT_INC_STATS(net, idev, type); ICMP6MSGOUT_INC_STATS(net, idev, type);
......
...@@ -465,7 +465,7 @@ static void ndisc_send_skb(struct sk_buff *skb, ...@@ -465,7 +465,7 @@ static void ndisc_send_skb(struct sk_buff *skb,
err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT,
net, sk, skb, NULL, dst->dev, net, sk, skb, NULL, dst->dev,
dst_output_okfn); dst_output);
if (!err) { if (!err) {
ICMP6MSGOUT_INC_STATS(net, idev, type); ICMP6MSGOUT_INC_STATS(net, idev, type);
ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS); ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS);
......
...@@ -151,7 +151,7 @@ static int __ip6_local_out_sk(struct sock *sk, struct sk_buff *skb) ...@@ -151,7 +151,7 @@ static int __ip6_local_out_sk(struct sock *sk, struct sk_buff *skb)
return nf_hook(NFPROTO_IPV6, NF_INET_LOCAL_OUT, return nf_hook(NFPROTO_IPV6, NF_INET_LOCAL_OUT,
net, sk, skb, NULL, skb_dst(skb)->dev, net, sk, skb, NULL, skb_dst(skb)->dev,
dst_output_okfn); dst_output);
} }
int __ip6_local_out(struct sk_buff *skb) int __ip6_local_out(struct sk_buff *skb)
...@@ -162,11 +162,12 @@ EXPORT_SYMBOL_GPL(__ip6_local_out); ...@@ -162,11 +162,12 @@ EXPORT_SYMBOL_GPL(__ip6_local_out);
int ip6_local_out_sk(struct sock *sk, struct sk_buff *skb) int ip6_local_out_sk(struct sock *sk, struct sk_buff *skb)
{ {
struct net *net = dev_net(skb_dst(skb)->dev);
int err; int err;
err = __ip6_local_out_sk(sk, skb); err = __ip6_local_out_sk(sk, skb);
if (likely(err == 1)) if (likely(err == 1))
err = dst_output(sk, skb); err = dst_output(net, sk, skb);
return err; return err;
} }
......
...@@ -655,7 +655,7 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length, ...@@ -655,7 +655,7 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length,
IP6_UPD_PO_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUT, skb->len); IP6_UPD_PO_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUT, skb->len);
err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, net, sk, skb, err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, net, sk, skb,
NULL, rt->dst.dev, dst_output_okfn); NULL, rt->dst.dev, dst_output);
if (err > 0) if (err > 0)
err = net_xmit_errno(err); err = net_xmit_errno(err);
if (err) if (err)
......
...@@ -147,7 +147,7 @@ static int __xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb) ...@@ -147,7 +147,7 @@ static int __xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
#ifdef CONFIG_NETFILTER #ifdef CONFIG_NETFILTER
if (!x) { if (!x) {
IP6CB(skb)->flags |= IP6SKB_REROUTED; IP6CB(skb)->flags |= IP6SKB_REROUTED;
return dst_output(sk, skb); return dst_output(net, sk, skb);
} }
#endif #endif
......
...@@ -576,7 +576,7 @@ static inline int ip_vs_nat_send_or_cont(int pf, struct sk_buff *skb, ...@@ -576,7 +576,7 @@ static inline int ip_vs_nat_send_or_cont(int pf, struct sk_buff *skb,
if (!skb->sk) if (!skb->sk)
skb_sender_cpu_clear(skb); skb_sender_cpu_clear(skb);
NF_HOOK(pf, NF_INET_LOCAL_OUT, cp->ipvs->net, NULL, skb, NF_HOOK(pf, NF_INET_LOCAL_OUT, cp->ipvs->net, NULL, skb,
NULL, skb_dst(skb)->dev, dst_output_okfn); NULL, skb_dst(skb)->dev, dst_output);
} else } else
ret = NF_ACCEPT; ret = NF_ACCEPT;
...@@ -598,7 +598,7 @@ static inline int ip_vs_send_or_cont(int pf, struct sk_buff *skb, ...@@ -598,7 +598,7 @@ static inline int ip_vs_send_or_cont(int pf, struct sk_buff *skb,
if (!skb->sk) if (!skb->sk)
skb_sender_cpu_clear(skb); skb_sender_cpu_clear(skb);
NF_HOOK(pf, NF_INET_LOCAL_OUT, cp->ipvs->net, NULL, skb, NF_HOOK(pf, NF_INET_LOCAL_OUT, cp->ipvs->net, NULL, skb,
NULL, skb_dst(skb)->dev, dst_output_okfn); NULL, skb_dst(skb)->dev, dst_output);
} else } else
ret = NF_ACCEPT; ret = NF_ACCEPT;
return ret; return ret;
......
...@@ -141,7 +141,7 @@ int xfrm_output_resume(struct sk_buff *skb, int err) ...@@ -141,7 +141,7 @@ int xfrm_output_resume(struct sk_buff *skb, int err)
goto out; goto out;
if (!skb_dst(skb)->xfrm) if (!skb_dst(skb)->xfrm)
return dst_output(skb->sk, skb); return dst_output(net, skb->sk, skb);
err = nf_hook(skb_dst(skb)->ops->family, err = nf_hook(skb_dst(skb)->ops->family,
NF_INET_POST_ROUTING, net, skb->sk, skb, NF_INET_POST_ROUTING, net, skb->sk, skb,
......
...@@ -1944,7 +1944,7 @@ static void xfrm_policy_queue_process(unsigned long arg) ...@@ -1944,7 +1944,7 @@ static void xfrm_policy_queue_process(unsigned long arg)
skb_dst_drop(skb); skb_dst_drop(skb);
skb_dst_set(skb, dst); skb_dst_set(skb, dst);
dst_output(skb->sk, skb); dst_output(net, skb->sk, skb);
} }
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment