diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.gitignore b/.gitignore index 58a89e1..e8a6050 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,7 @@ dropwatch-1.0.tbz2 dropwatch-1.1-0.tbz2 dropwatch-1.2.tbz2 /dropwatch-1.4.tbz2 +/dropwatch-1.5.tar.gz +/dropwatch-1.5.3.tar.gz +/dropwatch-1.5.4.tar.gz +/dropwatch-1.5.5.tar.gz diff --git a/convert-a-to-m-in-scanf-line.patch b/convert-a-to-m-in-scanf-line.patch deleted file mode 100644 index 2443ae3..0000000 --- a/convert-a-to-m-in-scanf-line.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up ./src/lookup_kas.c.orig ./src/lookup_kas.c ---- ./src/lookup_kas.c.orig 2012-05-30 18:43:23.000000000 -0400 -+++ ./src/lookup_kas.c 2015-07-06 09:03:59.093744007 -0400 -@@ -102,7 +102,7 @@ static int lookup_kas_proc(__u64 pc, str - * - "%pK %c %s\n" (for kernel internal symbols), or - * - "%pK %c %s\t[%s]\n" (for module-provided symbols) - */ -- if (fscanf(pf, "%llx %*s %as [ %*[^]] ]", &ppc, &name) < 0) { -+ if (fscanf(pf, "%llx %*s %ms [ %*[^]] ]", (unsigned long long *)&ppc, &name) < 0) { - perror("Error Scanning File: "); - break; - } diff --git a/dropwatch-linker-fix.patch b/dropwatch-linker-fix.patch deleted file mode 100644 index b9fe6f8..0000000 --- a/dropwatch-linker-fix.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -up ./src/Makefile.linker ./src/Makefile ---- ./src/Makefile.linker 2012-05-30 18:35:40.000000000 -0400 -+++ ./src/Makefile 2018-02-02 07:19:25.625443850 -0500 -@@ -1,6 +1,6 @@ - all: dropwatch - CFLAGS+=-c -g -D_GNU_SOURCE -Wall -Werror `pkg-config --cflags libnl-3.0` --LDFLAGS=-lbfd -lreadline -lnl-3 -lnl-genl-3 -+LDFLAGS+=-lbfd -lreadline -lnl-3 -lnl-genl-3 - OBJFILES := main.o lookup.o\ - lookup_bfd.o lookup_kas.o - diff --git a/dropwatch.spec b/dropwatch.spec index 92d56f4..568b88e 100644 --- a/dropwatch.spec +++ b/dropwatch.spec @@ -1,54 +1,158 @@ -Summary: Kernel dropped packet monitor -Name: dropwatch -Version: 1.4 -Release: 22%{?dist} -Source0: https://fedorahosted.org/releases/d/r/dropwatch/dropwatch-%{version}.tbz2 -URL: http://fedorahosted.org/dropwatch -License: GPLv2+ -Group: Applications/System -BuildRequires: kernel-headers readline-devel -BuildRequires: binutils-devel libnl3-devel pkgconfig -Requires: libnl3, readline +Name: dropwatch +Version: 1.5.5 +Release: 2%{?dist} +Summary: Kernel dropped packet monitor -Patch0: convert-a-to-m-in-scanf-line.patch -Patch1: printf-format-fix.patch -Patch2: dropwatch-linker-fix.patch +License: GPL-2.0-or-later +URL: https://github.com/nhorman/dropwatch +Source0: https://github.com/nhorman/dropwatch/archive/v%{version}/%{name}-%{version}.tar.gz + +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: gcc +BuildRequires: make +BuildRequires: pkgconfig +BuildRequires: libtool +BuildRequires: kernel-headers +BuildRequires: binutils-devel +BuildRequires: libnl3-devel +BuildRequires: libpcap-devel +BuildRequires: readline-devel + +Requires: libnl3 +Requires: readline %description dropwatch is an utility to interface to the kernel to monitor for dropped network packets. %prep -%setup -q -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 +%autosetup -p1 %build -cd src -export CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" -make +./autogen.sh +%configure +%make_build %install -rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT%{_bindir} -mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1 -install -m0755 src/dropwatch $RPM_BUILD_ROOT%{_bindir} -install -m0644 doc/dropwatch.1 $RPM_BUILD_ROOT%{_mandir}/man1 - +%{make_install} %files -%defattr(-,root,root,-) -%{_bindir}/* -%{_mandir}/man1/* -%doc README -%doc COPYING +%{_bindir}/dropwatch +%{_bindir}/dwdump +%{_mandir}/man1/dropwatch.1* +%{_mandir}/man1/dwdump.1* +%doc README.md +%license COPYING %changelog +* Wed Jul 23 2025 Fedora Release Engineering - 1.5.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + +* Wed Apr 30 2025 Hangbin Liu - 1.5.5-1 +- Update to version 1.5.5 +- kas is the default symbol lookup method now +- Fix building without libtool installed +- Misc fixes for kas lookup logic + +* Thu Jan 16 2025 Fedora Release Engineering - 1.5.4-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Wed Jul 17 2024 Fedora Release Engineering - 1.5.4-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Wed Jan 24 2024 Fedora Release Engineering - 1.5.4-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Jan 19 2024 Fedora Release Engineering - 1.5.4-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Tue Nov 14 2023 Hangbin Liu - 1.5.4-5 +- Update License to SPDX format + +* Wed Jul 19 2023 Fedora Release Engineering - 1.5.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Thu Jan 19 2023 Fedora Release Engineering - 1.5.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Thu Jul 21 2022 Fedora Release Engineering - 1.5.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Thu May 5 2022 Hangbin Liu - 1.5.4-1 +- Update to version 1.5.4 +- Support packet drop reason reporting when included in netlink message +- fix some minor compilation warnings/errors +- clean up some comments about deadline support +- convert configure.ac to use AM_PROG_LIBTOOL from outdated LT_INIT +- Fix missing SOL_NETLINK define in glibc < 2.24 +- Fix licensing issues that didn't make sense +- ignore ENOBUFS errors on data socket +- adding arm64 travis ci testing +- man page updates +- move to libnl3 from libnl + +* Sat Jan 29 2022 Hangbin Liu - 1.5.3-8 +- Fix compilation error with gcc 12 + +* Thu Jan 20 2022 Fedora Release Engineering - 1.5.3-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Wed Jul 21 2021 Fedora Release Engineering - 1.5.3-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Mon Jul 12 2021 Hangbin Liu - 1.5.3-5 +- Update spec file +- Update Makefile license +- Update obsoleted m4 macros +- Install new command dwdump + +* Tue Jan 26 2021 Fedora Release Engineering - 1.5.3-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Fri Nov 13 2020 Jeff Law - 1.5.3-3 +- Fix off-by-one buffer overflow caught by gcc-11 + +* Mon Jul 27 2020 Fedora Release Engineering - 1.5.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Thu Mar 19 2020 Neil Horman - 1.5.3-1 +- Update to latest upstream + +* Tue Jan 28 2020 Fedora Release Engineering - 1.5-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Wed Jul 24 2019 Fedora Release Engineering - 1.5-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sun Feb 17 2019 Igor Gnatenko - 1.5-7 +- Rebuild for readline 8.0 + +* Thu Jan 31 2019 Fedora Release Engineering - 1.5-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Thu Jul 12 2018 Fedora Release Engineering - 1.5-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Fri May 18 2018 Neil Horman - 1.5-4 +- add rpm-build to test.yml inventory + +* Fri May 18 2018 Neil Horman - 1.5-3 +- add wget to test.yml inventory + +* Fri May 18 2018 Neil Horman - 1.5-2 +- Make inventory script executable + +* Tue May 15 2018 Neil Horman - 1.5-1 +- Update to latest upstream and add CI harness + +* Tue May 08 2018 Neil Horman - 1.4-23 +- Updated specfile url and source location for github + * Wed Feb 07 2018 Fedora Release Engineering - 1.4-22 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild -* Fri Feb 1 2018 Neil Horman - 1.4-21 +* Thu Feb 01 2018 Neil Horman - 1.4-21 - Fix linker flag recognition (bz 1541058) * Thu Feb 1 2018 Florian Weimer - 1.4-20 diff --git a/plans.fmf b/plans.fmf new file mode 100644 index 0000000..20f21fd --- /dev/null +++ b/plans.fmf @@ -0,0 +1,9 @@ +summary: Run dropwatch selftest +discover: + how: fmf +prepare: + how: install + # install psmisc for killall + package: [dropwatch, psmisc] +execute: + how: tmt diff --git a/printf-format-fix.patch b/printf-format-fix.patch deleted file mode 100644 index 9cc0839..0000000 --- a/printf-format-fix.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up ./src/main.c.fixup ./src/main.c ---- ./src/main.c.fixup 2017-01-13 07:26:06.255896365 -0500 -+++ ./src/main.c 2017-01-13 07:26:34.349677272 -0500 -@@ -333,7 +333,7 @@ void handle_dm_alert_msg(struct netlink_ - printf ("%d drops at location %p\n", alert->points[i].count, location); - else - printf ("%d drops at %s+%llx (%p)\n", -- alert->points[i].count, res.symbol, res.offset, location); -+ alert->points[i].count, res.symbol, (long long unsigned)res.offset, location); - acount++; - if (alimit && (acount == alimit)) { - printf("Alert limit reached, deactivating!\n"); diff --git a/sources b/sources index 649b394..e954bb7 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -5145753b3e9255bd9b190251ba4d3bbf dropwatch-1.4.tbz2 +SHA512 (dropwatch-1.5.5.tar.gz) = b85de34d9b7c1f8232720dd8d4d843cb251ef96d2d9bd592e001d889bd55c2c6821cb8fb3af061bd8e5e2488f9f3aef4c45d1a0c41de3e626bc7c3794c1a4405 diff --git a/tests/main.fmf b/tests/main.fmf new file mode 100644 index 0000000..6189cf3 --- /dev/null +++ b/tests/main.fmf @@ -0,0 +1,2 @@ +summary: Smoke test +test: ./run_tests.sh diff --git a/tests/run_tests.sh b/tests/run_tests.sh new file mode 100755 index 0000000..6777d3c --- /dev/null +++ b/tests/run_tests.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +abort_dropwatch() { + sleep 5 + killall -SIGINT dropwatch +} + +abort_dropwatch & +echo -e "set alertlimit 1\nstart\nstop\nexit" | dropwatch -l kas &> "$TMT_TEST_DATA"/dropwatch.log + +# shellcheck disable=SC2181 +[ $? -eq 0 ] && exit 0 +# If the platform doesn't support NET_DM, skip this test +# Usually we got this issue in container as no privilege permission +grep -q NET_DM "$TMT_TEST_DATA"/dropwatch.log && exit 0 || exit 1