Commit 86cdbae6 authored by Jes Sorensen's avatar Jes Sorensen

don't try to delete public ARP entries if already succeeded in deleting a private one - gives such

silly error messages
parent 77f09fe6
...@@ -100,6 +100,7 @@ arp_del(char **args) ...@@ -100,6 +100,7 @@ arp_del(char **args)
struct arpreq req; struct arpreq req;
struct sockaddr sa; struct sockaddr sa;
int flags=0; int flags=0;
int err;
memset((char *) &req, 0, sizeof(req)); memset((char *) &req, 0, sizeof(req));
...@@ -189,13 +190,15 @@ arp_del(char **args) ...@@ -189,13 +190,15 @@ arp_del(char **args)
} }
if (flags == 0) if (flags == 0)
flags = 3; flags = 3;
strcpy(req.arp_dev,device); strcpy(req.arp_dev,device);
err = -1;
/* Call the kernel. */ /* Call the kernel. */
if (flags & 2) { if (flags & 2) {
if (opt_v) fprintf(stderr,"arp: SIOCDARP(nopub)\n"); if (opt_v) fprintf(stderr,"arp: SIOCDARP(nopub)\n");
if (ioctl(sockfd, SIOCDARP, &req) < 0) { if ((err = ioctl(sockfd, SIOCDARP, &req) < 0)) {
if (errno == ENXIO) { if (errno == ENXIO) {
if (flags & 1) if (flags & 1)
goto nopub; goto nopub;
...@@ -207,7 +210,7 @@ arp_del(char **args) ...@@ -207,7 +210,7 @@ arp_del(char **args)
return(-1); return(-1);
} }
} }
if (flags & 1) { if ((flags & 1) && (err)) {
nopub: nopub:
req.arp_flags |= ATF_PUBL; req.arp_flags |= ATF_PUBL;
if (opt_v) fprintf(stderr,"arp: SIOCDARP(pub)\n"); if (opt_v) fprintf(stderr,"arp: SIOCDARP(pub)\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment