minisocks.c (21f130a2370ba837cdfc5204ebe52e7c664fec3d) minisocks.c (ae31c3399d17b1f7bc1742724f70476b5417744f)
1/*
2 * net/dccp/minisocks.c
3 *
4 * An implementation of the DCCP protocol
5 * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License

--- 5 unchanged lines hidden (view full) ---

14#include <linux/dccp.h>
15#include <linux/skbuff.h>
16#include <linux/timer.h>
17
18#include <net/sock.h>
19#include <net/xfrm.h>
20#include <net/inet_timewait_sock.h>
21
1/*
2 * net/dccp/minisocks.c
3 *
4 * An implementation of the DCCP protocol
5 * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License

--- 5 unchanged lines hidden (view full) ---

14#include <linux/dccp.h>
15#include <linux/skbuff.h>
16#include <linux/timer.h>
17
18#include <net/sock.h>
19#include <net/xfrm.h>
20#include <net/inet_timewait_sock.h>
21
22#include "ackvec.h"
22#include "ccid.h"
23#include "dccp.h"
24
25struct inet_timewait_death_row dccp_death_row = {
26 .sysctl_max_tw_buckets = NR_FILE * 2,
27 .period = DCCP_TIMEWAIT_LEN / INET_TWDR_TWKILL_SLOTS,
28 .death_lock = SPIN_LOCK_UNLOCKED,
29 .hashinfo = &dccp_hashinfo,

--- 59 unchanged lines hidden (view full) ---

89 struct sock *newsk = inet_csk_clone(sk, req, GFP_ATOMIC);
90
91 if (newsk != NULL) {
92 const struct dccp_request_sock *dreq = dccp_rsk(req);
93 struct inet_connection_sock *newicsk = inet_csk(sk);
94 struct dccp_sock *newdp = dccp_sk(newsk);
95
96 newdp->dccps_role = DCCP_ROLE_SERVER;
23#include "ccid.h"
24#include "dccp.h"
25
26struct inet_timewait_death_row dccp_death_row = {
27 .sysctl_max_tw_buckets = NR_FILE * 2,
28 .period = DCCP_TIMEWAIT_LEN / INET_TWDR_TWKILL_SLOTS,
29 .death_lock = SPIN_LOCK_UNLOCKED,
30 .hashinfo = &dccp_hashinfo,

--- 59 unchanged lines hidden (view full) ---

90 struct sock *newsk = inet_csk_clone(sk, req, GFP_ATOMIC);
91
92 if (newsk != NULL) {
93 const struct dccp_request_sock *dreq = dccp_rsk(req);
94 struct inet_connection_sock *newicsk = inet_csk(sk);
95 struct dccp_sock *newdp = dccp_sk(newsk);
96
97 newdp->dccps_role = DCCP_ROLE_SERVER;
97 newdp->dccps_hc_rx_ackpkts = NULL;
98 newdp->dccps_hc_rx_ackvec = NULL;
98 newdp->dccps_service_list = NULL;
99 newdp->dccps_service = dreq->dreq_service;
100 newicsk->icsk_rto = DCCP_TIMEOUT_INIT;
101 do_gettimeofday(&newdp->dccps_epoch);
102
103 if (newdp->dccps_options.dccpo_send_ack_vector) {
99 newdp->dccps_service_list = NULL;
100 newdp->dccps_service = dreq->dreq_service;
101 newicsk->icsk_rto = DCCP_TIMEOUT_INIT;
102 do_gettimeofday(&newdp->dccps_epoch);
103
104 if (newdp->dccps_options.dccpo_send_ack_vector) {
104 newdp->dccps_hc_rx_ackpkts =
105 dccp_ackpkts_alloc(DCCP_MAX_ACK_VECTOR_LEN,
106 GFP_ATOMIC);
105 newdp->dccps_hc_rx_ackvec =
106 dccp_ackvec_alloc(DCCP_MAX_ACKVEC_LEN,
107 GFP_ATOMIC);
107 /*
108 * XXX: We're using the same CCIDs set on the parent,
109 * i.e. sk_clone copied the master sock and left the
110 * CCID pointers for this child, that is why we do the
111 * __ccid_get calls.
112 */
108 /*
109 * XXX: We're using the same CCIDs set on the parent,
110 * i.e. sk_clone copied the master sock and left the
111 * CCID pointers for this child, that is why we do the
112 * __ccid_get calls.
113 */
113 if (unlikely(newdp->dccps_hc_rx_ackpkts == NULL))
114 if (unlikely(newdp->dccps_hc_rx_ackvec == NULL))
114 goto out_free;
115 }
116
117 if (unlikely(ccid_hc_rx_init(newdp->dccps_hc_rx_ccid,
118 newsk) != 0 ||
119 ccid_hc_tx_init(newdp->dccps_hc_tx_ccid,
120 newsk) != 0)) {
115 goto out_free;
116 }
117
118 if (unlikely(ccid_hc_rx_init(newdp->dccps_hc_rx_ccid,
119 newsk) != 0 ||
120 ccid_hc_tx_init(newdp->dccps_hc_tx_ccid,
121 newsk) != 0)) {
121 dccp_ackpkts_free(newdp->dccps_hc_rx_ackpkts);
122 dccp_ackvec_free(newdp->dccps_hc_rx_ackvec);
122 ccid_hc_rx_exit(newdp->dccps_hc_rx_ccid, newsk);
123 ccid_hc_tx_exit(newdp->dccps_hc_tx_ccid, newsk);
124out_free:
125 /* It is still raw copy of parent, so invalidate
126 * destructor and make plain sk_free() */
127 newsk->sk_destruct = NULL;
128 sk_free(newsk);
129 return NULL;

--- 138 unchanged lines hidden ---
123 ccid_hc_rx_exit(newdp->dccps_hc_rx_ccid, newsk);
124 ccid_hc_tx_exit(newdp->dccps_hc_tx_ccid, newsk);
125out_free:
126 /* It is still raw copy of parent, so invalidate
127 * destructor and make plain sk_free() */
128 newsk->sk_destruct = NULL;
129 sk_free(newsk);
130 return NULL;

--- 138 unchanged lines hidden ---