r13007: let our winsclient code register multihomed records with
authorStefan Metzmacher <metze@samba.org>
Wed, 18 Jan 2006 16:36:53 +0000 (16:36 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:51:17 +0000 (13:51 -0500)
our winsserver and don't defend our local name against
our own register packets...

this won gave quite confusing logmessages...

metze

source/nbt_server/defense.c
source/nbt_server/interfaces.c
source/nbt_server/packet.c

index 86b3eb968b8b3d658cac1ca26e2c7c0e354968d3..72ebf0c301b10acb8b493141d9e4acb29ec4e4f1 100644 (file)
@@ -41,6 +41,15 @@ void nbtd_request_defense(struct nbt_name_socket *nbtsock,
        struct nbtd_interface *iface = talloc_get_type(nbtsock->incoming.private, 
                                                       struct nbtd_interface);
 
+       /*
+        * if the packet comes from one of our interfaces
+        * it must be our winsclient trying to reach the winsserver
+        */
+       if (nbtd_self_packet(nbtsock, packet, src)) {
+               nbtd_winsserver_request(nbtsock, packet, src);
+               return;
+       }
+
        NBTD_ASSERT_PACKET(packet, src, packet->qdcount == 1);
        NBTD_ASSERT_PACKET(packet, src, packet->arcount == 1);
        NBTD_ASSERT_PACKET(packet, src, 
index 10bdc0bb14e55cc8591167bfb4fa31e41c507e96..9fdad96b55709890003d13850fdb386b771a99ba 100644 (file)
@@ -42,8 +42,8 @@ static void nbtd_request_handler(struct nbt_name_socket *nbtsock,
        nbtsrv->stats.total_received++;
 
        /* see if its from one of our own interfaces - if so, then ignore it */
-       if (nbtd_self_packet(nbtsock, packet, src)) {
-               DEBUG(10,("Ignoring self packet from %s:%d\n", src->addr, src->port));
+       if (nbtd_self_packet_and_bcast(nbtsock, packet, src)) {
+               DEBUG(10,("Ignoring bcast self packet from %s:%d\n", src->addr, src->port));
                return;
        }
 
index 8909d7bbc44bb69c295145656408d1a0b1f226db..d73a3b027afdd22d0052be101d01c536359e6e18 100644 (file)
@@ -41,28 +41,43 @@ void nbtd_bad_packet(struct nbt_name_packet *packet,
   see if an incoming packet is a broadcast packet from one of our own
   interfaces
 */
-BOOL nbtd_self_packet(struct nbt_name_socket *nbtsock, 
-                     struct nbt_name_packet *packet, 
-                     const struct socket_address *src)
+BOOL nbtd_self_packet_and_bcast(struct nbt_name_socket *nbtsock, 
+                               struct nbt_name_packet *packet, 
+                               const struct socket_address *src)
 {
        struct nbtd_interface *iface = talloc_get_type(nbtsock->incoming.private, 
                                                       struct nbtd_interface);
-       struct nbtd_server *nbtsrv = iface->nbtsrv;
-       
+
        /* if its not a broadcast then its not considered a self packet */
        if (!(packet->operation & NBT_FLAG_BROADCAST)) {
                return False;
        }
 
-       /* if its not from the nbt port, then it wasn't a broadcast from us */
-       if (src->port != lp_nbt_port()) {
+       /* 
+        * this uses the fact that iface->nbtsock is the unicast listen address
+        * if the interface isn't the global bcast interface
+        *
+        * so if the request was directed to the unicast address it isn't a broadcast
+        * message
+        */
+       if (iface->nbtsock == nbtsock &&
+           iface != iface->nbtsrv->bcast_interface) {
                return False;
        }
 
-       /* this uses the fact that iface->nbtsock is our non-broadcast
-          listen address */
-       if (iface->nbtsock == nbtsock &&
-           iface != iface->nbtsrv->bcast_interface) {
+       return nbtd_self_packet(nbtsock, packet, src);
+}
+
+BOOL nbtd_self_packet(struct nbt_name_socket *nbtsock, 
+                     struct nbt_name_packet *packet, 
+                     const struct socket_address *src)
+{
+       struct nbtd_interface *iface = talloc_get_type(nbtsock->incoming.private, 
+                                                      struct nbtd_interface);
+       struct nbtd_server *nbtsrv = iface->nbtsrv;
+       
+       /* if its not from the nbt port, then it wasn't a broadcast from us */
+       if (src->port != lp_nbt_port()) {
                return False;
        }