From d7bb57e04af16b253f4ee8dbcc39c0d4c549e0ff Mon Sep 17 00:00:00 2001 From: kn Date: Fri, 23 Aug 2019 15:41:59 +0000 Subject: Honour -n when setting entries Just like avoiding reverse lookups when printing entries or not resolving hostnames when deleting entries, make -n effect setting entries as well; just like pfctl(8)'s -N from which the manual wording was copied verbatim. OK deraadt --- usr.sbin/ndp/ndp.8 | 7 ++++--- usr.sbin/ndp/ndp.c | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'usr.sbin/ndp') diff --git a/usr.sbin/ndp/ndp.8 b/usr.sbin/ndp/ndp.8 index d622e584ab5..62cdaa8a2b3 100644 --- a/usr.sbin/ndp/ndp.8 +++ b/usr.sbin/ndp/ndp.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ndp.8,v 1.45 2017/08/09 14:36:00 florian Exp $ +.\" $OpenBSD: ndp.8,v 1.46 2019/08/23 15:41:59 kn Exp $ .\" $KAME: ndp.8,v 1.28 2002/07/17 08:46:33 itojun Exp $ .\" .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: August 9 2017 $ +.Dd $Mdocdate: August 23 2019 $ .Dt NDP 8 .Os .Sh NAME @@ -122,7 +122,8 @@ option for a description of the file format. .It Fl i Ar interface View ND information for the specified interface. .It Fl n -Do not try to resolve numeric addresses to hostnames. +Do not perform domain name resolution. +If a name cannot be resolved without DNS, an error will be reported. .It Xo .Fl s Ar nodename ether_addr .Op Cm temp diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c index 71391565ec1..38d795c3015 100644 --- a/usr.sbin/ndp/ndp.c +++ b/usr.sbin/ndp/ndp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ndp.c,v 1.94 2019/08/22 19:33:57 kn Exp $ */ +/* $OpenBSD: ndp.c,v 1.95 2019/08/23 15:41:59 kn Exp $ */ /* $KAME: ndp.c,v 1.101 2002/07/17 08:46:33 itojun Exp $ */ /* @@ -330,6 +330,8 @@ set(int argc, char **argv) bzero(&hints, sizeof(hints)); hints.ai_family = AF_INET6; + if (nflag) + hints.ai_flags = AI_NUMERICHOST; gai_error = getaddrinfo(host, NULL, &hints, &res); if (gai_error) { warnx("%s: %s", host, gai_strerror(gai_error)); -- cgit v1.2.3-59-g8ed1b