summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat
diff options
context:
space:
mode:
authorbms <bms@FreeBSD.org>2004-06-16 07:00:50 +0000
committerbms <bms@FreeBSD.org>2004-06-16 07:00:50 +0000
commit6f2c3ad82da733bf2135cc2a015f095309337c84 (patch)
tree11b39a277ba83490f51efab4a7c85dab46eb2b59 /usr.bin/netstat
parent0aa70a0bbc3355e0c99649e3cf2cc53832f17a07 (diff)
downloadFreeBSD-src-6f2c3ad82da733bf2135cc2a015f095309337c84.zip
FreeBSD-src-6f2c3ad82da733bf2135cc2a015f095309337c84.tar.gz
Make netstat(1) more closely follow documented behaviour. If a TCP
socket in LISTEN state happens to be bound to an interface, it will show up in netstat(1) output even without the -a switch. As the definition of "sockets used by server processes" is a difficult one to qualify with regards to UDP, do not change the output behaviour for UDP sockets. PR: bin/26359
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r--usr.bin/netstat/inet.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index fb25bbe..495404e 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -186,7 +186,8 @@ protopr(u_long proto, /* for sysctl version we pass proto # */
continue;
if (!aflag &&
(
- (af1 == AF_INET &&
+ (istcp && tp->t_state == TCPS_LISTEN)
+ || (af1 == AF_INET &&
inet_lnaof(inp->inp_laddr) == INADDR_ANY)
#ifdef INET6
|| (af1 == AF_INET6 &&
OpenPOWER on IntegriCloud