diff --git a/gtests/net/packetdrill/sctp_chunk_to_string.c b/gtests/net/packetdrill/sctp_chunk_to_string.c index 56cfbc5d6c8901fbad77f865867e4a212b186f63..027873a947c3b8b21fa4eec314a20a63a29a1ee2 100644 --- a/gtests/net/packetdrill/sctp_chunk_to_string.c +++ b/gtests/net/packetdrill/sctp_chunk_to_string.c @@ -346,7 +346,7 @@ static int sctp_adaptation_indication_parameter_to_string( u16 length; length = ntohs(parameter->length); - if (length < sizeof(struct sctp_parameter)) { + if (length < sizeof(struct sctp_adaptation_indication_parameter)) { asprintf(error, "PARAMETER too short (type=0x%04x, length=%u)", ntohs(parameter->type), length); return STATUS_ERR; diff --git a/gtests/net/packetdrill/sctp_packet.c b/gtests/net/packetdrill/sctp_packet.c index b3ce132fc8b626135dcef80deae3809d04581441..5ddca4a72b388f1d5488bd6dd00a9e19e97d0f71 100644 --- a/gtests/net/packetdrill/sctp_packet.c +++ b/gtests/net/packetdrill/sctp_packet.c @@ -1570,8 +1570,6 @@ sctp_supported_address_types_parameter_new(struct sctp_address_type_list *list) parameter_length, flags); } - - struct sctp_parameter_list_item * sctp_supported_extensions_parameter_new(struct sctp_byte_list *list) { @@ -1614,7 +1612,7 @@ sctp_supported_extensions_parameter_new(struct sctp_byte_list *list) } struct sctp_parameter_list_item * -sctp_adaptation_indication_parameter_new(u32 val) +sctp_adaptation_indication_parameter_new(s64 val) { u32 flags; struct sctp_adaptation_indication_parameter *parameter; @@ -1629,8 +1627,13 @@ sctp_adaptation_indication_parameter_new(u32 val) parameter->type = htons(SCTP_ADAPTATION_INDICATION_PARAMETER_TYPE); parameter->length = htons(parameter_length); - parameter->adaptation_code_point = htonl(val); - + if (val == -1) { + parameter->adaptation_code_point = htonl(0); + flags |= FLAG_PARAMETER_VALUE_NOCHECK; + } else { + assert(is_valid_u32(val)); + parameter->adaptation_code_point = htonl((u32)val); + } return sctp_parameter_list_item_new((struct sctp_parameter *)parameter, parameter_length, flags); } diff --git a/gtests/net/packetdrill/sctp_packet.h b/gtests/net/packetdrill/sctp_packet.h index e7c8c491f0dd81b15e86d1472cd25103da3253a1..b492ebc736cb5e504e079ac981e59d1f3b933639 100644 --- a/gtests/net/packetdrill/sctp_packet.h +++ b/gtests/net/packetdrill/sctp_packet.h @@ -341,7 +341,7 @@ struct sctp_parameter_list_item * sctp_pad_parameter_new(s64 len, u8 *padding); struct sctp_parameter_list_item * -sctp_adaptation_indication_parameter_new(u32 val); +sctp_adaptation_indication_parameter_new(s64 val); struct sctp_parameter_list_item * sctp_supported_extensions_parameter_new(struct sctp_byte_list *list);