提交 02047741 编写于 作者: P Pavel Emelyanov 提交者: David S. Miller

[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: NPavel Emelyanov <xemul@openvz.org>
Acked-by: NArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 8231bd27
...@@ -5,6 +5,7 @@ struct sock; ...@@ -5,6 +5,7 @@ struct sock;
struct netns_dccp { struct netns_dccp {
struct sock *v4_ctl_sk; struct sock *v4_ctl_sk;
struct sock *v6_ctl_sk;
}; };
#endif #endif
...@@ -33,8 +33,7 @@ ...@@ -33,8 +33,7 @@
#include "ipv6.h" #include "ipv6.h"
#include "feat.h" #include "feat.h"
/* Socket used for sending RSTs and ACKs */ /* dccp_v6_ctl_sk is used for sending RSTs and ACKs */
static struct sock *dccp_v6_ctl_sk;
static struct inet_connection_sock_af_ops dccp_ipv6_mapped; static struct inet_connection_sock_af_ops dccp_ipv6_mapped;
static struct inet_connection_sock_af_ops dccp_ipv6_af_ops; 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,6 +295,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
struct ipv6hdr *rxip6h; struct ipv6hdr *rxip6h;
struct sk_buff *skb; struct sk_buff *skb;
struct flowi fl; struct flowi fl;
struct sock *ctl_sk = init_net.dccp.v6_ctl_sk;
if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET) if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET)
return; return;
...@@ -303,7 +303,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) ...@@ -303,7 +303,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
if (!ipv6_unicast_destination(rxskb)) if (!ipv6_unicast_destination(rxskb))
return; return;
skb = dccp_ctl_make_reset(dccp_v6_ctl_sk, rxskb); skb = dccp_ctl_make_reset(ctl_sk, rxskb);
if (skb == NULL) if (skb == NULL)
return; return;
...@@ -322,9 +322,9 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) ...@@ -322,9 +322,9 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
security_skb_classify_flow(rxskb, &fl); security_skb_classify_flow(rxskb, &fl);
/* sk = NULL, but it is safe for now. RST socket required. */ /* sk = NULL, but it is safe for now. RST socket required. */
if (!ip6_dst_lookup(dccp_v6_ctl_sk, &skb->dst, &fl)) { if (!ip6_dst_lookup(ctl_sk, &skb->dst, &fl)) {
if (xfrm_lookup(&skb->dst, &fl, NULL, 0) >= 0) { if (xfrm_lookup(&skb->dst, &fl, NULL, 0) >= 0) {
ip6_xmit(dccp_v6_ctl_sk, skb, &fl, NULL, 0); ip6_xmit(ctl_sk, skb, &fl, NULL, 0);
DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS); DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS);
DCCP_INC_STATS_BH(DCCP_MIB_OUTRSTS); DCCP_INC_STATS_BH(DCCP_MIB_OUTRSTS);
return; return;
...@@ -1198,7 +1198,7 @@ static int __init dccp_v6_init(void) ...@@ -1198,7 +1198,7 @@ static int __init dccp_v6_init(void)
inet6_register_protosw(&dccp_v6_protosw); inet6_register_protosw(&dccp_v6_protosw);
err = inet_ctl_sock_create(&dccp_v6_ctl_sk, PF_INET6, err = inet_ctl_sock_create(&init_net.dccp.v6_ctl_sk, PF_INET6,
SOCK_DCCP, IPPROTO_DCCP, &init_net); SOCK_DCCP, IPPROTO_DCCP, &init_net);
if (err != 0) if (err != 0)
goto out_unregister_protosw; goto out_unregister_protosw;
...@@ -1210,7 +1210,7 @@ static int __init dccp_v6_init(void) ...@@ -1210,7 +1210,7 @@ static int __init dccp_v6_init(void)
return err; return err;
out_destroy_ctl_sock: out_destroy_ctl_sock:
inet_ctl_sock_destroy(dccp_v6_ctl_sk); inet_ctl_sock_destroy(init_net.dccp.v6_ctl_sk);
out_unregister_protosw: out_unregister_protosw:
inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP); inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP);
inet6_unregister_protosw(&dccp_v6_protosw); inet6_unregister_protosw(&dccp_v6_protosw);
...@@ -1222,7 +1222,7 @@ static int __init dccp_v6_init(void) ...@@ -1222,7 +1222,7 @@ static int __init dccp_v6_init(void)
static void __exit dccp_v6_exit(void) static void __exit dccp_v6_exit(void)
{ {
unregister_pernet_subsys(&dccp_v6_ops); unregister_pernet_subsys(&dccp_v6_ops);
inet_ctl_sock_destroy(dccp_v6_ctl_sk); inet_ctl_sock_destroy(init_net.dccp.v6_ctl_sk);
inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP); inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP);
inet6_unregister_protosw(&dccp_v6_protosw); inet6_unregister_protosw(&dccp_v6_protosw);
proto_unregister(&dccp_v6_prot); proto_unregister(&dccp_v6_prot);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册