Let sockaddr2str() handle AF_UNSPEC addresses.
authorGuus Sliepen <guus@tinc-vpn.org>
Sat, 16 May 2015 00:01:54 +0000 (02:01 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Sat, 16 May 2015 00:01:54 +0000 (02:01 +0200)
src/netutl.c

index bff734e13c79a942d8649642d0c25dd43c2a8f0e..701a430935db52c145cdb12f5401fbe711d2dcf5 100644 (file)
@@ -83,7 +83,13 @@ void sockaddr2str(const sockaddr_t *sa, char **addrstr, char **portstr) {
        char *scopeid;
        int err;
 
-       if(sa->sa.sa_family == AF_UNKNOWN) {
+       if(sa->sa.sa_family == AF_UNSPEC) {
+               if(addrstr)
+                       *addrstr = xstrdup("unspec");
+               if(portstr)
+                       *portstr = xstrdup("unspec");
+               return;
+       } else if(sa->sa.sa_family == AF_UNKNOWN) {
                if(addrstr)
                        *addrstr = xstrdup(sa->unknown.address);
                if(portstr)