- correctly fix the -w option and return code of arping (#387881)
This commit is contained in:
parent
029752c346
commit
fe66682113
@ -1,25 +0,0 @@
|
|||||||
--- iputils/arping.c.orig 2001-10-05 18:42:47.000000000 -0400
|
|
||||||
+++ iputils/arping.c 2005-07-13 13:07:45.406217716 -0400
|
|
||||||
@@ -166,10 +166,12 @@ void catcher(void)
|
|
||||||
if (start.tv_sec==0)
|
|
||||||
start = tv;
|
|
||||||
|
|
||||||
- if (count-- == 0 || (timeout && MS_TDIFF(tv,start) > timeout*1000 + 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, &he);
|
|
||||||
if (count == 0 && unsolicited)
|
|
||||||
finish();
|
|
||||||
@@ -510,6 +512,8 @@ main(int argc, char **argv)
|
|
||||||
sigaddset(&sset, SIGINT);
|
|
||||||
sigprocmask(SIG_BLOCK, &sset, &osset);
|
|
||||||
recv_pack(packet, cc, &from);
|
|
||||||
+ if(received == count)
|
|
||||||
+ exit(0);
|
|
||||||
sigprocmask(SIG_SETMASK, &osset, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
65
iputils-20070202-arping_timeout.patch
Normal file
65
iputils-20070202-arping_timeout.patch
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
diff -up iputils-s20070202/arping.c.test_patch iputils-s20070202/arping.c
|
||||||
|
--- iputils-s20070202/arping.c.test_patch 2007-02-02 13:55:46.000000000 +0100
|
||||||
|
+++ iputils-s20070202/arping.c 2008-02-14 14:57:19.000000000 +0100
|
||||||
|
@@ -44,7 +44,8 @@ struct in_addr src, dst;
|
||||||
|
char *target;
|
||||||
|
int dad, unsolicited, advert;
|
||||||
|
int quiet;
|
||||||
|
-int count=-1;
|
||||||
|
+int count;
|
||||||
|
+int forever = 1;
|
||||||
|
int timeout;
|
||||||
|
int unicasting;
|
||||||
|
int s;
|
||||||
|
@@ -53,7 +54,7 @@ int broadcast_only;
|
||||||
|
struct sockaddr_ll me;
|
||||||
|
struct sockaddr_ll he;
|
||||||
|
|
||||||
|
-struct timeval start, last;
|
||||||
|
+struct timeval last;
|
||||||
|
|
||||||
|
int sent, brd_sent;
|
||||||
|
int received, brd_recv, req_recv;
|
||||||
|
@@ -165,13 +166,15 @@ void catcher(void)
|
||||||
|
|
||||||
|
gettimeofday(&tv, NULL);
|
||||||
|
|
||||||
|
- if (start.tv_sec==0)
|
||||||
|
- start = tv;
|
||||||
|
-
|
||||||
|
- if (count-- == 0 || (timeout && MS_TDIFF(tv,start) > timeout*1000 + 500))
|
||||||
|
- finish();
|
||||||
|
+ if (!forever && count == 0) {
|
||||||
|
+ if (timeout && MS_TDIFF(tv, last) > timeout * 1000 + 500)
|
||||||
|
+ finish();
|
||||||
|
+ else if (!timeout)
|
||||||
|
+ finish();
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- if (last.tv_sec==0 || MS_TDIFF(tv,last) > 500) {
|
||||||
|
+ if ((count > 0 || forever) && (last.tv_sec == 0 || MS_TDIFF(tv, last) > 500)) {
|
||||||
|
+ count--;
|
||||||
|
send_pack(s, src, dst, &me, &he);
|
||||||
|
if (count == 0 && unsolicited)
|
||||||
|
finish();
|
||||||
|
@@ -332,6 +335,10 @@ 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);
|
||||||
|
@@ -514,7 +521,8 @@ main(int argc, char **argv)
|
||||||
|
sigaddset(&sset, SIGALRM);
|
||||||
|
sigaddset(&sset, SIGINT);
|
||||||
|
sigprocmask(SIG_BLOCK, &sset, &osset);
|
||||||
|
- recv_pack(packet, cc, &from);
|
||||||
|
+ if (recv_pack(packet, cc, &from) && count == 0 && !forever)
|
||||||
|
+ finish();
|
||||||
|
sigprocmask(SIG_SETMASK, &osset, NULL);
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
Summary: Network monitoring tools including ping
|
Summary: Network monitoring tools including ping
|
||||||
Name: iputils
|
Name: iputils
|
||||||
Version: 20070202
|
Version: 20070202
|
||||||
Release: 7%{?dist}
|
Release: 8%{?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
|
||||||
@ -14,13 +14,13 @@ Patch4: iputils-20020927-addrcache.patch
|
|||||||
Patch5: iputils-20020927-ping-subint.patch
|
Patch5: iputils-20020927-ping-subint.patch
|
||||||
Patch9: iputils-20020927-unaligned.patch
|
Patch9: iputils-20020927-unaligned.patch
|
||||||
Patch13: iputils-20020927-ia64_align.patch
|
Patch13: iputils-20020927-ia64_align.patch
|
||||||
Patch15: iputils-20020927-12-arping.patch
|
|
||||||
Patch21: iputils-ping_cleanup.patch
|
Patch21: iputils-ping_cleanup.patch
|
||||||
Patch22: iputils-ifenslave.patch
|
Patch22: iputils-ifenslave.patch
|
||||||
Patch25: iputils-20020927-arping-infiniband.patch
|
Patch25: iputils-20020927-arping-infiniband.patch
|
||||||
Patch26: iputils-20070202-idn.patch
|
Patch26: iputils-20070202-idn.patch
|
||||||
Patch27: iputils-20070202-open-max.patch
|
Patch27: iputils-20070202-open-max.patch
|
||||||
Patch28: iputils-20070202-traffic_class.patch
|
Patch28: iputils-20070202-traffic_class.patch
|
||||||
|
Patch29: iputils-20070202-arping_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
|
||||||
@ -47,13 +47,13 @@ the target machine is alive and receiving network traffic.
|
|||||||
%patch5 -p1 -b .ping-subint
|
%patch5 -p1 -b .ping-subint
|
||||||
%patch9 -p1 -b .unaligned
|
%patch9 -p1 -b .unaligned
|
||||||
%patch13 -p1 -b .align
|
%patch13 -p1 -b .align
|
||||||
%patch15 -p1 -b .timeout
|
|
||||||
%patch21 -p1 -b .cleanup
|
%patch21 -p1 -b .cleanup
|
||||||
%patch22 -p1 -b .addr
|
%patch22 -p1 -b .addr
|
||||||
%patch25 -p1 -b .infiniband
|
%patch25 -p1 -b .infiniband
|
||||||
%patch26 -p1 -b .idn
|
%patch26 -p1 -b .idn
|
||||||
%patch27 -p1 -b .open-max
|
%patch27 -p1 -b .open-max
|
||||||
%patch28 -p1 -b .traffic_class
|
%patch28 -p1 -b .traffic_class
|
||||||
|
%patch29 -p1 -b .arping_timeout
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%ifarch s390 s390x
|
%ifarch s390 s390x
|
||||||
@ -154,6 +154,9 @@ rm -rf ${RPM_BUILD_ROOT}
|
|||||||
%{_sysconfdir}/rc.d/init.d/rdisc
|
%{_sysconfdir}/rc.d/init.d/rdisc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Feb 18 2008 Martin Nagy <mnagy@redhat.com> - 20070202-8
|
||||||
|
- correctly fix the -w option and return code of arping (#387881)
|
||||||
|
|
||||||
* Fri Feb 01 2008 Martin Nagy <mnagy@redhat.com> - 20070202-7
|
* Fri Feb 01 2008 Martin Nagy <mnagy@redhat.com> - 20070202-7
|
||||||
- fix -Q option of ping6 (#213544)
|
- fix -Q option of ping6 (#213544)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user