aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/dccp/ipv6.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 109dab3550f2..a8666902b8e4 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -295,7 +295,8 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
295 struct ipv6hdr *rxip6h; 295 struct ipv6hdr *rxip6h;
296 struct sk_buff *skb; 296 struct sk_buff *skb;
297 struct flowi fl; 297 struct flowi fl;
298 struct sock *ctl_sk = init_net.dccp.v6_ctl_sk; 298 struct net *net = dev_net(rxskb->dst->dev);
299 struct sock *ctl_sk = net->dccp.v6_ctl_sk;
299 300
300 if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET) 301 if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET)
301 return; 302 return;
@@ -1173,11 +1174,16 @@ static struct inet_protosw dccp_v6_protosw = {
1173 1174
1174static int dccp_v6_init_net(struct net *net) 1175static int dccp_v6_init_net(struct net *net)
1175{ 1176{
1176 return 0; 1177 int err;
1178
1179 err = inet_ctl_sock_create(&net->dccp.v6_ctl_sk, PF_INET6,
1180 SOCK_DCCP, IPPROTO_DCCP, net);
1181 return err;
1177} 1182}
1178 1183
1179static void dccp_v6_exit_net(struct net *net) 1184static void dccp_v6_exit_net(struct net *net)
1180{ 1185{
1186 inet_ctl_sock_destroy(net->dccp.v6_ctl_sk);
1181} 1187}
1182 1188
1183static struct pernet_operations dccp_v6_ops = { 1189static struct pernet_operations dccp_v6_ops = {
@@ -1198,11 +1204,6 @@ static int __init dccp_v6_init(void)
1198 1204
1199 inet6_register_protosw(&dccp_v6_protosw); 1205 inet6_register_protosw(&dccp_v6_protosw);
1200 1206
1201 err = inet_ctl_sock_create(&init_net.dccp.v6_ctl_sk, PF_INET6,
1202 SOCK_DCCP, IPPROTO_DCCP, &init_net);
1203 if (err != 0)
1204 goto out_unregister_protosw;
1205
1206 err = register_pernet_subsys(&dccp_v6_ops); 1207 err = register_pernet_subsys(&dccp_v6_ops);
1207 if (err != 0) 1208 if (err != 0)
1208 goto out_destroy_ctl_sock; 1209 goto out_destroy_ctl_sock;
@@ -1210,8 +1211,6 @@ out:
1210 return err; 1211 return err;
1211 1212
1212out_destroy_ctl_sock: 1213out_destroy_ctl_sock:
1213 inet_ctl_sock_destroy(init_net.dccp.v6_ctl_sk);
1214out_unregister_protosw:
1215 inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP); 1214 inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP);
1216 inet6_unregister_protosw(&dccp_v6_protosw); 1215 inet6_unregister_protosw(&dccp_v6_protosw);
1217out_unregister_proto: 1216out_unregister_proto:
@@ -1222,7 +1221,6 @@ out_unregister_proto:
1222static void __exit dccp_v6_exit(void) 1221static void __exit dccp_v6_exit(void)
1223{ 1222{
1224 unregister_pernet_subsys(&dccp_v6_ops); 1223 unregister_pernet_subsys(&dccp_v6_ops);
1225 inet_ctl_sock_destroy(init_net.dccp.v6_ctl_sk);
1226 inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP); 1224 inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP);
1227 inet6_unregister_protosw(&dccp_v6_protosw); 1225 inet6_unregister_protosw(&dccp_v6_protosw);
1228 proto_unregister(&dccp_v6_prot); 1226 proto_unregister(&dccp_v6_prot);