summaryrefslogtreecommitdiff
path: root/source4/nbt_server/interfaces.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-03-25 09:24:53 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:59:11 -0500
commit767685e9fd836d9ea3082855e7d9204ca66f047f (patch)
tree198a4abc1b49323273da0808ed7bf3a5d2d535a3 /source4/nbt_server/interfaces.c
parent3451ba729dad31e7a435908970d58965f08465f7 (diff)
downloadsamba-767685e9fd836d9ea3082855e7d9204ca66f047f.tar.gz
samba-767685e9fd836d9ea3082855e7d9204ca66f047f.tar.bz2
samba-767685e9fd836d9ea3082855e7d9204ca66f047f.zip
r14709: allways use the unicast socket of the interface, when reply to DGRAM
requests... this fixes a bug where I thought windows would try KRB5 via broadcast... metze (This used to be commit 0e7b224294ce6a3b5bbdc284181ab496a5a0c058)
Diffstat (limited to 'source4/nbt_server/interfaces.c')
-rw-r--r--source4/nbt_server/interfaces.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/source4/nbt_server/interfaces.c b/source4/nbt_server/interfaces.c
index e51cd5c6f3..1cfe79bb9f 100644
--- a/source4/nbt_server/interfaces.c
+++ b/source4/nbt_server/interfaces.c
@@ -193,7 +193,6 @@ static NTSTATUS nbtd_add_socket(struct nbtd_server *nbtsrv,
return NT_STATUS_OK;
}
-
/*
setup a socket for talking to our WINS servers
*/
@@ -312,22 +311,39 @@ const char **nbtd_address_list(struct nbtd_interface *iface, TALLOC_CTX *mem_ctx
/*
find the interface to use for sending a outgoing request
*/
-struct nbtd_interface *nbtd_find_interface(struct nbtd_server *nbtd_server,
- const char *address)
+struct nbtd_interface *nbtd_find_request_iface(struct nbtd_server *nbtd_server,
+ const char *address, BOOL allow_bcast_iface)
{
- struct nbtd_interface *iface;
+ struct nbtd_interface *cur;
+
/* try to find a exact match */
- for (iface=nbtd_server->interfaces;iface;iface=iface->next) {
- if (iface_same_net(address, iface->ip_address, iface->netmask)) {
- return iface;
+ for (cur=nbtd_server->interfaces;cur;cur=cur->next) {
+ if (iface_same_net(address, cur->ip_address, cur->netmask)) {
+ return cur;
}
}
/* no exact match, if we have the broadcast interface, use that */
- if (nbtd_server->bcast_interface) {
+ if (allow_bcast_iface && nbtd_server->bcast_interface) {
return nbtd_server->bcast_interface;
}
/* fallback to first interface */
return nbtd_server->interfaces;
}
+
+/*
+ * find the interface to use for sending a outgoing reply
+ */
+struct nbtd_interface *nbtd_find_reply_iface(struct nbtd_interface *iface,
+ const char *address, BOOL allow_bcast_iface)
+{
+ struct nbtd_server *nbtd_server = iface->nbtsrv;
+
+ /* first try to use the given interfacel when it's not the broadcast one */
+ if (iface != nbtd_server->bcast_interface) {
+ return iface;
+ }
+
+ return nbtd_find_request_iface(nbtd_server, address, allow_bcast_iface);
+}