summaryrefslogtreecommitdiff
path: root/source3/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
commit6e150a7ca507869df7b639e1a80ba101b1d5771a (patch)
tree2e734c0714fd43bac132fb935c75bb0765e01bf6 /source3/nmbd/nmbd_packets.c
parentd407579b94ee2647d1e51c536534024e5c4c51ad (diff)
downloadsamba-6e150a7ca507869df7b639e1a80ba101b1d5771a.tar.gz
samba-6e150a7ca507869df7b639e1a80ba101b1d5771a.tar.bz2
samba-6e150a7ca507869df7b639e1a80ba101b1d5771a.zip
Fix for bind interfaces only sometimes picking the wrong IP address
for a name query. From Steve Langasek <vorlon@netexpress.net>. Jeremy. (This used to be commit 9890740121ae7bd7a0196bbf946c6f8c82aa7f6e)
Diffstat (limited to 'source3/nmbd/nmbd_packets.c')
-rw-r--r--source3/nmbd/nmbd_packets.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index 05b75e984e..cf00dc9083 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/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;