Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[NETNS][DCCPV6]: Move the dccp_v6_ctl_sk on the struct net.

And replace all its usage with init_net's socket.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Pavel Emelyanov and committed by
David S. Miller
02047741 8231bd27

+9 -8
+1
include/net/netns/dccp.h
··· 5 5 6 6 struct netns_dccp { 7 7 struct sock *v4_ctl_sk; 8 + struct sock *v6_ctl_sk; 8 9 }; 9 10 10 11 #endif
+8 -8
net/dccp/ipv6.c
··· 33 33 #include "ipv6.h" 34 34 #include "feat.h" 35 35 36 - /* Socket used for sending RSTs and ACKs */ 37 - static struct sock *dccp_v6_ctl_sk; 36 + /* dccp_v6_ctl_sk is used for sending RSTs and ACKs */ 38 37 39 38 static struct inet_connection_sock_af_ops dccp_ipv6_mapped; 40 39 static struct inet_connection_sock_af_ops dccp_ipv6_af_ops; ··· 295 296 struct ipv6hdr *rxip6h; 296 297 struct sk_buff *skb; 297 298 struct flowi fl; 299 + struct sock *ctl_sk = init_net.dccp.v6_ctl_sk; 298 300 299 301 if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET) 300 302 return; ··· 303 303 if (!ipv6_unicast_destination(rxskb)) 304 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 307 if (skb == NULL) 308 308 return; 309 309 ··· 322 322 security_skb_classify_flow(rxskb, &fl); 323 323 324 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 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 328 DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS); 329 329 DCCP_INC_STATS_BH(DCCP_MIB_OUTRSTS); 330 330 return; ··· 1198 1198 1199 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 1202 SOCK_DCCP, IPPROTO_DCCP, &init_net); 1203 1203 if (err != 0) 1204 1204 goto out_unregister_protosw; ··· 1210 1210 return err; 1211 1211 1212 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 1214 out_unregister_protosw: 1215 1215 inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP); 1216 1216 inet6_unregister_protosw(&dccp_v6_protosw); ··· 1222 1222 static void __exit dccp_v6_exit(void) 1223 1223 { 1224 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 1226 inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP); 1227 1227 inet6_unregister_protosw(&dccp_v6_protosw); 1228 1228 proto_unregister(&dccp_v6_prot);