]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-slow.c
Include <string.h> only if required.
[tcpdump] / print-slow.c
index dc364cecfeb7d476bdfcb41fb60275e6a7d1e5f9..3529f03b2dcd138d673752e6f88ed55ea066af9c 100644 (file)
@@ -251,7 +251,6 @@ slow_print(netdissect_options *ndo,
     ndo->ndo_protocol = "slow";
     if (len < 1)
         goto tooshort;
-    ND_TCHECK_1(pptr);
     subtype = GET_U_1(pptr);
 
     /*
@@ -261,7 +260,6 @@ slow_print(netdissect_options *ndo,
     case SLOW_PROTO_LACP:
         if (len < 2)
             goto tooshort;
-        ND_TCHECK_1(pptr + 1);
         if (GET_U_1(pptr + 1) != LACP_VERSION) {
             ND_PRINT("LACP version %u packet not supported",
                      GET_U_1(pptr + 1));
@@ -273,7 +271,6 @@ slow_print(netdissect_options *ndo,
     case SLOW_PROTO_MARKER:
         if (len < 2)
             goto tooshort;
-        ND_TCHECK_1(pptr + 1);
         if (GET_U_1(pptr + 1) != MARKER_VERSION) {
             ND_PRINT("MARKER version %u packet not supported",
                      GET_U_1(pptr + 1));
@@ -339,10 +336,6 @@ tooshort:
         ND_PRINT(" (packet is too short)");
     else
         ND_PRINT("\n\t\t packet is too short");
-    return;
-
-trunc:
-    nd_print_trunc(ndo);
 }
 
 static void
@@ -388,8 +381,8 @@ slow_marker_lacp_print(netdissect_options *ndo,
 
         /* length includes the type and length fields */
         if (tlv_len < sizeof(struct tlv_header_t)) {
-            ND_PRINT("\n\t    ERROR: illegal length - should be >= %lu",
-                   (unsigned long) sizeof(struct tlv_header_t));
+            ND_PRINT("\n\t    ERROR: illegal length - should be >= %zu",
+                   sizeof(struct tlv_header_t));
             return;
         }
 
@@ -409,8 +402,8 @@ slow_marker_lacp_print(netdissect_options *ndo,
         case ((SLOW_PROTO_LACP << 8) + LACP_TLV_PARTNER_INFO):
             if (tlv_tlen !=
                 sizeof(struct lacp_tlv_actor_partner_info_t)) {
-                ND_PRINT("\n\t    ERROR: illegal length - should be %lu",
-                       (unsigned long) (sizeof(struct tlv_header_t) + sizeof(struct lacp_tlv_actor_partner_info_t)));
+                ND_PRINT("\n\t    ERROR: illegal length - should be %zu",
+                       sizeof(struct tlv_header_t) + sizeof(struct lacp_tlv_actor_partner_info_t));
                 goto badlength;
             }
 
@@ -418,7 +411,7 @@ slow_marker_lacp_print(netdissect_options *ndo,
 
             ND_PRINT("\n\t  System %s, System Priority %u, Key %u"
                    ", Port %u, Port Priority %u\n\t  State Flags [%s]",
-                   etheraddr_string(ndo, tlv_ptr.lacp_tlv_actor_partner_info->sys),
+                   GET_ETHERADDR_STRING(tlv_ptr.lacp_tlv_actor_partner_info->sys),
                    GET_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->sys_pri),
                    GET_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->key),
                    GET_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->port),
@@ -432,8 +425,8 @@ slow_marker_lacp_print(netdissect_options *ndo,
         case ((SLOW_PROTO_LACP << 8) + LACP_TLV_COLLECTOR_INFO):
             if (tlv_tlen !=
                 sizeof(struct lacp_tlv_collector_info_t)) {
-                ND_PRINT("\n\t    ERROR: illegal length - should be %lu",
-                       (unsigned long) (sizeof(struct tlv_header_t) + sizeof(struct lacp_tlv_collector_info_t)));
+                ND_PRINT("\n\t    ERROR: illegal length - should be %zu",
+                       sizeof(struct tlv_header_t) + sizeof(struct lacp_tlv_collector_info_t));
                 goto badlength;
             }
 
@@ -447,15 +440,15 @@ slow_marker_lacp_print(netdissect_options *ndo,
         case ((SLOW_PROTO_MARKER << 8) + MARKER_TLV_MARKER_INFO):
             if (tlv_tlen !=
                 sizeof(struct marker_tlv_marker_info_t)) {
-                ND_PRINT("\n\t    ERROR: illegal length - should be %lu",
-                       (unsigned long) (sizeof(struct tlv_header_t) + sizeof(struct marker_tlv_marker_info_t)));
+                ND_PRINT("\n\t    ERROR: illegal length - should be %zu",
+                       sizeof(struct tlv_header_t) + sizeof(struct marker_tlv_marker_info_t));
                 goto badlength;
             }
 
             tlv_ptr.marker_tlv_marker_info = (const struct marker_tlv_marker_info_t *)tlv_tptr;
 
             ND_PRINT("\n\t  Request System %s, Request Port %u, Request Transaction ID 0x%08x",
-                   etheraddr_string(ndo, tlv_ptr.marker_tlv_marker_info->req_sys),
+                   GET_ETHERADDR_STRING(tlv_ptr.marker_tlv_marker_info->req_sys),
                    GET_BE_U_2(tlv_ptr.marker_tlv_marker_info->req_port),
                    GET_BE_U_4(tlv_ptr.marker_tlv_marker_info->req_trans_id));
 
@@ -575,8 +568,8 @@ slow_oam_print(netdissect_options *ndo,
 
                 if (GET_U_1(tlv.slow_oam_info->info_length) !=
                     sizeof(struct slow_oam_info_t)) {
-                    ND_PRINT("\n\t    ERROR: illegal length - should be %lu",
-                           (unsigned long) sizeof(struct slow_oam_info_t));
+                    ND_PRINT("\n\t    ERROR: illegal length - should be %zu",
+                           sizeof(struct slow_oam_info_t));
                     hexdump = TRUE;
                     goto badlength_code_info;
                 }
@@ -628,7 +621,6 @@ slow_oam_print(netdissect_options *ndo,
         /* Sequence number */
         if (tlen < 2)
             goto tooshort;
-        ND_TCHECK_2(tptr);
         ND_PRINT("\n\t  Sequence Number %u", GET_BE_U_2(tptr));
         tlen -= 2;
         tptr += 2;
@@ -676,8 +668,8 @@ slow_oam_print(netdissect_options *ndo,
 
                 if (GET_U_1(tlv.slow_oam_link_event->event_length) !=
                     sizeof(struct slow_oam_link_event_t)) {
-                    ND_PRINT("\n\t    ERROR: illegal length - should be %lu",
-                           (unsigned long) sizeof(struct slow_oam_link_event_t));
+                    ND_PRINT("\n\t    ERROR: illegal length - should be %zu",
+                           sizeof(struct slow_oam_link_event_t));
                     hexdump = TRUE;
                     goto badlength_event_notif;
                 }