aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp')
-rw-r--r--net/dccp/dccp.h2
-rw-r--r--net/dccp/ipv4.c16
-rw-r--r--net/dccp/ipv6.c10
-rw-r--r--net/dccp/output.c6
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,
296extern int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, 296extern int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr,
297 int addr_len); 297 int addr_len);
298 298
299extern struct sk_buff *dccp_ctl_make_reset(struct socket *ctl, 299extern struct sk_buff *dccp_ctl_make_reset(struct sock *sk,
300 struct sk_buff *skb); 300 struct sk_buff *skb);
301extern int dccp_send_reset(struct sock *sk, enum dccp_reset_codes code); 301extern int dccp_send_reset(struct sock *sk, enum dccp_reset_codes code);
302extern void dccp_send_close(struct sock *sk, const int active); 302extern 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 */
39static struct socket *dccp_v4_ctl_socket; 39static struct sock *dccp_v4_ctl_sk;
40 40
41int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) 41int 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
992static int __init dccp_v4_init(void) 992static 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;
1009out: 1011out:
1010 return err; 1012 return err;
1011out_unregister_protosw: 1013out_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 */
37static struct socket *dccp_v6_ctl_socket; 37static struct sock *dccp_v6_ctl_sk;
38 38
39static struct inet_connection_sock_af_ops dccp_ipv6_mapped; 39static struct inet_connection_sock_af_ops dccp_ipv6_mapped;
40static struct inet_connection_sock_af_ops dccp_ipv6_af_ops; 40static 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
1174static int __init dccp_v6_init(void) 1174static 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;
1191out: 1193out:
1192 return err; 1194 return err;
1193out_unregister_protosw: 1195out_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,
348EXPORT_SYMBOL_GPL(dccp_make_response); 348EXPORT_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 */
351struct sk_buff *dccp_ctl_make_reset(struct socket *ctl, struct sk_buff *rcv_skb) 351struct 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);