]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-vtp.c
remove redundant ND_TCHECK, let GET_ routines handle checks
[tcpdump] / print-vtp.c
index e2b1f9ff927d29e5ddc8e44d9fe4e3f51382841f..e1b8377a213aeff846ef7b8b1a8e366bacbec4e6 100644 (file)
@@ -13,8 +13,8 @@
  * FOR A PARTICULAR PURPOSE.
  *
  * Reference documentation:
- *  http://www.cisco.com/c/en/us/support/docs/lan-switching/vtp/10558-21.html
- *  http://docstore.mik.ua/univercd/cc/td/doc/product/lan/trsrb/frames.htm
+ *  https://www.cisco.com/c/en/us/support/docs/lan-switching/vtp/10558-21.html
+ *  https://docstore.mik.ua/univercd/cc/td/doc/product/lan/trsrb/frames.htm
  *
  * Original code ode by Carles Kishimoto <[email protected]>
  */
@@ -184,7 +184,7 @@ vtp_print(netdissect_options *ndo,
        ND_TCHECK_8(tptr);
        ND_PRINT("\n\t  Config Rev %x, Updater %s",
               GET_BE_U_4(tptr),
-              ipaddr_string(ndo, tptr+4));
+              GET_IPADDR_STRING(tptr+4));
        tptr += 8;
        ND_TCHECK_LEN(tptr, VTP_UPDATE_TIMESTAMP_LEN);
        ND_PRINT(", Timestamp 0x%08x 0x%08x 0x%08x",
@@ -223,7 +223,6 @@ vtp_print(netdissect_options *ndo,
         *
         */
 
-       ND_TCHECK_4(tptr);
        ND_PRINT(", Config Rev %x", GET_BE_U_4(tptr));
 
        /*
@@ -242,9 +241,8 @@ vtp_print(netdissect_options *ndo,
         */
 
        tptr += 4;
-       while (tptr < (pptr+length)) {
+       while ((unsigned)(tptr - pptr) < length) {
 
-           ND_TCHECK_1(tptr);
            len = GET_U_1(tptr);
            if (len == 0)
                break;
@@ -281,7 +279,7 @@ vtp_print(netdissect_options *ndo,
 
                 /*
                  * Cisco specs say 2 bytes for type + 2 bytes for length;
-                 * see http://docstore.mik.ua/univercd/cc/td/doc/product/lan/trsrb/frames.htm
+                 * see https://docstore.mik.ua/univercd/cc/td/doc/product/lan/trsrb/frames.htm
                  * However, actual packets on the wire appear to use 1
                  * byte for the type and 1 byte for the length, so that's
                  * what we do.
@@ -378,7 +376,6 @@ vtp_print(netdissect_options *ndo,
         *
         */
 
-       ND_TCHECK_4(tptr);
        ND_PRINT("\n\tStart value: %u", GET_BE_U_4(tptr));
        break;