aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ipv4.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-04-14 01:29:37 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-14 01:29:37 -0400
commit7b1cffa8c90269dc3dc721d084d1e0d742d87c31 (patch)
tree790914a5574a2cf33a7ee3672629bf0a31f77b71 /net/dccp/ipv4.c
parent72a2d6138224298a576bcdc33d7d0004de604856 (diff)
[NETNS][DCCPV4]: Move the dccp_v4_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>
Diffstat (limited to 'net/dccp/ipv4.c')
-rw-r--r--net/dccp/ipv4.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 10bba039c4b8..85931dce744c 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -32,11 +32,10 @@
32#include "feat.h" 32#include "feat.h"
33 33
34/* 34/*
35 * This is the global socket data structure used for responding to 35 * The dccp_ctl_sk is the global socket data structure used for responding to
36 * the Out-of-the-blue (OOTB) packets. A control sock will be created 36 * the Out-of-the-blue (OOTB) packets. A control sock will be created
37 * for this socket at the initialization time. 37 * for this socket at the initialization time.
38 */ 38 */
39static struct sock *dccp_v4_ctl_sk;
40 39
41int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) 40int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
42{ 41{
@@ -506,6 +505,7 @@ static void dccp_v4_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
506 const struct iphdr *rxiph; 505 const struct iphdr *rxiph;
507 struct sk_buff *skb; 506 struct sk_buff *skb;
508 struct dst_entry *dst; 507 struct dst_entry *dst;
508 struct sock *ctl_sk = init_net.dccp.v4_ctl_sk;
509 509
510 /* Never send a reset in response to a reset. */ 510 /* Never send a reset in response to a reset. */
511 if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET) 511 if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET)
@@ -514,11 +514,11 @@ static void dccp_v4_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
514 if (rxskb->rtable->rt_type != RTN_LOCAL) 514 if (rxskb->rtable->rt_type != RTN_LOCAL)
515 return; 515 return;
516 516
517 dst = dccp_v4_route_skb(dccp_v4_ctl_sk, rxskb); 517 dst = dccp_v4_route_skb(ctl_sk, rxskb);
518 if (dst == NULL) 518 if (dst == NULL)
519 return; 519 return;
520 520
521 skb = dccp_ctl_make_reset(dccp_v4_ctl_sk, rxskb); 521 skb = dccp_ctl_make_reset(ctl_sk, rxskb);
522 if (skb == NULL) 522 if (skb == NULL)
523 goto out; 523 goto out;
524 524
@@ -527,10 +527,10 @@ static void dccp_v4_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
527 rxiph->daddr); 527 rxiph->daddr);
528 skb->dst = dst_clone(dst); 528 skb->dst = dst_clone(dst);
529 529
530 bh_lock_sock(dccp_v4_ctl_sk); 530 bh_lock_sock(ctl_sk);
531 err = ip_build_and_send_pkt(skb, dccp_v4_ctl_sk, 531 err = ip_build_and_send_pkt(skb, ctl_sk,
532 rxiph->daddr, rxiph->saddr, NULL); 532 rxiph->daddr, rxiph->saddr, NULL);
533 bh_unlock_sock(dccp_v4_ctl_sk); 533 bh_unlock_sock(ctl_sk);
534 534
535 if (net_xmit_eval(err) == 0) { 535 if (net_xmit_eval(err) == 0) {
536 DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS); 536 DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS);
@@ -1016,7 +1016,7 @@ static int __init dccp_v4_init(void)
1016 1016
1017 inet_register_protosw(&dccp_v4_protosw); 1017 inet_register_protosw(&dccp_v4_protosw);
1018 1018
1019 err = inet_ctl_sock_create(&dccp_v4_ctl_sk, PF_INET, 1019 err = inet_ctl_sock_create(&init_net.dccp.v4_ctl_sk, PF_INET,
1020 SOCK_DCCP, IPPROTO_DCCP, &init_net); 1020 SOCK_DCCP, IPPROTO_DCCP, &init_net);
1021 if (err) 1021 if (err)
1022 goto out_unregister_protosw; 1022 goto out_unregister_protosw;
@@ -1027,7 +1027,7 @@ static int __init dccp_v4_init(void)
1027out: 1027out:
1028 return err; 1028 return err;
1029out_destroy_ctl_sock: 1029out_destroy_ctl_sock:
1030 inet_ctl_sock_destroy(dccp_v4_ctl_sk); 1030 inet_ctl_sock_destroy(init_net.dccp.v4_ctl_sk);
1031out_unregister_protosw: 1031out_unregister_protosw:
1032 inet_unregister_protosw(&dccp_v4_protosw); 1032 inet_unregister_protosw(&dccp_v4_protosw);
1033 inet_del_protocol(&dccp_v4_protocol, IPPROTO_DCCP); 1033 inet_del_protocol(&dccp_v4_protocol, IPPROTO_DCCP);
@@ -1039,7 +1039,7 @@ out_proto_unregister:
1039static void __exit dccp_v4_exit(void) 1039static void __exit dccp_v4_exit(void)
1040{ 1040{
1041 unregister_pernet_subsys(&dccp_v4_ops); 1041 unregister_pernet_subsys(&dccp_v4_ops);
1042 inet_ctl_sock_destroy(dccp_v4_ctl_sk); 1042 inet_ctl_sock_destroy(init_net.dccp.v4_ctl_sk);
1043 inet_unregister_protosw(&dccp_v4_protosw); 1043 inet_unregister_protosw(&dccp_v4_protosw);
1044 inet_del_protocol(&dccp_v4_protocol, IPPROTO_DCCP); 1044 inet_del_protocol(&dccp_v4_protocol, IPPROTO_DCCP);
1045 proto_unregister(&dccp_v4_prot); 1045 proto_unregister(&dccp_v4_prot);