--- arping.c 2003-02-13 00:45:26.000000000 -0800
+++ arping.c.new 2003-02-13 00:44:45.000000000 -0800
@@ -38,6 +38,7 @@
char *device="eth0";
int ifindex;
char *source;
+int nobind=0;
struct in_addr src, dst;
char *target;
int dad, unsolicited, advert;
@@ -62,7 +63,7 @@
void usage(void)
{
fprintf(stderr,
- "Usage: arping [-fqbDUAV] [-c count] [-w timeout] [-I device] [-s source] destination\n"
+ "Usage: arping [-fqbDUAVB] [-c count] [-w timeout] [-I device] [-s source] destination\n"
" -f : quit on first reply\n"
" -q : be quiet\n"
" -b : keep broadcasting, don't go unicast\n"
@@ -70,6 +71,7 @@
" -U : Unsolicited ARP mode, update your neighbours\n"
" -A : ARP answer mode, update your neighbours\n"
" -V : print version and exit\n"
+ " -B : do not try to bind to source address\n"
" -c count : how many packets to send\n"
" -w timeout : how long to wait for a reply\n"
" -I device : which ethernet device to use (eth0)\n"
@@ -306,7 +308,7 @@
setuid(uid);
- while ((ch = getopt(argc, argv, "h?bfDUAqc:w:s:I:V")) != EOF) {
+ while ((ch = getopt(argc, argv, "h?bfDUAqc:w:s:I:VB")) != EOF) {
switch(ch) {
case 'b':
broadcast_only=1;
@@ -340,6 +342,9 @@
case 's':
source = optarg;
break;
+ case 'B':
+ nobind = 1;
+ break;
case 'V':
printf("arping utility, iputils-ss%s\n", SNAPSHOT);
exit(0);
@@ -428,7 +433,7 @@
saddr.sin_family = AF_INET;
if (src.s_addr) {
saddr.sin_addr = src;
- if (bind(probe_fd, (struct sockaddr*)&saddr, sizeof(saddr)) == -1) {
+ if (!nobind && bind(probe_fd, (struct sockaddr*)&saddr, sizeof(saddr)) == -1) {
perror("bind");
exit(2);
}