summaryrefslogtreecommitdiff
path: root/source4/nbt_server
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-02-04 02:05:27 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:09:31 -0500
commit1b27d0ce12c12a6ee4fd208789572442f2edd4fc (patch)
tree718fb533be38b344d7cf85a4f69ddbea8760dfa9 /source4/nbt_server
parent9eb33fc21236942c4b518557be920d4208e6b168 (diff)
downloadsamba-1b27d0ce12c12a6ee4fd208789572442f2edd4fc.tar.gz
samba-1b27d0ce12c12a6ee4fd208789572442f2edd4fc.tar.bz2
samba-1b27d0ce12c12a6ee4fd208789572442f2edd4fc.zip
r5212: added checking for receiving our own packets as broadcasts
(This used to be commit 290dbd8cdcfa6a897647768dcbbd03f22fc7cf36)
Diffstat (limited to 'source4/nbt_server')
-rw-r--r--source4/nbt_server/interfaces.c6
-rw-r--r--source4/nbt_server/packet.c29
2 files changed, 35 insertions, 0 deletions
diff --git a/source4/nbt_server/interfaces.c b/source4/nbt_server/interfaces.c
index 9c26925b32..bb599b4fcd 100644
--- a/source4/nbt_server/interfaces.c
+++ b/source4/nbt_server/interfaces.c
@@ -40,6 +40,12 @@ static void nbtd_request_handler(struct nbt_name_socket *nbtsock,
return;
}
+ /* see if its from one of our own interfaces - if so, then ignore it */
+ if (nbtd_self_packet(nbtsock, packet, src_address, src_port)) {
+ DEBUG(10,("Ignoring self packet from %s:%d\n", src_address, src_port));
+ return;
+ }
+
/* the request is to us in our role as a B node */
switch (packet->operation & NBT_OPCODE) {
case NBT_OPCODE_QUERY:
diff --git a/source4/nbt_server/packet.c b/source4/nbt_server/packet.c
index 337c77f33a..c5ed0b41ce 100644
--- a/source4/nbt_server/packet.c
+++ b/source4/nbt_server/packet.c
@@ -36,3 +36,32 @@ void nbtd_bad_packet(struct nbt_name_packet *packet,
}
}
+
+/*
+ see if an incoming packet is from one of our own interfaces
+*/
+BOOL nbtd_self_packet(struct nbt_name_socket *nbtsock,
+ struct nbt_name_packet *packet,
+ const char *src_address, int src_port)
+{
+ struct nbt_interface *iface = talloc_get_type(nbtsock->incoming.private,
+ struct nbt_interface);
+ struct nbt_server *nbtsrv = iface->nbtsrv;
+
+ if (src_port != lp_nbt_port()) {
+ return False;
+ }
+
+ for (iface=nbtsrv->interfaces;iface;iface=iface->next) {
+ if (strcmp(src_address, iface->ip_address) == 0) {
+ return True;
+ }
+ }
+
+ if (nbtsrv->bcast_interface &&
+ strcmp(src_address, nbtsrv->bcast_interface->ip_address) == 0) {
+ return True;
+ }
+
+ return False;
+}