Changeset ed3a238 for libpacketdump/ip_132.c
- Timestamp:
- 04/21/17 13:58:20 (4 years ago)
- Branches:
- cachetimestamps, develop, dpdk-ndag, etsilive, master, ndag_format, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance
- Children:
- f398c61
- Parents:
- 33a106a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpacketdump/ip_132.c
ree6e802 red3a238 155 155 int len = ntohs(ph->length) - 156 156 sizeof(struct sctp_var_param_hdr); 157 157 158 158 printf(" SCTP: Option Supported address types "); 159 159 160 160 while(len) { 161 161 printf("%hu ", ntohs(*p)); … … 181 181 struct sctp_chunk_hdr *chunk; 182 182 int chunk_num = 1; 183 int vlen; 183 int vlen = 0; 184 uint16_t chunklen = 0; 184 185 185 186 if(len < (signed)sizeof(struct sctp_common_hdr)) { … … 198 199 199 200 while(len > 0) { 201 if (len < sizeof(struct sctp_chunk_hdr)) { 202 printf(" SCTP: [Truncated]\n\n"); 203 break; 204 } 205 200 206 chunk = (struct sctp_chunk_hdr *)packet; 201 207 202 chunk ->length= ntohs(chunk->length);208 chunklen = ntohs(chunk->length); 203 209 204 210 printf(" SCTP: Chunk %d Type %s Flags %u Len %u\n", 205 211 chunk_num++, 206 sctp_type_to_str(chunk->type), chunk->flags, chunk ->length);207 208 if(chunk ->length== 0) {212 sctp_type_to_str(chunk->type), chunk->flags, chunklen); 213 214 if(chunklen == 0) { 209 215 printf(" SCTP: Invalid chunk length, aborting.\n\n"); 210 216 break; 217 } 218 219 /* Stupid SCTP has padding that is not accounted for in either 220 * the chunk length or the payload length fields */ 221 if ((chunklen % 4) != 0) { 222 /* Pad to the next four byte boundary */ 223 chunklen += ( 4 - (chunklen % 4) ); 224 } 225 226 /* Truncate any ridiculous chunk lengths so that they don't 227 * exceed the confines of the packet */ 228 if (chunklen > len) { 229 chunklen = len; 211 230 } 212 231 … … 229 248 struct sctp_init_ack *ack = (struct sctp_init_ack *) 230 249 (chunk + 1); 231 250 232 251 printf(" SCTP: Tag %u Credit %u Outbound %hu Inbound %hu " 233 252 "TSN %u\n", … … 238 257 ntohl(ack->init_tsn)); 239 258 240 vlen = chunk ->length- (sizeof(struct sctp_init_ack) +259 vlen = chunklen - (sizeof(struct sctp_init_ack) + 241 260 sizeof(struct sctp_chunk_hdr) + 242 261 sizeof(struct sctp_common_hdr) … … 270 289 break; 271 290 } 272 273 packet += chunk ->length;274 len -= chunk ->length;291 292 packet += chunklen; 293 len -= chunklen; 275 294 } 276 295 printf("\n");
Note: See TracChangeset
for help on using the changeset viewer.