Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/arp arp: warn if failed to delete a specified arp e...



details:   https://anonhg.NetBSD.org/src/rev/db353154934f
branches:  trunk
changeset: 323991:db353154934f
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Jul 11 03:10:48 2018 +0000

description:
arp: warn if failed to delete a specified arp entry

This restores the original behavior of arp in NetBSD 7.

diffstat:

 usr.sbin/arp/arp.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (42 lines):

diff -r 1d5f97f12d3d -r db353154934f usr.sbin/arp/arp.c
--- a/usr.sbin/arp/arp.c        Wed Jul 11 00:46:39 2018 +0000
+++ b/usr.sbin/arp/arp.c        Wed Jul 11 03:10:48 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arp.c,v 1.61 2018/07/07 15:44:27 christos Exp $ */
+/*     $NetBSD: arp.c,v 1.62 2018/07/11 03:10:48 ozaki-r Exp $ */
 
 /*
  * Copyright (c) 1984, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)arp.c      8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: arp.c,v 1.61 2018/07/07 15:44:27 christos Exp $");
+__RCSID("$NetBSD: arp.c,v 1.62 2018/07/11 03:10:48 ozaki-r Exp $");
 #endif
 #endif /* not lint */
 
@@ -502,6 +502,7 @@
        struct rt_msghdr *rtm;
        struct sockaddr_inarp *sina;
        struct sockaddr_inarp sin_m = blank_sin; /* struct copy */
+       bool found = false;
 
        if (host != NULL) {
                int ret = getinetaddr(host, &sin_m.sin_addr);
@@ -539,12 +540,15 @@
                if (host != NULL &&
                    sina->sin_addr.s_addr != sin_m.sin_addr.s_addr)
                        continue;
+               found = true;
                ret = delete_one(rtm);
                if (vflag && ret == 0) {
                        (void)printf("%s (%s) deleted\n", host,
                            inet_ntoa(sina->sin_addr));
                }
        }
+       if (host != NULL && !found)
+               warnx("delete: can't locate %s", host);
        free(buf);
 }
 



Home | Main Index | Thread Index | Old Index