diff options
author | Samba Release Account <samba-bugs@samba.org> | 1996-10-27 14:22:56 +0000 |
---|---|---|
committer | Samba Release Account <samba-bugs@samba.org> | 1996-10-27 14:22:56 +0000 |
commit | f14a7c5ce8864714fa8fa7f8fe8d630a6ab0861f (patch) | |
tree | 6fcdf37e1e643c964d2fee155808dcc3caf190e2 /source3/namepacket.c | |
parent | 697e46373c8fa7b07234f6611c93cf25fe9733ed (diff) | |
download | samba-f14a7c5ce8864714fa8fa7f8fe8d630a6ab0861f.tar.gz samba-f14a7c5ce8864714fa8fa7f8fe8d630a6ab0861f.tar.bz2 samba-f14a7c5ce8864714fa8fa7f8fe8d630a6ab0861f.zip |
severe debugging session for nmbd. in fact, i'm surprised that browsing
in 1.9.16 works at all!
question and resource record types for queries and response netbios
packets sorted out properly (see rfc1002.txt 4.2.1.3).
receipt of browser announcement packets were playing up
lkcl
(This used to be commit b289db62f1a53f1a68ea48dbfa59720cc778d39c)
Diffstat (limited to 'source3/namepacket.c')
-rw-r--r-- | source3/namepacket.c | 103 |
1 files changed, 53 insertions, 50 deletions
diff --git a/source3/namepacket.c b/source3/namepacket.c index e6677ee10d..84b0a1b355 100644 --- a/source3/namepacket.c +++ b/source3/namepacket.c @@ -141,28 +141,29 @@ void initiate_netbios_packet(uint16 *id, make_nmb_name(&nmb->question.question_name,name,name_type,scope); - nmb->question.question_type = quest_type; + nmb->question.question_type = 0x20; nmb->question.question_class = 0x1; if (quest_type == NMB_REG || quest_type == NMB_REG_REFRESH || quest_type == NMB_REL) - { + { nmb->additional = &additional_rec; bzero((char *)nmb->additional,sizeof(*nmb->additional)); nmb->additional->rr_name = nmb->question.question_name; - nmb->additional->rr_type = nmb->question.question_type; - nmb->additional->rr_class = nmb->question.question_class; + nmb->additional->rr_type = 0x20; + nmb->additional->rr_class = 0x1; if (quest_type == NMB_REG || quest_type == NMB_REG_REFRESH) - nmb->additional->ttl = lp_max_ttl(); + nmb->additional->ttl = lp_max_ttl(); else - nmb->additional->ttl = 0; + nmb->additional->ttl = 0; + nmb->additional->rdlength = 6; nmb->additional->rdata[0] = nb_flags; putip(&nmb->additional->rdata[2],(char *)iface_ip(to_ip)); - } + } p.ip = to_ip; p.port = NMB_PORT; @@ -492,58 +493,60 @@ void run_packet_queue() ***************************************************************************/ void listen_for_packets(BOOL run_election) { - fd_set fds; - int selrtn; - struct timeval timeout; + fd_set fds; + int selrtn; + struct timeval timeout; -try_again: + FD_ZERO(&fds); + FD_SET(ClientNMB,&fds); + FD_SET(ClientDGRAM,&fds); - FD_ZERO(&fds); - FD_SET(ClientNMB,&fds); - FD_SET(ClientDGRAM,&fds); + /* during elections and when expecting a netbios response packet we + need to send election packets at tighter intervals - /* during elections and when expecting a netbios response packet we - need to send election packets at tighter intervals + ideally it needs to be the interval (in ms) between time now and + the time we are expecting the next netbios packet */ - ideally it needs to be the interval (in ms) between time now and - the time we are expecting the next netbios packet */ + timeout.tv_sec = (run_election||num_response_packets) ? 1:NMBD_SELECT_LOOP; + timeout.tv_usec = 0; - timeout.tv_sec = (run_election||num_response_packets) ? 1 : NMBD_SELECT_LOOP; - timeout.tv_usec = 0; + selrtn = sys_select(&fds,&timeout); - selrtn = sys_select(&fds,&timeout); - - if (FD_ISSET(ClientNMB,&fds)) - { - struct packet_struct *packet = read_packet(ClientNMB, NMB_PACKET); - if (packet) { - if (ismyip(packet->ip) && - (packet->port == NMB_PORT || packet->port == DGRAM_PORT)) { - DEBUG(7,("discarding own packet from %s:%d\n", - inet_ntoa(packet->ip),packet->port)); - free_packet(packet); - goto try_again; - } else { - queue_packet(packet); + if (FD_ISSET(ClientNMB,&fds)) + { + struct packet_struct *packet = read_packet(ClientNMB, NMB_PACKET); + if (packet) + { + if (ismyip(packet->ip) && packet->port == NMB_PORT) + { + DEBUG(7,("discarding own packet from %s:%d\n", + inet_ntoa(packet->ip),packet->port)); + free_packet(packet); + } + else + { + queue_packet(packet); + } + } } - } - } - if (FD_ISSET(ClientDGRAM,&fds)) - { - struct packet_struct *packet = read_packet(ClientDGRAM, DGRAM_PACKET); - if (packet) { - if (ismyip(packet->ip) && - (packet->port == NMB_PORT || packet->port == DGRAM_PORT)) { - DEBUG(7,("discarding own packet from %s:%d\n", - inet_ntoa(packet->ip),packet->port)); - free_packet(packet); - goto try_again; - } else { - queue_packet(packet); + if (FD_ISSET(ClientDGRAM,&fds)) + { + struct packet_struct *packet = read_packet(ClientDGRAM, DGRAM_PACKET); + if (packet) + { + if (ismyip(packet->ip) && packet->port == DGRAM_PORT) + { + DEBUG(7,("discarding own packet from %s:%d\n", + inet_ntoa(packet->ip),packet->port)); + free_packet(packet); + } + else + { + queue_packet(packet); + } + } } - } - } } |