Commit 33224b16 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by David S. Miller

ipv4, ipv6: Pass net into ip_local_out and ip6_local_out

Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cf91a99d
...@@ -365,7 +365,7 @@ static int ipvlan_process_v4_outbound(struct sk_buff *skb) ...@@ -365,7 +365,7 @@ static int ipvlan_process_v4_outbound(struct sk_buff *skb)
} }
skb_dst_drop(skb); skb_dst_drop(skb);
skb_dst_set(skb, &rt->dst); skb_dst_set(skb, &rt->dst);
err = ip_local_out(skb->sk, skb); err = ip_local_out(net, skb->sk, skb);
if (unlikely(net_xmit_eval(err))) if (unlikely(net_xmit_eval(err)))
dev->stats.tx_errors++; dev->stats.tx_errors++;
else else
...@@ -403,7 +403,7 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb) ...@@ -403,7 +403,7 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb)
} }
skb_dst_drop(skb); skb_dst_drop(skb);
skb_dst_set(skb, dst); skb_dst_set(skb, dst);
err = ip6_local_out(skb->sk, skb); err = ip6_local_out(net, skb->sk, skb);
if (unlikely(net_xmit_eval(err))) if (unlikely(net_xmit_eval(err)))
dev->stats.tx_errors++; dev->stats.tx_errors++;
else else
......
...@@ -283,7 +283,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb) ...@@ -283,7 +283,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
ip_select_ident(net, skb, NULL); ip_select_ident(net, skb, NULL);
ip_send_check(iph); ip_send_check(iph);
ip_local_out(skb->sk, skb); ip_local_out(net, skb->sk, skb);
return 1; return 1;
tx_error: tx_error:
......
...@@ -76,7 +76,7 @@ static struct dst_entry *vrf_ip_check(struct dst_entry *dst, u32 cookie) ...@@ -76,7 +76,7 @@ static struct dst_entry *vrf_ip_check(struct dst_entry *dst, u32 cookie)
static int vrf_ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb) static int vrf_ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
{ {
return ip_local_out(sk, skb); return ip_local_out(net, sk, skb);
} }
static unsigned int vrf_v4_mtu(const struct dst_entry *dst) static unsigned int vrf_v4_mtu(const struct dst_entry *dst)
...@@ -222,7 +222,7 @@ static netdev_tx_t vrf_process_v4_outbound(struct sk_buff *skb, ...@@ -222,7 +222,7 @@ static netdev_tx_t vrf_process_v4_outbound(struct sk_buff *skb,
RT_SCOPE_LINK); RT_SCOPE_LINK);
} }
ret = ip_local_out(skb->sk, skb); ret = ip_local_out(dev_net(skb_dst(skb)->dev), skb->sk, skb);
if (unlikely(net_xmit_eval(ret))) if (unlikely(net_xmit_eval(ret)))
vrf_dev->stats.tx_errors++; vrf_dev->stats.tx_errors++;
else else
......
...@@ -113,7 +113,7 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, ...@@ -113,7 +113,7 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
int (*output)(struct net *, struct sock *, struct sk_buff *)); int (*output)(struct net *, struct sock *, struct sk_buff *));
void ip_send_check(struct iphdr *ip); void ip_send_check(struct iphdr *ip);
int __ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb); int __ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb);
int ip_local_out(struct sock *sk, struct sk_buff *skb); int ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb);
int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl); int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl);
void ip_init(void); void ip_init(void);
......
...@@ -87,7 +87,7 @@ static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb, ...@@ -87,7 +87,7 @@ static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,
int pkt_len, err; int pkt_len, err;
pkt_len = skb->len - skb_inner_network_offset(skb); pkt_len = skb->len - skb_inner_network_offset(skb);
err = ip6_local_out(sk, skb); err = ip6_local_out(dev_net(skb_dst(skb)->dev), 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);
......
...@@ -866,7 +866,7 @@ int ip6_input(struct sk_buff *skb); ...@@ -866,7 +866,7 @@ int ip6_input(struct sk_buff *skb);
int ip6_mc_input(struct sk_buff *skb); int ip6_mc_input(struct sk_buff *skb);
int __ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb); int __ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb);
int ip6_local_out(struct sock *sk, struct sk_buff *skb); int ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb);
/* /*
* Extension header (options) processing * Extension header (options) processing
......
...@@ -397,7 +397,7 @@ static int igmpv3_sendpack(struct sk_buff *skb) ...@@ -397,7 +397,7 @@ static int igmpv3_sendpack(struct sk_buff *skb)
pig->csum = ip_compute_csum(igmp_hdr(skb), igmplen); pig->csum = ip_compute_csum(igmp_hdr(skb), igmplen);
return ip_local_out(skb->sk, skb); return ip_local_out(dev_net(skb_dst(skb)->dev), skb->sk, skb);
} }
static int grec_size(struct ip_mc_list *pmc, int type, int gdel, int sdel) static int grec_size(struct ip_mc_list *pmc, int type, int gdel, int sdel)
...@@ -739,7 +739,7 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc, ...@@ -739,7 +739,7 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc,
ih->group = group; ih->group = group;
ih->csum = ip_compute_csum((void *)ih, sizeof(struct igmphdr)); ih->csum = ip_compute_csum((void *)ih, sizeof(struct igmphdr));
return ip_local_out(skb->sk, skb); return ip_local_out(net, skb->sk, skb);
} }
static void igmp_gq_timer_expire(unsigned long data) static void igmp_gq_timer_expire(unsigned long data)
......
...@@ -107,9 +107,8 @@ int __ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb) ...@@ -107,9 +107,8 @@ int __ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
dst_output); dst_output);
} }
int ip_local_out(struct sock *sk, struct sk_buff *skb) int ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
{ {
struct net *net = dev_net(skb_dst(skb)->dev);
int err; int err;
err = __ip_local_out(net, sk, skb); err = __ip_local_out(net, sk, skb);
...@@ -169,7 +168,7 @@ int ip_build_and_send_pkt(struct sk_buff *skb, const struct sock *sk, ...@@ -169,7 +168,7 @@ int ip_build_and_send_pkt(struct sk_buff *skb, const struct sock *sk,
skb->mark = sk->sk_mark; skb->mark = sk->sk_mark;
/* Send it out. */ /* Send it out. */
return ip_local_out(skb->sk, skb); return ip_local_out(net, skb->sk, skb);
} }
EXPORT_SYMBOL_GPL(ip_build_and_send_pkt); EXPORT_SYMBOL_GPL(ip_build_and_send_pkt);
...@@ -457,7 +456,7 @@ int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl) ...@@ -457,7 +456,7 @@ int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl)
skb->priority = sk->sk_priority; skb->priority = sk->sk_priority;
skb->mark = sk->sk_mark; skb->mark = sk->sk_mark;
res = ip_local_out(sk, skb); res = ip_local_out(net, sk, skb);
rcu_read_unlock(); rcu_read_unlock();
return res; return res;
...@@ -1437,7 +1436,7 @@ int ip_send_skb(struct net *net, struct sk_buff *skb) ...@@ -1437,7 +1436,7 @@ int ip_send_skb(struct net *net, struct sk_buff *skb)
{ {
int err; int err;
err = ip_local_out(skb->sk, skb); err = ip_local_out(net, skb->sk, skb);
if (err) { if (err) {
if (err > 0) if (err > 0)
err = net_xmit_errno(err); err = net_xmit_errno(err);
......
...@@ -79,7 +79,7 @@ int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb, ...@@ -79,7 +79,7 @@ int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
iph->ttl = ttl; iph->ttl = ttl;
__ip_select_ident(net, iph, skb_shinfo(skb)->gso_segs ?: 1); __ip_select_ident(net, iph, skb_shinfo(skb)->gso_segs ?: 1);
err = ip_local_out(sk, skb); err = ip_local_out(net, sk, skb);
if (unlikely(net_xmit_eval(err))) if (unlikely(net_xmit_eval(err)))
pkt_len = 0; pkt_len = 0;
return pkt_len; return pkt_len;
......
...@@ -63,7 +63,7 @@ synproxy_send_tcp(const struct synproxy_net *snet, ...@@ -63,7 +63,7 @@ synproxy_send_tcp(const struct synproxy_net *snet,
nf_conntrack_get(nfct); nf_conntrack_get(nfct);
} }
ip_local_out(nskb->sk, nskb); ip_local_out(net, nskb->sk, nskb);
return; return;
free_nskb: free_nskb:
......
...@@ -92,7 +92,7 @@ void nf_dup_ipv4(struct net *net, struct sk_buff *skb, unsigned int hooknum, ...@@ -92,7 +92,7 @@ void nf_dup_ipv4(struct net *net, struct sk_buff *skb, unsigned int hooknum,
if (nf_dup_ipv4_route(net, skb, gw, oif)) { if (nf_dup_ipv4_route(net, skb, gw, oif)) {
__this_cpu_write(nf_skb_duplicated, true); __this_cpu_write(nf_skb_duplicated, true);
ip_local_out(skb->sk, skb); ip_local_out(net, skb->sk, skb);
__this_cpu_write(nf_skb_duplicated, false); __this_cpu_write(nf_skb_duplicated, false);
} else { } else {
kfree_skb(skb); kfree_skb(skb);
......
...@@ -157,7 +157,7 @@ void nf_send_reset(struct net *net, struct sk_buff *oldskb, int hook) ...@@ -157,7 +157,7 @@ void nf_send_reset(struct net *net, struct sk_buff *oldskb, int hook)
dev_queue_xmit(nskb); dev_queue_xmit(nskb);
} else } else
#endif #endif
ip_local_out(nskb->sk, nskb); ip_local_out(net, nskb->sk, nskb);
return; return;
......
...@@ -1692,7 +1692,7 @@ int ip6_send_skb(struct sk_buff *skb) ...@@ -1692,7 +1692,7 @@ int ip6_send_skb(struct sk_buff *skb)
struct rt6_info *rt = (struct rt6_info *)skb_dst(skb); struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
int err; int err;
err = ip6_local_out(skb->sk, skb); err = ip6_local_out(net, skb->sk, skb);
if (err) { if (err) {
if (err > 0) if (err > 0)
err = net_xmit_errno(err); err = net_xmit_errno(err);
......
...@@ -76,7 +76,7 @@ synproxy_send_tcp(const struct synproxy_net *snet, ...@@ -76,7 +76,7 @@ synproxy_send_tcp(const struct synproxy_net *snet,
nf_conntrack_get(nfct); nf_conntrack_get(nfct);
} }
ip6_local_out(nskb->sk, nskb); ip6_local_out(net, nskb->sk, nskb);
return; return;
free_nskb: free_nskb:
......
...@@ -68,7 +68,7 @@ void nf_dup_ipv6(struct net *net, struct sk_buff *skb, unsigned int hooknum, ...@@ -68,7 +68,7 @@ void nf_dup_ipv6(struct net *net, struct sk_buff *skb, unsigned int hooknum,
} }
if (nf_dup_ipv6_route(net, skb, gw, oif)) { if (nf_dup_ipv6_route(net, skb, gw, oif)) {
__this_cpu_write(nf_skb_duplicated, true); __this_cpu_write(nf_skb_duplicated, true);
ip6_local_out(skb->sk, skb); ip6_local_out(net, skb->sk, skb);
__this_cpu_write(nf_skb_duplicated, false); __this_cpu_write(nf_skb_duplicated, false);
} else { } else {
kfree_skb(skb); kfree_skb(skb);
......
...@@ -206,7 +206,7 @@ void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook) ...@@ -206,7 +206,7 @@ void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook)
dev_queue_xmit(nskb); dev_queue_xmit(nskb);
} else } else
#endif #endif
ip6_local_out(nskb->sk, nskb); ip6_local_out(net, nskb->sk, nskb);
} }
EXPORT_SYMBOL_GPL(nf_send_reset6); EXPORT_SYMBOL_GPL(nf_send_reset6);
......
...@@ -154,9 +154,8 @@ int __ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb) ...@@ -154,9 +154,8 @@ int __ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
} }
EXPORT_SYMBOL_GPL(__ip6_local_out); EXPORT_SYMBOL_GPL(__ip6_local_out);
int ip6_local_out(struct sock *sk, struct sk_buff *skb) int ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
{ {
struct net *net = dev_net(skb_dst(skb)->dev);
int err; int err;
err = __ip6_local_out(net, sk, skb); err = __ip6_local_out(net, sk, skb);
......
...@@ -1049,7 +1049,7 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, ...@@ -1049,7 +1049,7 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
ret = ip_vs_tunnel_xmit_prepare(skb, cp); ret = ip_vs_tunnel_xmit_prepare(skb, cp);
if (ret == NF_ACCEPT) if (ret == NF_ACCEPT)
ip_local_out(skb->sk, skb); ip_local_out(net, skb->sk, skb);
else if (ret == NF_DROP) else if (ret == NF_DROP)
kfree_skb(skb); kfree_skb(skb);
rcu_read_unlock(); rcu_read_unlock();
...@@ -1141,7 +1141,7 @@ ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, ...@@ -1141,7 +1141,7 @@ ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
ret = ip_vs_tunnel_xmit_prepare(skb, cp); ret = ip_vs_tunnel_xmit_prepare(skb, cp);
if (ret == NF_ACCEPT) if (ret == NF_ACCEPT)
ip6_local_out(skb->sk, skb); ip6_local_out(cp->ipvs->net, skb->sk, skb);
else if (ret == NF_DROP) else if (ret == NF_DROP)
kfree_skb(skb); kfree_skb(skb);
rcu_read_unlock(); rcu_read_unlock();
......
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