Re-fix arping's default device search logic (#879807)

This commit is contained in:
Jan Synacek 2012-11-26 10:59:29 +01:00
parent a0b7493711
commit 01e652aa1d
2 changed files with 14 additions and 35 deletions

View File

@ -1,35 +1,11 @@
From 99e2651c08f6d4ac63fc9d8e4d11f680fa5cc274 Mon Sep 17 00:00:00 2001
From: Jan Synacek <jsynacek@redhat.com>
Date: Thu, 22 Nov 2012 09:42:51 +0100
Subject: [PATCH] arping: Fix find_device_by_ifaddrs()
Look for another device if the device name and the currently found one are the
same, not different.
Also, make checking for the device's flags nonfatal.
Signed-off-by: Jan Synacek <jsynacek@redhat.com>
---
arping.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arping.c b/arping.c
index ff77bec..d0edccf 100644
--- a/arping.c
+++ b/arping.c
@@ -550,10 +550,10 @@ static int find_device_by_ifaddrs(void)
continue;
if (ifa->ifa_addr->sa_family != AF_PACKET)
continue;
- if (device.name && ifa->ifa_name && strcmp(ifa->ifa_name, device.name))
+ if (device.name && ifa->ifa_name && !strcmp(ifa->ifa_name, device.name))
continue;
--- iputils-s20121121/arping.c.orig 2012-11-21 11:32:18.000000000 +0100
+++ iputils-s20121121/arping.c 2012-11-26 10:33:36.457178827 +0100
@@ -66,7 +66,7 @@ static void usage(void) __attribute__((n
- if (check_ifflags(ifa->ifa_flags, device.name != NULL) < 0)
+ if (check_ifflags(ifa->ifa_flags, 0) < 0)
continue;
if (!((struct sockaddr_ll *)ifa->ifa_addr)->sll_halen)
--
1.7.11.7
int quit_on_reply=0;
struct device device = {
- .name = DEFAULT_DEVICE,
+ .name = NULL,
};
char *source;
struct in_addr src, dst;

View File

@ -1,7 +1,7 @@
Summary: Network monitoring tools including ping
Name: iputils
Version: 20121121
Release: 1%{?dist}
Release: 2%{?dist}
# some parts are under the original BSD (ping.c)
# some are under GPLv2+ (tracepath.c)
License: BSD and GPLv2+
@ -149,6 +149,9 @@ mv -f RELNOTES.tmp RELNOTES
%{_sysconfdir}/rc.d/init.d/rdisc
%changelog
* Mon Nov 26 2012 Jan Synáček <jsynacek@redhat.com> - 20121121-2
- Re-fix arping's default device search logic (#879807)
* Thu Nov 22 2012 Jan Synáček <jsynacek@redhat.com> - 20121121-1
- Update to iputils-s20121121, drop unnecessary patches
- Add capabilities to clockdiff and arping