diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-04-14 01:32:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-04-14 01:32:45 -0400 |
commit | 334527d3511ecbffca68d6c8f75046262510cf41 (patch) | |
tree | ff57da540599a21bb547f01631c474b189837fa1 /net/dccp | |
parent | 0204774191d3e7bc69e3ae6bbf328b635607505a (diff) |
[NETNS][DCCPV6]: Actually create ctl socket on each net and use it.
Move the call to inet_ctl_sock_create to init callback (and
inet_ctl_sock_destroy to exit one) and use proper ctl sock
in dccp_v6_ctl_send_reset.
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>
Diffstat (limited to 'net/dccp')
-rw-r--r-- | net/dccp/ipv6.c | 18 |
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 | ||
1174 | static int dccp_v6_init_net(struct net *net) | 1175 | static 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 | ||
1179 | static void dccp_v6_exit_net(struct net *net) | 1184 | static void dccp_v6_exit_net(struct net *net) |
1180 | { | 1185 | { |
1186 | inet_ctl_sock_destroy(net->dccp.v6_ctl_sk); | ||
1181 | } | 1187 | } |
1182 | 1188 | ||
1183 | static struct pernet_operations dccp_v6_ops = { | 1189 | static 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 | ||
1212 | out_destroy_ctl_sock: | 1213 | out_destroy_ctl_sock: |
1213 | inet_ctl_sock_destroy(init_net.dccp.v6_ctl_sk); | ||
1214 | out_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); |
1217 | out_unregister_proto: | 1216 | out_unregister_proto: |
@@ -1222,7 +1221,6 @@ out_unregister_proto: | |||
1222 | static void __exit dccp_v6_exit(void) | 1221 | static 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); |