diff options
| author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2020-04-29 18:54:31 +0200 |
|---|---|---|
| committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2020-04-30 15:18:16 +0200 |
| commit | a881efab395fb7b7941de8204e91ea6d7cc7d4d7 (patch) | |
| tree | 420f7a2151cc1ecaaa1b8f8cd4873d426c524916 | |
| parent | 8b68bfb15dd3d2690bc056bd6ad1471d3b4b5ade (diff) | |
| download | tcpdump-a881efab395fb7b7941de8204e91ea6d7cc7d4d7.tar.gz | |
SLIP: Update the link-layer dissectors to void functions
Moreover:
Update the protocol names (sl_if -> slip and sl_bsdos_if -> slip_bsdos).
Update the output of some tests accordingly.
| -rw-r--r-- | netdissect.h | 4 | ||||
| -rw-r--r-- | print-sl.c | 22 | ||||
| -rw-r--r-- | print.c | 8 | ||||
| -rw-r--r-- | tests/heapoverflow-sl_if_print.out | 2 | ||||
| -rw-r--r-- | tests/slip-compressed_sl_print-oobr.out | 2 | ||||
| -rw-r--r-- | tests/slip-sliplink_print-oobr.out | 2 |
6 files changed, 22 insertions, 18 deletions
diff --git a/netdissect.h b/netdissect.h index d66883cf..3968f3c9 100644 --- a/netdissect.h +++ b/netdissect.h @@ -517,8 +517,8 @@ extern u_int ppp_if_print IF_PRINTER_ARGS; extern u_int pppoe_if_print IF_PRINTER_ARGS; extern u_int prism_if_print IF_PRINTER_ARGS; extern void raw_if_print IF_PRINTER_ARGS; -extern u_int sl_bsdos_if_print IF_PRINTER_ARGS; -extern u_int sl_if_print IF_PRINTER_ARGS; +extern void sl_bsdos_if_print IF_PRINTER_ARGS; +extern void sl_if_print IF_PRINTER_ARGS; extern u_int sll_if_print IF_PRINTER_ARGS; extern u_int sll2_if_print IF_PRINTER_ARGS; extern void sunatm_if_print IF_PRINTER_ARGS; @@ -54,7 +54,7 @@ static u_int lastconn = 255; static int sliplink_print(netdissect_options *, const u_char *, const struct ip *, u_int); static int compressed_sl_print(netdissect_options *, const u_char *, const struct ip *, u_int, int); -u_int +void sl_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { @@ -62,11 +62,13 @@ sl_if_print(netdissect_options *ndo, u_int length = h->len; const struct ip *ip; - ndo->ndo_protocol = "sl_if"; + ndo->ndo_protocol = "slip"; if (caplen < SLIP_HDRLEN) { nd_print_trunc(ndo); - return (caplen); + ndo->ndo_ll_header_length += caplen; + return; } + ndo->ndo_ll_header_length += SLIP_HDRLEN; caplen -= SLIP_HDRLEN; length -= SLIP_HDRLEN; @@ -76,7 +78,7 @@ sl_if_print(netdissect_options *ndo, if (ndo->ndo_eflag) if (sliplink_print(ndo, p, ip, length) == -1) { nd_print_trunc(ndo); - return (caplen + SLIP_HDRLEN); + return; } switch (IP_V(ip)) { @@ -90,10 +92,10 @@ sl_if_print(netdissect_options *ndo, ND_PRINT("ip v%u", IP_V(ip)); } - return (SLIP_HDRLEN); + return; } -u_int +void sl_bsdos_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { @@ -101,11 +103,13 @@ sl_bsdos_if_print(netdissect_options *ndo, u_int length = h->len; const struct ip *ip; - ndo->ndo_protocol = "sl_bsdos_if"; + ndo->ndo_protocol = "slip_bsdos"; if (caplen < SLIP_HDRLEN) { nd_print_trunc(ndo); - return (caplen); + ndo->ndo_ll_header_length += caplen; + return; } + ndo->ndo_ll_header_length += SLIP_HDRLEN; length -= SLIP_HDRLEN; @@ -118,7 +122,7 @@ sl_bsdos_if_print(netdissect_options *ndo, ip_print(ndo, (const u_char *)ip, length); - return (SLIP_HDRLEN); + return; } static int @@ -117,10 +117,6 @@ static const struct uint_printer uint_printers[] = { { mfr_if_print, DLT_MFR }, #endif { atm_if_print, DLT_ATM_RFC1483 }, - { sl_if_print, DLT_SLIP }, -#ifdef DLT_SLIP_BSDOS - { sl_bsdos_if_print, DLT_SLIP_BSDOS }, -#endif #ifdef DLT_LTALK { ltalk_if_print, DLT_LTALK }, #endif @@ -243,6 +239,10 @@ static const struct void_printer void_printers[] = { #ifdef DLT_IPV6 { raw_if_print, DLT_IPV6 }, #endif +#ifdef DLT_SLIP_BSDOS + { sl_bsdos_if_print, DLT_SLIP_BSDOS }, +#endif + { sl_if_print, DLT_SLIP }, #ifdef DLT_SUNATM { sunatm_if_print, DLT_SUNATM }, #endif diff --git a/tests/heapoverflow-sl_if_print.out b/tests/heapoverflow-sl_if_print.out index b99881f4..8b0ebd5f 100644 --- a/tests/heapoverflow-sl_if_print.out +++ b/tests/heapoverflow-sl_if_print.out @@ -1 +1 @@ - 1 05:27:12.808464432 [|sl_if] + 1 05:27:12.808464432 [|slip] diff --git a/tests/slip-compressed_sl_print-oobr.out b/tests/slip-compressed_sl_print-oobr.out index 55cbb3f3..03387de3 100644 --- a/tests/slip-compressed_sl_print-oobr.out +++ b/tests/slip-compressed_sl_print-oobr.out @@ -1 +1 @@ - 1 15:08:45.1677780311 I ctcp * W+48 [|sl_if] + 1 15:08:45.1677780311 I ctcp * W+48 [|slip] diff --git a/tests/slip-sliplink_print-oobr.out b/tests/slip-sliplink_print-oobr.out index 5e402f95..bd43c7b1 100644 --- a/tests/slip-sliplink_print-oobr.out +++ b/tests/slip-sliplink_print-oobr.out @@ -1 +1 @@ - 1 15:08:45.1677780310 O utcp 57: [|sl_if] + 1 15:08:45.1677780310 O utcp 57: [|slip] |
