commit:     2d726ec398bd5d80e0646686b6102822662374a8
Author:     Holger Hoffstätte <holger <AT> applied-asynchrony <DOT> com>
AuthorDate: Sun Jun  1 12:50:15 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun  4 00:30:36 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2d726ec3

net-analyzer/arpwatch: add 3.8, misc. fixes

- do not use a long deprecated resolver option
- fix Makefile to use correct path for reading ethercodes.dat
- fix hardcoded paths in update-ethercodes.sh so that it actually works
- remind users to update their ethercodes.dat

Thanks to Vladislav Mikhailikov <vmikhailikov <AT> gmail.com> for initial
work and inspiration.

Closes: https://bugs.gentoo.org/783195
Signed-off-by: Holger Hoffstätte <holger <AT> applied-asynchrony.com>
Part-of: https://github.com/gentoo/gentoo/pull/42386
Closes: https://github.com/gentoo/gentoo/pull/42386
Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-analyzer/arpwatch/Manifest                     |   1 +
 net-analyzer/arpwatch/arpwatch-3.8.ebuild          | 104 +++++++++++++++++++++
 .../0003-Drop-deprecated-resolver-option.patch     |  17 ++++
 .../arpwatch/files/0004-Use-correct-datadir.patch  |  14 +++
 ...05-Use-correct-paths-in-update-ethercodes.patch |  30 ++++++
 5 files changed, 166 insertions(+)

diff --git a/net-analyzer/arpwatch/Manifest b/net-analyzer/arpwatch/Manifest
index 9eb2873b92df..e22d5e67642a 100644
--- a/net-analyzer/arpwatch/Manifest
+++ b/net-analyzer/arpwatch/Manifest
@@ -1,4 +1,5 @@
 DIST arpwatch-3.5.tar.gz 117594 BLAKE2B 
73b979ec279e5bf5baaeac05949e1bddf08cd9c3c7afcd29b37991ba55ba2bb8968b57b407eb571ec52871017372f479e586ba84b0f1aee67331ce7617309fb8
 SHA512 
e46b350c483f0e7c873eb177be337f238b2db3d859d8b305df5a74d9d97ca449750f9ed50a99c5d4c51618e22747731d70ceb3f13aae39c39d258b960258fb88
 DIST arpwatch-3.6.tar.gz 117254 BLAKE2B 
77cb129bb543a45e22e27c02193b2ceaf4c65fd56b4d77e710379a2fbcaa5f1be4d625ea0b99f63843358ae993c7bee95db764baf36e0802a7aceae5d81706c7
 SHA512 
5ba47b15f294396f79efa4b72743169b9eb36747d675144e8f456a23d3987dc0d719d9b97704e7eeec0795f03ee7ef7e8fe8a4ba1ee35d19ab8ec6b077d345e8
 DIST arpwatch-3.7.tar.gz 117274 BLAKE2B 
512f271979e964ed26148eea2587bca61a55df065960444f629993ec04eaf49be9e8016ed18278566935be38de4e6e71a03a9ab8d6b4befcef3e1fa4b02ad850
 SHA512 
8bdda7fc94241813ee57c91683ce5c6a8e4d5e66255bf2cc302d69763086e29c6548b009805660274437edca7a5b8bbf24566846357afe1f96015bd26db89624
+DIST arpwatch-3.8.tar.gz 117299 BLAKE2B 
2ec0360ed12722e09cfccd06a1ab48ed77ea017d9ebf182cf2792dac53b61b1f0d6b5895fe30ec4d6b9e05d78aa75762775e548573f7bd5b2918ce8ca775eed3
 SHA512 
9147da89f187adaaa26bc2cef0f04a69baa9a5ff96844f6a7e32ee269a3e1c4fed75b186ca3eb6b97f3579b648f63a7590e0534f545e7480d7ec14d9c7c18f89
 DIST ethercodes.dat-20200628.xz 239028 BLAKE2B 
e702b9109ef3ccce73e2637f96126bf19e7dfa533774c0bd623042b3609f147981263b84397ec155a65ae12fa57247c32644e1e7e57c2c749ef768156d853027
 SHA512 
