Skip to content

Commit c3f8e04

Browse files
committed
ENC: Update the link-layer dissector to a void function
Moreover: Remove trailing "_if" from protocol name. Remove a no longer used 'out' label.
1 parent 717095a commit c3f8e04

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

netdissect.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ extern u_int chdlc_if_print IF_PRINTER_ARGS;
472472
extern u_int cip_if_print IF_PRINTER_ARGS;
473473
extern u_int dsa_if_print IF_PRINTER_ARGS;
474474
extern u_int edsa_if_print IF_PRINTER_ARGS;
475-
extern u_int enc_if_print IF_PRINTER_ARGS;
475+
extern void enc_if_print IF_PRINTER_ARGS;
476476
extern u_int ether_if_print IF_PRINTER_ARGS;
477477
extern u_int fddi_if_print IF_PRINTER_ARGS;
478478
extern u_int fr_if_print IF_PRINTER_ARGS;

print-enc.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ struct enchdr {
9494
#define SWAPLONG(y) \
9595
((((y)&0xff)<<24) | (((y)&0xff00)<<8) | (((y)&0xff0000)>>8) | (((y)>>24)&0xff))
9696

97-
u_int
97+
void
9898
enc_if_print(netdissect_options *ndo,
9999
const struct pcap_pkthdr *h, const u_char *p)
100100
{
@@ -103,11 +103,13 @@ enc_if_print(netdissect_options *ndo,
103103
u_int af, flags;
104104
const struct enchdr *hdr;
105105

106-
ndo->ndo_protocol = "enc_if";
106+
ndo->ndo_protocol = "enc";
107107
if (caplen < ENC_HDRLEN) {
108+
ndo->ndo_ll_header_length += caplen;
108109
nd_print_trunc(ndo);
109-
goto out;
110+
return;
110111
}
112+
ndo->ndo_ll_header_length += ENC_HDRLEN;
111113

112114
hdr = (const struct enchdr *)p;
113115
/*
@@ -159,6 +161,5 @@ enc_if_print(netdissect_options *ndo,
159161
break;
160162
}
161163

162-
out:
163-
return (ENC_HDRLEN);
164+
return;
164165
}

print.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@ static const struct uint_printer uint_printers[] = {
127127
{ mfr_if_print, DLT_MFR },
128128
#endif
129129
{ atm_if_print, DLT_ATM_RFC1483 },
130-
#ifdef DLT_ENC
131-
{ enc_if_print, DLT_ENC },
132-
#endif
133130
{ sl_if_print, DLT_SLIP },
134131
#ifdef DLT_SLIP_BSDOS
135132
{ sl_bsdos_if_print, DLT_SLIP_BSDOS },
@@ -231,6 +228,9 @@ static const struct void_printer void_printers[] = {
231228
#endif
232229
#ifdef DLT_BLUETOOTH_HCI_H4_WITH_PHDR
233230
{ bt_if_print, DLT_BLUETOOTH_HCI_H4_WITH_PHDR},
231+
#endif
232+
#ifdef DLT_ENC
233+
{ enc_if_print, DLT_ENC },
234234
#endif
235235
{ null_if_print, DLT_NULL },
236236
#ifdef DLT_LOOP

0 commit comments

Comments
 (0)