summaryrefslogtreecommitdiff
path: root/print-pflog.c
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2020-08-06 17:22:34 +0200
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2020-08-06 17:28:03 +0200
commit6855c11117b46c93c5ea83b2a9436e67f4dae254 (patch)
tree8187c48ab9c968bf14bee5b3a1907c8ebef4c5ff /print-pflog.c
parentb846e244235904990a66bb7fcee7b028cf83ab2c (diff)
downloadtcpdump-6855c11117b46c93c5ea83b2a9436e67f4dae254.tar.gz
PFLOG: Update the link-layer dissector to a void function
Moreover: Use GET_U_1() when needed. Remove trailing "_if" from the protocol name.
Diffstat (limited to 'print-pflog.c')
-rw-r--r--print-pflog.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/print-pflog.c b/print-pflog.c
index fc83a04b..679c2dbd 100644
--- a/print-pflog.c
+++ b/print-pflog.c
@@ -104,7 +104,7 @@ pflog_print(netdissect_options *ndo, const struct pfloghdr *hdr)
hdr->ifname);
}
-u_int
+void
pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
const u_char *p)
{
@@ -114,24 +114,27 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
const struct pfloghdr *hdr;
uint8_t af;
- ndo->ndo_protocol = "pflog_if";
+ ndo->ndo_protocol = "pflog";
/* check length */
if (caplen < sizeof(uint8_t)) {
nd_print_trunc(ndo);
- return (caplen);
+ ndo->ndo_ll_hdr_len += h->caplen;
+ return;
}
#define MIN_PFLOG_HDRLEN 45
hdr = (const struct pfloghdr *)p;
- if (hdr->length < MIN_PFLOG_HDRLEN) {
+ if (GET_U_1(&hdr->length) < MIN_PFLOG_HDRLEN) {
ND_PRINT("[pflog: invalid header length!]");
- return (hdr->length); /* XXX: not really */
+ ndo->ndo_ll_hdr_len += GET_U_1(&hdr->length); /* XXX: not really */
+ return;
}
hdrlen = BPF_WORDALIGN(hdr->length);
if (caplen < hdrlen) {
nd_print_trunc(ndo);
- return (hdrlen); /* XXX: true? */
+ ndo->ndo_ll_hdr_len += hdrlen; /* XXX: true? */
+ return;
}
/* print what we know */
@@ -172,8 +175,10 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
ND_DEFAULTPRINT(p, caplen);
}
- return (hdrlen);
+ ndo->ndo_ll_hdr_len += hdrlen;
+ return;
trunc:
nd_print_trunc(ndo);
- return (hdrlen);
+ ndo->ndo_ll_hdr_len += hdrlen;
+ return;
}