2edc05d384f387e6b43d07da99038625f9c55c8044b5a48d1bcf9f657df691bf413a97fb9ca915f04dbdafab23f919edd15d906c4ce8bff12be0b255a6717f07

diff --git a/net-analyzer/arpwatch/arpwatch-3.8.ebuild 
b/net-analyzer/arpwatch/arpwatch-3.8.ebuild
new file mode 100644
index 000000000000..a19c8507c99e
--- /dev/null
+++ b/net-analyzer/arpwatch/arpwatch-3.8.ebuild
@@ -0,0 +1,104 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools systemd
+
+ETHERCODES_DATE=20200628
+DESCRIPTION="An ethernet monitor program that keeps track of ethernet/IP 
address pairings"
+HOMEPAGE="https://ee.lbl.gov/";
+SRC_URI="
+       https://ee.lbl.gov/downloads/${PN}/${P}.tar.gz
+       
https://dev.gentoo.org/~jsmolic/distfiles/ethercodes.dat-${ETHERCODES_DATE}.xz
+"
+
+LICENSE="BSD GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~ppc ~riscv ~sparc ~x86"
+IUSE="selinux"
+
+DEPEND="
+       acct-group/arpwatch
+       net-libs/libpcap
+       sys-libs/ncurses:=
+"
+RDEPEND="
+       ${DEPEND}
+       acct-user/arpwatch
+       virtual/mta
+       selinux? ( sec-policy/selinux-arpwatch )
+"
+
+PATCHES=(
+       # sent upstream on 2023-12-05
+       "${FILESDIR}"/0001-Fix-configure-check-for-time.h.patch
+       "${FILESDIR}"/0002-Avoid-using-undocumented-internals-for-DNS.patch
+       # custom fix
+       "${FILESDIR}"/0003-Drop-deprecated-resolver-option.patch
+       # bug 783195
+       "${FILESDIR}"/0004-Use-correct-datadir.patch
+       "${FILESDIR}"/0005-Use-correct-paths-in-update-ethercodes.patch
+)
+
+src_prepare() {
+       default
+
+       # Temporary for 0001-Fix-configure-check-for-time.h.patch
+       eautoreconf
+}
+
+src_configure() {
+       # pass missing @sbindir@ (bug 783195)
+       local myconf=(
+               --sbindir="${EPREFIX}/usr/sbin"
+       )
+
+       econf "${myconf[@]}"
+}
+
+src_install() {
+       dosbin arp2ethers arpfetch arpsnmp arpwatch bihourly.sh 
massagevendor.py update-ethercodes.sh
+       doman arpsnmp.8 arpwatch.8
+
+       insinto /usr/share/arpwatch
+       newins "${WORKDIR}"/ethercodes.dat-${ETHERCODES_DATE} ethercodes.dat
+
+       insinto /usr/share/arpwatch/awk
+       doins d.awk duplicates.awk e.awk euppertolower.awk p.awk
+
+       diropts --group=arpwatch --mode=770
+       keepdir /var/lib/arpwatch
+       dodoc README CHANGES
+
+       newconfd "${FILESDIR}"/arpwatch.confd-r2 arpwatch
+       newinitd "${FILESDIR}"/arpwatch.initd-r2 arpwatch
+
+       systemd_dounit "${FILESDIR}/arpwatch.service"
+       systemd_install_serviced "${FILESDIR}/arpwatch.conf"
+}
+
+pkg_postinst() {
+       # Previous revisions installed /var/lib/arpwatch with the wrong
+       # ownership. Instead of the intended arpwatch:root, it was left as
+       # root:root. If we find any such mis-owned directories, we fix them,
+       # and then set the permission bits how we want them in *this*
+       # revision.
+       #
+       # The "--from" flag ensures that we only fix directories that need
+       # fixing, and the "&& chmod" ensures that we only adjust the
+       # permissions if the owner also needed fixing.
+       chown \
+               --from=root:root \
+               --no-dereference \
+               :arpwatch \
+               "${ROOT}"/var/lib/arpwatch && \
+               chmod 770 "${ROOT}"/var/lib/arpwatch
+
+       # Remind users to update their ethercodes.dat
+       einfo "Please remember to update your ethercodes.dat (IEEE MA-L 
Assignments) by running:"
+       einfo
+       einfo "  /usr/sbin/update-ethercodes.sh"
+       einfo
+       einfo "Without this newer device vendors may not be recognized."
+}

