From: Francois-Xavier Le Bail Date: Wed, 6 Jun 2018 13:00:10 +0000 (+0200) Subject: Add more nd_print_trunc() calls X-Git-Tag: tcpdump-4.99-bp~1137 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/4dee61760d291060f08e68eed2e7a1b98ce7e4a4 Add more nd_print_trunc() calls Update the output of some tests accordingly. --- diff --git a/print-arcnet.c b/print-arcnet.c index 18d90aa9..b5831c23 100644 --- a/print-arcnet.c +++ b/print-arcnet.c @@ -192,7 +192,7 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch ndo->ndo_protocol = "arcnet_if"; if (caplen < ARC_HDRLEN || length < ARC_HDRLEN) { - ND_PRINT("[|arcnet]"); + nd_print_trunc(ndo); return (caplen); } @@ -280,7 +280,7 @@ arcnet_linux_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, cons ndo->ndo_protocol = "arcnet_linux_if"; if (caplen < ARC_LINUX_HDRLEN || length < ARC_LINUX_HDRLEN) { - ND_PRINT("[|arcnet]"); + nd_print_trunc(ndo); return (caplen); } @@ -291,7 +291,7 @@ arcnet_linux_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, cons default: archdrlen = ARC_LINUX_HDRNEWLEN; if (caplen < ARC_LINUX_HDRNEWLEN || length < ARC_LINUX_HDRNEWLEN) { - ND_PRINT("[|arcnet]"); + nd_print_trunc(ndo); return (caplen); } break; diff --git a/print-atalk.c b/print-atalk.c index 278495f8..a40efe2a 100644 --- a/print-atalk.c +++ b/print-atalk.c @@ -106,7 +106,7 @@ llap_print(netdissect_options *ndo, return (length); } if (!ND_TTEST_LEN(bp, sizeof(*lp))) { - ND_PRINT(" [|llap]"); + nd_print_trunc(ndo); return (0); /* cut short by the snapshot length */ } lp = (const struct LAP *)bp; @@ -221,7 +221,7 @@ aarp_print(netdissect_options *ndo, ap = (const struct aarp *)bp; if (!ND_TTEST_SIZE(ap)) { /* Just bail if we don't have the whole chunk. */ - ND_PRINT(" [|aarp]"); + nd_print_trunc(ndo); return; } if (length < sizeof(*ap)) { diff --git a/print-ether.c b/print-ether.c index aed2bea8..373103dc 100644 --- a/print-ether.c +++ b/print-ether.c @@ -159,11 +159,11 @@ ether_print(netdissect_options *ndo, ndo->ndo_protocol = "ether"; if (caplen < ETHER_HDRLEN) { - ND_PRINT("[|ether]"); + nd_print_trunc(ndo); return (caplen); } if (length < ETHER_HDRLEN) { - ND_PRINT("[|ether]"); + nd_print_trunc(ndo); return (length); } @@ -297,7 +297,7 @@ netanalyzer_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, */ ndo->ndo_protocol = "netanalyzer_if"; if (h->len < 4 || h->caplen < 4) { - ND_PRINT("[|netanalyzer]"); + nd_print_trunc(ndo); return (h->caplen); } @@ -326,7 +326,7 @@ netanalyzer_transparent_if_print(netdissect_options *ndo, */ ndo->ndo_protocol = "netanalyzer_transparent_if"; if (h->len < 12 || h->caplen < 12) { - ND_PRINT("[|netanalyzer-transparent]"); + nd_print_trunc(ndo); return (h->caplen); } diff --git a/print-isakmp.c b/print-isakmp.c index 40eabe26..8c3c0806 100644 --- a/print-isakmp.c +++ b/print-isakmp.c @@ -2752,7 +2752,7 @@ ike_sub0_print(netdissect_options *ndo, return cp; trunc: - ND_PRINT(" [|isakmp]"); + nd_print_trunc(ndo); return NULL; } @@ -2920,7 +2920,7 @@ ikev2_sub0_print(netdissect_options *ndo, const struct isakmp *base, return cp; trunc: - ND_PRINT(" [|isakmp]"); + nd_print_trunc(ndo); return NULL; } @@ -3045,7 +3045,7 @@ isakmp_print(netdissect_options *ndo, ep = ndo->ndo_snapend; if ((const struct isakmp *)ep < p + 1) { - ND_PRINT("[|isakmp]"); + nd_print_trunc(ndo); return; } @@ -3130,6 +3130,6 @@ isakmp_rfc3948_print(netdissect_options *ndo, } trunc: - ND_PRINT("[|isakmp]"); + nd_print_trunc(ndo); return; } diff --git a/print-ppp.c b/print-ppp.c index eb016ae3..86581ce0 100644 --- a/print-ppp.c +++ b/print-ppp.c @@ -1469,7 +1469,7 @@ cleanup: trunc: ndo->ndo_snapend = se; - ND_PRINT("[|ppp]"); + nd_print_trunc(ndo); } @@ -1602,7 +1602,7 @@ ppp_print(netdissect_options *ndo, handle_ppp(ndo, proto, p, length); return (hdr_len); trunc: - ND_PRINT("[|ppp]"); + nd_print_trunc(ndo); return (0); } @@ -1617,7 +1617,7 @@ ppp_if_print(netdissect_options *ndo, ndo->ndo_protocol = "ppp_if"; if (caplen < PPP_HDRLEN) { - ND_PRINT("[|ppp]"); + nd_print_trunc(ndo); return (caplen); } @@ -1688,7 +1688,7 @@ ppp_hdlc_if_print(netdissect_options *ndo, ndo->ndo_protocol = "ppp_hdlc_if"; if (caplen < 2) { - ND_PRINT("[|ppp]"); + nd_print_trunc(ndo); return (caplen); } @@ -1696,7 +1696,7 @@ ppp_hdlc_if_print(netdissect_options *ndo, case PPP_ADDRESS: if (caplen < 4 || length < 4) { - ND_PRINT("[|ppp]"); + nd_print_trunc(ndo); return (caplen); } @@ -1722,7 +1722,7 @@ ppp_hdlc_if_print(netdissect_options *ndo, default: if (caplen < 4) { - ND_PRINT("[|ppp]"); + nd_print_trunc(ndo); return (caplen); } @@ -1763,7 +1763,7 @@ ppp_bsdos_if_print(netdissect_options *ndo _U_, ndo->ndo_protocol = "ppp_bsdos_if"; if (caplen < PPP_BSDI_HDRLEN) { - ND_PRINT("[|ppp]"); + nd_print_trunc(ndo); return (caplen); } diff --git a/print-sll.c b/print-sll.c index 0e570bf6..571b7c5e 100644 --- a/print-sll.c +++ b/print-sll.c @@ -208,7 +208,7 @@ sll_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char * adds this many bytes of header to every packet in a * cooked socket capture. */ - ND_PRINT("[|sll]"); + nd_print_trunc(ndo); return (caplen); } diff --git a/tests/heapoverflow-ppp_hdlc_if_print.out b/tests/heapoverflow-ppp_hdlc_if_print.out index 39cef422..f54b30e5 100644 --- a/tests/heapoverflow-ppp_hdlc_if_print.out +++ b/tests/heapoverflow-ppp_hdlc_if_print.out @@ -1 +1 @@ -[|ppp] + [|ppp_hdlc_if] diff --git a/tests/isakmp-3948-oobr-2.out b/tests/isakmp-3948-oobr-2.out index cad5686c..96166825 100644 --- a/tests/isakmp-3948-oobr-2.out +++ b/tests/isakmp-3948-oobr-2.out @@ -1 +1 @@ -IP 48.48.48.48.4500 > 48.48.48.48.12336: [|isakmp] +IP 48.48.48.48.4500 > 48.48.48.48.12336: [|isakmp_rfc3948] diff --git a/tests/isakmp-rfc3948-oobr.out b/tests/isakmp-rfc3948-oobr.out index c43c9359..6360c01e 100644 --- a/tests/isakmp-rfc3948-oobr.out +++ b/tests/isakmp-rfc3948-oobr.out @@ -64,4 +64,4 @@ 30:30:30:30:30:30 > 30:30:30:30:30:30, ethertype Unknown (0x3030), length 262144: 0x0000: 3030 3030 3030 3030 3030 3030 3030 3030 0000000000000000 0x0010: 3030 3030 3030 3030 3030 3030 000000000000 -IP 48.48.48.48.4500 > 48.48.48.48.12336: [|isakmp] +IP 48.48.48.48.4500 > 48.48.48.48.12336: [|isakmp_rfc3948] diff --git a/tests/l2tp-avp-overflow.out b/tests/l2tp-avp-overflow.out index 8fde020c..a836b28f 100644 --- a/tests/l2tp-avp-overflow.out +++ b/tests/l2tp-avp-overflow.out @@ -10,7 +10,7 @@ IP (tos 0x30, ttl 48, id 12331, offset 0, flags [none], proto UDP (17), length 1 127.0.0.229.12416 > 127.236.0.1.1701: l2tp:[TL](560/2056) ACCM(AVP too short) [|l2tp] IP (tos 0x30, ttl 48, id 12336, offset 0, flags [none], proto UDP (17), length 12336, bad cksum 1f51 (->ab5d)!) 127.0.0.0.0 > 0.0.0.0.2048: UDP, bad length 17704 > 12308 -[|ether] + [|ether] IP (tos 0x30, ttl 48, id 12336, offset 0, flags [none], proto UDP (17), length 12336, bad cksum 1f51 (->2a8b)!) 127.0.0.229.12416 > 127.236.0.1.1701: l2tp:[TL](560/2056) AVP-#48() [|l2tp] IP (tos 0x30, ttl 48, id 12331, offset 0, flags [none], proto UDP (17), length 8752, bad cksum 1f51 (->3890)!) @@ -21,7 +21,7 @@ IP (tos 0x30, ttl 48, id 12331, offset 0, flags [none], proto UDP (17), length 1 127.0.0.229.12416 > 127.236.0.1.1701: l2tp:[TL](560/2056) ACCM(AVP too short) [|l2tp] IP (tos 0x30, ttl 48, id 12336, offset 0, flags [none], proto UDP (17), length 12336, bad cksum 1f51 (->ab5d)!) 127.0.0.0.0 > 0.0.0.0.2048: UDP, bad length 17704 > 12308 -[|ether] + [|ether] IP (tos 0x30, ttl 48, id 12336, offset 0, flags [none], proto UDP (17), length 12336, bad cksum 1f51 (->2a8b)!) 127.0.0.229.12416 > 127.236.0.1.1701: l2tp:[TL](560/2056) AVP-#48() [|l2tp] IP (tos 0x30, ttl 48, id 12331, offset 0, flags [none], proto UDP (17), length 8752, bad cksum 1f51 (->3890)!) diff --git a/tests/otv-heapoverflow-2.out b/tests/otv-heapoverflow-2.out index 7ea809f6..ab1f7822 100644 --- a/tests/otv-heapoverflow-2.out +++ b/tests/otv-heapoverflow-2.out @@ -8,4 +8,4 @@ IP 192.168.0.18.47808 > 192.168.0.255.47808: UDP, length 24 IP 192.168.0.24.40896 > 192.168.0.134.47808: UDP, length 30 IP 192.168.0.24.47808 > 192.168.0.255.47808: UDP, length 20 IP 192.168.0.9.37123 > 97.34.1.224.8472: OTV, flags [I] (0x9d), overlay 12124160, instance 4587520 -[|ether] + [|ether] diff --git a/tests/pktap-heap-overflow.out b/tests/pktap-heap-overflow.out index 8cd05caa..d116fcad 100644 --- a/tests/pktap-heap-overflow.out +++ b/tests/pktap-heap-overflow.out @@ -1,2 +1,2 @@ [|pktap_if] -[|ppp] + [|ppp_hdlc_if]