aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2012-02-17 08:17:09 -0800
committerStephen Hemminger <shemminger@vyatta.com>2012-02-17 08:17:09 -0800
commit0df7db3cf431d88953cda6220e76ece39bd0c344 (patch)
tree6265b007f6925a8d84c10f6d9f7ca19600b40839
parent2728f598bbeb6d4b7cc7f65a774ab70fdca04ab4 (diff)
downloadplatform_external_iproute2-0df7db3cf431d88953cda6220e76ece39bd0c344.tar.gz
platform_external_iproute2-0df7db3cf431d88953cda6220e76ece39bd0c344.tar.bz2
platform_external_iproute2-0df7db3cf431d88953cda6220e76ece39bd0c344.zip
arpd: allow configuring polling interval
A new option -p is added to the arpd command that accepts a time indicating the number of seconds to wait between kernel arp table polling attempts. The minimum value is .1 (100ms). If not specified, polling defaults to 30 seconds. Patch by Erik Hugne <erik.hugne@ericsson.com> with modifications
-rw-r--r--man/man8/arpd.85
-rw-r--r--misc/arpd.c14
2 files changed, 15 insertions, 4 deletions
diff --git a/man/man8/arpd.8 b/man/man8/arpd.8
index 37b6ba46..a14044b4 100644
--- a/man/man8/arpd.8
+++ b/man/man8/arpd.8
@@ -4,7 +4,7 @@
arpd \- userspace arp daemon.
.SH SYNOPSIS
-Usage: arpd [ -lkh? ] [ -a N ] [ -b dbase ] [ -B number ] [ -f file ] [ -n time ] [ -R rate ] [ interfaces ]
+Usage: arpd [ -lkh? ] [ -a N ] [ -b dbase ] [ -B number ] [ -f file ] [-p interval ] [ -n time ] [ -R rate ] [ interfaces ]
.SH DESCRIPTION
The
@@ -34,6 +34,9 @@ Suppress sending broadcast queries by kernel. It takes sense together with optio
-n <TIME>
Timeout of negative cache. When resolution fails arpd suppresses further attempts to resolve for this period. It makes sense only together with option -k This timeout should not be too much longer than boot time of a typical host not supporting gratuitous ARP. Default value is 60 seconds.
.TP
+-p <TIME>
+Time to wait in seconds between polling attempts to the kernel ARP table. TIME may be a floating point number. The default value is 30.
+.TP
-R <RATE>
Maximal steady rate of broadcasts sent by arpd in packets per second. Default value is 1.
.TP
diff --git a/misc/arpd.c b/misc/arpd.c
index 4f0021ba..dd1de80c 100644
--- a/misc/arpd.c
+++ b/misc/arpd.c
@@ -90,11 +90,13 @@ int negative_timeout = 60;
int no_kernel_broadcasts;
int broadcast_rate = 1000;
int broadcast_burst = 3000;
+int poll_timeout = 30000;
void usage(void)
{
fprintf(stderr,
-"Usage: arpd [ -lkh? ] [ -a N ] [ -b dbase ] [ -B number ] [ -f file ] [ -n time ] [ -R rate ] [ interfaces ]\n");
+ "Usage: arpd [ -lkh? ] [ -a N ] [ -b dbase ] [ -B number ]"
+ " [ -f file ] [ -n time ] [-p interval ] [ -R rate ] [ interfaces ]\n");
exit(1);
}
@@ -591,7 +593,7 @@ int main(int argc, char **argv)
int do_list = 0;
char *do_load = NULL;
- while ((opt = getopt(argc, argv, "h?b:lf:a:n:kR:B:")) != EOF) {
+ while ((opt = getopt(argc, argv, "h?b:lf:a:n:p:kR:B:")) != EOF) {
switch (opt) {
case 'b':
dbname = optarg;
@@ -615,6 +617,12 @@ int main(int argc, char **argv)
case 'k':
no_kernel_broadcasts = 1;
break;
+ case 'p':
+ if ((poll_timeout = 1000 * strtod(optarg, NULL)) < 100) {
+ fprintf(stderr,"Invalid poll timeout\n");
+ exit(-1);
+ }
+ break;
case 'R':
if ((broadcast_rate = atoi(optarg)) <= 0 ||
(broadcast_rate = 1000/broadcast_rate) <= 0) {
@@ -807,7 +815,7 @@ int main(int argc, char **argv)
}
if (do_stats)
send_stats();
- if (poll(pset, 2, 30000) > 0) {
+ if (poll(pset, 2, poll_timeout) > 0) {
in_poll = 0;
if (pset[0].revents&EVENTS)
get_arp_pkt();