diff --git a/TODO b/TODO index d678b6fec..44b9bc259 100644 --- a/TODO +++ b/TODO @@ -21,10 +21,6 @@ Akademy must have's: icecream network destroy the fun and are not easy to find manually) Random: -* Option -iiface to specify the interface[s] to listen on for the scheduler, or - to use for the daemon. -* Don't explicitly forbid tunnels because it could be useful for things like - vmware * If someone calls a amd64 client on a host that runs a ia32 daemon and there are no other amd64 daemons in the farm, he will get no answer, but a timeout from scheduler (quite a corner case, but neat) diff --git a/services/comm.cpp b/services/comm.cpp index 364461fb8..7d5e2a481 100644 --- a/services/comm.cpp +++ b/services/comm.cpp @@ -1473,8 +1473,8 @@ static int open_send_broadcast(int port, const char* buf, int size) continue; } - if ((addr->ifa_flags & IFF_POINTOPOINT) || !(addr->ifa_flags & IFF_BROADCAST)) { - log_info() << "ignoring tunnels " << addr->ifa_name << " for broadcast" << endl; + if (!(addr->ifa_flags & IFF_BROADCAST) && !(addr->ifa_flags & IFF_POINTOPOINT)) { + log_info() << "ignoring " << addr->ifa_name << " - has no broadcast address, nor is it point-to-point" << endl; continue; } } else { @@ -1484,15 +1484,23 @@ static int open_send_broadcast(int port, const char* buf, int size) } } - if (addr->ifa_broadaddr) { + sockaddr_in *broad_or_dst_addr = nullptr; + + // both of these flags are never set at the same time + if (addr->ifa_flags & IFF_BROADCAST) + broad_or_dst_addr = (sockaddr_in *)addr->ifa_broadaddr; + if (addr->ifa_flags & IFF_POINTOPOINT) + broad_or_dst_addr = (sockaddr_in *)addr->ifa_dstaddr; + + if (broad_or_dst_addr) { log_info() << "broadcast " << addr->ifa_name << " " - << inet_ntoa(((sockaddr_in *)addr->ifa_broadaddr)->sin_addr) + << inet_ntoa(broad_or_dst_addr->sin_addr) << endl; remote_addr.sin_family = AF_INET; remote_addr.sin_port = htons(port); - remote_addr.sin_addr = ((sockaddr_in *)addr->ifa_broadaddr)->sin_addr; + remote_addr.sin_addr = broad_or_dst_addr->sin_addr; if (sendto(ask_fd, buf, size, 0, (struct sockaddr *)&remote_addr, sizeof(remote_addr)) != size) {