]> The Tcpdump Group git mirrors - tcpdump/commitdiff
FR: Update the link-layer dissectors to void functions
authorFrancois-Xavier Le Bail <[email protected]>
Tue, 4 Aug 2020 15:24:53 +0000 (17:24 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Tue, 4 Aug 2020 15:25:01 +0000 (17:25 +0200)
Moreover:
Remove trailing "_if" from the protocol name.
Add two comments.

netdissect.h
print-fr.c
print.c

index 408cff8a026dc0275ca3f40b6f6b875b4b5fc9c8..dde21bc8385bd24571f6f70db730c6449d269a00 100644 (file)
@@ -479,7 +479,7 @@ extern void edsa_if_print IF_PRINTER_ARGS;
 extern void enc_if_print IF_PRINTER_ARGS;
 extern void ether_if_print IF_PRINTER_ARGS;
 extern void fddi_if_print IF_PRINTER_ARGS;
-extern u_int fr_if_print IF_PRINTER_ARGS;
+extern void fr_if_print IF_PRINTER_ARGS;
 extern void ieee802_11_if_print IF_PRINTER_ARGS;
 extern void ieee802_11_radio_avs_if_print IF_PRINTER_ARGS;
 extern void ieee802_11_radio_if_print IF_PRINTER_ARGS;
@@ -505,7 +505,7 @@ extern void juniper_pppoe_if_print IF_PRINTER_ARGS;
 extern void juniper_services_if_print IF_PRINTER_ARGS;
 extern u_int lane_if_print IF_PRINTER_ARGS;
 extern u_int ltalk_if_print IF_PRINTER_ARGS;
-extern u_int mfr_if_print IF_PRINTER_ARGS;
+extern void mfr_if_print IF_PRINTER_ARGS;
 extern void netanalyzer_if_print IF_PRINTER_ARGS;
 extern void netanalyzer_transparent_if_print IF_PRINTER_ARGS;
 extern void nflog_if_print IF_PRINTER_ARGS;
index f1c69b420f0378a9eaf06a61a61024607bce1f6d..d52e3cefc2ad44cedb9fbc180b90fbde5407c572 100644 (file)
@@ -212,23 +212,22 @@ fr_hdr_print(netdissect_options *ndo, int length, u_int addr_len,
     }
 }
 
-u_int
+/* Frame Relay */
+void
 fr_if_print(netdissect_options *ndo,
             const struct pcap_pkthdr *h, const u_char *p)
 {
        u_int length = h->len;
        u_int caplen = h->caplen;
 
-       ndo->ndo_protocol = "fr_if";
-        ND_TCHECK_4(p); /* minimum frame header length */
+       ndo->ndo_protocol = "fr";
+       if (caplen < 4) {       /* minimum frame header length */
+               nd_print_trunc(ndo);
+               ndo->ndo_ll_hdr_len += caplen;
+               return;
+       }
 
-        if ((length = fr_print(ndo, p, length)) == 0)
-            return (0);
-        else
-            return length;
-trunc:
-        nd_print_trunc(ndo);
-        return caplen;
+       ndo->ndo_ll_hdr_len += fr_print(ndo, p, length);
 }
 
 u_int
@@ -370,23 +369,22 @@ trunc:
 
 }
 
-u_int
+/* Multi Link Frame Relay (FRF.16) */
+void
 mfr_if_print(netdissect_options *ndo,
              const struct pcap_pkthdr *h, const u_char *p)
 {
        u_int length = h->len;
        u_int caplen = h->caplen;
 
-       ndo->ndo_protocol = "mfr_if";
-        ND_TCHECK_2(p); /* minimum frame header length */
+       ndo->ndo_protocol = "mfr";
+       if (caplen < 2) {       /* minimum frame header length */
+               nd_print_trunc(ndo);
+               ndo->ndo_ll_hdr_len += caplen;
+               return;
+       }
 
-        if ((length = mfr_print(ndo, p, length)) == 0)
-            return (0);
-        else
-            return length;
-trunc:
-        nd_print_trunc(ndo);
-        return caplen;
+       ndo->ndo_ll_hdr_len += mfr_print(ndo, p, length);
 }
 
 
diff --git a/print.c b/print.c
index 414a8955a134c207ab3c4dada3d6ea537261d9a0..780a6281dae940bcc9e658d9bf76dc7b1a00f833 100644 (file)
--- a/print.c
+++ b/print.c
@@ -65,15 +65,6 @@ static const struct uint_printer uint_printers[] = {
 #if defined(DLT_PFLOG) && defined(HAVE_NET_IF_PFLOG_H)
        { pflog_if_print,       DLT_PFLOG },
 #endif
-#ifdef DLT_FR
-       { fr_if_print,          DLT_FR },
-#endif
-#ifdef DLT_FRELAY
-       { fr_if_print,          DLT_FRELAY },
-#endif
-#ifdef DLT_MFR
-       { mfr_if_print,         DLT_MFR },
-#endif
 #ifdef DLT_LTALK
        { ltalk_if_print,       DLT_LTALK },
 #endif
@@ -125,6 +116,12 @@ static const struct void_printer void_printers[] = {
 #endif
        { ether_if_print,       DLT_EN10MB },
        { fddi_if_print,        DLT_FDDI },
+#ifdef DLT_FR
+       { fr_if_print,          DLT_FR },
+#endif
+#ifdef DLT_FRELAY
+       { fr_if_print,          DLT_FRELAY },
+#endif
 #ifdef DLT_IEEE802_11
        { ieee802_11_if_print,  DLT_IEEE802_11},
 #endif
@@ -197,6 +194,9 @@ static const struct void_printer void_printers[] = {
 #ifdef DLT_JUNIPER_SERVICES
        { juniper_services_if_print, DLT_JUNIPER_SERVICES },
 #endif
+#ifdef DLT_MFR
+       { mfr_if_print,         DLT_MFR },
+#endif
 #ifdef DLT_NETANALYZER
        { netanalyzer_if_print, DLT_NETANALYZER },
 #endif