[PATCH] arping.c
Guillaume GOURAT / NexVision
guillaume.gourat at nexvision.fr
Fri Dec 22 06:03:49 PST 2006
Hi,
Please find a patch for arping :
- correct the interface option: -i to -I
- add an interval option: -i
Regards,
Guillaume GOURAT
diff --unified --recursive --new-file busybox-1.2.2.1/include/usage.h
busybox-1.2.2.1-nx1/include/usage.h
--- busybox-1.2.2.1/include/usage.h 2006-07-01 00:42:10.000000000 +0200
+++ busybox-1.2.2.1-nx1/include/usage.h 2006-12-22 12:19:29.000000000 +0100
@@ -46,7 +46,7 @@
"\t-v\t\tverbosely list files processed"
#define arping_trivial_usage \
- "[-fqbDUA] [-c count] [-w timeout] [-i device] [-s sender] target"
+ "[-fqbDUA] [-c count] [-w timeout] [-I device] [-i interval] [-s
sender] target"
#define arping_full_usage \
"Ping hosts by ARP requests/replies.\n\n" \
"Options:\n" \
@@ -58,7 +58,8 @@
"\t-A\t\tARP answer mode, update your neighbours\n" \
"\t-c count\tStop after sending count ARP request packets\n" \
"\t-w timeout\tTime to wait for ARP reply, in seconds\n" \
- "\t-i device\tOutgoing interface name, default is eth0\n" \
+ "\t-I device\tOutgoing interface name, default is eth0\n" \
+ "\t-i interval\tWait interval seconds between sending each packet,
default is 1\n" \
"\t-s sender\tSet specific sender IP address\n" \
"\ttarget\t\tTarget IP address of ARP request"
diff --unified --recursive --new-file busybox-1.2.2.1/networking/arping.c
busybox-1.2.2.1-nx1/networking/arping.c
--- busybox-1.2.2.1/networking/arping.c 2006-07-29 00:53:44.000000000 +0200
+++ busybox-1.2.2.1-nx1/networking/arping.c 2006-12-22
10:21:16.000000000 +0100
@@ -48,7 +48,7 @@
static int received;
static int brd_recv;
static int req_recv;
-
+static int interval = 1;
#define MS_TDIFF(tv1,tv2) ( ((tv1).tv_sec-(tv2).tv_sec)*1000 + \
((tv1).tv_usec-(tv2).tv_usec)/1000 )
@@ -152,7 +152,7 @@
if (count == 0 && cfg&unsolicited)
finish();
}
- alarm(1);
+ alarm(interval);
}
static int recv_pack(unsigned char *buf, int len, struct sockaddr_ll *FROM)
@@ -279,27 +279,29 @@
{
unsigned long opt;
- char *_count, *_timeout, *_device;
+ char *_device, *_count, *_timeout, *_interval;
/* Dad also sets quit_on_reply.
* Advert also sets unsolicited.
*/
bb_opt_complementally = "Df:AU";
- opt = bb_getopt_ulflags(argc, argv, "DUAqfbc:w:i:s:",
- &_count, &_timeout,
&_device);
+ opt = bb_getopt_ulflags(argc, argv, "DUAqfbI:c:w:i:s:",
+ &_device, &_count,
&_timeout, &_interval);
cfg |= opt & 63; /* set respective flags */
- if (opt & 64) /* count */
- count = atoi(_count);
- if (opt & 128) /* timeout */
- timeout = atoi(_timeout);
- if (opt & 256) { /* interface */
+ if (opt & 64) { /* interface */
if (strlen(_device) > IF_NAMESIZE) {
bb_error_msg_and_die("Interface name `%s'
must be less than %d",
_device,
IF_NAMESIZE);
}
device = _device;
}
- if (opt & 512) /* source */
+ if (opt & 128) /* count */
+ count = atoi(_count);
+ if (opt & 256) /* timeout */
+ timeout = atoi(_timeout);
+ if (opt & 512) /* interval */
+ interval = atoi(_interval);
+ if (opt & 1024) /* source */
source = optarg;
}
argc -= optind;
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch-arping.txt
Url: http://busybox.net/lists/busybox/attachments/20061222/2c49fb78/attachment.txt
More information about the busybox
mailing list