Date: Mon, 31 Jan 2022 21:57:21 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 261566] Padding of DLT_PFLOG packets should be done differently Message-ID: <bug-261566-227-R8psztmoc2@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-261566-227@https.bugs.freebsd.org/bugzilla/> References: <bug-261566-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D261566 Kristof Provost <kp@freebsd.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kp@freebsd.org --- Comment #2 from Kristof Provost <kp@freebsd.org> --- Thanks for the report. I distinctly recall looking at the Wireshark code before implementing the BPF_WORDALIGN(), however it clearly does `padded_length =3D WS_ROUNDUP_4(length);`, so I don't know what happened there. How does this look to you: diff --git a/sys/net/if_pflog.h b/sys/net/if_pflog.h index 0406f78474a8..443c1cc36cf6 100644 --- a/sys/net/if_pflog.h +++ b/sys/net/if_pflog.h @@ -33,7 +33,6 @@ #include <sys/types.h> -#include <net/bpf.h> #include <net/if.h> #define PFLOGIFS_MAX 16 @@ -60,7 +59,9 @@ struct pfloghdr { u_int8_t pad2[3]; }; -#define PFLOG_HDRLEN BPF_WORDALIGN(offsetof(struct pflog= hdr, pad2)) +#define PFLOG_ALIGNMENT sizeof(uint32_t) +#define PFLOG_ALIGN(x) (((x) + PFLOG_ALIGNMENT - 1) & ~(PFLOG_ALIGNMENT - 1)) +#define PFLOG_HDRLEN PFLOG_ALIGN(offsetof(struct pfloghd= r, pad2)) /* minus pad, also used as a signature */ #define PFLOG_REAL_HDRLEN offsetof(struct pfloghdr, pad2) --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-261566-227-R8psztmoc2>