diff --git a/sbin/ifconfig/af_inet6.c b/sbin/ifconfig/af_inet6.c index a9149b64f067..1fcdf054e250 100644 --- a/sbin/ifconfig/af_inet6.c +++ b/sbin/ifconfig/af_inet6.c @@ -1,4 +1,4 @@ -/* $NetBSD: af_inet6.c,v 1.23 2008/07/15 20:56:13 dyoung Exp $ */ +/* $NetBSD: af_inet6.c,v 1.24 2009/08/07 18:53:37 dyoung Exp $ */ /* * Copyright (c) 1983, 1993 @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: af_inet6.c,v 1.23 2008/07/15 20:56:13 dyoung Exp $"); +__RCSID("$NetBSD: af_inet6.c,v 1.24 2009/08/07 18:53:37 dyoung Exp $"); #endif /* not lint */ #include @@ -278,7 +278,7 @@ in6_alias(const char *ifname, prop_dictionary_t env, prop_dictionary_t oenv, char hbuf[NI_MAXHOST]; u_int32_t scopeid; int s; - const int niflag = NI_NUMERICHOST; + const int niflag = Nflag ? 0 : NI_NUMERICHOST; unsigned short flags; /* Get the non-alias address for this interface. */ diff --git a/sbin/ifconfig/extern.h b/sbin/ifconfig/extern.h index 4d5be7aaf630..d8ef47990897 100644 --- a/sbin/ifconfig/extern.h +++ b/sbin/ifconfig/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.13 2008/07/15 20:56:13 dyoung Exp $ */ +/* $NetBSD: extern.h,v 1.14 2009/08/07 18:53:37 dyoung Exp $ */ /* * Copyright (c) 1983, 1993 @@ -88,6 +88,6 @@ int register_usage(usage_func_t *); int register_flag(int); bool get_flag(int); -extern bool lflag, vflag, zflag; +extern bool lflag, Nflag, vflag, zflag; #endif /* _IFCONFIG_EXTERN_H */ diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index c36e5b58f9a8..08d7f8d332a7 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $NetBSD: ifconfig.c,v 1.219 2009/05/26 16:03:24 pooka Exp $ */ +/* $NetBSD: ifconfig.c,v 1.220 2009/08/07 18:53:37 dyoung Exp $ */ /*- * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc. @@ -63,7 +63,7 @@ #ifndef lint __COPYRIGHT("@(#) Copyright (c) 1983, 1993\ The Regents of the University of California. All rights reserved."); -__RCSID("$NetBSD: ifconfig.c,v 1.219 2009/05/26 16:03:24 pooka Exp $"); +__RCSID("$NetBSD: ifconfig.c,v 1.220 2009/08/07 18:53:37 dyoung Exp $"); #endif /* not lint */ #include @@ -102,9 +102,9 @@ __RCSID("$NetBSD: ifconfig.c,v 1.219 2009/05/26 16:03:24 pooka Exp $"); #include "env.h" static bool bflag, dflag, hflag, sflag, uflag; -bool lflag, vflag, zflag; +bool lflag, Nflag, vflag, zflag; -static char gflags[10 + 26 * 2 + 1] = "AabCdhlsuvz"; +static char gflags[10 + 26 * 2 + 1] = "AabCdhlNsuvz"; bool gflagset[10 + 26 * 2]; static int carrier(prop_dictionary_t); @@ -550,7 +550,7 @@ main(int argc, char **argv) start = init_parser(); /* Parse command-line options */ - aflag = vflag = zflag = false; + aflag = Nflag = vflag = zflag = false; while ((ch = getopt(argc, argv, gflags)) != -1) { switch (ch) { case 'A': @@ -578,6 +578,9 @@ main(int argc, char **argv) case 'l': lflag = true; break; + case 'N': + Nflag = true; + break; case 's': sflag = true; diff --git a/sbin/ifconfig/tunnel.c b/sbin/ifconfig/tunnel.c index dd5d7e6fa46e..0d372a88429e 100644 --- a/sbin/ifconfig/tunnel.c +++ b/sbin/ifconfig/tunnel.c @@ -1,4 +1,4 @@ -/* $NetBSD: tunnel.c,v 1.16 2008/07/15 21:27:58 dyoung Exp $ */ +/* $NetBSD: tunnel.c,v 1.17 2009/08/07 18:53:37 dyoung Exp $ */ /* * Copyright (c) 1983, 1993 @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: tunnel.c,v 1.16 2008/07/15 21:27:58 dyoung Exp $"); +__RCSID("$NetBSD: tunnel.c,v 1.17 2009/08/07 18:53:37 dyoung Exp $"); #endif /* not lint */ #include @@ -157,7 +157,7 @@ tunnel_status(prop_dictionary_t env, prop_dictionary_t oenv) char srcserv[sizeof(",65535")]; char psrcaddr[NI_MAXHOST]; char pdstaddr[NI_MAXHOST]; - const int niflag = NI_NUMERICHOST|NI_NUMERICSERV; + const int niflag = Nflag ? 0 : (NI_NUMERICHOST|NI_NUMERICSERV); struct if_laddrreq req; const struct afswtch *afp; diff --git a/sbin/ifconfig/util.c b/sbin/ifconfig/util.c index d7b982c8aab1..02c5207244c4 100644 --- a/sbin/ifconfig/util.c +++ b/sbin/ifconfig/util.c @@ -1,4 +1,4 @@ -/* $NetBSD: util.c,v 1.11 2009/04/27 20:10:49 dyoung Exp $ */ +/* $NetBSD: util.c,v 1.12 2009/08/07 18:53:37 dyoung Exp $ */ /*- * Copyright (c) 2008 David Young. All rights reserved. @@ -27,7 +27,7 @@ #include #ifndef lint -__RCSID("$NetBSD: util.c,v 1.11 2009/04/27 20:10:49 dyoung Exp $"); +__RCSID("$NetBSD: util.c,v 1.12 2009/08/07 18:53:37 dyoung Exp $"); #endif /* not lint */ #include @@ -52,6 +52,7 @@ __RCSID("$NetBSD: util.c,v 1.11 2009/04/27 20:10:49 dyoung Exp $"); #include /* XXX */ #include "env.h" +#include "extern.h" #include "util.h" int @@ -279,7 +280,8 @@ print_link_addresses(prop_dictionary_t env, bool print_active_only) continue; if (getnameinfo(ifa->ifa_addr, ifa->ifa_addr->sa_len, - hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) == 0 && + hbuf, sizeof(hbuf), NULL, 0, + Nflag ? 0 : NI_NUMERICHOST) == 0 && hbuf[0] != '\0') { printf("\t%s %s\n", print_active_only ? "address:" : "link", hbuf);