From a2641cfe00b7857056fd8fd1e020aae7ea817690 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 4 Jun 1996 15:14:47 +0000 Subject: Did more integration of Lukes code ready for the first release. I've now got WINS registration working, and refresh working. Its looking pretty good so far, but needs lots of testing. (This used to be commit 045014aa57721b9701ca379bcab055b908773184) --- source3/nameresp.c | 60 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 27 deletions(-) (limited to 'source3/nameresp.c') diff --git a/source3/nameresp.c b/source3/nameresp.c index a4a55c9f1b..8ed2ba92c4 100644 --- a/source3/nameresp.c +++ b/source3/nameresp.c @@ -245,29 +245,6 @@ uint16 initiate_netbios_packet(int fd,int quest_type,char *name,int name_type, } -void send_name_reg(void) -{ - struct packet_struct p; - struct nmb_packet *nmb = &p.packet.nmb; - int rcode = 0; - - nmb->header.opcode = 5; - nmb->header.response = True; - nmb->header.nm_flags.bcast = False; - nmb->header.nm_flags.recursion_available = CanRecurse; - nmb->header.nm_flags.recursion_desired = CanRecurse; - nmb->header.nm_flags.trunc = False; - nmb->header.nm_flags.authoritative = True; - nmb->header.qdcount = 0; - nmb->header.ancount = 1; - nmb->header.nscount = 0; - nmb->header.arcount = 0; - nmb->header.rcode = rcode; - - send_packet(&p); -} - - /**************************************************************************** wrapper function to override a broadcast message and send it to the WINS name server instead, if it exists. if wins is false, and there has been no @@ -349,7 +326,8 @@ void queue_netbios_packet(int fd,int quest_type,enum cmd_type cmd,char *name, if (id == 0) return; - if ((n = make_name_query_record(cmd,id,fd,name,name_type,bcast,recurse,to_ip))) + if ((n = + make_name_query_record(cmd,id,fd,name,name_type,bcast,recurse,to_ip))) { add_response_record(n); } @@ -453,13 +431,41 @@ void listen_for_packets(BOOL run_election) if (FD_ISSET(ClientNMB,&fds)) { struct packet_struct *packet = read_packet(ClientNMB, NMB_PACKET); - if (packet) queue_packet(packet); + if (packet) { +#if 0 + if (ip_equal(packet->ip,myip) && + (packet->port == NMB_PORT || packet->port == DGRAM_PORT)) { + DEBUG(3,("discarding packet from %s:%d\n", + inet_ntoa(packet->ip),packet->port)); + DEBUG(3,("myip=%s eq=%d\n", + inet_ntoa(myip),ip_equal(packet->ip,myip))); + free_packet(packet); + } else +#endif + { + queue_packet(packet); + } + } } if (FD_ISSET(ClientDGRAM,&fds)) { struct packet_struct *packet = read_packet(ClientDGRAM, DGRAM_PACKET); - if (packet) queue_packet(packet); + if (packet) { +#if 0 + if (ip_equal(packet->ip,myip) && + (packet->port == NMB_PORT || packet->port == DGRAM_PORT)) { + DEBUG(3,("discarding packet from %s:%d\n", + inet_ntoa(packet->ip),packet->port)); + DEBUG(3,("myip=%s eq=%d\n", + inet_ntoa(myip),ip_equal(packet->ip,myip))); + free_packet(packet); + } else +#endif + { + queue_packet(packet); + } + } } } @@ -615,7 +621,7 @@ BOOL send_mailslot_reply(char *mailslot,int fd,char *buf,int len,char *srcname, p.ip = dest_ip; p.port = DGRAM_PORT; - p.fd = fd; + p.fd = ClientDGRAM; p.timestamp = time(NULL); p.packet_type = DGRAM_PACKET; -- cgit