From d0db1a11651748a7544905610587f7ffdc792b16 Mon Sep 17 00:00:00 2001 From: Jiri Skala Date: Fri, 5 Mar 2010 08:54:47 +0000 Subject: [PATCH] - fixes #557308 - arping ignores the deadline option --- iputils-20071127-timeout.patch | 71 ++++++++++++++++++++++++++++++++++ iputils.spec | 7 +++- 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 iputils-20071127-timeout.patch diff --git a/iputils-20071127-timeout.patch b/iputils-20071127-timeout.patch new file mode 100644 index 0000000..a821bd0 --- /dev/null +++ b/iputils-20071127-timeout.patch @@ -0,0 +1,71 @@ +diff -up iputils-s20071127/arping.c.timeout iputils-s20071127/arping.c +--- iputils-s20071127/arping.c.timeout 2010-03-04 17:29:38.723487588 +0100 ++++ iputils-s20071127/arping.c 2010-03-04 17:36:32.586489670 +0100 +@@ -44,8 +44,7 @@ struct in_addr src, dst; + char *target; + int dad, unsolicited, advert; + int quiet; +-int count; +-int forever = 1; ++int count=-1; + int timeout; + int unicasting; + int s; +@@ -59,10 +58,10 @@ int broadcast_only; + struct sockaddr_ll me[2]; + struct sockaddr_ll he[2]; + +-struct timeval last; ++struct timeval start, last; + + int sent, brd_sent; +-int received, brd_recv, req_recv; ++int received=0, brd_recv, req_recv; + + #define SYSFS_MNT_PATH "/sys" + #define SYSFS_CLASS "class" +@@ -179,14 +178,14 @@ void catcher(void) + + gettimeofday(&tv, NULL); + +- if (!forever && count == 0) { +- if (timeout && MS_TDIFF(tv, last) > timeout * 1000 + 500) +- finish(); +- else if (!timeout) +- finish(); +- } ++ if (start.tv_sec==0) ++ start = tv; + +- if ((count > 0 || forever) && (last.tv_sec == 0 || MS_TDIFF(tv, last) > 500)) { ++ if ((timeout && MS_TDIFF(tv,start) > timeout*1000 + 500) || ++ ((count == 0) && (!timeout))) ++ finish(); ++ ++ if (last.tv_sec == 0 || MS_TDIFF(tv, last) > 500) { + count--; + send_pack(s, src, dst, &me[0], &he[0]); + if (count == 0 && unsolicited) +@@ -405,10 +404,6 @@ main(int argc, char **argv) + break; + case 'c': + count = atoi(optarg); +- if (count > 0) +- forever = 0; +- else +- forever = 1; + break; + case 'w': + timeout = atoi(optarg); +@@ -610,8 +605,9 @@ main(int argc, char **argv) + sigaddset(&sset, SIGALRM); + sigaddset(&sset, SIGINT); + sigprocmask(SIG_BLOCK, &sset, &osset); +- if (recv_pack(packet, cc, from) && count == 0 && !forever) +- finish(); ++ recv_pack(packet, cc, &from[0]); ++ if(received == count) ++ exit(0); + sigprocmask(SIG_SETMASK, &osset, NULL); + } + } diff --git a/iputils.spec b/iputils.spec index 3338841..0389619 100644 --- a/iputils.spec +++ b/iputils.spec @@ -1,7 +1,7 @@ Summary: Network monitoring tools including ping Name: iputils Version: 20071127 -Release: 9%{?dist} +Release: 10%{?dist} License: BSD URL: http://www.skbuff.net/iputils Group: System Environment/Daemons @@ -26,6 +26,7 @@ Patch12: iputils-20070202-ia64_align.patch Patch13: iputils-20071127-warnings.patch Patch14: iputils-20071127-typing_bug.patch Patch15: iputils-20071127-corr_type.patch +Patch16: iputils-20071127-timeout.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: docbook-utils perl-SGMLSpm @@ -61,6 +62,7 @@ the target machine is alive and receiving network traffic. %patch13 -p1 -b .warnings %patch14 -p1 -b .typing_bug %patch15 -p1 -b .corr_type +%patch16 -p1 -b .timeout %build %ifarch s390 s390x @@ -150,6 +152,9 @@ rm -rf ${RPM_BUILD_ROOT} %{_sysconfdir}/rc.d/init.d/rdisc %changelog +* Fri Mar 05 2010 Jiri Skala - 20071127-10 +- fixes #557308 - arping ignores the deadline option + * Fri Jul 24 2009 Fedora Release Engineering - 20071127-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild