Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F112502248
D48729.id150421.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D48729.id150421.diff
View Options
diff --git a/tests/sys/netinet/fibs_test.sh b/tests/sys/netinet/fibs_test.sh
--- a/tests/sys/netinet/fibs_test.sh
+++ b/tests/sys/netinet/fibs_test.sh
@@ -240,9 +240,9 @@
# Verify that the default route exists for both fibs, with their
# respective interfaces.
- atf_check -o match:"^0\.0\.0\.0.*${TAP0}$" \
+ atf_check -o match:"^default.*${TAP0}$" \
setfib ${FIB0} netstat -rn -f inet
- atf_check -o match:"^0\.0\.0\.0.*${TAP1}$" \
+ atf_check -o match:"^default.*${TAP1}$" \
setfib ${FIB1} netstat -rn -f inet
}
@@ -286,9 +286,9 @@
# Verify that the default route exists for both fibs, with their
# respective interfaces.
- atf_check -o match:"^::/0.*${TAP0}$" \
+ atf_check -o match:"^default.*${TAP0}$" \
setfib ${FIB0} netstat -rn -f inet6
- atf_check -o match:"^::/0.*${TAP1}$" \
+ atf_check -o match:"^default.*${TAP1}$" \
setfib ${FIB1} netstat -rn -f inet6
}
@@ -479,7 +479,7 @@
atf_check -o match:"${SUBNET}:/${MASK}.*\<U\>.*$EPAIRB" \
netstat -rnf inet6 -F $FIB1
# Check default route
- atf_check -o match:"^::/0.*\<UG\>.*$EPAIRB" \
+ atf_check -o match:"default.*\<UG\>.*$EPAIRB" \
netstat -rnf inet6 -F $FIB1
# Check that none of the above routes appeared on other routes
diff --git a/tests/sys/netinet6/ndp.sh b/tests/sys/netinet6/ndp.sh
--- a/tests/sys/netinet6/ndp.sh
+++ b/tests/sys/netinet6/ndp.sh
@@ -163,12 +163,12 @@
while [ -z "$(jexec ${jname} ndp -r)" ]; do
sleep 0.1
done
- atf_check -o match:"^::/0[[:space:]]+fe80:" \
+ atf_check -o match:"^default[[:space:]]+fe80:" \
jexec ${jname} netstat -rn -6
# Get rid of the default route.
jexec ${jname} route -6 flush
- atf_check -o not-match:"^::/0[[:space:]]+fe80:" \
+ atf_check -o not-match:"^default[[:space:]]+fe80:" \
jexec ${jname} netstat -rn -6
# Send another RA, make sure that the default route is installed again.
@@ -180,7 +180,7 @@
while [ -z "$(jexec ${jname} ndp -r)" ]; do
sleep 0.1
done
- atf_check -o match:"^::/0[[:space:]]+fe80:" \
+ atf_check -o match:"^default[[:space:]]+fe80:" \
jexec ${jname} netstat -rn -6
}
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.
+Specifying
+.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
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 19, 11:39 PM (2 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17223660
Default Alt Text
D48729.id150421.diff (4 KB)
Attached To
Mode
D48729: netstat: restore printing the "default" keyword, provide -nn option
Attached
Detach File
Event Timeline
Log In to Comment