summaryrefslogtreecommitdiffstats
path: root/source/nmbd/nmbd_packets.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-08-30 17:34:35 +0000
committerJeremy Allison <jra@samba.org>2000-08-30 17:34:35 +0000
commit9890740121ae7bd7a0196bbf946c6f8c82aa7f6e (patch)
tree60a6f5cf30c3d76af8caf1900cf5dccf263da197 /source/nmbd/nmbd_packets.c
parent6d081a9017f87f59b7189ba507e211db01c40af5 (diff)
downloadsamba-9890740121ae7bd7a0196bbf946c6f8c82aa7f6e.tar.gz
samba-9890740121ae7bd7a0196bbf946c6f8c82aa7f6e.tar.xz
samba-9890740121ae7bd7a0196bbf946c6f8c82aa7f6e.zip
Fix for bind interfaces only sometimes picking the wrong IP address
for a name query. From Steve Langasek <vorlon@netexpress.net>. Jeremy.
Diffstat (limited to 'source/nmbd/nmbd_packets.c')
-rw-r--r--source/nmbd/nmbd_packets.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/source/nmbd/nmbd_packets.c b/source/nmbd/nmbd_packets.c
index 05b75e984ef..cf00dc9083f 100644
--- a/source/nmbd/nmbd_packets.c
+++ b/source/nmbd/nmbd_packets.c
@@ -699,8 +699,30 @@ struct response_record *queue_query_name( struct subnet_record *subrec,
subrec->bcast_ip)) == NULL)
return NULL;
- if(initiate_name_query_packet( p ) == False)
- {
+ if(lp_bind_interfaces_only()) {
+ int i;
+
+ DEBUG(10,("queue_query_name: bind_interfaces_only is set, looking for suitable source IP\n"));
+ for(i = 0; i < iface_count(); i++) {
+ struct in_addr *ifip = iface_n_ip(i);
+
+ if(ifip == NULL) {
+ DEBUG(0,("queue_query_name: interface %d has NULL IP address !\n", i));
+ continue;
+ }
+
+ if (ip_equal(*ifip,loopback_ip)) {
+ DEBUG(5,("queue_query_name: ignoring loopback interface (%d)\n", i));
+ continue;
+ }
+
+ DEBUG(10,("queue_query_name: using source IP %s\n",inet_ntoa(*ifip)));
+ p->fd = find_subnet_fd_for_address( *ifip );
+ break;
+ }
+ }
+
+ if(initiate_name_query_packet( p ) == False) {
p->locked = False;
free_packet(p);
return NULL;