diff options
Diffstat (limited to 'net/ipv6/anycast.c')
-rw-r--r-- | net/ipv6/anycast.c | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c index b8c533fbdb63..f915c4df9820 100644 --- a/net/ipv6/anycast.c +++ b/net/ipv6/anycast.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/proc_fs.h> | 30 | #include <linux/proc_fs.h> |
31 | #include <linux/seq_file.h> | 31 | #include <linux/seq_file.h> |
32 | 32 | ||
33 | #include <net/net_namespace.h> | ||
33 | #include <net/sock.h> | 34 | #include <net/sock.h> |
34 | #include <net/snmp.h> | 35 | #include <net/snmp.h> |
35 | 36 | ||
@@ -111,10 +112,10 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, struct in6_addr *addr) | |||
111 | } else { | 112 | } else { |
112 | /* router, no matching interface: just pick one */ | 113 | /* router, no matching interface: just pick one */ |
113 | 114 | ||
114 | dev = dev_get_by_flags(IFF_UP, IFF_UP|IFF_LOOPBACK); | 115 | dev = dev_get_by_flags(&init_net, IFF_UP, IFF_UP|IFF_LOOPBACK); |
115 | } | 116 | } |
116 | } else | 117 | } else |
117 | dev = dev_get_by_index(ifindex); | 118 | dev = dev_get_by_index(&init_net, ifindex); |
118 | 119 | ||
119 | if (dev == NULL) { | 120 | if (dev == NULL) { |
120 | err = -ENODEV; | 121 | err = -ENODEV; |
@@ -195,7 +196,7 @@ int ipv6_sock_ac_drop(struct sock *sk, int ifindex, struct in6_addr *addr) | |||
195 | 196 | ||
196 | write_unlock_bh(&ipv6_sk_ac_lock); | 197 | write_unlock_bh(&ipv6_sk_ac_lock); |
197 | 198 | ||
198 | dev = dev_get_by_index(pac->acl_ifindex); | 199 | dev = dev_get_by_index(&init_net, pac->acl_ifindex); |
199 | if (dev) { | 200 | if (dev) { |
200 | ipv6_dev_ac_dec(dev, &pac->acl_addr); | 201 | ipv6_dev_ac_dec(dev, &pac->acl_addr); |
201 | dev_put(dev); | 202 | dev_put(dev); |
@@ -223,7 +224,7 @@ void ipv6_sock_ac_close(struct sock *sk) | |||
223 | if (pac->acl_ifindex != prev_index) { | 224 | if (pac->acl_ifindex != prev_index) { |
224 | if (dev) | 225 | if (dev) |
225 | dev_put(dev); | 226 | dev_put(dev); |
226 | dev = dev_get_by_index(pac->acl_ifindex); | 227 | dev = dev_get_by_index(&init_net, pac->acl_ifindex); |
227 | prev_index = pac->acl_ifindex; | 228 | prev_index = pac->acl_ifindex; |
228 | } | 229 | } |
229 | if (dev) | 230 | if (dev) |
@@ -413,7 +414,7 @@ static int ipv6_chk_acast_dev(struct net_device *dev, struct in6_addr *addr) | |||
413 | break; | 414 | break; |
414 | read_unlock_bh(&idev->lock); | 415 | read_unlock_bh(&idev->lock); |
415 | in6_dev_put(idev); | 416 | in6_dev_put(idev); |
416 | return aca != 0; | 417 | return aca != NULL; |
417 | } | 418 | } |
418 | return 0; | 419 | return 0; |
419 | } | 420 | } |
@@ -428,7 +429,7 @@ int ipv6_chk_acast_addr(struct net_device *dev, struct in6_addr *addr) | |||
428 | if (dev) | 429 | if (dev) |
429 | return ipv6_chk_acast_dev(dev, addr); | 430 | return ipv6_chk_acast_dev(dev, addr); |
430 | read_lock(&dev_base_lock); | 431 | read_lock(&dev_base_lock); |
431 | for_each_netdev(dev) | 432 | for_each_netdev(&init_net, dev) |
432 | if (ipv6_chk_acast_dev(dev, addr)) { | 433 | if (ipv6_chk_acast_dev(dev, addr)) { |
433 | found = 1; | 434 | found = 1; |
434 | break; | 435 | break; |
@@ -452,7 +453,7 @@ static inline struct ifacaddr6 *ac6_get_first(struct seq_file *seq) | |||
452 | struct ac6_iter_state *state = ac6_seq_private(seq); | 453 | struct ac6_iter_state *state = ac6_seq_private(seq); |
453 | 454 | ||
454 | state->idev = NULL; | 455 | state->idev = NULL; |
455 | for_each_netdev(state->dev) { | 456 | for_each_netdev(&init_net, state->dev) { |
456 | struct inet6_dev *idev; | 457 | struct inet6_dev *idev; |
457 | idev = in6_dev_get(state->dev); | 458 | idev = in6_dev_get(state->dev); |
458 | if (!idev) | 459 | if (!idev) |
@@ -548,24 +549,8 @@ static const struct seq_operations ac6_seq_ops = { | |||
548 | 549 | ||
549 | static int ac6_seq_open(struct inode *inode, struct file *file) | 550 | static int ac6_seq_open(struct inode *inode, struct file *file) |
550 | { | 551 | { |
551 | struct seq_file *seq; | 552 | return seq_open_private(file, &ac6_seq_ops, |
552 | int rc = -ENOMEM; | 553 | sizeof(struct ac6_iter_state)); |
553 | struct ac6_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); | ||
554 | |||
555 | if (!s) | ||
556 | goto out; | ||
557 | |||
558 | rc = seq_open(file, &ac6_seq_ops); | ||
559 | if (rc) | ||
560 | goto out_kfree; | ||
561 | |||
562 | seq = file->private_data; | ||
563 | seq->private = s; | ||
564 | out: | ||
565 | return rc; | ||
566 | out_kfree: | ||
567 | kfree(s); | ||
568 | goto out; | ||
569 | } | 554 | } |
570 | 555 | ||
571 | static const struct file_operations ac6_seq_fops = { | 556 | static const struct file_operations ac6_seq_fops = { |
@@ -578,7 +563,7 @@ static const struct file_operations ac6_seq_fops = { | |||
578 | 563 | ||
579 | int __init ac6_proc_init(void) | 564 | int __init ac6_proc_init(void) |
580 | { | 565 | { |
581 | if (!proc_net_fops_create("anycast6", S_IRUGO, &ac6_seq_fops)) | 566 | if (!proc_net_fops_create(&init_net, "anycast6", S_IRUGO, &ac6_seq_fops)) |
582 | return -ENOMEM; | 567 | return -ENOMEM; |
583 | 568 | ||
584 | return 0; | 569 | return 0; |
@@ -586,7 +571,7 @@ int __init ac6_proc_init(void) | |||
586 | 571 | ||
587 | void ac6_proc_exit(void) | 572 | void ac6_proc_exit(void) |
588 | { | 573 | { |
589 | proc_net_remove("anycast6"); | 574 | proc_net_remove(&init_net, "anycast6"); |
590 | } | 575 | } |
591 | #endif | 576 | #endif |
592 | 577 | ||