diff options
Diffstat (limited to 'net/ipv6/af_inet6.c')
-rw-r--r-- | net/ipv6/af_inet6.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index c802bc1658a8..da944eca2ca6 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -72,6 +72,10 @@ MODULE_LICENSE("GPL"); | |||
72 | static struct list_head inetsw6[SOCK_MAX]; | 72 | static struct list_head inetsw6[SOCK_MAX]; |
73 | static DEFINE_SPINLOCK(inetsw6_lock); | 73 | static DEFINE_SPINLOCK(inetsw6_lock); |
74 | 74 | ||
75 | static int disable_ipv6 = 0; | ||
76 | module_param_named(disable, disable_ipv6, int, 0); | ||
77 | MODULE_PARM_DESC(disable, "Disable IPv6 such that it is non-functional"); | ||
78 | |||
75 | static __inline__ struct ipv6_pinfo *inet6_sk_generic(struct sock *sk) | 79 | static __inline__ struct ipv6_pinfo *inet6_sk_generic(struct sock *sk) |
76 | { | 80 | { |
77 | const int offset = sk->sk_prot->obj_size - sizeof(struct ipv6_pinfo); | 81 | const int offset = sk->sk_prot->obj_size - sizeof(struct ipv6_pinfo); |
@@ -991,10 +995,21 @@ static int __init inet6_init(void) | |||
991 | { | 995 | { |
992 | struct sk_buff *dummy_skb; | 996 | struct sk_buff *dummy_skb; |
993 | struct list_head *r; | 997 | struct list_head *r; |
994 | int err; | 998 | int err = 0; |
995 | 999 | ||
996 | BUILD_BUG_ON(sizeof(struct inet6_skb_parm) > sizeof(dummy_skb->cb)); | 1000 | BUILD_BUG_ON(sizeof(struct inet6_skb_parm) > sizeof(dummy_skb->cb)); |
997 | 1001 | ||
1002 | /* Register the socket-side information for inet6_create. */ | ||
1003 | for(r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r) | ||
1004 | INIT_LIST_HEAD(r); | ||
1005 | |||
1006 | if (disable_ipv6) { | ||
1007 | printk(KERN_INFO | ||
1008 | "IPv6: Loaded, but administratively disabled, " | ||
1009 | "reboot required to enable\n"); | ||
1010 | goto out; | ||
1011 | } | ||
1012 | |||
998 | err = proto_register(&tcpv6_prot, 1); | 1013 | err = proto_register(&tcpv6_prot, 1); |
999 | if (err) | 1014 | if (err) |
1000 | goto out; | 1015 | goto out; |
@@ -1012,10 +1027,6 @@ static int __init inet6_init(void) | |||
1012 | goto out_unregister_udplite_proto; | 1027 | goto out_unregister_udplite_proto; |
1013 | 1028 | ||
1014 | 1029 | ||
1015 | /* Register the socket-side information for inet6_create. */ | ||
1016 | for(r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r) | ||
1017 | INIT_LIST_HEAD(r); | ||
1018 | |||
1019 | /* We MUST register RAW sockets before we create the ICMP6, | 1030 | /* We MUST register RAW sockets before we create the ICMP6, |
1020 | * IGMP6, or NDISC control sockets. | 1031 | * IGMP6, or NDISC control sockets. |
1021 | */ | 1032 | */ |