Skip to content

Commit 33224b1

Browse files
ebiedermdavem330
authored andcommitted
ipv4, ipv6: Pass net into ip_local_out and ip6_local_out
Signed-off-by: "Eric W. Biederman" <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent cf91a99 commit 33224b1

File tree

18 files changed

+25
-27
lines changed

18 files changed

+25
-27
lines changed

drivers/net/ipvlan/ipvlan_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ static int ipvlan_process_v4_outbound(struct sk_buff *skb)
365365
}
366366
skb_dst_drop(skb);
367367
skb_dst_set(skb, &rt->dst);
368-
err = ip_local_out(skb->sk, skb);
368+
err = ip_local_out(net, skb->sk, skb);
369369
if (unlikely(net_xmit_eval(err)))
370370
dev->stats.tx_errors++;
371371
else
@@ -403,7 +403,7 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb)
403403
}
404404
skb_dst_drop(skb);
405405
skb_dst_set(skb, dst);
406-
err = ip6_local_out(skb->sk, skb);
406+
err = ip6_local_out(net, skb->sk, skb);
407407
if (unlikely(net_xmit_eval(err)))
408408
dev->stats.tx_errors++;
409409
else

drivers/net/ppp/pptp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
283283
ip_select_ident(net, skb, NULL);
284284
ip_send_check(iph);
285285

286-
ip_local_out(skb->sk, skb);
286+
ip_local_out(net, skb->sk, skb);
287287
return 1;
288288

289289
tx_error:

drivers/net/vrf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static struct dst_entry *vrf_ip_check(struct dst_entry *dst, u32 cookie)
7676

7777
static int vrf_ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
7878
{
79-
return ip_local_out(sk, skb);
79+
return ip_local_out(net, sk, skb);
8080
}
8181

8282
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,
222222
RT_SCOPE_LINK);
223223
}
224224

225-
ret = ip_local_out(skb->sk, skb);
225+
ret = ip_local_out(dev_net(skb_dst(skb)->dev), skb->sk, skb);
226226
if (unlikely(net_xmit_eval(ret)))
227227
vrf_dev->stats.tx_errors++;
228228
else

include/net/ip.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
113113
int (*output)(struct net *, struct sock *, struct sk_buff *));
114114
void ip_send_check(struct iphdr *ip);
115115
int __ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb);
116-
int ip_local_out(struct sock *sk, struct sk_buff *skb);
116+
int ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb);
117117

118118
int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl);
119119
void ip_init(void);

include/net/ip6_tunnel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,
8787
int pkt_len, err;
8888

8989
pkt_len = skb->len - skb_inner_network_offset(skb);
90-
err = ip6_local_out(sk, skb);
90+
err = ip6_local_out(dev_net(skb_dst(skb)->dev), sk, skb);
9191

9292
if (net_xmit_eval(err) == 0) {
9393
struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);

include/net/ipv6.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ int ip6_input(struct sk_buff *skb);
866866
int ip6_mc_input(struct sk_buff *skb);
867867

868868
int __ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb);
869-
int ip6_local_out(struct sock *sk, struct sk_buff *skb);
869+
int ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb);
870870

871871
/*
872872
* Extension header (options) processing

net/ipv4/igmp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ static int igmpv3_sendpack(struct sk_buff *skb)
397397

398398
pig->csum = ip_compute_csum(igmp_hdr(skb), igmplen);
399399

400-
return ip_local_out(skb->sk, skb);
400+
return ip_local_out(dev_net(skb_dst(skb)->dev), skb->sk, skb);
401401
}
402402

403403
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,
739739
ih->group = group;
740740
ih->csum = ip_compute_csum((void *)ih, sizeof(struct igmphdr));
741741

742-
return ip_local_out(skb->sk, skb);
742+
return ip_local_out(net, skb->sk, skb);
743743
}
744744

745745
static void igmp_gq_timer_expire(unsigned long data)

net/ipv4/ip_output.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,8 @@ int __ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
107107
dst_output);
108108
}
109109

110-
int ip_local_out(struct sock *sk, struct sk_buff *skb)
110+
int ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
111111
{
112-
struct net *net = dev_net(skb_dst(skb)->dev);
113112
int err;
114113

115114
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,
169168
skb->mark = sk->sk_mark;
170169

171170
/* Send it out. */
172-
return ip_local_out(skb->sk, skb);
171+
return ip_local_out(net, skb->sk, skb);
173172
}
174173
EXPORT_SYMBOL_GPL(ip_build_and_send_pkt);
175174

@@ -457,7 +456,7 @@ int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl)
457456
skb->priority = sk->sk_priority;
458457
skb->mark = sk->sk_mark;
459458

460-
res = ip_local_out(sk, skb);
459+
res = ip_local_out(net, sk, skb);
461460
rcu_read_unlock();
462461
return res;
463462

