some patches to deal with kday pcap files

Author:    Michael Richardson <mcr@sandelman.ca>
This commit is contained in:
Michael Richardson 2015-02-16 14:49:11 -05:00 committed by Guy Harris
parent 1d1e1d9196
commit 364b00185b
10 changed files with 26 additions and 2 deletions

View File

@ -2309,6 +2309,10 @@ isis_print(netdissect_options *ndo,
length=pdu_len;
}
if(length > ndo->ndo_snaplen) {
goto trunc;
}
ND_TCHECK(*header_lsp);
ND_PRINT((ndo, "\n\t lsp-id: %s, seq: 0x%08x, lifetime: %5us\n\t chksum: 0x%04x",
isis_print_id(header_lsp->lsp_id, LSP_ID_LEN),
@ -3082,14 +3086,19 @@ osi_print_cksum(netdissect_options *ndo,
uint16_t calculated_checksum;
/* do not attempt to verify the checksum if it is zero */
if (!checksum) {
if (!checksum || checksum_offset > length) {
ND_PRINT((ndo, "(unverified)"));
} else {
unsigned char *truncated = "trunc";
//printf("\nosi_print_cksum: %p %u %u %u\n", pptr, checksum_offset, length, ndo->ndo_snaplen);
//ND_TCHECK2(pptr, checksum_offset+length);
calculated_checksum = create_osi_cksum(pptr, checksum_offset, length);
if (checksum == calculated_checksum) {
ND_PRINT((ndo, " (correct)"));
} else {
ND_PRINT((ndo, " (incorrect should be 0x%04x)", calculated_checksum));
truncated = "incorrect";
//trunc:
ND_PRINT((ndo, " (%s should be 0x%04x)", truncated, calculated_checksum));
}
}
}

View File

@ -178,6 +178,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, u_int indent)
pdu_header = (rpki_rtr_pdu *)tptr;
pdu_type = pdu_header->pdu_type;
pdu_len = EXTRACT_32BITS(pdu_header->length);
ND_TCHECK2(tptr, pdu_len);
hexdump = FALSE;
ND_PRINT((ndo, "%sRPKI-RTRv%u, %s PDU (%u), length: %u",
@ -286,6 +287,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, u_int indent)
tptr += 4;
tlen -= 4;
}
printf("text_length: %u tlen %u\n", text_length, tlen);
if (text_length && (text_length <= tlen )) {
memcpy(buf, tptr, min(sizeof(buf)-1, text_length));
buf[text_length] = '\0';
@ -306,6 +308,11 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, u_int indent)
if (ndo->ndo_vflag > 1 || (ndo->ndo_vflag && hexdump)) {
print_unknown_data(ndo,tptr,"\n\t ", pdu_len);
}
return;
trunc:
ND_PRINT((ndo, "|trunc"));
return;
}
void

1
tests/kday1.out Normal file
View File

@ -0,0 +1 @@
EXIT CODE 00000100

1
tests/kday2.out Normal file
View File

@ -0,0 +1 @@
EXIT CODE 00000100

1
tests/kday3.out Normal file
View File

@ -0,0 +1 @@
EXIT CODE 00000100

1
tests/kday4.out Normal file
View File

@ -0,0 +1 @@
EXIT CODE 00000100

1
tests/kday5.out Normal file
View File

@ -0,0 +1 @@
EXIT CODE 00000100

1
tests/kday6.out Normal file
View File

@ -0,0 +1 @@
EXIT CODE 00000100

1
tests/kday7.out Normal file
View File

@ -0,0 +1 @@
EXIT CODE 00000100

1
tests/kday8.out Normal file
View File

@ -0,0 +1 @@
EXIT CODE 00000100