diff options
Diffstat (limited to 'net/sctp')
-rw-r--r-- | net/sctp/sm_make_chunk.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 9484f33730f6..6851ee94e974 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -224,7 +224,9 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, | |||
224 | num_ext += 2; | 224 | num_ext += 2; |
225 | } | 225 | } |
226 | 226 | ||
227 | chunksize += sizeof(aiparam); | 227 | if (sp->adaptation_ind) |
228 | chunksize += sizeof(aiparam); | ||
229 | |||
228 | chunksize += vparam_len; | 230 | chunksize += vparam_len; |
229 | 231 | ||
230 | /* Account for AUTH related parameters */ | 232 | /* Account for AUTH related parameters */ |
@@ -304,10 +306,12 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, | |||
304 | if (sctp_prsctp_enable) | 306 | if (sctp_prsctp_enable) |
305 | sctp_addto_chunk(retval, sizeof(prsctp_param), &prsctp_param); | 307 | sctp_addto_chunk(retval, sizeof(prsctp_param), &prsctp_param); |
306 | 308 | ||
307 | aiparam.param_hdr.type = SCTP_PARAM_ADAPTATION_LAYER_IND; | 309 | if (sp->adaptation_ind) { |
308 | aiparam.param_hdr.length = htons(sizeof(aiparam)); | 310 | aiparam.param_hdr.type = SCTP_PARAM_ADAPTATION_LAYER_IND; |
309 | aiparam.adaptation_ind = htonl(sp->adaptation_ind); | 311 | aiparam.param_hdr.length = htons(sizeof(aiparam)); |
310 | sctp_addto_chunk(retval, sizeof(aiparam), &aiparam); | 312 | aiparam.adaptation_ind = htonl(sp->adaptation_ind); |
313 | sctp_addto_chunk(retval, sizeof(aiparam), &aiparam); | ||
314 | } | ||
311 | 315 | ||
312 | /* Add SCTP-AUTH chunks to the parameter list */ | 316 | /* Add SCTP-AUTH chunks to the parameter list */ |
313 | if (sctp_auth_enable) { | 317 | if (sctp_auth_enable) { |
@@ -332,6 +336,7 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, | |||
332 | sctp_inithdr_t initack; | 336 | sctp_inithdr_t initack; |
333 | struct sctp_chunk *retval; | 337 | struct sctp_chunk *retval; |
334 | union sctp_params addrs; | 338 | union sctp_params addrs; |
339 | struct sctp_sock *sp; | ||
335 | int addrs_len; | 340 | int addrs_len; |
336 | sctp_cookie_param_t *cookie; | 341 | sctp_cookie_param_t *cookie; |
337 | int cookie_len; | 342 | int cookie_len; |
@@ -366,6 +371,7 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, | |||
366 | /* Calculate the total size of allocation, include the reserved | 371 | /* Calculate the total size of allocation, include the reserved |
367 | * space for reporting unknown parameters if it is specified. | 372 | * space for reporting unknown parameters if it is specified. |
368 | */ | 373 | */ |
374 | sp = sctp_sk(asoc->base.sk); | ||
369 | chunksize = sizeof(initack) + addrs_len + cookie_len + unkparam_len; | 375 | chunksize = sizeof(initack) + addrs_len + cookie_len + unkparam_len; |
370 | 376 | ||
371 | /* Tell peer that we'll do ECN only if peer advertised such cap. */ | 377 | /* Tell peer that we'll do ECN only if peer advertised such cap. */ |
@@ -381,7 +387,8 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, | |||
381 | num_ext += 2; | 387 | num_ext += 2; |
382 | } | 388 | } |
383 | 389 | ||
384 | chunksize += sizeof(aiparam); | 390 | if (sp->adaptation_ind) |
391 | chunksize += sizeof(aiparam); | ||
385 | 392 | ||
386 | if (asoc->peer.auth_capable) { | 393 | if (asoc->peer.auth_capable) { |
387 | auth_random = (sctp_paramhdr_t *)asoc->c.auth_random; | 394 | auth_random = (sctp_paramhdr_t *)asoc->c.auth_random; |
@@ -432,10 +439,12 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, | |||
432 | if (asoc->peer.prsctp_capable) | 439 | if (asoc->peer.prsctp_capable) |
433 | sctp_addto_chunk(retval, sizeof(prsctp_param), &prsctp_param); | 440 | sctp_addto_chunk(retval, sizeof(prsctp_param), &prsctp_param); |
434 | 441 | ||
435 | aiparam.param_hdr.type = SCTP_PARAM_ADAPTATION_LAYER_IND; | 442 | if (sp->adaptation_ind) { |
436 | aiparam.param_hdr.length = htons(sizeof(aiparam)); | 443 | aiparam.param_hdr.type = SCTP_PARAM_ADAPTATION_LAYER_IND; |
437 | aiparam.adaptation_ind = htonl(sctp_sk(asoc->base.sk)->adaptation_ind); | 444 | aiparam.param_hdr.length = htons(sizeof(aiparam)); |
438 | sctp_addto_chunk(retval, sizeof(aiparam), &aiparam); | 445 | aiparam.adaptation_ind = htonl(sp->adaptation_ind); |
446 | sctp_addto_chunk(retval, sizeof(aiparam), &aiparam); | ||
447 | } | ||
439 | 448 | ||
440 | if (asoc->peer.auth_capable) { | 449 | if (asoc->peer.auth_capable) { |
441 | sctp_addto_chunk(retval, ntohs(auth_random->length), | 450 | sctp_addto_chunk(retval, ntohs(auth_random->length), |