summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIhar Hrachyshka <ihrachys@redhat.com>2018-10-22 21:25:46 +0100
committerSami Kerola <kerolasa@iki.fi>2018-10-22 21:25:46 +0100
commit97926373401e4e794fa90f87b42c6cac9c35daf7 (patch)
tree9545afe053b4af341d7bbcee0bd990a63e4a579d
parentfa1b153b5a8918c34807e6c174396b936bba8e4b (diff)
downloadiputils-97926373401e4e794fa90f87b42c6cac9c35daf7.tar.gz
arping: support -i interval option
This option will allow to set time interval to use between packets sent. It may become handy to work around timing issues in the network. For example, Linux kernel as of the time of writing by default ignores all ARP updates that arrive in 1-second interval since previous update for the same table entry *irrespective of whether the previous update was ignored*. It means that calling apring with -c 3 may still not affect Linux network peers because every consequent update is ignored because of the previous ARP update (that was also ignored). In this scenario, we would now be able to call arping -i 2 to work that kernel behaviour around. Linux fix can be found in: https://patchwork.ozlabs.org/patch/760372/
-rw-r--r--arping.c9
-rw-r--r--doc/arping.xml6
2 files changed, 13 insertions, 2 deletions
diff --git a/arping.c b/arping.c
index 3998d97..80acad0 100644
--- a/arping.c
+++ b/arping.c
@@ -79,6 +79,7 @@ int dad, unsolicited, advert;
int quiet;
int count = -1;
int timeout;
+unsigned int interval = 1;
int unicasting;
int socketfd;
int broadcast_only;
@@ -125,6 +126,7 @@ void usage(void)
" -V print version and exit\n"
" -c <count> how many packets to send\n"
" -w <timeout> how long to wait for a reply\n"
+ " -i <interval> set interval between packets (default: 1 second)\n"
" -I <device> which ethernet device to use"
#ifdef DEFAULT_DEVICE_STR
"(" DEFAULT_DEVICE_STR ")"
@@ -382,7 +384,7 @@ void catcher(void)
* unsolicited mode */
finish();
}
- alarm(1);
+ alarm(interval);
}
void print_hex(unsigned char *p, int len)
@@ -1004,7 +1006,7 @@ main(int argc, char **argv)
disable_capability_raw();
- while ((ch = getopt(argc, argv, "h?bfDUAqc:w:s:I:V")) != EOF) {
+ while ((ch = getopt(argc, argv, "h?bfDUAqc:w:i:s:I:V")) != EOF) {
switch(ch) {
case 'b':
broadcast_only=1;
@@ -1029,6 +1031,9 @@ main(int argc, char **argv)
case 'w':
timeout = atoi(optarg);
break;
+ case 'i':
+ interval = (unsigned int)atoi(optarg);
+ break;
case 'I':
device.name = optarg;
break;
diff --git a/doc/arping.xml b/doc/arping.xml
index a20e3be..0c7db21 100644
--- a/doc/arping.xml
+++ b/doc/arping.xml
@@ -23,6 +23,7 @@
<arg choice='opt'>-AbDfhqUV </arg>
<arg choice='opt'>-c <replaceable>count</replaceable></arg>
<arg choice='opt'>-w <replaceable>deadline</replaceable></arg>
+ <arg choice='opt'>-i <replaceable>interval</replaceable></arg>
<arg choice='opt'>-s <replaceable>source</replaceable></arg>
<arg choice='opt'>-I <replaceable>interface</replaceable></arg>
<arg choice='plain'><replaceable>destination</replaceable></arg>
@@ -133,6 +134,11 @@ expire or until
probes are answered.</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>-i </option><emphasis remap='I'>interval</emphasis></term>
+ <listitem><para>Specify an interval, in seconds, between packets.</para>
+ </listitem>
+ </varlistentry>
</variablelist>
</refsect1>