diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2020-02-07 18:21:40 +0100 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2020-02-07 20:36:34 +0100 |
commit | 717095ab66fd1930248b6a3069ed275281214898 (patch) | |
tree | a1c5808b20f0ba91b60a369fcee608b9bdeb8e29 /print-null.c | |
parent | 92a263b1b36bd33612baa63b9e9ed0a41e07f05f (diff) | |
download | tcpdump-717095ab66fd1930248b6a3069ed275281214898.tar.gz |
NULL/LOOP: Update the link-layer dissector to a void function
Moreover:
Remove trailing "_if" from protocol name.
Remove a useless ND_TCHECK_4 test (GET_HE_U_4 used).
Remove a no longer used 'trunc' label.
Use uint32_t type for family in null_hdr_print().
Diffstat (limited to 'print-null.c')
-rw-r--r-- | print-null.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/print-null.c b/print-null.c index f730a23f..f2ea96e2 100644 --- a/print-null.c +++ b/print-null.c @@ -55,7 +55,7 @@ ((((y)&0xff)<<24) | (((y)&0xff00)<<8) | (((y)&0xff0000)>>8) | (((y)>>24)&0xff)) static void -null_hdr_print(netdissect_options *ndo, u_int family, u_int length) +null_hdr_print(netdissect_options *ndo, uint32_t family, u_int length) { if (!ndo->ndo_qflag) { ND_PRINT("AF %s (%u)", @@ -74,18 +74,21 @@ null_hdr_print(netdissect_options *ndo, u_int family, 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 null_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { u_int length = h->len; u_int caplen = h->caplen; uint32_t family; - ndo->ndo_protocol = "null_if"; - if (caplen < NULL_HDRLEN) - goto trunc; + ndo->ndo_protocol = "null"; + if (caplen < NULL_HDRLEN) { + ndo->ndo_ll_header_length += caplen; + nd_print_trunc(ndo); + return; + } + ndo->ndo_ll_header_length += NULL_HDRLEN; - ND_TCHECK_4(p); family = GET_HE_U_4(p); /* @@ -138,8 +141,5 @@ null_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char ND_DEFAULTPRINT(p, caplen); } - return (NULL_HDRLEN); -trunc: - nd_print_trunc(ndo); - return (NULL_HDRLEN); + return; } |