git: 5abf4c8aa762 - stable/13 - sockstat: change check for wildcard sockets to avoid historical classes

From: Mike Karels <karels_at_FreeBSD.org>
Date: Fri, 10 Dec 2021 16:29:16 UTC
The branch stable/13 has been updated by karels:

URL: https://cgit.FreeBSD.org/src/commit/?id=5abf4c8aa7623528aa89889af6a44d45b489df9d

commit 5abf4c8aa7623528aa89889af6a44d45b489df9d
Author:     Mike Karels <karels@FreeBSD.org>
AuthorDate: 2021-10-27 03:12:24 +0000
Commit:     Mike Karels <karels@FreeBSD.org>
CommitDate: 2021-12-10 16:27:24 +0000

    sockstat: change check for wildcard sockets to avoid historical classes
    
    sockstat was checking whether a bound address was "host 0", the lowest
    host on a network, using inet_lnaof().  This only works for class A/B/C.
    However, it isn't useful to bind such an address unless it is really
    the unspecified address INADDR_ANY.  Change the check to to use that.
    
    (cherry picked from commit 64acb29b7d9699c301a55a5431d94374391e4f30)
---
 usr.bin/sockstat/sockstat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c
index 109b254b7438..6edb589b5209 100644
--- a/usr.bin/sockstat/sockstat.c
+++ b/usr.bin/sockstat/sockstat.c
@@ -856,7 +856,7 @@ printaddr(struct sockaddr_storage *ss)
 
 	switch (ss->ss_family) {
 	case AF_INET:
-		if (inet_lnaof(sstosin(ss)->sin_addr) == INADDR_ANY)
+		if (sstosin(ss)->sin_addr.s_addr == INADDR_ANY)
 			addrstr[0] = '*';
 		port = ntohs(sstosin(ss)->sin_port);
 		break;