aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/sm_make_chunk.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sctp/sm_make_chunk.c')
-rw-r--r--net/sctp/sm_make_chunk.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 9e732916b671..224db014fb6b 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -207,7 +207,8 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
207 sp = sctp_sk(asoc->base.sk); 207 sp = sctp_sk(asoc->base.sk);
208 num_types = sp->pf->supported_addrs(sp, types); 208 num_types = sp->pf->supported_addrs(sp, types);
209 209
210 chunksize = sizeof(init) + addrs_len + SCTP_SAT_LEN(num_types); 210 chunksize = sizeof(init) + addrs_len;
211 chunksize += WORD_ROUND(SCTP_SAT_LEN(num_types));
211 chunksize += sizeof(ecap_param); 212 chunksize += sizeof(ecap_param);
212 213
213 if (sctp_prsctp_enable) 214 if (sctp_prsctp_enable)
@@ -237,14 +238,14 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
237 /* Add HMACS parameter length if any were defined */ 238 /* Add HMACS parameter length if any were defined */
238 auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs; 239 auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs;
239 if (auth_hmacs->length) 240 if (auth_hmacs->length)
240 chunksize += ntohs(auth_hmacs->length); 241 chunksize += WORD_ROUND(ntohs(auth_hmacs->length));
241 else 242 else
242 auth_hmacs = NULL; 243 auth_hmacs = NULL;
243 244
244 /* Add CHUNKS parameter length */ 245 /* Add CHUNKS parameter length */
245 auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks; 246 auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks;
246 if (auth_chunks->length) 247 if (auth_chunks->length)
247 chunksize += ntohs(auth_chunks->length); 248 chunksize += WORD_ROUND(ntohs(auth_chunks->length));
248 else 249 else
249 auth_chunks = NULL; 250 auth_chunks = NULL;
250 251
@@ -254,7 +255,8 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
254 255
255 /* If we have any extensions to report, account for that */ 256 /* If we have any extensions to report, account for that */
256 if (num_ext) 257 if (num_ext)
257 chunksize += sizeof(sctp_supported_ext_param_t) + num_ext; 258 chunksize += WORD_ROUND(sizeof(sctp_supported_ext_param_t) +
259 num_ext);
258 260
259 /* RFC 2960 3.3.2 Initiation (INIT) (1) 261 /* RFC 2960 3.3.2 Initiation (INIT) (1)
260 * 262 *
@@ -396,13 +398,13 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
396 398
397 auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs; 399 auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs;
398 if (auth_hmacs->length) 400 if (auth_hmacs->length)
399 chunksize += ntohs(auth_hmacs->length); 401 chunksize += WORD_ROUND(ntohs(auth_hmacs->length));
400 else 402 else
401 auth_hmacs = NULL; 403 auth_hmacs = NULL;
402 404
403 auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks; 405 auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks;
404 if (auth_chunks->length) 406 if (auth_chunks->length)
405 chunksize += ntohs(auth_chunks->length); 407 chunksize += WORD_ROUND(ntohs(auth_chunks->length));
406 else 408 else
407 auth_chunks = NULL; 409 auth_chunks = NULL;
408 410
@@ -411,7 +413,8 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
411 } 413 }
412 414
413 if (num_ext) 415 if (num_ext)
414 chunksize += sizeof(sctp_supported_ext_param_t) + num_ext; 416 chunksize += WORD_ROUND(sizeof(sctp_supported_ext_param_t) +
417 num_ext);
415 418
416 /* Now allocate and fill out the chunk. */ 419 /* Now allocate and fill out the chunk. */
417 retval = sctp_make_chunk(asoc, SCTP_CID_INIT_ACK, 0, chunksize); 420 retval = sctp_make_chunk(asoc, SCTP_CID_INIT_ACK, 0, chunksize);
@@ -3314,21 +3317,6 @@ int sctp_process_asconf_ack(struct sctp_association *asoc,
3314 sctp_chunk_free(asconf); 3317 sctp_chunk_free(asconf);
3315 asoc->addip_last_asconf = NULL; 3318 asoc->addip_last_asconf = NULL;
3316 3319
3317 /* Send the next asconf chunk from the addip chunk queue. */
3318 if (!list_empty(&asoc->addip_chunk_list)) {
3319 struct list_head *entry = asoc->addip_chunk_list.next;
3320 asconf = list_entry(entry, struct sctp_chunk, list);
3321
3322 list_del_init(entry);
3323
3324 /* Hold the chunk until an ASCONF_ACK is received. */
3325 sctp_chunk_hold(asconf);
3326 if (sctp_primitive_ASCONF(asoc, asconf))
3327 sctp_chunk_free(asconf);
3328 else
3329 asoc->addip_last_asconf = asconf;
3330 }
3331
3332 return retval; 3320 return retval;
3333} 3321}
3334 3322