/* converts <addr> and <port> into a string representation of the address and port. This is sort
* of an inverse of str2sa_range, with some restrictions. The supported families are AF_INET,
* AF_INET6, AF_UNIX, and AF_CUST_SOCKPAIR. If the family is unsopported NULL is returned.
+ * If port is special value '-1', then only the address is represented and <map_ports> is ignored.
* If map_ports is true, then the sign of the port is included in the output, to indicate it is
* relative to the incoming port. AF_INET and AF_INET6 will be in the form "<addr>:<port>".
* AF_UNIX will either be just the path (if using a pathname) or "abns@<path>" if it is abstract.
/* converts <addr> and <port> into a string representation of the address and port. This is sort
* of an inverse of str2sa_range, with some restrictions. The supported families are AF_INET,
* AF_INET6, AF_UNIX, and AF_CUST_SOCKPAIR. If the family is unsopported NULL is returned.
+ * If port is special value '-1', then only the address is represented and <map_ports> is ignored.
* If map_ports is true, then the sign of the port is included in the output, to indicate it is
* relative to the incoming port. AF_INET and AF_INET6 will be in the form "<addr>:<port>".
* AF_UNIX will either be just the path (if using a pathname) or "abns@<path>" if it is abstract.
BUG_ON(errno == ENOSPC);
return NULL;
}
+
+ if (port == -1)
+ return strdup(buffer); // address only
+
if (map_ports)
return memprintf(&out, "%s:%+d", buffer, port);
else