]> The Tcpdump Group git mirrors - tcpdump/commitdiff
SunATM: Modernize packet parsing style.
authorDenis Ovsienko <[email protected]>
Sat, 17 Oct 2020 15:35:14 +0000 (16:35 +0100)
committerDenis Ovsienko <[email protected]>
Sat, 17 Oct 2020 16:55:37 +0000 (17:55 +0100)
Remove a redundant ND_TCHECK_LEN() and increment ndo_ll_hdr_len after
retrieving a full header worth of data, not before.

print-sunatm.c

index 82835ae631e03008433e93811af07293f0873f00..39b718f6956f6c3944a746ec91c16975c654c264 100644 (file)
@@ -71,8 +71,6 @@ sunatm_if_print(netdissect_options *ndo,
        u_int traftype;
 
        ndo->ndo_protocol = "sunatm";
-       ND_TCHECK_LEN(p, PKT_BEGIN_POS);
-       ndo->ndo_ll_hdr_len += PKT_BEGIN_POS;
 
        if (ndo->ndo_eflag) {
                ND_PRINT(GET_U_1(p + DIR_POS) & 0x80 ? "Tx: " : "Rx: ");
@@ -99,5 +97,6 @@ sunatm_if_print(netdissect_options *ndo,
        p += PKT_BEGIN_POS;
        caplen -= PKT_BEGIN_POS;
        length -= PKT_BEGIN_POS;
+       ndo->ndo_ll_hdr_len += PKT_BEGIN_POS;
        atm_print(ndo, vpi, vci, traftype, p, length, caplen);
 }