summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Richardson <mcr@sandelman.ca>2015-04-22 16:34:26 -0400
committerMichael Richardson <mcr@sandelman.ca>2015-04-22 16:34:26 -0400
commit7211dddf95010ff70bf1b2d27505104b8a1767b3 (patch)
tree1bcce0a2e9fef8cd8f36efbe3b8800fcc7b47542
parent4f824b276e19375dfd63168542ccefa0eb6b1453 (diff)
parent8f0170452f5ebc2aae97544f296e8984e942a5cb (diff)
downloadtcpdump-4.7.4.tar.gz
Merge remote-tracking branch 'bpf/tcpdump-4.7' into tcpdump-4.7tcpdump-4.7.4tcpdump-1.7.4
-rw-r--r--CHANGES10
-rw-r--r--VERSION2
-rw-r--r--netdissect.h7
-rw-r--r--print-isoclns.c10
-rw-r--r--print-rpki-rtr.c13
-rw-r--r--print-wb.c6
-rw-r--r--tcpdump.c3
-rw-r--r--tests/kday2.out9
-rw-r--r--tests/kday3.out25
-rw-r--r--tests/kday4.out38
-rw-r--r--tests/kday5.out10
-rw-r--r--tests/kday7.out37
-rw-r--r--tests/kday8.out9
-rw-r--r--util.c20
14 files changed, 155 insertions, 44 deletions
diff --git a/CHANGES b/CHANGES
index 2dbcfa9a..38769f2c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,8 +1,14 @@
-Monday March. 11, 2015 guy@alum.mit.edu
+Friday April 10, 2015 guy@alum.mit.edu
+ Summary for 4.7.4 tcpdump release
+ RPKI to Router Protocol: Fix Segmentation Faults and other problems
+ RPKI to Router Protocol: print strings with fn_printn()
+ wb: fix some bounds checks
+
+Wednesday March 11, 2015 mcr@sandelman.ca
Summary for 4.7.3 tcpdump release
Capsicum fixes for FreeBSD 10
-Monday March. 10, 2015 guy@alum.mit.edu
+Tuesday March 10, 2015 mcr@sandelman.ca
Summary for 4.7.2 tcpdump release
DCCP: update Packet Types with RFC4340/IANA names
fixes for CVE-2015-0261: IPv6 mobility header check issue
diff --git a/VERSION b/VERSION
index 87b18a56..b48b2de9 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.7.3
+4.7.4
diff --git a/netdissect.h b/netdissect.h
index 818f8eca..d507f580 100644
--- a/netdissect.h
+++ b/netdissect.h
@@ -81,9 +81,9 @@ extern const char *tok2strbuf(const struct tok *, const char *, u_int,
char *buf, size_t bufsize);
/* tok2str is deprecated */
-extern const char *tok2str(const struct tok *, const char *, int);
-extern char *bittok2str(const struct tok *, const char *, int);
-extern char *bittok2str_nosep(const struct tok *, const char *, int);
+extern const char *tok2str(const struct tok *, const char *, u_int);
+extern char *bittok2str(const struct tok *, const char *, u_int);
+extern char *bittok2str_nosep(const struct tok *, const char *, u_int);
typedef struct netdissect_options netdissect_options;
@@ -293,7 +293,6 @@ extern void relts_print(netdissect_options *, int);
extern int fn_print(netdissect_options *, const u_char *, const u_char *);
extern int fn_printn(netdissect_options *, const u_char *, u_int, const u_char *);
extern int fn_printzp(netdissect_options *, const u_char *, u_int, const u_char *);
-extern const char *tok2str(const struct tok *, const char *, int);
/*
* Flags for txtproto_print().
diff --git a/print-isoclns.c b/print-isoclns.c
index d3a64d49..f8de7bce 100644
--- a/print-isoclns.c
+++ b/print-isoclns.c
@@ -3093,14 +3093,18 @@ osi_print_cksum(netdissect_options *ndo,
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);
+#if 0
+ printf("\nosi_print_cksum: %p %u %u %u\n", pptr, checksum_offset, length, ndo->ndo_snaplen);
+ ND_TCHECK2(pptr, checksum_offset+length);
+#endif
calculated_checksum = create_osi_cksum(pptr, checksum_offset, length);
if (checksum == calculated_checksum) {
ND_PRINT((ndo, " (correct)"));
} else {
truncated = "incorrect";
- //trunc:
+#if 0
+ trunc:
+#endif
ND_PRINT((ndo, " (%s should be 0x%04x)", truncated, calculated_checksum));
}
}
diff --git a/print-rpki-rtr.c b/print-rpki-rtr.c
index da55dd36..34e2057b 100644
--- a/print-rpki-rtr.c
+++ b/print-rpki-rtr.c
@@ -178,7 +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);
+ ND_TCHECK2(*tptr, pdu_len);
hexdump = FALSE;
ND_PRINT((ndo, "%sRPKI-RTRv%u, %s PDU (%u), length: %u",
@@ -251,10 +251,10 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, u_int indent)
{
rpki_rtr_pdu_error_report *pdu;
u_int encapsulated_pdu_length, text_length, tlen, error_code;
- u_char buf[80];
pdu = (rpki_rtr_pdu_error_report *)tptr;
encapsulated_pdu_length = EXTRACT_32BITS(pdu->encapsulated_pdu_length);
+ ND_TCHECK2(*tptr, encapsulated_pdu_length);
tlen = pdu_len;
error_code = EXTRACT_16BITS(pdu->pdu_header.u.error_code);
@@ -287,11 +287,10 @@ 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);
+ ND_TCHECK2(*tptr, text_length);
if (text_length && (text_length <= tlen )) {
- memcpy(buf, tptr, min(sizeof(buf)-1, text_length));
- buf[text_length] = '\0';
- ND_PRINT((ndo, "%sError text: %s", indent_string(indent+2), buf));
+ ND_PRINT((ndo, "%sError text: ", indent_string(indent+2)));
+ fn_printn(ndo, tptr, text_length, ndo->ndo_snapend);
}
}
break;
@@ -337,13 +336,13 @@ rpki_rtr_print(netdissect_options *ndo, register const u_char *pptr, register u_
pdu_header = (rpki_rtr_pdu *)tptr;
pdu_type = pdu_header->pdu_type;
pdu_len = EXTRACT_32BITS(pdu_header->length);
+ ND_TCHECK2(*tptr, pdu_len);
/* infinite loop check */
if (!pdu_type || !pdu_len) {
break;
}
- ND_TCHECK2(*tptr, pdu_len);
if (tlen < pdu_len) {
goto trunc;
}
diff --git a/print-wb.c b/print-wb.c
index 38c2a672..e10d5328 100644
--- a/print-wb.c
+++ b/print-wb.c
@@ -202,7 +202,7 @@ wb_id(netdissect_options *ndo,
len -= sizeof(*io) * nid;
io = (struct id_off *)(id + 1);
cp = (char *)(io + nid);
- if (!ND_TTEST2(cp, len)) {
+ if (ND_TTEST2(cp, len)) {
ND_PRINT((ndo, "\""));
fn_print(ndo, (u_char *)cp, (u_char *)cp + len);
ND_PRINT((ndo, "\""));
@@ -267,7 +267,7 @@ wb_prep(netdissect_options *ndo,
}
n = EXTRACT_32BITS(&prep->pp_n);
ps = (const struct pgstate *)(prep + 1);
- while (--n >= 0 && !ND_TTEST(*ps)) {
+ while (--n >= 0 && ND_TTEST(*ps)) {
const struct id_off *io, *ie;
char c = '<';
@@ -276,7 +276,7 @@ wb_prep(netdissect_options *ndo,
ipaddr_string(ndo, &ps->page.p_sid),
EXTRACT_32BITS(&ps->page.p_uid)));
io = (struct id_off *)(ps + 1);
- for (ie = io + ps->nid; io < ie && !ND_TTEST(*io); ++io) {
+ for (ie = io + ps->nid; io < ie && ND_TTEST(*io); ++io) {
ND_PRINT((ndo, "%c%s:%u", c, ipaddr_string(ndo, &io->id),
EXTRACT_32BITS(&io->off)));
c = ',';
diff --git a/tcpdump.c b/tcpdump.c
index 2fd16177..2b71d27d 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -2220,9 +2220,6 @@ static void
dump_packet_and_trunc(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
{
struct dump_info *dump_info;
-#ifdef HAVE_CAPSICUM
- cap_rights_t rights;
-#endif
++packets_captured;
diff --git a/tests/kday2.out b/tests/kday2.out
index cf5e34ab..770fc3b7 100644
--- a/tests/kday2.out
+++ b/tests/kday2.out
@@ -22,6 +22,13 @@ IP (tos 0x10, ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), length 52,
IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3e8c (->438c)!)
204.9.64.80.55936 > 204.9.40.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x7767), ack 3587398274, win 1040, options [nop,nop,TS val 647770294 ecr 2364779354], length 0
IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
- 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0x8900), seq 3589495407:3589495754, ack 370428050, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347|trunc|trunc
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0x8900), seq 3589495407:3589495754, ack 370428050, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347
+ RPKI-RTRv177, Unknown PDU (100), length: 60
+ 0x0000: b164 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 61f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 21
+ Error code: Unknown (66), Encapsulated PDU length: 37|trunc
[|RPKI-RTR]
EXIT CODE 00000100
diff --git a/tests/kday3.out b/tests/kday3.out
index 85bb54e4..f6fd7284 100644
--- a/tests/kday3.out
+++ b/tests/kday3.out
@@ -7,7 +7,17 @@ IP (tos 0x10, ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), length 52,
IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3e8c (->438c)!)
204.9.64.80.55936 > 204.9.40.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x7767), ack 3587398274, win 1040, options [nop,nop,TS val 647770294 ecr 2364779354], length 0
IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
- 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0x0cf1), seq 3589495407:3589495754, ack 370428050, win 1040, options [nop,nop,TS val 2381534627 ecr 3084508609], length 347|trunc|trunc|trunc
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0x0cf1), seq 3589495407:3589495754, ack 370428050, win 1040, options [nop,nop,TS val 2381534627 ecr 3084508609], length 347
+ RPKI-RTRv177, Unknown PDU (100), length: 60
+ 0x0000: b164 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 61f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66|trunc
+ RPKI-RTRv115, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 12
+ -----encapsulated PDU-----|trunc|trunc
+ [|RPKI-RTR]
IP (tos 0x10, ttl 62, id 64806, offset 0, flags [DF], proto TCP (6), length 52)
204.9.51.132.50079 > 204.9.54.80.22: Flags [.], cksum 0x8611 (incorrect -> 0xa678), ack 0, win 4094, options [nop,nop,TS val 941371775 ecr 4294967242], length 0
IP (tos 0x10, ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 4504 (->451a)!)
@@ -15,6 +25,17 @@ IP (tos 0x10, ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), length 52,
IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3e8c (->438c)!)
204.9.64.80.55936 > 204.9.40.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x8d67), ack 1, win 1040, options [nop,nop,TS val 647770294 ecr 2364773722], length 0
IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
- 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0xa6b3), seq 0:347, ack 1, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347|trunc|trunc|trunc
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0xa6b3), seq 0:347, ack 1, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347
+ RPKI-RTRv177, Unknown PDU (100), length: 60
+ 0x0000: b164 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 61f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 37
+ -----encapsulated PDU-----|trunc|trunc
+ RPKI-RTRv9, Unknown PDU (51), length: 32
+ 0x0000: 0933 84cc 0000 0020 9f00 1649 d1c8 546c
+ 0x0010: ff13 1980 100f fc85 8b00 0055 0000 0101
[|RPKI-RTR]
EXIT CODE 00000100
diff --git a/tests/kday4.out b/tests/kday4.out
index ee3228e3..95b29cc3 100644
--- a/tests/kday4.out
+++ b/tests/kday4.out
@@ -6,7 +6,18 @@ IP (tos 0x10, ttl 62, id 64806, offset 0, flags [DF], proto TCP (6), length 52,
IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52)
204.9.54.80.55936 > 204.9.55.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x725a), ack 3589495407, win 1040, options [nop,nop,TS val 647770294 ecr 2364779354], length 0
IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
- 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0xcd5f), seq 3589495407:3589495754, ack 370436242, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347|trunc|trunc|trunc
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0xcd5f), seq 3589495407:3589495754, ack 370436242, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347
+ RPKI-RTRv177, Unknown PDU (100), length: 60
+ 0x0000: b164 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 58f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 37
+ -----encapsulated PDU-----|trunc|trunc
+ RPKI-RTRv115, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 12
+ -----encapsulated PDU-----|trunc|trunc
[|RPKI-RTR]
IP (tos 0x10, ttl 62, id 64806, offset 0, flags [DF], proto TCP (6), length 52)
204.9.51.132.50079 > 204.9.54.80.22: Flags [.], cksum 0x8611 (incorrect -> 0xa678), ack 1819218606, win 4094, options [nop,nop,TS val 941371775 ecr 4294967242], length 0
@@ -15,7 +26,19 @@ IP (tos 0x10, ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), length 52,
IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3e8c (->438c)!)
204.9.64.80.55936 > 204.9.40.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x8d67), ack 3587398274, win 1040, options [nop,nop,TS val 647770294 ecr 2364773722], length 0
IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
- 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0xfa70), seq 0:347, ack 4294959105, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347|trunc|trunc|trunc
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0xfa70), seq 0:347, ack 4294959105, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347
+ RPKI-RTRv197, Unknown PDU (100), length: 60
+ 0x0000: c564 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 61f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 37
+ -----encapsulated PDU-----|trunc|trunc
+ RPKI-RTRv115, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 12
+ -----encapsulated PDU-----|trunc|trunc
+ [|RPKI-RTR]
IP truncated-ip - 768 bytes missing! (tos 0x10, ttl 62, id 64806, offset 0, flags [DF], proto TCP (6), length 820, bad cksum 3da6 (->3aa6)!)
204.9.51.132.50079 > 204.9.54.80.22: Flags [.], seq 0:768, ack 1, win 4094, options [nop,nop,TS val 941371775 ecr 4294967242], length 768
IP (tos 0x6,ECT(0), ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 4504 (->4524)!)
@@ -23,6 +46,15 @@ IP (tos 0x6,ECT(0), ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), lengt
IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3e8c (->438c)!)
204.9.64.80.55936 > 204.9.40.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x8d67), ack 1, win 1040, options [nop,nop,TS val 647770294 ecr 2364773722], length 0
IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
- 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0x3f28), seq 0:347, ack 4294959105, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347|trunc|trunc|trunc
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0x3f28), seq 0:347, ack 4294959105, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347
+ RPKI-RTRv177, Unknown PDU (100), length: 60
+ 0x0000: b164 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 61f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 100
+ Error text: ^@^@^@M-^?M-^?^_^[pM-xWM-nhMM-}M_M-YM-=M-G^I0M-,M-^AvM-3mM-L^Q:M-?^RM-^QM-q^FNM-^aM-tbM-^WM-/M-D9M-$^MM-9zM-%hs3M-hA^J^@B^@^@^@B^@^@^@%M-Dz^HM-i^RM-^DM-5M-^\M->0H^H^@E^P^@4M-}&@^@>^F
+ RPKI-RTRv115, Error Report PDU (10), length: 66|trunc
[|RPKI-RTR]
EXIT CODE 00000100
diff --git a/tests/kday5.out b/tests/kday5.out
index 9f0fb80b..7aeae727 100644
--- a/tests/kday5.out
+++ b/tests/kday5.out
@@ -22,6 +22,14 @@ IP (tos 0x10, ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), length 52,
IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3e8c (->438c)!)
204.9.64.80.55936 > 204.9.40.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x7767), ack 3587398274, win 1040, options [nop,nop,TS val 647770294 ecr 2364779354], length 0
IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
- 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0x183a), seq 3589495407:3589495754, ack 370428050, win 1040, options [nop,nop,TS val 2351322531 ecr 3084508609], length 347|trunc|trunc
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0x183a), seq 3589495407:3589495754, ack 370428050, win 1040, options [nop,nop,TS val 2351322531 ecr 3084508609], length 347
+ RPKI-RTRv177, Unknown PDU (100), length: 60
+ 0x0000: b164 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 61f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 80
+ Error text: M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-CM-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^V^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J
[|RPKI-RTR]
EXIT CODE 00000100
diff --git a/tests/kday7.out b/tests/kday7.out
index 79b70a6d..94e8b651 100644
--- a/tests/kday7.out
+++ b/tests/kday7.out
@@ -6,7 +6,18 @@ IP (tos 0x10, ttl 62, id 64806, offset 0, flags [DF], proto TCP (6), length 52,
IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52)
204.9.54.80.55936 > 204.9.55.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x725a), ack 3589495407, win 1040, options [nop,nop,TS val 647770294 ecr 2364779354], length 0
IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
- 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0xcd5f), seq 3589495407:3589495754, ack 370436242, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347|trunc|trunc|trunc
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0xcd5f), seq 3589495407:3589495754, ack 370436242, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347
+ RPKI-RTRv177, Unknown PDU (100), length: 60
+ 0x0000: b164 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 58f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 37
+ -----encapsulated PDU-----|trunc|trunc
+ RPKI-RTRv115, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 12
+ -----encapsulated PDU-----|trunc|trunc
[|RPKI-RTR]
IP (tos 0x10, ttl 62, id 64806, offset 0, flags [DF], proto TCP (6), length 52)
204.9.51.132.50079 > 204.9.54.80.22: Flags [.], cksum 0x8611 (incorrect -> 0xa678), ack 1819218606, win 4094, options [nop,nop,TS val 941371775 ecr 4294967242], length 0
@@ -15,7 +26,19 @@ IP (tos 0x10, ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), length 52,
IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3e8c (->438c)!)
204.9.64.80.55936 > 204.9.40.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x8d67), ack 3587398274, win 1040, options [nop,nop,TS val 647770294 ecr 2364773722], length 0
IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
- 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0xfa86), seq 0:347, ack 4294959105, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347|trunc|trunc|trunc
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0xfa86), seq 0:347, ack 4294959105, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347
+ RPKI-RTRv197, Unknown PDU (100), length: 60
+ 0x0000: c564 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 61f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 37
+ -----encapsulated PDU-----|trunc|trunc
+ RPKI-RTRv115, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 12
+ -----encapsulated PDU-----|trunc|trunc
+ [|RPKI-RTR]
IP truncated-ip - 768 bytes missing! (tos 0x10, ttl 62, id 64806, offset 0, flags [DF], proto TCP (6), length 820, bad cksum 3da6 (->3aa6)!)
204.9.51.132.50079 > 204.9.54.80.22: Flags [.], seq 0:768, ack 1, win 4094, options [nop,nop,TS val 941371775 ecr 4294967242], length 768
IP (tos 0x6,ECT(0), ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 4504 (->4524)!)
@@ -23,6 +46,14 @@ IP (tos 0x6,ECT(0), ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), lengt
IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3e8c (->438c)!)
204.9.64.80.55936 > 204.9.40.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x8d67), ack 1, win 1040, options [nop,nop,TS val 647770294 ecr 2364773722], length 0
IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
- 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0x4ba9), seq 0:347, ack 4294959105, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347|trunc|trunc|trunc
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0x4ba9), seq 0:347, ack 4294959105, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347
+ RPKI-RTRv177, Unknown PDU (100), length: 60
+ 0x0000: b164 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 61f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 100|trunc
+ RPKI-RTRv115, Error Report PDU (10), length: 66|trunc
[|RPKI-RTR]
EXIT CODE 00000100
diff --git a/tests/kday8.out b/tests/kday8.out
index fa84bf3b..2d84b724 100644
--- a/tests/kday8.out
+++ b/tests/kday8.out
@@ -22,6 +22,13 @@ IP (tos 0x10, ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), length 52,
IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3e8c (->438c)!)
204.9.64.80.55936 > 204.9.40.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x7767), ack 3587398274, win 1040, options [nop,nop,TS val 647770294 ecr 2364779354], length 0
IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
- 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0xed9b), seq 3589495407:3589495754, ack 370428050, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347|trunc|trunc
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0xed9b), seq 3589495407:3589495754, ack 370428050, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347
+ RPKI-RTRv177, Unknown PDU (100), length: 60
+ 0x0000: b164 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 61f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 80|trunc
[|RPKI-RTR]
EXIT CODE 00000100
diff --git a/util.c b/util.c
index 5569021c..b37f3d81 100644
--- a/util.c
+++ b/util.c
@@ -337,7 +337,7 @@ tok2strbuf(register const struct tok *lp, register const char *fmt,
*/
const char *
tok2str(register const struct tok *lp, register const char *fmt,
- register int v)
+ register u_int v)
{
static char buf[4][128];
static int idx = 0;
@@ -355,12 +355,12 @@ tok2str(register const struct tok *lp, register const char *fmt,
*/
static char *
bittok2str_internal(register const struct tok *lp, register const char *fmt,
- register int v, register int sep)
+ register u_int v, const char *sep)
{
static char buf[256]; /* our stringbuffer */
int buflen=0;
- register int rotbit; /* this is the bit we rotate through all bitpositions */
- register int tokval;
+ register u_int rotbit; /* this is the bit we rotate through all bitpositions */
+ register u_int tokval;
const char * sepstr = "";
while (lp != NULL && lp->s != NULL) {
@@ -375,7 +375,7 @@ bittok2str_internal(register const struct tok *lp, register const char *fmt,
/* ok we have found something */
buflen+=snprintf(buf+buflen, sizeof(buf)-buflen, "%s%s",
sepstr, lp->s);
- sepstr = sep ? ", " : "";
+ sepstr = sep;
break;
}
rotbit=rotbit<<1; /* no match - lets shift and try again */
@@ -385,7 +385,7 @@ bittok2str_internal(register const struct tok *lp, register const char *fmt,
if (buflen == 0)
/* bummer - lets print the "unknown" message as advised in the fmt string if we got one */
- (void)snprintf(buf, sizeof(buf), fmt == NULL ? "#%d" : fmt, v);
+ (void)snprintf(buf, sizeof(buf), fmt == NULL ? "#%08x" : fmt, v);
return (buf);
}
@@ -395,9 +395,9 @@ bittok2str_internal(register const struct tok *lp, register const char *fmt,
*/
char *
bittok2str_nosep(register const struct tok *lp, register const char *fmt,
- register int v)
+ register u_int v)
{
- return (bittok2str_internal(lp, fmt, v, 0));
+ return (bittok2str_internal(lp, fmt, v, ""));
}
/*
@@ -406,9 +406,9 @@ bittok2str_nosep(register const struct tok *lp, register const char *fmt,
*/
char *
bittok2str(register const struct tok *lp, register const char *fmt,
- register int v)
+ register u_int v)
{
- return (bittok2str_internal(lp, fmt, v, 1));
+ return (bittok2str_internal(lp, fmt, v, ", "));
}
/*