ipfwpcap: Fix build after libpcap 1.10.6 update

pcap-int.h now references SIZEOF_TIME_T from libpcap's config.h, which
is not available to consumers of the internal header outside of the
libpcap build.  Switch to the public <pcap.h> header and replace the
direct FILE* casts and ferror()/fflush() calls with pcap_dump_flush(3),
which is the correct public API for flushing a pcap dump file.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Joseph Mingrone
2026-03-15 02:32:01 -03:00
parent 16cef5f7a6
commit a0b3ef1952
+2 -7
View File
@@ -41,11 +41,7 @@
#include <net/bpf.h>
/* XXX normally defined in config.h */
#define HAVE_STRLCPY 1
#define HAVE_SNPRINTF 1
#define HAVE_VSNPRINTF 1
#include <pcap-int.h> /* see pcap(3) and /usr/src/contrib/libpcap/. */
#include <pcap.h>
#ifdef IP_MAXPACKET
#define BUFMAX IP_MAXPACKET
@@ -295,8 +291,7 @@ if (debug) fprintf(stderr, " sendto(%d) = %d\n", sd, r);
(void) gettimeofday(&(phd.ts), NULL);
phd.caplen = phd.len = nr;
pcap_dump((u_char *)dp, &phd, buf);
if (ferror((FILE *)dp)) { perror(dumpf); quit(14); }
(void) fflush((FILE *)dp);
if (pcap_dump_flush(dp) == -1) { pcap_perror(p, dumpf); quit(14); }
}
quit(0);