summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-06-17 13:25:22 +0000
committertron <tron@openttd.org>2006-06-17 13:25:22 +0000
commitd9febd1458ca9c53d1d9aa3f0c0e8ffeab3b13a4 (patch)
treeca5fa6580b40153e0ab9431824669c9c1d10b6e3
parent325e460ca9a3c0945337d098f6d1020362eef50f (diff)
downloadopenttd-d9febd1458ca9c53d1d9aa3f0c0e8ffeab3b13a4.tar.xz
(svn r5297) Check the interface flags if IFF_BROADCAST is set before asking for the broadcast address
-rw-r--r--network.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/network.c b/network.c
index bfc5d806f..262a61705 100644
--- a/network.c
+++ b/network.c
@@ -427,7 +427,9 @@ static void NetworkFindIPs(void)
struct ifreq r;
strncpy(r.ifr_name, req->ifr_name, lengthof(r.ifr_name));
- if (ioctl(sock, SIOCGIFBRDADDR, &r) != -1) {
+ if (ioctl(sock, SIOCGIFFLAGS, &r) != -1 &&
+ r.ifr_flags & IFF_BROADCAST &&
+ ioctl(sock, SIOCGIFBRDADDR, &r) != -1) {
_broadcast_list[i++] =
((struct sockaddr_in*)&r.ifr_broadaddr)->sin_addr.s_addr;
}