Module Name: src
Committed By: dyoung
Date: Fri Aug 7 18:53:37 UTC 2009
Modified Files:
src/sbin/ifconfig: af_inet6.c extern.h ifconfig.c tunnel.c util.c
Log Message:
Add option -N. -N is just the opposite of option -n in netstat(8)
or route(8): it tells ifconfig(8) to try to resolve numbers to
hosts and service names.
This default ifconfig behavior stays the same as it always was.
To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sbin/ifconfig/af_inet6.c
cvs rdiff -u -r1.13 -r1.14 src/sbin/ifconfig/extern.h
cvs rdiff -u -r1.219 -r1.220 src/sbin/ifconfig/ifconfig.c
cvs rdiff -u -r1.16 -r1.17 src/sbin/ifconfig/tunnel.c
cvs rdiff -u -r1.11 -r1.12 src/sbin/ifconfig/util.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/ifconfig/af_inet6.c
diff -u src/sbin/ifconfig/af_inet6.c:1.23 src/sbin/ifconfig/af_inet6.c:1.24
--- src/sbin/ifconfig/af_inet6.c:1.23 Tue Jul 15 20:56:13 2008
+++ src/sbin/ifconfig/af_inet6.c Fri Aug 7 18:53:37 2009
@@ -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 <sys/cdefs.h>
#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 <sys/param.h>
@@ -278,7 +278,7 @@
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. */
Index: src/sbin/ifconfig/extern.h
diff -u src/sbin/ifconfig/extern.h:1.13 src/sbin/ifconfig/extern.h:1.14
--- src/sbin/ifconfig/extern.h:1.13 Tue Jul 15 20:56:13 2008
+++ src/sbin/ifconfig/extern.h Fri Aug 7 18:53:37 2009
@@ -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_flag(int);
bool get_flag(int);
-extern bool lflag, vflag, zflag;
+extern bool lflag, Nflag, vflag, zflag;
#endif /* _IFCONFIG_EXTERN_H */
Index: src/sbin/ifconfig/ifconfig.c
diff -u src/sbin/ifconfig/ifconfig.c:1.219 src/sbin/ifconfig/ifconfig.c:1.220
--- src/sbin/ifconfig/ifconfig.c:1.219 Tue May 26 16:03:24 2009
+++ src/sbin/ifconfig/ifconfig.c Fri Aug 7 18:53:37 2009
@@ -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 <sys/param.h>
@@ -102,9 +102,9 @@
#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 @@
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 @@
case 'l':
lflag = true;
break;
+ case 'N':
+ Nflag = true;
+ break;
case 's':
sflag = true;
Index: src/sbin/ifconfig/tunnel.c
diff -u src/sbin/ifconfig/tunnel.c:1.16 src/sbin/ifconfig/tunnel.c:1.17
--- src/sbin/ifconfig/tunnel.c:1.16 Tue Jul 15 21:27:58 2008
+++ src/sbin/ifconfig/tunnel.c Fri Aug 7 18:53:37 2009
@@ -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 <sys/cdefs.h>
#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 <sys/param.h>
@@ -157,7 +157,7 @@
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;
Index: src/sbin/ifconfig/util.c
diff -u src/sbin/ifconfig/util.c:1.11 src/sbin/ifconfig/util.c:1.12
--- src/sbin/ifconfig/util.c:1.11 Mon Apr 27 20:10:49 2009
+++ src/sbin/ifconfig/util.c Fri Aug 7 18:53:37 2009
@@ -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 <sys/cdefs.h>
#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 <ctype.h>
@@ -52,6 +52,7 @@
#include <netinet/in.h> /* XXX */
#include "env.h"
+#include "extern.h"
#include "util.h"
int
@@ -279,7 +280,8 @@
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);