aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ndisc.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-04-03 17:31:03 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-03 17:31:03 -0400
commit1ed8516f09e510e4595bc900ad9266c15aacfdd2 (patch)
treee41fa4151f3b13031291dae5b3ef5a83b3de23d8 /net/ipv6/ndisc.c
parent5616bdd6dfeb4e36be499dbac245e4d3be90a138 (diff)
[IPV6]: Simplify IPv6 control sockets creation.
Do this by replacing sock_create_kern with inet_ctl_sock_create. Signed-off-by: Denis V. Lunev <den@openvz.org> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ndisc.c')
-rw-r--r--net/ipv6/ndisc.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 510aa747a404..06d80c6dc5ce 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -84,6 +84,7 @@
84 84
85#include <net/flow.h> 85#include <net/flow.h>
86#include <net/ip6_checksum.h> 86#include <net/ip6_checksum.h>
87#include <net/inet_common.h>
87#include <linux/proc_fs.h> 88#include <linux/proc_fs.h>
88 89
89#include <linux/netfilter.h> 90#include <linux/netfilter.h>
@@ -1731,12 +1732,12 @@ static int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, int __user *name,
1731 1732
1732static int ndisc_net_init(struct net *net) 1733static int ndisc_net_init(struct net *net)
1733{ 1734{
1734 struct socket *sock;
1735 struct ipv6_pinfo *np; 1735 struct ipv6_pinfo *np;
1736 struct sock *sk; 1736 struct sock *sk;
1737 int err; 1737 int err;
1738 1738
1739 err = sock_create_kern(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6, &sock); 1739 err = inet_ctl_sock_create(&sk, PF_INET6,
1740 SOCK_RAW, IPPROTO_ICMPV6, net);
1740 if (err < 0) { 1741 if (err < 0) {
1741 ND_PRINTK0(KERN_ERR 1742 ND_PRINTK0(KERN_ERR
1742 "ICMPv6 NDISC: Failed to initialize the control socket (err %d).\n", 1743 "ICMPv6 NDISC: Failed to initialize the control socket (err %d).\n",
@@ -1744,22 +1745,19 @@ static int ndisc_net_init(struct net *net)
1744 return err; 1745 return err;
1745 } 1746 }
1746 1747
1747 net->ipv6.ndisc_sk = sk = sock->sk; 1748 net->ipv6.ndisc_sk = sk;
1748 sk_change_net(sk, net);
1749 1749
1750 np = inet6_sk(sk); 1750 np = inet6_sk(sk);
1751 sk->sk_allocation = GFP_ATOMIC;
1752 np->hop_limit = 255; 1751 np->hop_limit = 255;
1753 /* Do not loopback ndisc messages */ 1752 /* Do not loopback ndisc messages */
1754 np->mc_loop = 0; 1753 np->mc_loop = 0;
1755 sk->sk_prot->unhash(sk);
1756 1754
1757 return 0; 1755 return 0;
1758} 1756}
1759 1757
1760static void ndisc_net_exit(struct net *net) 1758static void ndisc_net_exit(struct net *net)
1761{ 1759{
1762 sk_release_kernel(net->ipv6.ndisc_sk); 1760 inet_ctl_sock_destroy(net->ipv6.ndisc_sk);
1763} 1761}
1764 1762
1765static struct pernet_operations ndisc_net_ops = { 1763static struct pernet_operations ndisc_net_ops = {