@@ -1437,7 +1436,7 @@ int ip_send_skb(struct net *net, struct sk_buff *skb)
14371436
{
14381437
int err;
14391438

1440-
err = ip_local_out(skb->sk, skb);
1439+
err = ip_local_out(net, skb->sk, skb);
14411440
if (err) {
14421441
if (err > 0)
14431442
err = net_xmit_errno(err);

net/ipv4/ip_tunnel_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
7979
iph->ttl = ttl;
8080
__ip_select_ident(net, iph, skb_shinfo(skb)->gso_segs ?: 1);
8181

82-
err = ip_local_out(sk, skb);
82+
err = ip_local_out(net, sk, skb);
8383
if (unlikely(net_xmit_eval(err)))
8484
pkt_len = 0;
8585
return pkt_len;

net/ipv4/netfilter/ipt_SYNPROXY.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ synproxy_send_tcp(const struct synproxy_net *snet,
6363
nf_conntrack_get(nfct);
6464
}
6565

66-
ip_local_out(nskb->sk, nskb);
66+
ip_local_out(net, nskb->sk, nskb);
6767
return;
6868

6969
free_nskb:

net/ipv4/netfilter/nf_dup_ipv4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void nf_dup_ipv4(struct net *net, struct sk_buff *skb, unsigned int hooknum,
9292

9393
if (nf_dup_ipv4_route(net, skb, gw, oif)) {
9494
__this_cpu_write(nf_skb_duplicated, true);
95-
ip_local_out(skb->sk, skb);
95+
ip_local_out(net, skb->sk, skb);
9696
__this_cpu_write(nf_skb_duplicated, false);
9797
} else {
9898
kfree_skb(skb);

net/ipv4/netfilter/nf_reject_ipv4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ void nf_send_reset(struct net *net, struct sk_buff *oldskb, int hook)
157157
dev_queue_xmit(nskb);
158158
} else
159159
#endif
160-
ip_local_out(nskb->sk, nskb);
160+
ip_local_out(net, nskb->sk, nskb);
161161

162162
return;
163163

net/ipv6/ip6_output.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1692,7 +1692,7 @@ int ip6_send_skb(struct sk_buff *skb)
16921692
struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
16931693
int err;
16941694

1695-
err = ip6_local_out(skb->sk, skb);
1695+
err = ip6_local_out(net, skb->sk, skb);
16961696
if (err) {
16971697
if (err > 0)
16981698
err = net_xmit_errno(err);

net/ipv6/netfilter/ip6t_SYNPROXY.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ synproxy_send_tcp(const struct synproxy_net *snet,
7676
nf_conntrack_get(nfct);
7777
}
7878

79-
ip6_local_out(nskb->sk, nskb);
79+
ip6_local_out(net, nskb->sk, nskb);
8080
return;
8181

8282
free_nskb:

net/ipv6/netfilter/nf_dup_ipv6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void nf_dup_ipv6(struct net *net, struct sk_buff *skb, unsigned int hooknum,
6868
}
6969
if (nf_dup_ipv6_route(net, skb, gw, oif)) {
7070
__this_cpu_write(nf_skb_duplicated, true);
71-
ip6_local_out(skb->sk, skb);
71+
ip6_local_out(net, skb->sk, skb);
7272
__this_cpu_write(nf_skb_duplicated, false);
7373
} else {
7474
kfree_skb(skb);

net/ipv6/netfilter/nf_reject_ipv6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook)
206206
dev_queue_xmit(nskb);
207207
} else
208208
#endif
209-
ip6_local_out(nskb->sk, nskb);
209+
ip6_local_out(net, nskb->sk, nskb);
210210
}
211211
EXPORT_SYMBOL_GPL(nf_send_reset6);
212212

net/ipv6/output_core.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,8 @@ int __ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
154154
}
155155
EXPORT_SYMBOL_GPL(__ip6_local_out);
156156

157-
int ip6_local_out(struct sock *sk, struct sk_buff *skb)
157+
int ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
158158
{
159-
struct net *net = dev_net(skb_dst(skb)->dev);
160159
int err;
161160

162161
err = __ip6_local_out(net, sk, skb);

net/netfilter/ipvs/ip_vs_xmit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
10491049

10501050
ret = ip_vs_tunnel_xmit_prepare(skb, cp);
10511051
if (ret == NF_ACCEPT)
1052-
ip_local_out(skb->sk, skb);
1052+
ip_local_out(net, skb->sk, skb);
10531053
else if (ret == NF_DROP)
10541054
kfree_skb(skb);
10551055
rcu_read_unlock();
@@ -1141,7 +1141,7 @@ ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
11411141

11421142
ret = ip_vs_tunnel_xmit_prepare(skb, cp);
11431143
if (ret == NF_ACCEPT)
1144-
ip6_local_out(skb->sk, skb);
1144+
ip6_local_out(cp->ipvs->net, skb->sk, skb);
11451145
else if (ret == NF_DROP)
11461146
kfree_skb(skb);
11471147
rcu_read_unlock();

0 commit comments

Comments
 (0)