]> The Tcpdump Group git mirrors - tcpdump/commitdiff
CIP: Update the link-layer dissector to a void function
authorFrancois-Xavier Le Bail <[email protected]>
Sun, 2 Aug 2020 09:50:35 +0000 (11:50 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Sun, 2 Aug 2020 09:50:46 +0000 (11:50 +0200)
Moreover:
Remove trailing "_if" from the protocol name.

netdissect.h
print-cip.c
print.c

index a563a521d260557808632040d726db5747339bb9..8cee597c974e8b672dfd44e369b99ee88f809d9f 100644 (file)
@@ -473,7 +473,7 @@ extern void bt_if_print IF_PRINTER_ARGS;
 extern void brcm_tag_if_print IF_PRINTER_ARGS;
 extern void brcm_tag_prepend_if_print IF_PRINTER_ARGS;
 extern u_int chdlc_if_print IF_PRINTER_ARGS;
-extern u_int cip_if_print IF_PRINTER_ARGS;
+extern void cip_if_print IF_PRINTER_ARGS;
 extern void dsa_if_print IF_PRINTER_ARGS;
 extern void edsa_if_print IF_PRINTER_ARGS;
 extern void enc_if_print IF_PRINTER_ARGS;
index e69999a0feb49a8c68ad9323ec43fcbceb990463..8838dc99c9227a50eb6ea9eb05a84d897de41238 100644 (file)
@@ -56,7 +56,7 @@ cip_print(netdissect_options *ndo, u_int length)
  * 'h->len' is the length of the packet off the wire, and 'h->caplen'
  * is the number of bytes actually captured.
  */
-u_int
+void
 cip_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
 {
        u_int caplen = h->caplen;
@@ -64,7 +64,7 @@ cip_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char
        size_t cmplen;
        int llc_hdrlen;
 
-       ndo->ndo_protocol = "cip_if";
+       ndo->ndo_protocol = "cip";
        cmplen = sizeof(rfcllc);
        if (cmplen > caplen)
                cmplen = caplen;
@@ -76,7 +76,7 @@ cip_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char
 
        if (cmplen == 0) {
                nd_print_trunc(ndo);
-               return 0;
+               return;
        }
        if (memcmp(rfcllc, p, cmplen) == 0) {
                /*
@@ -97,5 +97,5 @@ cip_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char
                ip_print(ndo, p, length);
        }
 
-       return (llc_hdrlen);
+       ndo->ndo_ll_hdr_len += llc_hdrlen;
 }
diff --git a/print.c b/print.c
index 84df9a1ae6def4755cc9f1894fc11b0c24417fa6..56438353b426dec8486d924d376a8b326d29b5e2 100644 (file)
--- a/print.c
+++ b/print.c
@@ -53,12 +53,6 @@ struct void_printer {
 };
 
 static const struct uint_printer uint_printers[] = {
-#ifdef DLT_CIP
-       { cip_if_print,         DLT_CIP },
-#endif
-#ifdef DLT_ATM_CLIP
-       { cip_if_print,         DLT_ATM_CLIP },
-#endif
 #ifdef DLT_IP_OVER_FC
        { ipfc_if_print,        DLT_IP_OVER_FC },
 #endif
@@ -125,6 +119,12 @@ static const struct void_printer void_printers[] = {
 #ifdef DLT_BLUETOOTH_HCI_H4_WITH_PHDR
        { bt_if_print,          DLT_BLUETOOTH_HCI_H4_WITH_PHDR},
 #endif
+#ifdef DLT_ATM_CLIP
+       { cip_if_print,         DLT_ATM_CLIP },
+#endif
+#ifdef DLT_CIP
+       { cip_if_print,         DLT_CIP },
+#endif
 #ifdef DLT_DSA_TAG_DSA
        { dsa_if_print,         DLT_DSA_TAG_DSA },
 #endif