summaryrefslogtreecommitdiff
path: root/source4/nbt_server/packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/nbt_server/packet.c')
-rw-r--r--source4/nbt_server/packet.c29
1 files changed, 29 insertions, 0 deletions
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;
+}