]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Remove some useless tests
authorFrancois-Xavier Le Bail <[email protected]>
Fri, 14 Sep 2018 15:34:47 +0000 (17:34 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Fri, 14 Sep 2018 16:04:38 +0000 (18:04 +0200)
Because packet length (length) >= capture length (caplen).

(see the sanity checks in print.c, pretty_print_packet() function)

print-arcnet.c
print-atm.c
print-bt.c
print-nflog.c
print-pktap.c
print-ppp.c
print-sl.c

index b5831c237579bf0f021d0c4e69cf05ba4a912af9..adc846ff46b22ae92fc628ac394915051a014c02 100644 (file)
@@ -191,7 +191,7 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch
        u_char arc_type;
 
        ndo->ndo_protocol = "arcnet_if";
-       if (caplen < ARC_HDRLEN || length < ARC_HDRLEN) {
+       if (caplen < ARC_HDRLEN) {
                nd_print_trunc(ndo);
                return (caplen);
        }
@@ -212,7 +212,7 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch
        }
 
        if (phds) {
-               if (caplen < ARC_HDRNEWLEN || length < ARC_HDRNEWLEN) {
+               if (caplen < ARC_HDRNEWLEN) {
                        arcnet_print(ndo, p, length, 0, 0, 0);
                        ND_PRINT("[|phds]");
                        return (caplen);
@@ -220,7 +220,7 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch
 
                flag = EXTRACT_U_1(ap->arc_flag);
                if (flag == 0xff) {
-                       if (caplen < ARC_HDRNEWLEN_EXC || length < ARC_HDRNEWLEN_EXC) {
+                       if (caplen < ARC_HDRNEWLEN_EXC) {
                                arcnet_print(ndo, p, length, 0, 0, 0);
                                ND_PRINT("[|phds extended]");
                                return (caplen);
@@ -279,7 +279,7 @@ arcnet_linux_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, cons
        u_char arc_type;
 
        ndo->ndo_protocol = "arcnet_linux_if";
-       if (caplen < ARC_LINUX_HDRLEN || length < ARC_LINUX_HDRLEN) {
+       if (caplen < ARC_LINUX_HDRLEN) {
                nd_print_trunc(ndo);
                return (caplen);
        }
@@ -290,7 +290,7 @@ arcnet_linux_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, cons
        switch (arc_type) {
        default:
                archdrlen = ARC_LINUX_HDRNEWLEN;
-               if (caplen < ARC_LINUX_HDRNEWLEN || length < ARC_LINUX_HDRNEWLEN) {
+               if (caplen < ARC_LINUX_HDRNEWLEN) {
                        nd_print_trunc(ndo);
                        return (caplen);
                }
index 06ecc0178a6ec628884f1366de4c7f5bea97a0cf..3bc135d7421992bb140ec2542ec7a92870bd7a45 100644 (file)
@@ -253,7 +253,7 @@ atm_if_print(netdissect_options *ndo,
        u_int hdrlen = 0;
 
        ndo->ndo_protocol = "atm_if";
-       if (caplen < 1 || length < 1) {
+       if (caplen < 1) {
                nd_print_trunc(ndo);
                return (caplen);
        }
@@ -270,7 +270,7 @@ atm_if_print(netdissect_options *ndo,
         * Must have at least a DSAP, an SSAP, and the first byte of the
         * control field.
         */
-       if (caplen < 3 || length < 3) {
+       if (caplen < 3) {
                nd_print_trunc(ndo);
                return (caplen);
        }
@@ -302,7 +302,7 @@ atm_if_print(netdissect_options *ndo,
                 * packets?  If so, could it be changed to use a
                 * new DLT_IEEE802_6 value if we added it?
                 */
-               if (caplen < 20 || length < 20) {
+               if (caplen < 20) {
                        nd_print_trunc(ndo);
                        return (caplen);
                }
index 411642b48ca792a53fe55df26012ad4b650e9b51..d380770cf3622a1e265278db03941250a81ddcee 100644 (file)
@@ -54,7 +54,7 @@ bt_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *
        const bluetooth_h4_header* hdr = (const bluetooth_h4_header*)p;
 
        ndo->ndo_protocol = "bt_if";
-       if (caplen < BT_HDRLEN || length < BT_HDRLEN)
+       if (caplen < BT_HDRLEN)
                goto trunc;
        caplen -= BT_HDRLEN;
        length -= BT_HDRLEN;
index 849b54d19a0d544d199a081089a8b7a06d0feaae..28929747562deca767a53e93ca5c0ddea53322af 100644 (file)
@@ -139,7 +139,7 @@ nflog_if_print(netdissect_options *ndo,
        u_int length = h->len;
 
        ndo->ndo_protocol = "nflog_if";
-       if (caplen < sizeof(nflog_hdr_t) || length < sizeof(nflog_hdr_t))
+       if (caplen < sizeof(nflog_hdr_t))
                goto trunc;
 
        ND_TCHECK_SIZE(hdr);
@@ -159,7 +159,7 @@ nflog_if_print(netdissect_options *ndo,
                const nflog_tlv_t *tlv;
 
                /* We have some data.  Do we have enough for the TLV header? */
-               if (caplen < sizeof(nflog_tlv_t) || length < sizeof(nflog_tlv_t))
+               if (caplen < sizeof(nflog_tlv_t))
                        goto trunc;     /* No. */
 
                tlv = (const nflog_tlv_t *) p;
@@ -173,7 +173,7 @@ nflog_if_print(netdissect_options *ndo,
                        goto trunc;     /* Yes. Give up now. */
 
                /* Do we have enough data for the full TLV? */
-               if (caplen < size || length < size)
+               if (caplen < size)
                        goto trunc;     /* No. */
 
                if (EXTRACT_HE_U_2(tlv->tlv_type) == NFULA_PAYLOAD) {
index 05ab987b2d8c028d5857ffc50679057bc2b14b77..0e10aeba56abaacf22ca9900e8ac62fe8173207a 100644 (file)
@@ -107,7 +107,7 @@ pktap_if_print(netdissect_options *ndo,
        struct pcap_pkthdr nhdr;
 
        ndo->ndo_protocol = "pktap_if";
-       if (caplen < sizeof(pktap_header_t) || length < sizeof(pktap_header_t)) {
+       if (caplen < sizeof(pktap_header_t)) {
                nd_print_trunc(ndo);
                return (caplen);
        }
@@ -125,7 +125,7 @@ pktap_if_print(netdissect_options *ndo,
                nd_print_trunc(ndo);
                return (caplen);
        }
-       if (caplen < hdrlen || length < hdrlen) {
+       if (caplen < hdrlen) {
                nd_print_trunc(ndo);
                return (caplen);
        }
index 86581ce05e231848af9623e28f89af91dd72747f..92fffe42a488559099b80fb6a69985b795f0bdea 100644 (file)
@@ -1695,7 +1695,7 @@ ppp_hdlc_if_print(netdissect_options *ndo,
        switch (EXTRACT_U_1(p)) {
 
        case PPP_ADDRESS:
-               if (caplen < 4 || length < 4) {
+               if (caplen < 4) {
                        nd_print_trunc(ndo);
                        return (caplen);
                }
index 5bba17ab2c03efad2fa0e19033f018d4e100e638..38ecb70def42aec59340c767296333ed5d23ec63 100644 (file)
@@ -63,7 +63,7 @@ sl_if_print(netdissect_options *ndo,
        const struct ip *ip;
 
        ndo->ndo_protocol = "sl_if";
-       if (caplen < SLIP_HDRLEN || length < SLIP_HDRLEN) {
+       if (caplen < SLIP_HDRLEN) {
                nd_print_trunc(ndo);
                return (caplen);
        }
@@ -76,7 +76,7 @@ sl_if_print(netdissect_options *ndo,
        if (ndo->ndo_eflag)
                sliplink_print(ndo, p, ip, length);
 
-       if (caplen < 1 || length < 1) {
+       if (caplen < 1) {
                nd_print_trunc(ndo);
                return (caplen + SLIP_HDRLEN);
        }