diff --git 
a/net-analyzer/arpwatch/files/0003-Drop-deprecated-resolver-option.patch 
b/net-analyzer/arpwatch/files/0003-Drop-deprecated-resolver-option.patch
new file mode 100644
index 000000000000..069e8423d786
--- /dev/null
+++ b/net-analyzer/arpwatch/files/0003-Drop-deprecated-resolver-option.patch
@@ -0,0 +1,17 @@
+This enumeration value is deprecated in /usr/include/resolv.h:
+
+#define RES_AAONLY \
+  __glibc_macro_warning ("RES_AAONLY is deprecated") 0x00000004
+
+Since Gentoo is not using outdated glibc version it is safe to disable it.
+
+--- a/dns.c
++++ b/dns.c
+@@ -150,7 +150,6 @@
+       struct hostent *hp;
+ 
+       options = _res.options;
+-      _res.options |= RES_AAONLY;
+       _res.options &= ~(RES_DEFNAMES | RES_DNSRCH);
+       hp = gethostbyaddr((char *)&a, sizeof(a), AF_INET);
+       _res.options = options;

diff --git a/net-analyzer/arpwatch/files/0004-Use-correct-datadir.patch 
b/net-analyzer/arpwatch/files/0004-Use-correct-datadir.patch
new file mode 100644
index 000000000000..a8e199a2465c
--- /dev/null
+++ b/net-analyzer/arpwatch/files/0004-Use-correct-datadir.patch
@@ -0,0 +1,14 @@
+Use correct directory for database files.
+Bug: https://bugs.gentoo.org/783195
+
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -40,7 +40,7 @@ MANDEST = @mandir@
+ # The root of the directory tree for read-only
+ datarootdir = @datarootdir@
+ # Pathname of directory to install database file
+-ARPDIR ?= @prefix@/arpwatch
++ARPDIR ?= @datarootdir@/arpwatch
+ 
+ # VPATH
+ srcdir = @srcdir@

diff --git 
a/net-analyzer/arpwatch/files/0005-Use-correct-paths-in-update-ethercodes.patch 
b/net-analyzer/arpwatch/files/0005-Use-correct-paths-in-update-ethercodes.patch
new file mode 100644
index 000000000000..564cf3bc9a0c
--- /dev/null
+++ 
b/net-analyzer/arpwatch/files/0005-Use-correct-paths-in-update-ethercodes.patch
@@ -0,0 +1,30 @@
+Use correct paths in update-etherncodes.sh
+Bug: https://bugs.gentoo.org/783195
+
+--- a/update-ethercodes.sh.in
++++ b/update-ethercodes.sh.in
+@@ -6,22 +6,19 @@
+ 
+ prog="`basename $0`"
+ 
+-PATH=/usr/local/bin:${PATH}
+-export PATH
+-
+ t1=/tmp/${prog}.1.$$
+ 
+ trap 'rm -f ${t1}; exit 1' 1 2 3 15 EXIT
+ 
+ if [ ! -f arp.dat ]; then
+-      cd /usr/local/arpwatch || exit 1
++      cd @datarootdir@/arpwatch || exit 1
+ fi
+ 
+ fn=ethercodes.dat
+ url=https://standards-oui.ieee.org/oui/oui.csv
+ 
+ cmd1="curl --no-progress-meter ${url}"
+-cmd2=./massagevendor
++cmd2=@sbindir@/massagevendor.py
+ 
+ # Emit exit status of first command in pipe
+ # https://unix.stackexchange.com/a/70675

Reply via email to