aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/icmp.c
diff options
context:
space:
mode:
authorBenjamin Thery <benjamin.thery@bull.net>2008-03-05 13:49:18 -0500
committerDavid S. Miller <davem@davemloft.net>2008-03-05 13:49:18 -0500
commit9a43b709a230705ca40a6f854a334a02334a3c1c (patch)
tree2dba0cbab9a90760cedae1802c0c6c5d6f87fe2b /net/ipv6/icmp.c
parentda6bb5c0c5c22e8289aa555afadfb69487fafbc3 (diff)
[NETNS][IPV6] icmp6 - make icmpv6_socket per namespace
This patch make the changes necessary to support network namespaces in ICMPv6. Signed-off-by: Benjamin Thery <benjamin.thery@bull.net> Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/icmp.c')
-rw-r--r--net/ipv6/icmp.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index d4c4b50420d..6b5391ab834 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -163,6 +163,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type,
163 struct flowi *fl) 163 struct flowi *fl)
164{ 164{
165 struct dst_entry *dst; 165 struct dst_entry *dst;
166 struct net *net = sk->sk_net;
166 int res = 0; 167 int res = 0;
167 168
168 /* Informational messages are not limited. */ 169 /* Informational messages are not limited. */
@@ -178,7 +179,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type,
178 * XXX: perhaps the expire for routing entries cloned by 179 * XXX: perhaps the expire for routing entries cloned by
179 * this lookup should be more aggressive (not longer than timeout). 180 * this lookup should be more aggressive (not longer than timeout).
180 */ 181 */
181 dst = ip6_route_output(&init_net, sk, fl); 182 dst = ip6_route_output(net, sk, fl);
182 if (dst->error) { 183 if (dst->error) {
183 IP6_INC_STATS(ip6_dst_idev(dst), 184 IP6_INC_STATS(ip6_dst_idev(dst),
184 IPSTATS_MIB_OUTNOROUTES); 185 IPSTATS_MIB_OUTNOROUTES);
@@ -186,7 +187,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type,
186 res = 1; 187 res = 1;
187 } else { 188 } else {
188 struct rt6_info *rt = (struct rt6_info *)dst; 189 struct rt6_info *rt = (struct rt6_info *)dst;
189 int tmo = init_net.ipv6.sysctl.icmpv6_time; 190 int tmo = net->ipv6.sysctl.icmpv6_time;
190 191
191 /* Give more bandwidth to wider prefixes. */ 192 /* Give more bandwidth to wider prefixes. */
192 if (rt->rt6i_dst.plen < 128) 193 if (rt->rt6i_dst.plen < 128)
@@ -305,6 +306,7 @@ static inline void mip6_addr_swap(struct sk_buff *skb) {}
305void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, 306void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
306 struct net_device *dev) 307 struct net_device *dev)
307{ 308{
309 struct net *net = skb->dev->nd_net;
308 struct inet6_dev *idev = NULL; 310 struct inet6_dev *idev = NULL;
309 struct ipv6hdr *hdr = ipv6_hdr(skb); 311 struct ipv6hdr *hdr = ipv6_hdr(skb);
310 struct sock *sk; 312 struct sock *sk;
@@ -334,7 +336,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
334 */ 336 */
335 addr_type = ipv6_addr_type(&hdr->daddr); 337 addr_type = ipv6_addr_type(&hdr->daddr);
336 338
337 if (ipv6_chk_addr(&init_net, &hdr->daddr, skb->dev, 0)) 339 if (ipv6_chk_addr(net, &hdr->daddr, skb->dev, 0))
338 saddr = &hdr->daddr; 340 saddr = &hdr->daddr;
339 341
340 /* 342 /*
@@ -391,7 +393,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
391 fl.fl_icmp_code = code; 393 fl.fl_icmp_code = code;
392 security_skb_classify_flow(skb, &fl); 394 security_skb_classify_flow(skb, &fl);
393 395
394 sk = icmpv6_sk(&init_net); 396 sk = icmpv6_sk(net);
395 np = inet6_sk(sk); 397 np = inet6_sk(sk);
396 398
397 if (icmpv6_xmit_lock(sk)) 399 if (icmpv6_xmit_lock(sk))
@@ -507,6 +509,7 @@ EXPORT_SYMBOL(icmpv6_send);
507 509
508static void icmpv6_echo_reply(struct sk_buff *skb) 510static void icmpv6_echo_reply(struct sk_buff *skb)
509{ 511{
512 struct net *net = skb->dev->nd_net;
510 struct sock *sk; 513 struct sock *sk;
511 struct inet6_dev *idev; 514 struct inet6_dev *idev;
512 struct ipv6_pinfo *np; 515 struct ipv6_pinfo *np;
@@ -537,7 +540,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
537 fl.fl_icmp_type = ICMPV6_ECHO_REPLY; 540 fl.fl_icmp_type = ICMPV6_ECHO_REPLY;
538 security_skb_classify_flow(skb, &fl); 541 security_skb_classify_flow(skb, &fl);
539 542
540 sk = icmpv6_sk(&init_net); 543 sk = icmpv6_sk(net);
541 np = inet6_sk(sk); 544 np = inet6_sk(sk);
542 545
543 if (icmpv6_xmit_lock(sk)) 546 if (icmpv6_xmit_lock(sk))