Page MenuHomeFreeBSD

D48729.id150206.diff
No OneTemporary

D48729.id150206.diff

diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -207,8 +207,8 @@
int Lflag; /* show size of listen queues */
int mflag; /* show memory stats */
int noutputs = 0; /* how much outputs before we exit */
-int numeric_addr; /* show addresses numerically */
-int numeric_port; /* show ports numerically */
+u_int numeric_addr = 0; /* show addresses numerically */
+bool numeric_port; /* show ports numerically */
int Oflag; /* show nhgrp objects*/
int oflag; /* show nexthop objects*/
int Pflag; /* show TCP log ID */
@@ -361,7 +361,8 @@
nlistf = optarg;
break;
case 'n':
- numeric_addr = numeric_port = 1;
+ numeric_addr++;
+ numeric_port = true;
break;
case 'o':
oflag = 1;
diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h
--- a/usr.bin/netstat/netstat.h
+++ b/usr.bin/netstat/netstat.h
@@ -49,8 +49,8 @@
extern int Lflag; /* show size of listen queues */
extern int mflag; /* show memory stats */
extern int noutputs; /* how much outputs before we exit */
-extern int numeric_addr; /* show addresses numerically */
-extern int numeric_port; /* show ports numerically */
+extern u_int numeric_addr; /* show addresses numerically */
+extern bool numeric_port; /* show ports numerically */
extern int Pflag; /* show TCP log ID */
extern int rflag; /* show routing tables (or routing stats) */
extern int Rflag; /* show flowid / RSS information */
diff --git a/usr.bin/netstat/netstat.1 b/usr.bin/netstat/netstat.1
--- a/usr.bin/netstat/netstat.1
+++ b/usr.bin/netstat/netstat.1
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd July 29, 2024
+.Dd January 29, 2025
.Dt NETSTAT 1
.Os
.Sh NAME
@@ -872,6 +872,12 @@
.Nm
attempts to resolve addresses and ports,
and display them symbolically.
+Specifing
+.Fl n
+twice will also disable printing the keyword
+.Qq Dv default
+for the default IPv4 and IPv6 routes when displaying contents of routing
+tables.
.It Fl W
Wider output; expand address fields, etc, to avoid truncation.
Non-numeric values such as domain names may still be truncated; use the
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -578,7 +578,7 @@
struct netent *np = 0;
in_addr_t i;
- if (!numeric_addr && in == INADDR_ANY && mask == 0) {
+ if (numeric_addr < 2 && in == INADDR_ANY && mask == 0) {
strlcpy(line, "default", sizeof(line));
return (line);
}
@@ -673,7 +673,7 @@
else
masklen = 128;
- if (!numeric_addr && masklen == 0 &&
+ if (numeric_addr < 2 && masklen == 0 &&
IN6_IS_ADDR_UNSPECIFIED(&sa6->sin6_addr))
return("default");

File Metadata

Mime Type
text/plain
Expires
Mon, Jun 8, 8:25 AM (15 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33808701
Default Alt Text
D48729.id150206.diff (2 KB)

Event Timeline