From nobody Fri Oct 04 13:43:20 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XKqWD1xMGz5XnW9; Fri, 04 Oct 2024 13:43:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XKqWD1PCkz4rk4; Fri, 4 Oct 2024 13:43:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728049400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Lhyy7r+Fp2Y+/EjTR7OCgWooxEBKZDfhjutMIIWmId8=; b=nz0EuK2iY9WD3gciIHpmgRXH/FYxli/4C+C3QriAgKCtjVOblMIPsvFGssy9oavcPR6ohX +QF3cpMGJrq/84ZURaAt5+odtKFQmhgQa6Y8A+mtJ5sPXXoOTtDqf5ZwKGiBlFp8ytH0N5 J7NWqmQlCIk/pk96NymqMKG+YzHcad5bBT/6wz3WOvYTWGymO2EqNYTRXfXUDy/6vJaYYC 8UozOd1f8swFqmlEz6HaXIW/wxDrI+rnbyIQY8XAsTSGjArHFBX+9l6PrRE5rR8g0IWYTA q44djUqbfx83d2FToifBAO+l2qaxLRLrsM7w11s7Fl4bmjoNZwq8xI37DZ4MtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728049400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Lhyy7r+Fp2Y+/EjTR7OCgWooxEBKZDfhjutMIIWmId8=; b=xg8Sybcw2NdlFC4i5iT76Mdh3/6mHVw0+CTzWuJICH2d5PALf7/QWXUn6Pk5siJlX9uRks +WAttleg8iarTBiTJysWevbL+QGA74DBNZcf3A3ZXwRUkBMlvdzS9RGEqAEy/pHg905OZ9 BJFApU/bYiZjtbt4wv6E0dnNJ6UUtK3FYrHpWaUnZoYCa1jjmVTmCUCXcuvqpsPnu+xjvj huHIz64u4p0bumvhjrm/FqYm9RmEFIbvTxRGpSUwrF/mpzn1aIZ/SP5VgR61/OPJDAJ18/ mIw8Y/YCDomocqXwLl6jnXnIB+1SgPDuEADvin9s1uHk73oFCqx/60dslwg56w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728049400; a=rsa-sha256; cv=none; b=JpTp8Jy70qGC8dWbhg00aXoqoV4WKPZ+CxSoZIvl1EoVxG+iwpboQqYojw3BSXqIAMnagM HuplkA2QXgQUOGNK8ZteVxQffGHq0n6f1jz4MJBL9GD8GpVJfbR41W+Y61bEwu18kaY8Xv lFMZjZWqExMJJbqcOGTQbmXGpyoNyiYZy4UT8e0+X/XM44quG9NCqMT73kLNb/6u68GuuD Aq6pY2d9w3lWuSjtEh0m2gfpnvnJj5G1dym5uf8waTbzdqgsaqw8vlf2cYd7iyJNtWl/yz XAmv2hmRLctOQpEOcDvsjp50jX+wxj2cZVORgvwjoe9+AGwYKjwF4VegksXKOA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XKqWD10NNzcP6; Fri, 4 Oct 2024 13:43:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 494DhKhZ027840; Fri, 4 Oct 2024 13:43:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 494DhKR4027837; Fri, 4 Oct 2024 13:43:20 GMT (envelope-from git) Date: Fri, 4 Oct 2024 13:43:20 GMT Message-Id: <202410041343.494DhKR4027837@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Joseph Mingrone Subject: git: 34aa6f2c2db5 - main - pflogd: Move struct definitions out of header file List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 34aa6f2c2db5cc9655f201a1ef01adbb9fb484d5 Auto-Submitted: auto-generated The branch main has been updated by jrm: URL: https://cgit.FreeBSD.org/src/commit/?id=34aa6f2c2db5cc9655f201a1ef01adbb9fb484d5 commit 34aa6f2c2db5cc9655f201a1ef01adbb9fb484d5 Author: Joseph Mingrone AuthorDate: 2024-10-03 19:49:51 +0000 Commit: Joseph Mingrone CommitDate: 2024-10-04 13:41:53 +0000 pflogd: Move struct definitions out of header file In libpcap 1.10.5, two structures that we relied on, pcap_timeval and pcap_sf_pkthdr, were made private. As a workaround, we initially defined the structures in pflogd.h. After further investigation, mostly by kp@, we concluded that it is reasonable to define these structures ourselves since they represent a file format and thus are unlikely to change from under us. We will stick with this solution but move the definitions out of the header file to prevent others from using pflogd.h to access them. Another solution that was considered was using libpcap's pcap_dump() function to write packets, but there are blockers. For example, pflogd writes to a memory buffer, and libpcap lacks support for this. Reviewed by: kp MFC after: 3 days Event: EuroBSDCon 2024 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46894 --- contrib/pf/pflogd/pflogd.c | 11 +++++++++++ contrib/pf/pflogd/pflogd.h | 13 ------------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/contrib/pf/pflogd/pflogd.c b/contrib/pf/pflogd/pflogd.c index 6df97f8b84f4..e24553dfc37b 100644 --- a/contrib/pf/pflogd/pflogd.c +++ b/contrib/pf/pflogd/pflogd.c @@ -74,6 +74,17 @@ char errbuf[PCAP_ERRBUF_SIZE]; int log_debug = 0; unsigned int delay = FLUSH_DELAY; +struct pcap_timeval { + bpf_u_int32 tv_sec; /* seconds */ + bpf_u_int32 tv_usec; /* microseconds */ +}; + +struct pcap_sf_pkthdr { + struct pcap_timeval ts; /* time stamp */ + bpf_u_int32 caplen; /* length of portion present */ + bpf_u_int32 len; /* length of this packet (off wire) */ +}; + char *copy_argv(char * const *); void dump_packet(u_char *, const struct pcap_pkthdr *, const u_char *); void dump_packet_nobuf(u_char *, const struct pcap_pkthdr *, const u_char *); diff --git a/contrib/pf/pflogd/pflogd.h b/contrib/pf/pflogd/pflogd.h index 6e6b588d24bf..596e69692614 100644 --- a/contrib/pf/pflogd/pflogd.h +++ b/contrib/pf/pflogd/pflogd.h @@ -40,19 +40,6 @@ int priv_open_log(void); int priv_move_log(void); pcap_t *pcap_open_live_fd(int fd, int snaplen, char *ebuf); -/* XXX TODO: Investigate a permanent solution, rather than defining these two - structures here. */ -struct pcap_timeval { - bpf_u_int32 tv_sec; /* seconds */ - bpf_u_int32 tv_usec; /* microseconds */ -}; - -struct pcap_sf_pkthdr { - struct pcap_timeval ts; /* time stamp */ - bpf_u_int32 caplen; /* length of portion present */ - bpf_u_int32 len; /* length of this packet (off wire) */ -}; - void set_pcap_filter(void); /* File descriptor send/recv */ void send_fd(int, int);