diff options
Diffstat (limited to 'net/sctp/associola.c')
-rw-r--r-- | net/sctp/associola.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 8c8ddf7f9b61..dec68a604773 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
@@ -128,9 +128,29 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
128 | */ | 128 | */ |
129 | asoc->max_burst = sctp_max_burst; | 129 | asoc->max_burst = sctp_max_burst; |
130 | 130 | ||
131 | /* Copy things from the endpoint. */ | 131 | /* initialize association timers */ |
132 | asoc->timeouts[SCTP_EVENT_TIMEOUT_NONE] = 0; | ||
133 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_COOKIE] = asoc->rto_initial; | ||
134 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_INIT] = asoc->rto_initial; | ||
135 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T2_SHUTDOWN] = asoc->rto_initial; | ||
136 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T3_RTX] = 0; | ||
137 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T4_RTO] = 0; | ||
138 | |||
139 | /* sctpimpguide Section 2.12.2 | ||
140 | * If the 'T5-shutdown-guard' timer is used, it SHOULD be set to the | ||
141 | * recommended value of 5 times 'RTO.Max'. | ||
142 | */ | ||
143 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD] | ||
144 | = 5 * asoc->rto_max; | ||
145 | |||
146 | asoc->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] = 0; | ||
147 | asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = | ||
148 | SCTP_DEFAULT_TIMEOUT_SACK; | ||
149 | asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = | ||
150 | sp->autoclose * HZ; | ||
151 | |||
152 | /* Initilizes the timers */ | ||
132 | for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i) { | 153 | for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i) { |
133 | asoc->timeouts[i] = ep->timeouts[i]; | ||
134 | init_timer(&asoc->timers[i]); | 154 | init_timer(&asoc->timers[i]); |
135 | asoc->timers[i].function = sctp_timer_events[i]; | 155 | asoc->timers[i].function = sctp_timer_events[i]; |
136 | asoc->timers[i].data = (unsigned long) asoc; | 156 | asoc->timers[i].data = (unsigned long) asoc; |
@@ -157,10 +177,10 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
157 | * RFC 6 - A SCTP receiver MUST be able to receive a minimum of | 177 | * RFC 6 - A SCTP receiver MUST be able to receive a minimum of |
158 | * 1500 bytes in one SCTP packet. | 178 | * 1500 bytes in one SCTP packet. |
159 | */ | 179 | */ |
160 | if (sk->sk_rcvbuf < SCTP_DEFAULT_MINWINDOW) | 180 | if ((sk->sk_rcvbuf/2) < SCTP_DEFAULT_MINWINDOW) |
161 | asoc->rwnd = SCTP_DEFAULT_MINWINDOW; | 181 | asoc->rwnd = SCTP_DEFAULT_MINWINDOW; |
162 | else | 182 | else |
163 | asoc->rwnd = sk->sk_rcvbuf; | 183 | asoc->rwnd = sk->sk_rcvbuf/2; |
164 | 184 | ||
165 | asoc->a_rwnd = asoc->rwnd; | 185 | asoc->a_rwnd = asoc->rwnd; |
166 | 186 | ||
@@ -172,6 +192,9 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
172 | /* Set the sndbuf size for transmit. */ | 192 | /* Set the sndbuf size for transmit. */ |
173 | asoc->sndbuf_used = 0; | 193 | asoc->sndbuf_used = 0; |
174 | 194 | ||
195 | /* Initialize the receive memory counter */ | ||
196 | atomic_set(&asoc->rmem_alloc, 0); | ||
197 | |||
175 | init_waitqueue_head(&asoc->wait); | 198 | init_waitqueue_head(&asoc->wait); |
176 | 199 | ||
177 | asoc->c.my_vtag = sctp_generate_tag(ep); | 200 | asoc->c.my_vtag = sctp_generate_tag(ep); |
@@ -380,6 +403,8 @@ static void sctp_association_destroy(struct sctp_association *asoc) | |||
380 | spin_unlock_bh(&sctp_assocs_id_lock); | 403 | spin_unlock_bh(&sctp_assocs_id_lock); |
381 | } | 404 | } |
382 | 405 | ||
406 | BUG_TRAP(!atomic_read(&asoc->rmem_alloc)); | ||
407 | |||
383 | if (asoc->base.malloced) { | 408 | if (asoc->base.malloced) { |
384 | kfree(asoc); | 409 | kfree(asoc); |
385 | SCTP_DBG_OBJCNT_DEC(assoc); | 410 | SCTP_DBG_OBJCNT_DEC(assoc); |