From 9968ca4c5bf5c33393b6ac9786cec03b6a2c6174 Mon Sep 17 00:00:00 2001
From: Gerhard Rieger <gerhard@dest-unreach.org>
Date: Wed, 29 Jan 2025 21:51:58 +0100
Subject: [PATCH] Fixed  filan -s  displaying "(stream)" instead of "tcp"

---
 CHANGES  | 3 +++
 fdname.c | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/CHANGES b/CHANGES
index 5a94938..cf9a110 100644
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,9 @@ Security:
 Corrections:
 	Fixed display of option phases in help output.
 
+	filan -s  displayed "(stream)" instead of "tcp" with addresses
+	(regression).
+
 Building:
 	Disabling certain features during configure could break build process.
 
diff --git a/fdname.c b/fdname.c
index 58aa509..af7afc0 100644
--- a/fdname.c
+++ b/fdname.c
@@ -226,7 +226,7 @@ int sockname(int fd, FILE *outfile, char style) {
 #define FDNAME_OPTLEN 256
 #define FDNAME_NAMELEN 256
    socklen_t optlen;
-#if WITH_IP && ( HAVE_GETPROTOBYNUMBER || HAVE_GETPROTOBYNUMBER_R )
+#if (WITH_IP4 || WITH_IP6) && ( HAVE_GETPROTOBYNUMBER || HAVE_GETPROTOBYNUMBER_R )
    struct protoent protoent, *protoentp;
 #endif
 #define PROTONAMEMAX 1024
@@ -278,7 +278,7 @@ int sockname(int fd, FILE *outfile, char style) {
    Getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &optacceptconn, &optlen);
 #endif
 
-#if WITH_IP && ( defined(SO_PROTOCOL) || defined(SO_PROTOTYPE) )
+#if (WITH_IP4 || WITH_IP6) && ( defined(SO_PROTOCOL) || defined(SO_PROTOTYPE) )
 #if HAVE_GETPROTOBYNUMBER_R==1 /* Linux */
    rc = getprotobynumber_r(proto, &protoent, protoname, sizeof(protoname), &protoentp);
    if (protoentp == NULL) {