[packages/arpwatch] Keep ethercodes on df

arekm arekm at pld-linux.org
Sun Aug 16 20:45:32 CEST 2026


commit ce9cd2cddacf1d100f2624e3411764cae7e6fe9a
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sun Aug 16 20:44:15 2026 +0200

    Keep ethercodes on df

 arpwatch.spec    | 14 ++++++--------
 update-source.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 8 deletions(-)
---
diff --git a/arpwatch.spec b/arpwatch.spec
index c047dbe..66fa463 100644
--- a/arpwatch.spec
+++ b/arpwatch.spec
@@ -1,5 +1,5 @@
 #
-# oui.csv is published without a version, so it is snapshotted by date
+# ethernet vendor table, regenerate with ./update-source.sh
 %define		ouidate	20260816
 #
 Summary:	Arpwatch monitors changes in ethernet/ip address pairings
@@ -17,8 +17,8 @@ Source0:	https://ee.lbl.gov/downloads/%{name}/%{name}-%{version}.tar.gz
 Source1:	%{name}.init
 Source2:	%{name}.sysconfig
 Source3:	%{name}@.service
-Source4:	https://standards-oui.ieee.org/oui/oui.csv?/oui-%{ouidate}.csv
-# Source4-md5:	411302ab553163fc88effb8c3c842951
+Source4:	ethercodes-%{ouidate}.dat.xz
+# Source4-md5:	ee731a1b4a43ed938fcd53f430c1ef6d
 Patch0:		%{name}-time.patch
 Patch1:		%{name}-c99.patch
 Patch2:		%{name}-user.patch
@@ -34,8 +34,8 @@ Patch11:	%{name}-nolocal.patch
 URL:		https://ee.lbl.gov/
 BuildRequires:	autoconf >= 2.71
 BuildRequires:	libpcap-devel
-BuildRequires:	python3
 BuildRequires:	rpmbuild(macros) >= 1.671
+BuildRequires:	xz
 Requires(post,preun):	/sbin/chkconfig
 Requires(post,postun):	systemd-units >= 38
 Requires:	rc-scripts >= 0.2.0
@@ -90,9 +90,6 @@ Dodatkowo tworzona jest baza par adresów ethernet/IP.
 %{__make} \
 	ARPDIR=/var/lib/%{name}
 
-# upstream fetches oui.csv over the network, which is not available here
-%{__python3} massagevendor.py < %{SOURCE4} > ethercodes.dat
-
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,sysconfig},%{systemdunitdir}} \
@@ -108,7 +105,8 @@ install arp2ethers arpfetch $RPM_BUILD_ROOT%{_sbindir}
 install massagevendor.py $RPM_BUILD_ROOT%{_sbindir}/massagevendor
 install bihourly.sh $RPM_BUILD_ROOT%{_sbindir}/bihourly
 install *.awk $RPM_BUILD_ROOT/var/lib/%{name}
-install -m 644 arp.dat ethercodes.dat $RPM_BUILD_ROOT/var/lib/%{name}
+install -m 644 arp.dat $RPM_BUILD_ROOT/var/lib/%{name}
+%{__xz} -dc %{SOURCE4} > $RPM_BUILD_ROOT/var/lib/%{name}/ethercodes.dat
 
 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
diff --git a/update-source.sh b/update-source.sh
new file mode 100755
index 0000000..66315a8
--- /dev/null
+++ b/update-source.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+set -e
+# Regenerate the ethernet vendor table from the current IEEE registry.
+#
+# The IEEE serves oui.csv rows in a random order, so the raw file hashes
+# differently on every fetch and cannot be pinned as a Source. massagevendor
+# sorts its output, so the converted table is stable and an unchanged registry
+# regenerates byte for byte.
+
+specfile=arpwatch.spec
+
+# Work in package dir
+dir=$(dirname "$0")
+cd "$dir"
+
+version=$(awk '/^Version:/{print $2}' $specfile)
+tarball=arpwatch-$version.tar.gz
+[ -f "$tarball" ] || builder -ncs -g $specfile
+
+tmp=$(mktemp -d)
+trap 'rm -rf "$tmp"' EXIT
+
+# massagevendor.py.in is a configure template, so substitute what it needs
+# rather than requiring an installed arpwatch
+tar xzf "$tarball" -C "$tmp" arpwatch-$version/massagevendor.py.in
+sed -e 's|@PYTHON@|/usr/bin/python3|' -e 's|@ZEROPAD@|0|' \
+	"$tmp/arpwatch-$version/massagevendor.py.in" > "$tmp/massagevendor.py"
+
+curl -sSf https://standards-oui.ieee.org/oui/oui.csv \
+	| /usr/bin/python3 "$tmp/massagevendor.py" > "$tmp/ethercodes.dat"
+
+# a truncated download or an error page must not become the shipped table
+entries=$(wc -l < "$tmp/ethercodes.dat")
+if [ "$entries" -lt 30000 ]; then
+	echo >&2 "$0: only $entries entries, refusing to publish"
+	exit 1
+fi
+
+ouidate=$(date -u +%Y%m%d)
+out=ethercodes-$ouidate.dat.xz
+xz -9 < "$tmp/ethercodes.dat" > "$out"
+echo "Updating $specfile: ouidate: $ouidate ($entries entries)"
+
+sed -i -re "s/^[#%](define[ \t]+ouidate[ \t]+)[0-9]+\$/%\1$ouidate/" $specfile
+
+../md5 $specfile
+../dropin "$out"
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/arpwatch.git/commitdiff/ce9cd2cddacf1d100f2624e3411764cae7e6fe9a



More information about the pld-cvs-commit mailing list