diff options
-rw-r--r-- | include/net/netns/dccp.h | 1 | ||||
-rw-r--r-- | net/dccp/ipv6.c | 16 |
2 files changed, 9 insertions, 8 deletions
diff --git a/include/net/netns/dccp.h b/include/net/netns/dccp.h index e4f16faa898a..98d2a7ce1f71 100644 --- a/include/net/netns/dccp.h +++ b/include/net/netns/dccp.h | |||
@@ -5,6 +5,7 @@ struct sock; | |||
5 | 5 | ||
6 | struct netns_dccp { | 6 | struct netns_dccp { |
7 | struct sock *v4_ctl_sk; | 7 | struct sock *v4_ctl_sk; |
8 | struct sock *v6_ctl_sk; | ||
8 | }; | 9 | }; |
9 | 10 | ||
10 | #endif | 11 | #endif |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 2ca52913f4be..109dab3550f2 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -33,8 +33,7 @@ | |||
33 | #include "ipv6.h" | 33 | #include "ipv6.h" |
34 | #include "feat.h" | 34 | #include "feat.h" |
35 | 35 | ||
36 | /* Socket used for sending RSTs and ACKs */ | 36 | /* dccp_v6_ctl_sk is used for sending RSTs and ACKs */ |
37 | static struct sock *dccp_v6_ctl_sk; | ||
38 | 37 | ||
39 | static struct inet_connection_sock_af_ops dccp_ipv6_mapped; | 38 | static struct inet_connection_sock_af_ops dccp_ipv6_mapped; |
40 | static struct inet_connection_sock_af_ops dccp_ipv6_af_ops; | 39 | static struct inet_connection_sock_af_ops dccp_ipv6_af_ops; |
@@ -296,6 +295,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) | |||
296 | struct ipv6hdr *rxip6h; | 295 | struct ipv6hdr *rxip6h; |
297 | struct sk_buff *skb; | 296 | struct sk_buff *skb; |
298 | struct flowi fl; | 297 | struct flowi fl; |
298 | struct sock *ctl_sk = init_net.dccp.v6_ctl_sk; | ||
299 | 299 | ||
300 | if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET) | 300 | if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET) |
301 | return; | 301 | return; |
@@ -303,7 +303,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) | |||
303 | if (!ipv6_unicast_destination(rxskb)) | 303 | if (!ipv6_unicast_destination(rxskb)) |
304 | return; | 304 | return; |
305 | 305 | ||
306 | skb = dccp_ctl_make_reset(dccp_v6_ctl_sk, rxskb); | 306 | skb = dccp_ctl_make_reset(ctl_sk, rxskb); |
307 | if (skb == NULL) | 307 | if (skb == NULL) |
308 | return; | 308 | return; |
309 | 309 | ||
@@ -322,9 +322,9 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) | |||
322 | security_skb_classify_flow(rxskb, &fl); | 322 | security_skb_classify_flow(rxskb, &fl); |
323 | 323 | ||
324 | /* sk = NULL, but it is safe for now. RST socket required. */ | 324 | /* sk = NULL, but it is safe for now. RST socket required. */ |
325 | if (!ip6_dst_lookup(dccp_v6_ctl_sk, &skb->dst, &fl)) { | 325 | if (!ip6_dst_lookup(ctl_sk, &skb->dst, &fl)) { |
326 | if (xfrm_lookup(&skb->dst, &fl, NULL, 0) >= 0) { | 326 | if (xfrm_lookup(&skb->dst, &fl, NULL, 0) >= 0) { |
327 | ip6_xmit(dccp_v6_ctl_sk, skb, &fl, NULL, 0); | 327 | ip6_xmit(ctl_sk, skb, &fl, NULL, 0); |
328 | DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS); | 328 | DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS); |
329 | DCCP_INC_STATS_BH(DCCP_MIB_OUTRSTS); | 329 | DCCP_INC_STATS_BH(DCCP_MIB_OUTRSTS); |
330 | return; | 330 | return; |
@@ -1198,7 +1198,7 @@ static int __init dccp_v6_init(void) | |||
1198 | 1198 | ||
1199 | inet6_register_protosw(&dccp_v6_protosw); | 1199 | inet6_register_protosw(&dccp_v6_protosw); |
1200 | 1200 | ||
1201 | err = inet_ctl_sock_create(&dccp_v6_ctl_sk, PF_INET6, | 1201 | err = inet_ctl_sock_create(&init_net.dccp.v6_ctl_sk, PF_INET6, |
1202 | SOCK_DCCP, IPPROTO_DCCP, &init_net); | 1202 | SOCK_DCCP, IPPROTO_DCCP, &init_net); |
1203 | if (err != 0) | 1203 | if (err != 0) |
1204 | goto out_unregister_protosw; | 1204 | goto out_unregister_protosw; |
@@ -1210,7 +1210,7 @@ out: | |||
1210 | return err; | 1210 | return err; |
1211 | 1211 | ||
1212 | out_destroy_ctl_sock: | 1212 | out_destroy_ctl_sock: |
1213 | inet_ctl_sock_destroy(dccp_v6_ctl_sk); | 1213 | inet_ctl_sock_destroy(init_net.dccp.v6_ctl_sk); |
1214 | out_unregister_protosw: | 1214 | out_unregister_protosw: |
1215 | inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP); | 1215 | inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP); |
1216 | inet6_unregister_protosw(&dccp_v6_protosw); | 1216 | inet6_unregister_protosw(&dccp_v6_protosw); |
@@ -1222,7 +1222,7 @@ out_unregister_proto: | |||
1222 | static void __exit dccp_v6_exit(void) | 1222 | static void __exit dccp_v6_exit(void) |
1223 | { | 1223 | { |
1224 | unregister_pernet_subsys(&dccp_v6_ops); | 1224 | unregister_pernet_subsys(&dccp_v6_ops); |
1225 | inet_ctl_sock_destroy(dccp_v6_ctl_sk); | 1225 | inet_ctl_sock_destroy(init_net.dccp.v6_ctl_sk); |
1226 | inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP); | 1226 | inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP); |
1227 | inet6_unregister_protosw(&dccp_v6_protosw); | 1227 | inet6_unregister_protosw(&dccp_v6_protosw); |
1228 | proto_unregister(&dccp_v6_prot); | 1228 | proto_unregister(&dccp_v6_prot); |