- fixes #557308 - arping ignores the deadline option

This commit is contained in:
Jiri Skala 2010-03-05 08:54:47 +00:00
parent 6501b3f782
commit d0db1a1165
2 changed files with 77 additions and 1 deletions

View File

@ -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);
}
}

View File

@ -1,7 +1,7 @@
Summary: Network monitoring tools including ping Summary: Network monitoring tools including ping
Name: iputils Name: iputils
Version: 20071127 Version: 20071127
Release: 9%{?dist} Release: 10%{?dist}
License: BSD License: BSD
URL: http://www.skbuff.net/iputils URL: http://www.skbuff.net/iputils
Group: System Environment/Daemons Group: System Environment/Daemons
@ -26,6 +26,7 @@ Patch12: iputils-20070202-ia64_align.patch
Patch13: iputils-20071127-warnings.patch Patch13: iputils-20071127-warnings.patch
Patch14: iputils-20071127-typing_bug.patch Patch14: iputils-20071127-typing_bug.patch
Patch15: iputils-20071127-corr_type.patch Patch15: iputils-20071127-corr_type.patch
Patch16: iputils-20071127-timeout.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: docbook-utils perl-SGMLSpm BuildRequires: docbook-utils perl-SGMLSpm
@ -61,6 +62,7 @@ the target machine is alive and receiving network traffic.
%patch13 -p1 -b .warnings %patch13 -p1 -b .warnings
%patch14 -p1 -b .typing_bug %patch14 -p1 -b .typing_bug
%patch15 -p1 -b .corr_type %patch15 -p1 -b .corr_type
%patch16 -p1 -b .timeout
%build %build
%ifarch s390 s390x %ifarch s390 s390x
@ -150,6 +152,9 @@ rm -rf ${RPM_BUILD_ROOT}
%{_sysconfdir}/rc.d/init.d/rdisc %{_sysconfdir}/rc.d/init.d/rdisc
%changelog %changelog
* Fri Mar 05 2010 Jiri Skala <jskala@redhat.com> - 20071127-10
- fixes #557308 - arping ignores the deadline option
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 20071127-9 * Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 20071127-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild