the last WINS update broke self registration when we are a WINS
authorAndrew Tridgell <tridge@samba.org>
Tue, 9 Jul 2002 14:17:26 +0000 (14:17 +0000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 9 Jul 2002 14:17:26 +0000 (14:17 +0000)
server. The real problem is all the special cases we had for when we
are a wins server as opposed to when we are using a 'real' wins
server.

This patch removes the special cases. We now accept non-broadcast
packets from ourselves and we use ourselves as a wins server when we
are one. This gets rid of the special cases and simplifies things
quite a bit.

It all seems to work, but there are bound to be problems found later.

source/lib/wins_srv.c
source/nmbd/nmbd_packets.c

index 9fd2760612caacc48417b85668f5b4bde9cf541b..adf405ae7e247b55b1f5e339e26e6cdab8129c90 100644 (file)
@@ -71,9 +71,6 @@ static struct wins_dead {
        struct wins_dead *next, *prev;
 } *dead_servers;
 
-/* nmbd sets this */
-BOOL global_in_nmbd = False;
-
 /* an internal convenience structure for an IP with a short string tag
    attached */
 struct tagged_ip {
@@ -161,8 +158,6 @@ unsigned wins_srv_count(void)
        int count = 0;
 
        if (lp_wins_support()) {
-               if (global_in_nmbd) return 0;
-
                /* simple - just talk to ourselves */
                return 1;
        }
@@ -210,7 +205,6 @@ char **wins_srv_tags(void)
        char **list;
 
        if (lp_wins_support()) {
-               if (global_in_nmbd) return NULL;
                /* give the caller something to chew on. This makes
                   the rest of the logic simpler (ie. less special cases) */
                ret = (char **)malloc(sizeof(char *)*2);
@@ -335,7 +329,6 @@ unsigned wins_srv_count_tag(const char *tag)
 
        /* if we are a wins server then we always just talk to ourselves */
        if (lp_wins_support()) {
-               if (global_in_nmbd) return 0;
                return 1;
        }
 
index 64b63627d795547dbaad83934b22f69be000d78d..a20ebf16fde44851aa606882fa3999c27395719f 100644 (file)
@@ -1866,8 +1866,9 @@ BOOL listen_for_packets(BOOL run_election)
                                                   inet_ntoa(packet->ip),packet->port));          
                                          free_packet(packet);
                                  } else if ((ip_equal(loopback_ip, packet->ip) || 
-                                             ismyip(packet->ip)) && packet->port == global_nmb_port) {
-                                         DEBUG(7,("discarding own packet from %s:%d\n",
+                                             ismyip(packet->ip)) && packet->port == global_nmb_port &&
+                                            packet->packet.nmb.header.nm_flags.bcast) {
+                                         DEBUG(7,("discarding own bcast packet from %s:%d\n",
                                                   inet_ntoa(packet->ip),packet->port));          
                                          free_packet(packet);
                                  } else {
@@ -1893,7 +1894,7 @@ BOOL listen_for_packets(BOOL run_election)
                                          free_packet(packet);
                                  } else if ((ip_equal(loopback_ip, packet->ip) || 
                                              ismyip(packet->ip)) && packet->port == DGRAM_PORT) {
-                                         DEBUG(7,("discarding own packet from %s:%d\n",
+                                         DEBUG(7,("discarding own dgram packet from %s:%d\n",
                                                   inet_ntoa(packet->ip),packet->port));          
                                          free_packet(packet);
                                  } else {