From f9f72747568f3bfa9c60b61577a75aab6874f72d Mon Sep 17 00:00:00 2001 From: Thomas Oberhammer Date: Fri, 30 Nov 2012 11:22:06 +0100 Subject: Implement gratuitous ARP Allows to send real gratuitous ARP with the destination MAC address field in the ARP frame set to the broadcast address. This is needed because some devices do not update their ARP table if this field is set to zero. Example: arping -i -U Signed-off-by: Thomas Oberhammer Signed-off-by: Roman Hoog Antink --- doc/arping.yodl | 8 ++++++++ src/arping.c | 16 +++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/doc/arping.yodl b/doc/arping.yodl index 62b64f8..9f3bcbe 100644 --- a/doc/arping.yodl +++ b/doc/arping.yodl @@ -84,6 +84,14 @@ mancommand(.sp) $ arping -S -s -p dit(-u) Show index=received/sent instead of just index=received when pinging MACs. + dit(-U) Send unsolicited ARP. This sets the destination MAC address in + the ARP frame to the broadcast address. Unsolicited ARP is used + to update the neighbours' ARP chaches. + + em(Example): + mancommand(.nf) + mancommand(.sp) + $ arping -i -U dit(-v) Verbose output. Use twice for more messages. dit(-w) Time to wait between pings, in microseconds. enddit() diff --git a/src/arping.c b/src/arping.c index 093639e..63385be 100644 --- a/src/arping.c +++ b/src/arping.c @@ -144,6 +144,7 @@ static int beep = 0; /* beep when reply is received. -a */ static int reverse_beep = 0; /* beep when expected reply absent. -e */ static int alsototal = 0; /* print sent as well as received. -u */ static int addr_must_be_same = 0; /* -A */ +static int unsolicited = 0; /* -U */ static int finddup = 0; /* finddup mode. -d */ static int dupfound = 0; /* set to 1 if dup found */ @@ -339,6 +340,7 @@ extended_usage() " \"own\" the MAC address you are using.\n" " -u Show index=received/sent instead of just index=received when\n" " pinging MACs.\n" + " -U Send unsolicited ARP.\n" " -v Verbose output. Use twice for more messages.\n" " -w Time to wait between pings, in microseconds.\n"); printf("Report bugs to: thomas@habets.se\n" @@ -354,7 +356,7 @@ standard_usage() { printf("ARPing %s, by Thomas Habets \n", version); - printf("usage: arping [ -0aAbdDeFpqrRuv ] [ -w ] " + printf("usage: arping [ -0aAbdDeFpqrRuUv ] [ -w ] " "[ -S ]\n" " " "[ -T