From: Francois-Xavier Le Bail Date: Sun, 2 Aug 2020 09:50:35 +0000 (+0200) Subject: CIP: Update the link-layer dissector to a void function X-Git-Tag: tcpdump-4.99-bp~297 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/e2e1906cff6ab7d5de40f587b89039713dac6d82 CIP: Update the link-layer dissector to a void function Moreover: Remove trailing "_if" from the protocol name. --- diff --git a/netdissect.h b/netdissect.h index a563a521..8cee597c 100644 --- a/netdissect.h +++ b/netdissect.h @@ -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; diff --git a/print-cip.c b/print-cip.c index e69999a0..8838dc99 100644 --- a/print-cip.c +++ b/print-cip.c @@ -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 84df9a1a..56438353 100644 --- 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