From 2b286ced87e1dcceabca54cdee08c88d2d0559a2 Mon Sep 17 00:00:00 2001 From: Bruce M Simpson Date: Wed, 16 Jun 2004 07:00:50 +0000 Subject: [PATCH] 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 --- usr.bin/netstat/inet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index fb25bbe6edb..495404eabcc 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 &&