fprintf(stderr, "Could not restart MeshLink: %s\n", meshlink_strerror(meshlink_errno));
exit(1);
}
+ } else if(!strcasecmp(buf, "scan")) {
+ meshlink_hint_network_change(mesh);
} else if(!strcasecmp(buf, "kick")) {
if(!arg) {
fprintf(stderr, "/kick requires an argument!\n");
void scan_ifaddrs(meshlink_handle_t *mesh) {
#ifdef HAVE_GETIFADDRS
+ logger(mesh, MESHLINK_WARNING, "Calling getifaddrs()");
struct ifaddrs *ifa = NULL;
if(getifaddrs(&ifa) == -1) {
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);
}
freeifaddrs(ifa);
#else
- (void)mesh;
+ logger(mesh, MESHLINK_ERROR, "getifaddrs() not supported");
#endif
}