- correctly fix the -w option and return code of arping (#387881)
This commit is contained in:
parent
fe66682113
commit
30468abf14
@ -1,6 +1,7 @@
|
|||||||
--- iputils/Makefile.infiniband 2007-02-22 15:53:04.000000000 +0100
|
diff -up iputils-s20070202/Makefile.infiniband iputils-s20070202/Makefile
|
||||||
+++ iputils/Makefile 2007-02-22 15:55:05.000000000 +0100
|
--- iputils-s20070202/Makefile.infiniband 2008-02-18 16:47:39.000000000 +0100
|
||||||
@@ -45,6 +45,8 @@
|
+++ iputils-s20070202/Makefile 2008-02-18 16:47:39.000000000 +0100
|
||||||
|
@@ -37,6 +37,8 @@ rdisc_srv: rdisc_srv.o
|
||||||
rdisc_srv.o: rdisc.c
|
rdisc_srv.o: rdisc.c
|
||||||
$(CC) $(CFLAGS) -DRDISC_SERVER -o rdisc_srv.o rdisc.c
|
$(CC) $(CFLAGS) -DRDISC_SERVER -o rdisc_srv.o rdisc.c
|
||||||
|
|
||||||
@ -9,9 +10,10 @@
|
|||||||
|
|
||||||
check-kernel:
|
check-kernel:
|
||||||
ifeq ($(KERNEL_INCLUDE),)
|
ifeq ($(KERNEL_INCLUDE),)
|
||||||
--- iputils/arping.c.infiniband 2007-02-22 15:53:04.000000000 +0100
|
diff -up iputils-s20070202/arping.c.infiniband iputils-s20070202/arping.c
|
||||||
+++ iputils/arping.c 2007-02-22 15:53:05.000000000 +0100
|
--- iputils-s20070202/arping.c.infiniband 2008-02-18 16:47:39.000000000 +0100
|
||||||
@@ -29,6 +29,7 @@
|
+++ iputils-s20070202/arping.c 2008-02-18 16:50:44.000000000 +0100
|
||||||
|
@@ -31,6 +31,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
@ -19,7 +21,7 @@
|
|||||||
|
|
||||||
#include "SNAPSHOT.h"
|
#include "SNAPSHOT.h"
|
||||||
|
|
||||||
@@ -48,8 +49,13 @@
|
@@ -50,8 +51,13 @@ int unicasting;
|
||||||
int s;
|
int s;
|
||||||
int broadcast_only;
|
int broadcast_only;
|
||||||
|
|
||||||
@ -35,7 +37,7 @@
|
|||||||
|
|
||||||
struct timeval start, last;
|
struct timeval start, last;
|
||||||
|
|
||||||
@@ -124,7 +130,8 @@
|
@@ -124,7 +130,8 @@ int send_pack(int s, struct in_addr src,
|
||||||
p+=4;
|
p+=4;
|
||||||
|
|
||||||
gettimeofday(&now, NULL);
|
gettimeofday(&now, NULL);
|
||||||
@ -45,16 +47,16 @@
|
|||||||
if (err == p-buf) {
|
if (err == p-buf) {
|
||||||
last = now;
|
last = now;
|
||||||
sent++;
|
sent++;
|
||||||
@@ -174,7 +181,7 @@
|
@@ -172,7 +179,7 @@ void catcher(void)
|
||||||
|
finish();
|
||||||
|
|
||||||
if (last.tv_sec==0 || MS_TDIFF(tv,last) > 500) {
|
if (last.tv_sec==0 || MS_TDIFF(tv,last) > 500) {
|
||||||
count--;
|
|
||||||
- send_pack(s, src, dst, &me, &he);
|
- send_pack(s, src, dst, &me, &he);
|
||||||
+ send_pack(s, src, dst, &me[0], &he[0]);
|
+ send_pack(s, src, dst, &me[0], &he[0]);
|
||||||
if (count == 0 && unsolicited)
|
if (count == 0 && unsolicited)
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
@@ -221,7 +228,7 @@
|
@@ -219,7 +226,7 @@ int recv_pack(unsigned char *buf, int le
|
||||||
return 0;
|
return 0;
|
||||||
if (ah->ar_pln != 4)
|
if (ah->ar_pln != 4)
|
||||||
return 0;
|
return 0;
|
||||||
@ -63,7 +65,7 @@
|
|||||||
return 0;
|
return 0;
|
||||||
if (len < sizeof(*ah) + 2*(4 + ah->ar_hln))
|
if (len < sizeof(*ah) + 2*(4 + ah->ar_hln))
|
||||||
return 0;
|
return 0;
|
||||||
@@ -232,7 +239,7 @@
|
@@ -230,7 +237,7 @@ int recv_pack(unsigned char *buf, int le
|
||||||
return 0;
|
return 0;
|
||||||
if (src.s_addr != dst_ip.s_addr)
|
if (src.s_addr != dst_ip.s_addr)
|
||||||
return 0;
|
return 0;
|
||||||
@ -72,7 +74,7 @@
|
|||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
/* DAD packet was:
|
/* DAD packet was:
|
||||||
@@ -250,7 +257,7 @@
|
@@ -248,7 +255,7 @@ int recv_pack(unsigned char *buf, int le
|
||||||
*/
|
*/
|
||||||
if (src_ip.s_addr != dst.s_addr)
|
if (src_ip.s_addr != dst.s_addr)
|
||||||
return 0;
|
return 0;
|
||||||
@ -81,7 +83,7 @@
|
|||||||
return 0;
|
return 0;
|
||||||
if (src.s_addr && src.s_addr != dst_ip.s_addr)
|
if (src.s_addr && src.s_addr != dst_ip.s_addr)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -266,7 +273,7 @@
|
@@ -264,7 +271,7 @@ int recv_pack(unsigned char *buf, int le
|
||||||
printf("for %s ", inet_ntoa(dst_ip));
|
printf("for %s ", inet_ntoa(dst_ip));
|
||||||
s_printed = 1;
|
s_printed = 1;
|
||||||
}
|
}
|
||||||
@ -90,7 +92,7 @@
|
|||||||
if (!s_printed)
|
if (!s_printed)
|
||||||
printf("for ");
|
printf("for ");
|
||||||
printf("[");
|
printf("[");
|
||||||
@@ -292,7 +299,7 @@
|
@@ -290,7 +297,7 @@ int recv_pack(unsigned char *buf, int le
|
||||||
if (quit_on_reply)
|
if (quit_on_reply)
|
||||||
finish();
|
finish();
|
||||||
if(!broadcast_only) {
|
if(!broadcast_only) {
|
||||||
@ -99,7 +101,7 @@
|
|||||||
unicasting=1;
|
unicasting=1;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@@ -458,9 +465,9 @@
|
@@ -459,9 +466,9 @@ main(int argc, char **argv)
|
||||||
close(probe_fd);
|
close(probe_fd);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -112,7 +114,7 @@
|
|||||||
if (bind(s, (struct sockaddr*)&me, sizeof(me)) == -1) {
|
if (bind(s, (struct sockaddr*)&me, sizeof(me)) == -1) {
|
||||||
perror("bind");
|
perror("bind");
|
||||||
exit(2);
|
exit(2);
|
||||||
@@ -473,14 +480,37 @@
|
@@ -474,14 +481,37 @@ main(int argc, char **argv)
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,7 +156,7 @@
|
|||||||
|
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
printf("ARPING %s ", inet_ntoa(dst));
|
printf("ARPING %s ", inet_ntoa(dst));
|
||||||
@@ -500,7 +530,7 @@
|
@@ -501,7 +531,7 @@ main(int argc, char **argv)
|
||||||
while(1) {
|
while(1) {
|
||||||
sigset_t sset, osset;
|
sigset_t sset, osset;
|
||||||
unsigned char packet[4096];
|
unsigned char packet[4096];
|
||||||
@ -163,12 +165,12 @@
|
|||||||
socklen_t alen = sizeof(from);
|
socklen_t alen = sizeof(from);
|
||||||
int cc;
|
int cc;
|
||||||
|
|
||||||
@@ -513,7 +543,7 @@
|
@@ -514,7 +544,7 @@ main(int argc, char **argv)
|
||||||
sigaddset(&sset, SIGALRM);
|
sigaddset(&sset, SIGALRM);
|
||||||
sigaddset(&sset, SIGINT);
|
sigaddset(&sset, SIGINT);
|
||||||
sigprocmask(SIG_BLOCK, &sset, &osset);
|
sigprocmask(SIG_BLOCK, &sset, &osset);
|
||||||
- recv_pack(packet, cc, &from);
|
- recv_pack(packet, cc, &from);
|
||||||
+ recv_pack(packet, cc, &from[0]);
|
+ recv_pack(packet, cc, &from[0]);
|
||||||
if(received == count)
|
|
||||||
exit(0);
|
|
||||||
sigprocmask(SIG_SETMASK, &osset, NULL);
|
sigprocmask(SIG_SETMASK, &osset, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
diff -up iputils-s20070202/arping.c.test_patch iputils-s20070202/arping.c
|
diff -up iputils-s20070202/arping.c.arping_timeout iputils-s20070202/arping.c
|
||||||
--- iputils-s20070202/arping.c.test_patch 2007-02-02 13:55:46.000000000 +0100
|
--- iputils-s20070202/arping.c.arping_timeout 2008-02-18 16:51:36.000000000 +0100
|
||||||
+++ iputils-s20070202/arping.c 2008-02-14 14:57:19.000000000 +0100
|
+++ iputils-s20070202/arping.c 2008-02-18 16:54:03.000000000 +0100
|
||||||
@@ -44,7 +44,8 @@ struct in_addr src, dst;
|
@@ -45,7 +45,8 @@ struct in_addr src, dst;
|
||||||
char *target;
|
char *target;
|
||||||
int dad, unsolicited, advert;
|
int dad, unsolicited, advert;
|
||||||
int quiet;
|
int quiet;
|
||||||
@ -11,16 +11,16 @@ diff -up iputils-s20070202/arping.c.test_patch iputils-s20070202/arping.c
|
|||||||
int timeout;
|
int timeout;
|
||||||
int unicasting;
|
int unicasting;
|
||||||
int s;
|
int s;
|
||||||
@@ -53,7 +54,7 @@ int broadcast_only;
|
@@ -59,7 +60,7 @@ int broadcast_only;
|
||||||
struct sockaddr_ll me;
|
struct sockaddr_ll me[2];
|
||||||
struct sockaddr_ll he;
|
struct sockaddr_ll he[2];
|
||||||
|
|
||||||
-struct timeval start, last;
|
-struct timeval start, last;
|
||||||
+struct timeval last;
|
+struct timeval last;
|
||||||
|
|
||||||
int sent, brd_sent;
|
int sent, brd_sent;
|
||||||
int received, brd_recv, req_recv;
|
int received, brd_recv, req_recv;
|
||||||
@@ -165,13 +166,15 @@ void catcher(void)
|
@@ -172,13 +173,15 @@ void catcher(void)
|
||||||
|
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
|
|
||||||
@ -39,10 +39,10 @@ diff -up iputils-s20070202/arping.c.test_patch iputils-s20070202/arping.c
|
|||||||
- if (last.tv_sec==0 || MS_TDIFF(tv,last) > 500) {
|
- if (last.tv_sec==0 || MS_TDIFF(tv,last) > 500) {
|
||||||
+ if ((count > 0 || forever) && (last.tv_sec == 0 || MS_TDIFF(tv, last) > 500)) {
|
+ if ((count > 0 || forever) && (last.tv_sec == 0 || MS_TDIFF(tv, last) > 500)) {
|
||||||
+ count--;
|
+ count--;
|
||||||
send_pack(s, src, dst, &me, &he);
|
send_pack(s, src, dst, &me[0], &he[0]);
|
||||||
if (count == 0 && unsolicited)
|
if (count == 0 && unsolicited)
|
||||||
finish();
|
finish();
|
||||||
@@ -332,6 +335,10 @@ main(int argc, char **argv)
|
@@ -339,6 +342,10 @@ main(int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
count = atoi(optarg);
|
count = atoi(optarg);
|
||||||
@ -53,11 +53,11 @@ diff -up iputils-s20070202/arping.c.test_patch iputils-s20070202/arping.c
|
|||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
timeout = atoi(optarg);
|
timeout = atoi(optarg);
|
||||||
@@ -514,7 +521,8 @@ main(int argc, char **argv)
|
@@ -544,7 +551,8 @@ main(int argc, char **argv)
|
||||||
sigaddset(&sset, SIGALRM);
|
sigaddset(&sset, SIGALRM);
|
||||||
sigaddset(&sset, SIGINT);
|
sigaddset(&sset, SIGINT);
|
||||||
sigprocmask(SIG_BLOCK, &sset, &osset);
|
sigprocmask(SIG_BLOCK, &sset, &osset);
|
||||||
- recv_pack(packet, cc, &from);
|
- recv_pack(packet, cc, &from[0]);
|
||||||
+ if (recv_pack(packet, cc, &from) && count == 0 && !forever)
|
+ if (recv_pack(packet, cc, &from) && count == 0 && !forever)
|
||||||
+ finish();
|
+ finish();
|
||||||
sigprocmask(SIG_SETMASK, &osset, NULL);
|
sigprocmask(SIG_SETMASK, &osset, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user