summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorAravind Srinivasan <aravind.srinivasan@isilon.com>2009-02-04 16:05:36 -0800
committerSteven Danneman <steven.danneman@isilon.com>2009-02-04 20:26:50 -0800
commit83cf98f113541acca5a9b4d6ad084d401b64706f (patch)
treed272a436b2a9e6d084401ca60ee0fb9038195bcf /source3/lib
parent7435b877c7969a72b6b17d3ce4df87c5629882b8 (diff)
downloadsamba-83cf98f113541acca5a9b4d6ad084d401b64706f.tar.gz
samba-83cf98f113541acca5a9b4d6ad084d401b64706f.tar.bz2
samba-83cf98f113541acca5a9b4d6ad084d401b64706f.zip
Have nmbd check all available interfaces for WINS before failing
When nmbd is acting as WINS, it picks the first interface's IP as WINS server's IP. If the first interface's IP is zero, we will just quit (even though we might have other interfaces with valid IPs). This patch makes nmbd look at all interfaces and pick the first interface with a valid IP as the WINS server's IP.
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/interface.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source3/lib/interface.c b/source3/lib/interface.c
index 48fa4d32a9..b32ccb9c56 100644
--- a/source3/lib/interface.c
+++ b/source3/lib/interface.c
@@ -151,7 +151,8 @@ int iface_count_v4_nl(void)
}
/****************************************************************************
- Return a pointer to the in_addr of the first IPv4 interface.
+ Return a pointer to the in_addr of the first IPv4 interface that's
+ not 0.0.0.0.
**************************************************************************/
const struct in_addr *first_ipv4_iface(void)
@@ -159,7 +160,9 @@ const struct in_addr *first_ipv4_iface(void)
struct interface *i;
for (i=local_interfaces;i ;i=i->next) {
- if (i->ip.ss_family == AF_INET) {
+ if ((i->ip.ss_family == AF_INET) &&
+ (!is_zero_ip_v4(((struct sockaddr_in *)&i->ip)->sin_addr)))
+ {
break;
}
}