Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144532428
D54375.1775280281.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
914 B
Referenced Files
None
Subscribers
None
D54375.1775280281.diff
View Options
diff --git a/usr.bin/sockstat/main.c b/usr.bin/sockstat/main.c
--- a/usr.bin/sockstat/main.c
+++ b/usr.bin/sockstat/main.c
@@ -928,6 +928,7 @@
struct sockaddr_un *sun;
char addrstr[NI_MAXHOST] = { '\0', '\0' };
int error, off, port = 0;
+ bool needs_ipv6_brackets = false;
switch (ss->ss_family) {
case AF_INET:
@@ -938,6 +939,8 @@
case AF_INET6:
if (IN6_IS_ADDR_UNSPECIFIED(&sstosin6(ss)->sin6_addr))
addrstr[0] = '*';
+ else
+ needs_ipv6_brackets = true;
port = ntohs(sstosin6(ss)->sin6_port);
break;
case AF_UNIX:
@@ -962,6 +965,11 @@
xo_emit("{:port/%d}", port);
return 0;
}
+ if (needs_ipv6_brackets) {
+ if (port == 0)
+ return (snprintf(buf, bufsize, "[%s]:*", addrstr));
+ return (snprintf(buf, bufsize, "[%s]:%d", addrstr, port));
+ }
if (port == 0)
return snprintf(buf, bufsize, "%s:*", addrstr);
return snprintf(buf, bufsize, "%s:%d", addrstr, port);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 4, 5:24 AM (13 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28258031
Default Alt Text
D54375.1775280281.diff (914 B)
Attached To
Mode
D54375: sockstat: Surround explicit IPv6 addresses with brackets
Attached
Detach File
Event Timeline
Log In to Comment