From 6c7fbd496df19dbc72b25c598b8ef2861b6c6dda Mon Sep 17 00:00:00 2001 From: Jason Tibbitts Date: Nov 27 2018 14:27:27 +0000 Subject: Add patch to pick first running interface. --- diff --git a/iftop-1.0-running-interface.patch b/iftop-1.0-running-interface.patch new file mode 100644 index 0000000..83a4e9c --- /dev/null +++ b/iftop-1.0-running-interface.patch @@ -0,0 +1,13 @@ +diff --git a/options.c b/options.c +index b438d4c..a70cb65 100644 +--- a/options.c ++++ b/options.c +@@ -103,7 +103,7 @@ static char *get_first_interface(void) { + while(nameindex[j].if_index != 0) { + if (strcmp(nameindex[j].if_name, "lo") != 0 && !is_bad_interface_name(nameindex[j].if_name)) { + strncpy(ifr.ifr_name, nameindex[j].if_name, sizeof(ifr.ifr_name)); +- if ((s == -1) || (ioctl(s, SIOCGIFFLAGS, &ifr) == -1) || (ifr.ifr_flags & IFF_UP)) { ++ if ((s == -1) || (ioctl(s, SIOCGIFFLAGS, &ifr) == -1) || (ifr.ifr_flags & IFF_RUNNING)) { + i = xstrdup(nameindex[j].if_name); + break; + } diff --git a/iftop.spec b/iftop.spec index 39fc0d6..41247c7 100644 --- a/iftop.spec +++ b/iftop.spec @@ -1,7 +1,7 @@ Summary: Command line tool that displays bandwidth usage on an interface Name: iftop Version: 1.0 -Release: 0.18.pre4%{?dist} +Release: 0.19.pre4%{?dist} License: GPLv2+ Group: Applications/Internet URL: http://www.ex-parrot.com/~pdw/%{name}/ @@ -10,6 +10,12 @@ Patch0: iftop-1.0-ncursesw.patch Patch1: iftop-1.0-mac-address.patch Patch2: iftop-1.0-dns-resolution.patch BuildRequires: gcc + +# Upstream patch to find first running interface instead of just the first "up" interface. +# https://code.blinkace.com/pdw/iftop/commit/949ed0f7e2c54c598868c270b82c2d702131a339 +# https://bugzilla.redhat.com/show_bug.cgi?id=1403025 +Patch3: iftop-1.0-running-interface.patch + BuildRequires: ncurses-devel, %{_includedir}/pcap.h %description @@ -24,6 +30,7 @@ so slow?". touch -c -r configure.ac{.ncursesw,} %patch1 -p1 -b .mac-address %patch2 -p1 -b .dns-resolution +%patch3 -p1 -b .running-interface %build %configure @@ -41,6 +48,9 @@ make DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p' install %{_mandir}/man8/%{name}.* %changelog +* Tue Nov 27 2018 Jason L Tibbitts III - 1.0-0.19.pre4 +- Add upstream patch to fix interface detection (#1403025) + * Fri Jul 13 2018 Fedora Release Engineering - 1.0-0.18.pre4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild