X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fdiscovery.c;h=8fc6895e671c8ec32a39d825e0bd25e6de8457c5;hb=c31f626c3a252a0d6805a5f3ca9154d934ea41f5;hp=18919745c2e01d783bf452e5f638c56cf6779e0a;hpb=6cf2bd7b4a69a1b173d52d059aae092343b4c4ed;p=meshlink diff --git a/src/discovery.c b/src/discovery.c index 18919745..8fc6895e 100644 --- a/src/discovery.c +++ b/src/discovery.c @@ -434,6 +434,7 @@ static void addr_del(meshlink_handle_t *mesh, const discovery_address_t *addr) { void scan_ifaddrs(meshlink_handle_t *mesh) { #ifdef HAVE_GETIFADDRS + logger(mesh, MESHLINK_WARNING, "Calling getifaddrs()"); struct ifaddrs *ifa = NULL; if(getifaddrs(&ifa) == -1) { @@ -525,6 +526,13 @@ void scan_ifaddrs(meshlink_handle_t *mesh) { addr.address.sa.sa_family = AF_UNKNOWN; } + if(addr.address.sa.sa_family != AF_UNKNOWN) { + char *host = NULL; + sockaddr2str(sa, &host, NULL); + logger(mesh, MESHLINK_WARNING, "iface %d (%s) address %s", index, ifap->ifa_name, host); + free(host); + } + if(addr.address.sa.sa_family != AF_UNKNOWN) { addr_add(mesh, &addr); } @@ -532,7 +540,7 @@ void scan_ifaddrs(meshlink_handle_t *mesh) { freeifaddrs(ifa); #else - (void)mesh; + logger(mesh, MESHLINK_ERROR, "getifaddrs() not supported"); #endif }