diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-02-08 01:09:21 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:09:36 -0500 |
commit | 998c856d9005cd8e1111a939db6fa7b25196b766 (patch) | |
tree | cc562247c591a12fbad4d9fce76c7e816636d511 /source4/nbt_server/interfaces.c | |
parent | 2513ac33de03e4c92f6d4a10595db44700971bb8 (diff) | |
download | samba-998c856d9005cd8e1111a939db6fa7b25196b766.tar.gz samba-998c856d9005cd8e1111a939db6fa7b25196b766.tar.bz2 samba-998c856d9005cd8e1111a939db6fa7b25196b766.zip |
r5276: - added support for NBT_OPCODE_REFRESH2 (type 0x9)
- when registering with a WINS server, initially use multi-homed
registration, then switch to name refresh requests. Send refresh
requests only to the WINS server that responded to our
registration. If that server goes away, then start the registration
from scratch. This makes registration more robust to WINS server
failure.
- send WINS registration requests out on our first interface rather
than an unbound interface, to avoid the problem of WACK replies
being sent to the wrong port (w2k3 WINS server does this)
(This used to be commit f7712ac7468184c07b3e3c10cb7b847ad1791dd2)
Diffstat (limited to 'source4/nbt_server/interfaces.c')
-rw-r--r-- | source4/nbt_server/interfaces.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/source4/nbt_server/interfaces.c b/source4/nbt_server/interfaces.c index 7572e4e336..3cb690b85d 100644 --- a/source4/nbt_server/interfaces.c +++ b/source4/nbt_server/interfaces.c @@ -49,13 +49,14 @@ static void nbtd_request_handler(struct nbt_name_socket *nbtsock, } /* the request is to us in our role as a B node */ - switch (packet->operation & NBT_OPCODE) { + switch ((enum nbt_opcode)(packet->operation & NBT_OPCODE)) { case NBT_OPCODE_QUERY: nbtd_request_query(nbtsock, packet, src_address, src_port); break; case NBT_OPCODE_REGISTER: case NBT_OPCODE_REFRESH: + case NBT_OPCODE_REFRESH2: nbtd_request_defense(nbtsock, packet, src_address, src_port); break; @@ -165,9 +166,6 @@ static NTSTATUS nbtd_add_wins_socket(struct nbtd_server *nbtsrv) iface->nbtsrv = nbtsrv; - iface->nbtsock = nbt_name_socket_init(iface, nbtsrv->task->event_ctx); - NT_STATUS_HAVE_NO_MEMORY(iface->nbtsock); - DLIST_ADD(nbtsrv->wins_interface, iface); return NT_STATUS_OK; @@ -238,21 +236,24 @@ const char **nbtd_address_list(struct nbtd_interface *iface, TALLOC_CTX *mem_ctx struct nbtd_server *nbtsrv = iface->nbtsrv; const char **ret = NULL; struct nbtd_interface *iface2; - int count; + int count = 0; - ret = talloc_array(mem_ctx, const char *, 2); - if (ret == NULL) goto failed; + if (iface->ip_address) { + ret = talloc_array(mem_ctx, const char *, 2); + if (ret == NULL) goto failed; - ret[0] = talloc_strdup(ret, iface->ip_address); - if (ret[0] == NULL) goto failed; - ret[1] = NULL; + ret[0] = talloc_strdup(ret, iface->ip_address); + if (ret[0] == NULL) goto failed; + ret[1] = NULL; - count = 1; + count = 1; + } for (iface2=nbtsrv->interfaces;iface2;iface2=iface2->next) { const char **ret2; - if (strcmp(iface2->ip_address, iface->ip_address) == 0) { + if (iface->ip_address && + strcmp(iface2->ip_address, iface->ip_address) == 0) { continue; } |