Source code:
Use %zu when printing a sizeof to squelch compiler warnings
(FIXME: somebody please wrap the line below just before the release)
- AODV, AppleTalk, BOOTP, EGP, EIGRP, Geneve, L2TP, NTP, OLSR, PGM, RIP, RSVP, TCP, UDP: Modernize packet parsing style
+ AODV, AppleTalk, BOOTP, EGP, EIGRP, Geneve, L2TP, NTP, OLSR, PGM, RIP, RSVP, SCTP, TCP, UDP: Modernize packet parsing style
EGP: Replace custom code with tok2str()
UDP: Clean up address and port printing.
AppleTalk: Declutter appletalk.h.
#include "netdissect-stdinc.h"
+#define ND_LONGJMP_FROM_TCHECK
#include "netdissect.h"
#include "addrtoname.h"
#include "extract.h"
{
ND_PRINT("truncated-sctp - %zu bytes missing!",
sizeof(struct sctpHeader) - sctpPacketLength);
- return;
+ goto invalid;
}
sctpPktHdr = (const struct sctpHeader*) bp;
ND_TCHECK_SIZE(sctpPktHdr);
if (chunkLengthRemaining < sizeof(*dataHdrPtr)) {
ND_PRINT("bogus chunk length %u]", chunkLength);
- return;
+ goto invalid;
}
dataHdrPtr=(const struct sctpDataPart*)bp;
payload_size = chunkLengthRemaining;
if (payload_size == 0) {
ND_PRINT("bogus chunk length %u]", chunkLength);
- return;
+ goto invalid;
}
if (isforces) {
if (chunkLengthRemaining < sizeof(*init)) {
ND_PRINT("bogus chunk length %u]", chunkLength);
- return;
+ goto invalid;
}
init=(const struct sctpInitiation*)bp;
ND_PRINT("[init tag: %u] ", GET_BE_U_4(init->initTag));
if (chunkLengthRemaining < sizeof(*init)) {
ND_PRINT("bogus chunk length %u]", chunkLength);
- return;
+ goto invalid;
}
init=(const struct sctpInitiation*)bp;
ND_PRINT("[init tag: %u] ", GET_BE_U_4(init->initTag));
if (chunkLengthRemaining < sizeof(*sack)) {
ND_PRINT("bogus chunk length %u]", chunkLength);
- return;
+ goto invalid;
}
sack=(const struct sctpSelectiveAck*)bp;
ND_PRINT("[cum ack %u] ", GET_BE_U_4(sack->highestConseqTSN));
bp += sizeof(*frag), sctpPacketLengthRemaining -= sizeof(*frag), chunkLengthRemaining -= sizeof(*frag), fragNo++) {
if (chunkLengthRemaining < sizeof(*frag)) {
ND_PRINT("bogus chunk length %u]", chunkLength);
- return;
+ goto invalid;
}
frag = (const struct sctpSelectiveFrag *)bp;
ND_PRINT("\n\t\t[gap ack block #%u: start = %u, end = %u] ",
bp += 4, sctpPacketLengthRemaining -= 4, chunkLengthRemaining -= 4, tsnNo++) {
if (chunkLengthRemaining < 4) {
ND_PRINT("bogus chunk length %u]", chunkLength);
- return;
+ goto invalid;
}
dupTSN = (const u_char *)bp;
ND_PRINT("\n\t\t[dup TSN #%u: %u] ", tsnNo+1,
}
}
return;
-
-trunc:
- nd_print_trunc(ndo);
+invalid:
+ nd_print_invalid(ndo);
}