diff options
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 93980c3b83e6..9544beb6d1ca 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -2166,14 +2166,36 @@ static struct inet_protosw tcpv6_protosw = { | |||
2166 | INET_PROTOSW_ICSK, | 2166 | INET_PROTOSW_ICSK, |
2167 | }; | 2167 | }; |
2168 | 2168 | ||
2169 | void __init tcpv6_init(void) | 2169 | int __init tcpv6_init(void) |
2170 | { | 2170 | { |
2171 | int ret; | ||
2172 | |||
2173 | ret = inet6_add_protocol(&tcpv6_protocol, IPPROTO_TCP); | ||
2174 | if (ret) | ||
2175 | goto out; | ||
2176 | |||
2171 | /* register inet6 protocol */ | 2177 | /* register inet6 protocol */ |
2172 | if (inet6_add_protocol(&tcpv6_protocol, IPPROTO_TCP) < 0) | 2178 | ret = inet6_register_protosw(&tcpv6_protosw); |
2173 | printk(KERN_ERR "tcpv6_init: Could not register protocol\n"); | 2179 | if (ret) |
2174 | inet6_register_protosw(&tcpv6_protosw); | 2180 | goto out_tcpv6_protocol; |
2181 | |||
2182 | ret = inet_csk_ctl_sock_create(&tcp6_socket, PF_INET6, | ||
2183 | SOCK_RAW, IPPROTO_TCP); | ||
2184 | if (ret) | ||
2185 | goto out_tcpv6_protosw; | ||
2186 | out: | ||
2187 | return ret; | ||
2175 | 2188 | ||
2176 | if (inet_csk_ctl_sock_create(&tcp6_socket, PF_INET6, SOCK_RAW, | 2189 | out_tcpv6_protocol: |
2177 | IPPROTO_TCP) < 0) | 2190 | inet6_del_protocol(&tcpv6_protocol, IPPROTO_TCP); |
2178 | panic("Failed to create the TCPv6 control socket.\n"); | 2191 | out_tcpv6_protosw: |
2192 | inet6_unregister_protosw(&tcpv6_protosw); | ||
2193 | goto out; | ||
2194 | } | ||
2195 | |||
2196 | void __exit tcpv6_exit(void) | ||
2197 | { | ||
2198 | sock_release(tcp6_socket); | ||
2199 | inet6_unregister_protosw(&tcpv6_protosw); | ||
2200 | inet6_del_protocol(&tcpv6_protocol, IPPROTO_TCP); | ||
2179 | } | 2201 | } |