]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-slow.c
Squelch a Coverity warning.
[tcpdump] / print-slow.c
index aa26d3e99c8eff26aff11ec506ab2e63b84abde9..7e83d1669be2c0e01931b8f5ba7e0171f472e3c4 100644 (file)
  * Original code by Hannes Gredler ([email protected])
  */
 
-#define NETDISSECT_REWORKED
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
 
-#include "interface.h"
+#include "netdissect.h"
 #include "extract.h"
 #include "addrtoname.h"
 #include "ether.h"
 #include "oui.h"
 
 struct slow_common_header_t {
-    u_int8_t proto_subtype;
-    u_int8_t version;
+    uint8_t proto_subtype;
+    uint8_t version;
 };
 
 #define        SLOW_PROTO_LACP                     1
@@ -79,15 +78,15 @@ static const struct tok slow_oam_code_values[] = {
 };
 
 struct slow_oam_info_t {
-    u_int8_t info_type;
-    u_int8_t info_length;
-    u_int8_t oam_version;
-    u_int8_t revision[2];
-    u_int8_t state;
-    u_int8_t oam_config;
-    u_int8_t oam_pdu_config[2];
-    u_int8_t oui[3];
-    u_int8_t vendor_private[4];
+    uint8_t info_type;
+    uint8_t info_length;
+    uint8_t oam_version;
+    uint8_t revision[2];
+    uint8_t state;
+    uint8_t oam_config;
+    uint8_t oam_pdu_config[2];
+    uint8_t oui[3];
+    uint8_t vendor_private[4];
 };
 
 #define SLOW_OAM_INFO_TYPE_END_OF_TLV 0x00
