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 fa2ac7ee662f..57b07da1212a 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); |
@@ -1001,10 +1005,21 @@ static int __init inet6_init(void) | |||
1001 | { | 1005 | { |
1002 | struct sk_buff *dummy_skb; | 1006 | struct sk_buff *dummy_skb; |
1003 | struct list_head *r; | 1007 | struct list_head *r; |
1004 | int err; | 1008 | int err = 0; |
1005 | 1009 | ||
1006 | BUILD_BUG_ON(sizeof(struct inet6_skb_parm) > sizeof(dummy_skb->cb)); | 1010 | BUILD_BUG_ON(sizeof(struct inet6_skb_parm) > sizeof(dummy_skb->cb)); |
1007 | 1011 | ||
1012 | /* Register the socket-side information for inet6_create. */ | ||
1013 | for(r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r) | ||
1014 | INIT_LIST_HEAD(r); | ||
1015 | |||
1016 | if (disable_ipv6) { | ||
1017 | printk(KERN_INFO | ||
1018 | "IPv6: Loaded, but administratively disabled, " | ||
1019 | "reboot required to enable\n"); | ||
1020 | goto out; | ||
1021 | } | ||
1022 | |||
1008 | err = proto_register(&tcpv6_prot, 1); | 1023 | err = proto_register(&tcpv6_prot, 1); |
1009 | if (err) | 1024 | if (err) |
1010 | goto out; | 1025 | goto out; |
@@ -1022,10 +1037,6 @@ static int __init inet6_init(void) | |||
1022 | goto out_unregister_udplite_proto; | 1037 | goto out_unregister_udplite_proto; |
1023 | 1038 | ||
1024 | 1039 | ||
1025 | /* Register the socket-side information for inet6_create. */ | ||
1026 | for(r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r) | ||
1027 | INIT_LIST_HEAD(r); | ||
1028 | |||
1029 | /* We MUST register RAW sockets before we create the ICMP6, | 1040 | /* We MUST register RAW sockets before we create the ICMP6, |
1030 | * IGMP6, or NDISC control sockets. | 1041 | * IGMP6, or NDISC control sockets. |
1031 | */ | 1042 | */ |