Let sockaddr2hostname() handle AF_UNSPEC addresses.
authorSven-Haegar Koch <haegar@sdinet.de>
Sun, 17 May 2015 03:29:21 +0000 (05:29 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Sun, 17 May 2015 16:43:34 +0000 (18:43 +0200)
src/netutl.c

index 701a430935db52c145cdb12f5401fbe711d2dcf5..2eebb6445ec5266ccaf36847a44d9dfab027f991 100644 (file)
@@ -121,7 +121,10 @@ char *sockaddr2hostname(const sockaddr_t *sa) {
        char port[NI_MAXSERV] = "unknown";
        int err;
 
-       if(sa->sa.sa_family == AF_UNKNOWN) {
+       if(sa->sa.sa_family == AF_UNSPEC) {
+               xasprintf(&str, "unspec port unspec");
+               return str;
+       } else if(sa->sa.sa_family == AF_UNKNOWN) {
                xasprintf(&str, "%s port %s", sa->unknown.address, sa->unknown.port);
                return str;
        }