diff options
author | Denis V. Lunev <den@openvz.org> | 2008-04-03 17:20:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-04-03 17:20:52 -0400 |
commit | 7630f026810a63464e47391ab1e03674c33eb1b8 (patch) | |
tree | 05ff3b2f6a750e659de4484c4b825953ecce1659 | |
parent | 14c0c8e8e0fb85e7a57e88606c009377746b39d9 (diff) |
[DCCP]: Replace socket with sock for reset sending.
Replace dccp_v(4|6)_ctl_socket with sock to unify a code with TCP/ICMP.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/dccp/dccp.h | 2 | ||||
-rw-r--r-- | net/dccp/ipv4.c | 16 | ||||
-rw-r--r-- | net/dccp/ipv6.c | 10 | ||||
-rw-r--r-- | net/dccp/output.c | 6 |
4 files changed, 19 insertions, 15 deletions
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index e1b7c9c6a623..fe7726b0018f 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
@@ -296,7 +296,7 @@ extern unsigned int dccp_poll(struct file *file, struct socket *sock, | |||
296 | extern int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, | 296 | extern int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, |
297 | int addr_len); | 297 | int addr_len); |
298 | 298 | ||
299 | extern struct sk_buff *dccp_ctl_make_reset(struct socket *ctl, | 299 | extern struct sk_buff *dccp_ctl_make_reset(struct sock *sk, |
300 | struct sk_buff *skb); | 300 | struct sk_buff *skb); |
301 | extern int dccp_send_reset(struct sock *sk, enum dccp_reset_codes code); | 301 | extern int dccp_send_reset(struct sock *sk, enum dccp_reset_codes code); |
302 | extern void dccp_send_close(struct sock *sk, const int active); | 302 | extern void dccp_send_close(struct sock *sk, const int active); |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 7d62f7eb6134..f97049bf22c0 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -36,7 +36,7 @@ | |||
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 | */ |
39 | static struct socket *dccp_v4_ctl_socket; | 39 | static struct sock *dccp_v4_ctl_sk; |
40 | 40 | ||
41 | int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | 41 | int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) |
42 | { | 42 | { |
@@ -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_socket->sk, rxskb); | 517 | dst = dccp_v4_route_skb(dccp_v4_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_socket, rxskb); | 521 | skb = dccp_ctl_make_reset(dccp_v4_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_socket->sk); | 530 | bh_lock_sock(dccp_v4_ctl_sk); |
531 | err = ip_build_and_send_pkt(skb, dccp_v4_ctl_socket->sk, | 531 | err = ip_build_and_send_pkt(skb, dccp_v4_ctl_sk, |
532 | rxiph->daddr, rxiph->saddr, NULL); | 532 | rxiph->daddr, rxiph->saddr, NULL); |
533 | bh_unlock_sock(dccp_v4_ctl_socket->sk); | 533 | bh_unlock_sock(dccp_v4_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); |
@@ -991,6 +991,7 @@ static struct inet_protosw dccp_v4_protosw = { | |||
991 | 991 | ||
992 | static int __init dccp_v4_init(void) | 992 | static int __init dccp_v4_init(void) |
993 | { | 993 | { |
994 | struct socket *socket; | ||
994 | int err = proto_register(&dccp_v4_prot, 1); | 995 | int err = proto_register(&dccp_v4_prot, 1); |
995 | 996 | ||
996 | if (err != 0) | 997 | if (err != 0) |
@@ -1002,10 +1003,11 @@ static int __init dccp_v4_init(void) | |||
1002 | 1003 | ||
1003 | inet_register_protosw(&dccp_v4_protosw); | 1004 | inet_register_protosw(&dccp_v4_protosw); |
1004 | 1005 | ||
1005 | err = inet_csk_ctl_sock_create(&dccp_v4_ctl_socket, PF_INET, | 1006 | err = inet_csk_ctl_sock_create(&socket, PF_INET, |
1006 | SOCK_DCCP, IPPROTO_DCCP); | 1007 | SOCK_DCCP, IPPROTO_DCCP); |
1007 | if (err) | 1008 | if (err) |
1008 | goto out_unregister_protosw; | 1009 | goto out_unregister_protosw; |
1010 | dccp_v4_ctl_sk = socket->sk; | ||
1009 | out: | 1011 | out: |
1010 | return err; | 1012 | return err; |
1011 | out_unregister_protosw: | 1013 | out_unregister_protosw: |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index ea3f32648618..44e8b3323170 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include "feat.h" | 34 | #include "feat.h" |
35 | 35 | ||
36 | /* Socket used for sending RSTs and ACKs */ | 36 | /* Socket used for sending RSTs and ACKs */ |
37 | static struct socket *dccp_v6_ctl_socket; | 37 | static struct sock *dccp_v6_ctl_sk; |
38 | 38 | ||
39 | static struct inet_connection_sock_af_ops dccp_ipv6_mapped; | 39 | static struct inet_connection_sock_af_ops dccp_ipv6_mapped; |
40 | static struct inet_connection_sock_af_ops dccp_ipv6_af_ops; | 40 | static struct inet_connection_sock_af_ops dccp_ipv6_af_ops; |
@@ -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_socket, rxskb); | 306 | skb = dccp_ctl_make_reset(dccp_v6_ctl_sk, rxskb); |
307 | if (skb == NULL) | 307 | if (skb == NULL) |
308 | return; | 308 | return; |
309 | 309 | ||
@@ -324,7 +324,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) | |||
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(NULL, &skb->dst, &fl)) { | 325 | if (!ip6_dst_lookup(NULL, &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_socket->sk, skb, &fl, NULL, 0); | 327 | ip6_xmit(dccp_v6_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; |
@@ -1173,6 +1173,7 @@ static struct inet_protosw dccp_v6_protosw = { | |||
1173 | 1173 | ||
1174 | static int __init dccp_v6_init(void) | 1174 | static int __init dccp_v6_init(void) |
1175 | { | 1175 | { |
1176 | struct socket *socket; | ||
1176 | int err = proto_register(&dccp_v6_prot, 1); | 1177 | int err = proto_register(&dccp_v6_prot, 1); |
1177 | 1178 | ||
1178 | if (err != 0) | 1179 | if (err != 0) |
@@ -1184,10 +1185,11 @@ static int __init dccp_v6_init(void) | |||
1184 | 1185 | ||
1185 | inet6_register_protosw(&dccp_v6_protosw); | 1186 | inet6_register_protosw(&dccp_v6_protosw); |
1186 | 1187 | ||
1187 | err = inet_csk_ctl_sock_create(&dccp_v6_ctl_socket, PF_INET6, | 1188 | err = inet_csk_ctl_sock_create(&socket, PF_INET6, |
1188 | SOCK_DCCP, IPPROTO_DCCP); | 1189 | SOCK_DCCP, IPPROTO_DCCP); |
1189 | if (err != 0) | 1190 | if (err != 0) |
1190 | goto out_unregister_protosw; | 1191 | goto out_unregister_protosw; |
1192 | dccp_v6_ctl_sk = socket->sk; | ||
1191 | out: | 1193 | out: |
1192 | return err; | 1194 | return err; |
1193 | out_unregister_protosw: | 1195 | out_unregister_protosw: |
diff --git a/net/dccp/output.c b/net/dccp/output.c index 3b763db3d863..f32a84ef757b 100644 --- a/net/dccp/output.c +++ b/net/dccp/output.c | |||
@@ -348,7 +348,7 @@ struct sk_buff *dccp_make_response(struct sock *sk, struct dst_entry *dst, | |||
348 | EXPORT_SYMBOL_GPL(dccp_make_response); | 348 | EXPORT_SYMBOL_GPL(dccp_make_response); |
349 | 349 | ||
350 | /* answer offending packet in @rcv_skb with Reset from control socket @ctl */ | 350 | /* answer offending packet in @rcv_skb with Reset from control socket @ctl */ |
351 | struct sk_buff *dccp_ctl_make_reset(struct socket *ctl, struct sk_buff *rcv_skb) | 351 | struct sk_buff *dccp_ctl_make_reset(struct sock *sk, struct sk_buff *rcv_skb) |
352 | { | 352 | { |
353 | struct dccp_hdr *rxdh = dccp_hdr(rcv_skb), *dh; | 353 | struct dccp_hdr *rxdh = dccp_hdr(rcv_skb), *dh; |
354 | struct dccp_skb_cb *dcb = DCCP_SKB_CB(rcv_skb); | 354 | struct dccp_skb_cb *dcb = DCCP_SKB_CB(rcv_skb); |
@@ -358,11 +358,11 @@ struct sk_buff *dccp_ctl_make_reset(struct socket *ctl, struct sk_buff *rcv_skb) | |||
358 | struct dccp_hdr_reset *dhr; | 358 | struct dccp_hdr_reset *dhr; |
359 | struct sk_buff *skb; | 359 | struct sk_buff *skb; |
360 | 360 | ||
361 | skb = alloc_skb(ctl->sk->sk_prot->max_header, GFP_ATOMIC); | 361 | skb = alloc_skb(sk->sk_prot->max_header, GFP_ATOMIC); |
362 | if (skb == NULL) | 362 | if (skb == NULL) |
363 | return NULL; | 363 | return NULL; |
364 | 364 | ||
365 | skb_reserve(skb, ctl->sk->sk_prot->max_header); | 365 | skb_reserve(skb, sk->sk_prot->max_header); |
366 | 366 | ||
367 | /* Swap the send and the receive. */ | 367 | /* Swap the send and the receive. */ |
368 | dh = dccp_zeroed_hdr(skb, dccp_hdr_reset_len); | 368 | dh = dccp_zeroed_hdr(skb, dccp_hdr_reset_len); |