@@ -149,29 +148,29 @@ static const struct tok slow_oam_link_event_values[] = {
 };
 
 struct slow_oam_link_event_t {
-    u_int8_t event_type;
-    u_int8_t event_length;
-    u_int8_t time_stamp[2];
-    u_int8_t window[8];
-    u_int8_t threshold[8];
-    u_int8_t errors[8];
-    u_int8_t errors_running_total[8];
-    u_int8_t event_running_total[4];
+    uint8_t event_type;
+    uint8_t event_length;
+    uint8_t time_stamp[2];
+    uint8_t window[8];
+    uint8_t threshold[8];
+    uint8_t errors[8];
+    uint8_t errors_running_total[8];
+    uint8_t event_running_total[4];
 };
 
 struct slow_oam_variablerequest_t {
-    u_int8_t branch;
-    u_int8_t leaf[2];
+    uint8_t branch;
+    uint8_t leaf[2];
 };
 
 struct slow_oam_variableresponse_t {
-    u_int8_t branch;
-    u_int8_t leaf[2];
-    u_int8_t length;
+    uint8_t branch;
+    uint8_t leaf[2];
+    uint8_t length;
 };
 
 struct slow_oam_loopbackctrl_t {
-    u_int8_t command;
+    uint8_t command;
 };
 
 static const struct tok slow_oam_loopbackctrl_cmd_values[] = {
@@ -181,8 +180,8 @@ static const struct tok slow_oam_loopbackctrl_cmd_values[] = {
 };
 
 struct tlv_header_t {
-    u_int8_t type;
-    u_int8_t length;
+    uint8_t type;
+    uint8_t length;
 };
 
 #define LACP_TLV_TERMINATOR     0x00
@@ -205,13 +204,13 @@ static const struct tok slow_tlv_values[] = {
 };
 
 struct lacp_tlv_actor_partner_info_t {
-    u_int8_t sys_pri[2];
-    u_int8_t sys[ETHER_ADDR_LEN];
-    u_int8_t key[2];
-    u_int8_t port_pri[2];
-    u_int8_t port[2];
-    u_int8_t state;
-    u_int8_t pad[3];
+    uint8_t sys_pri[2];
+    uint8_t sys[ETHER_ADDR_LEN];
+    uint8_t key[2];
+    uint8_t port_pri[2];
+    uint8_t port[2];
+    uint8_t state;
+    uint8_t pad[3];
 };
 
 static const struct tok lacp_tlv_actor_partner_info_state_values[] = {
@@ -227,19 +226,19 @@ static const struct tok lacp_tlv_actor_partner_info_state_values[] = {
 };
 
 struct lacp_tlv_collector_info_t {
-    u_int8_t max_delay[2];
-    u_int8_t pad[12];
+    uint8_t max_delay[2];
+    uint8_t pad[12];
 };
 
 struct marker_tlv_marker_info_t {
-    u_int8_t req_port[2];
-    u_int8_t req_sys[ETHER_ADDR_LEN];
-    u_int8_t req_trans_id[4];
-    u_int8_t pad[2];
+    uint8_t req_port[2];
+    uint8_t req_sys[ETHER_ADDR_LEN];
+    uint8_t req_trans_id[4];
+    uint8_t pad[2];
 };
 
 struct lacp_marker_tlv_terminator_t {
-    u_int8_t pad[50];
+    uint8_t pad[50];
 };
 
 static void slow_marker_lacp_print(netdissect_options *, register const u_char *, register u_int);
@@ -249,8 +248,8 @@ const struct slow_common_header_t *slow_com_header;
 
 void
 slow_print(netdissect_options *ndo,
-           register const u_char *pptr, register u_int len) {
-
+           register const u_char *pptr, register u_int len)
+{
     int print_version;
 
     slow_com_header = (const struct slow_common_header_t *)pptr;
@@ -332,8 +331,8 @@ trunc:
 
 static void
 slow_marker_lacp_print(netdissect_options *ndo,
-                       register const u_char *tptr, register u_int tlen) {
-
+                       register const u_char *tptr, register u_int tlen)
+{
     const struct tlv_header_t *tlv_header;
     const u_char *tlv_tptr;
     u_int tlv_len, tlv_tlen;
@@ -382,7 +381,7 @@ slow_marker_lacp_print(netdissect_options *ndo,
 
             ND_PRINT((ndo, "\n\t  System %s, System Priority %u, Key %u" \
                    ", Port %u, Port Priority %u\n\t  State Flags [%s]",
-                   etheraddr_string(tlv_ptr.lacp_tlv_actor_partner_info->sys),
+                   etheraddr_string(ndo, tlv_ptr.lacp_tlv_actor_partner_info->sys),
                    EXTRACT_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->sys_pri),
                    EXTRACT_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->key),
                    EXTRACT_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->port),
@@ -405,7 +404,7 @@ slow_marker_lacp_print(netdissect_options *ndo,
             tlv_ptr.marker_tlv_marker_info = (const struct marker_tlv_marker_info_t *)tlv_tptr;
 
             ND_PRINT((ndo, "\n\t  Request System %s, Request Port %u, Request Transaction ID 0x%08x",
-                   etheraddr_string(tlv_ptr.marker_tlv_marker_info->req_sys),
+                   etheraddr_string(ndo, tlv_ptr.marker_tlv_marker_info->req_sys),
                    EXTRACT_16BITS(tlv_ptr.marker_tlv_marker_info->req_port),
                    EXTRACT_32BITS(tlv_ptr.marker_tlv_marker_info->req_trans_id)));
 
@@ -450,18 +449,18 @@ trunc:
 
 static void
 slow_oam_print(netdissect_options *ndo,
-               register const u_char *tptr, register u_int tlen) {
-
+               register const u_char *tptr, register u_int tlen)
+{
     u_int hexdump;
 
     struct slow_oam_common_header_t {
-        u_int8_t flags[2];
-        u_int8_t code;
+        uint8_t flags[2];
+        uint8_t code;
     };
 
     struct slow_oam_tlv_header_t {
-        u_int8_t type;
-        u_int8_t length;
+        uint8_t type;
+        uint8_t length;
     };
 
     union {
@@ -477,7 +476,7 @@ slow_oam_print(netdissect_options *ndo,
         const struct slow_oam_loopbackctrl_t *slow_oam_loopbackctrl;
     } tlv;
 
-    ptr.slow_oam_common_header = (struct slow_oam_common_header_t *)tptr;
+    ptr.slow_oam_common_header = (const struct slow_oam_common_header_t *)tptr;
     tptr += sizeof(struct slow_oam_common_header_t);
     tlen -= sizeof(struct slow_oam_common_header_t);