summaryrefslogtreecommitdiffstats
path: root/source/libsmb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-06-27 14:37:17 +0000
committerAndrew Tridgell <tridge@samba.org>2002-06-27 14:37:17 +0000
commit313f2c9ff7a513802e4f893324865e70912d419e (patch)
treea0eb9a93e558db5358c1bce7a76f85caa49cd877 /source/libsmb
parent1e36b7e9620f616590dd9f4f44384272b62605ff (diff)
downloadsamba-313f2c9ff7a513802e4f893324865e70912d419e.tar.gz
samba-313f2c9ff7a513802e4f893324865e70912d419e.tar.xz
samba-313f2c9ff7a513802e4f893324865e70912d419e.zip
The next phase in the WINS rewrite!
We now cope wiith multiple WINS groups and multiple failover servers for release and refresh as well as registration. We also do the regitrations in the same fashion as W2K does, where we don't try to register the next IP in the list for a name until the WINS server has acked the previos IP. This prevents us flooding the WINS server and also seems to make for much more reliable multi-homed registration. I also changed the dead WINS server code to mark pairs of IPs dead, not individual IPs. The idea is that a WINS server might be dead from the point of view of one of our interfaces, but not another, so we need to keep talking to it on one while moving onto a failover WINS server on the other interface. This copes much better with partial LAN outages and weird routing tables.
Diffstat (limited to 'source/libsmb')
-rw-r--r--source/libsmb/namequery.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/source/libsmb/namequery.c b/source/libsmb/namequery.c
index 7cd7d708153..2c6fb2fd711 100644
--- a/source/libsmb/namequery.c
+++ b/source/libsmb/namequery.c
@@ -637,12 +637,12 @@ BOOL name_resolve_bcast(const char *name, int name_type,
/********************************************************
Resolve via "wins" method.
*********************************************************/
-
BOOL resolve_wins(const char *name, int name_type,
struct in_addr **return_iplist, int *return_count)
{
int sock, t, i;
char **wins_tags;
+ struct in_addr src_ip;
*return_iplist = NULL;
*return_count = 0;
@@ -662,15 +662,19 @@ BOOL resolve_wins(const char *name, int name_type,
return False;
}
+ /* the address we will be sending from */
+ src_ip = *interpret_addr2(lp_socket_address());
+
/* in the worst case we will try every wins server with every
tag! */
for (t=0; wins_tags && wins_tags[t]; t++) {
- for (i=0; i<wins_srv_count_tag(wins_tags[t]); i++) {
+ int srv_count = wins_srv_count_tag(wins_tags[t]);
+ for (i=0; i<srv_count; i++) {
struct in_addr wins_ip;
int flags;
BOOL timed_out;
- wins_ip = wins_srv_ip_tag(wins_tags[t]);
+ wins_ip = wins_srv_ip_tag(wins_tags[t], src_ip);
if (global_in_nmbd && ismyip(wins_ip)) {
/* yikes! we'll loop forever */
@@ -678,13 +682,13 @@ BOOL resolve_wins(const char *name, int name_type,
}
/* skip any that have been unresponsive lately */
- if (wins_srv_is_dead(wins_ip)) {
+ if (wins_srv_is_dead(wins_ip, src_ip)) {
continue;
}
DEBUG(3,("resolve_wins: using WINS server %s and tag '%s'\n", inet_ntoa(wins_ip), wins_tags[t]));
- sock = open_socket_in(SOCK_DGRAM, 0, 3, interpret_addr(lp_socket_address()), True);
+ sock = open_socket_in(SOCK_DGRAM, 0, 3, src_ip.s_addr, True);
if (sock == -1) {
continue;
}
@@ -699,7 +703,7 @@ BOOL resolve_wins(const char *name, int name_type,
if (timed_out) {
/* Timed out wating for WINS server to respond. Mark it dead. */
- wins_srv_died(wins_ip);
+ wins_srv_died(wins_ip, src_ip);
} else {
/* The name definately isn't in this
group of WINS servers. goto the next group */