BOOL recurse;
struct in_addr send_ip;
struct in_addr reply_to_ip;
+ int reply_id;
int num_msgs;
NMB_QUERY,NAME_STATUS_DOM_SRV_CHK,
name, type, 0,0,0,
work->work_group,NULL,
- False, False, nr->ip_flgs[0].ip, nr->ip_flgs[0].ip);
+ False, False, nr->ip_flgs[0].ip, nr->ip_flgs[0].ip, 0);
}
}
queue_netbios_packet(d,ClientNMB,NMB_QUERY,
b->local?NAME_QUERY_SYNC_LOCAL:NAME_QUERY_SYNC_REMOTE,
b->name,0x20,0,0,0,NULL,b->group,
- False,False,b->ip,b->ip);
+ False,False,b->ip,b->ip, 0);
b->synced = True;
}
int quest_type, char *name,int type, int nb_flags, time_t ttl,
int server_type, char *my_name, char *my_comment,
BOOL bcast,BOOL recurse,
- struct in_addr send_ip, struct in_addr reply_to_ip)
+ struct in_addr send_ip, struct in_addr reply_to_ip,
+ int reply_id)
{
struct response_record *n;
n->recurse = recurse;
n->send_ip = send_ip;
n->reply_to_ip = reply_to_ip;
+ n->reply_id = reply_id;
if(my_name)
StrnCpy(n->my_name, my_name, sizeof(n->my_name)-1);
else
queue_netbios_packet(d,ClientNMB,NMB_QUERY,NAME_QUERY_MST_CHK,
work->work_group,0x1d,0,0,0,NULL,NULL,
- True,False,d->bcast_ip,d->bcast_ip);
+ True,False,d->bcast_ip,d->bcast_ip, 0);
}
}
}
BOOL CanRecurse = True;
extern pstring scope;
extern struct in_addr wins_ip;
+extern struct in_addr loopback_ip;
static uint16 name_trn_id=0;
}
default:
{
- DEBUG(1,("replying netbios packet: %s %s\n",
+ DEBUG(1,("replying netbios packet: %s %s %s\n",
packet_type, namestr(rr_name), inet_ntoa(p.ip)));
return;
}
}
- DEBUG(4,("replying netbios packet: %s %s\n",
+ DEBUG(4,("replying netbios packet: %s %s %s\n",
packet_type, namestr(rr_name), inet_ntoa(p.ip)));
nmb->header.name_trn_id = trn_id;
struct packet_struct *packet = read_packet(ClientNMB, NMB_PACKET);
if (packet)
{
- if (ismyip(packet->ip) && packet->port == NMB_PORT)
+ if ((ip_equal(loopback_ip, packet->ip) ||
+ ismyip(packet->ip)) &&
+ packet->port == NMB_PORT)
{
DEBUG(7,("discarding own packet from %s:%d\n",
inet_ntoa(packet->ip),packet->port));
struct packet_struct *packet = read_packet(ClientDGRAM, DGRAM_PACKET);
if (packet)
{
- if (ismyip(packet->ip) && packet->port == DGRAM_PORT)
+ if ((ip_equal(loopback_ip, packet->ip) ||
+ ismyip(packet->ip)) &&
+ packet->port == DGRAM_PORT)
{
DEBUG(7,("discarding own packet from %s:%d\n",
inet_ntoa(packet->ip),packet->port));
wanted the unique name and tell them that they can have it
*/
- add_name_respond(d,n->fd,d->myip, n->response_id ,&n->name,
+ add_name_respond(d,n->fd,d->myip, n->reply_id ,&n->name,
n->nb_flags, GET_TTL(0),
n->reply_to_ip, True, n->reply_to_ip);
return queue_netbios_packet(wins_subnet,fd, quest_type, state,
name, name_type, nb_flags, ttl,
server_type,my_name,my_comment,
- False, True, send_ip, reply_to_ip);
+ False, True, send_ip, reply_to_ip, 0);
}
int name_type,int nb_flags, time_t ttl,
int server_type, char *my_name, char *my_comment,
BOOL bcast,BOOL recurse,
- struct in_addr send_ip, struct in_addr reply_to_ip)
+ struct in_addr send_ip, struct in_addr reply_to_ip,
+ int reply_id)
{
struct response_record *n;
uint16 id = 0xffff;
if ((n = make_response_queue_record(state,id,fd,
quest_type,name,name_type,nb_flags,ttl,
server_type,my_name, my_comment,
- bcast,recurse,send_ip,reply_to_ip)))
+ bcast,recurse,send_ip,reply_to_ip,
+ reply_id)))
{
add_response_record(d,n);
return n;
/* local interface: release them on the network */
queue_netbios_packet(d,ClientNMB,NMB_REL,NAME_RELEASE,
name, type, 0, 0,0,NULL,NULL,
- True, False, d->bcast_ip, d->bcast_ip);
+ True, False, d->bcast_ip, d->bcast_ip, 0);
}
}
queue_netbios_packet(d,ClientNMB,
re_reg ? NMB_REG_REFRESH : NMB_REG, NAME_REGISTER,
name, type, nb_flags, GET_TTL(0),0,NULL,NULL,
- True, False, d->bcast_ip, ipzero);
+ True, False, d->bcast_ip, ipzero, 0);
}
}
myworkgroup, 0x1b,
0, 0,0,NULL,NULL,
True, False,
- d->bcast_ip, d->bcast_ip);
+ d->bcast_ip, d->bcast_ip, 0);
}
}
}
queue_netbios_packet(d,ClientNMB,NMB_QUERY,NAME_QUERY_CONFIRM,
n->name.name, n->name.name_type,
0,0,0,NULL,NULL,
- False,False,n->ip_flgs[0].ip,n->ip_flgs[0].ip);
+ False,False,n->ip_flgs[0].ip,n->ip_flgs[0].ip,
+ 0);
count++;
}
int name_trn_id, int opcode, BOOL success,
BOOL recursion_available, BOOL recursion_desired,
struct nmb_name *reply_name, int nb_flags, int ttl,
- struct in_addr ip)
+ struct in_addr ip)
{
char rdata[6];
struct packet_struct p;
/* reply yes or no to the host that requested the name */
/* see rfc1002.txt - 4.2.10 and 4.2.11 */
- send_name_response(fd,from_ip, response_id, NMB_REG,
+
+ send_name_response(fd, reply_to_ip, response_id, NMB_REG,
new_owner,
True, True,
name, nb_flags, ttl, reply_to_ip);
reply_name->name,reply_name->name_type,
nb_flags,0,0,NULL,NULL,
False, False,
- n->ip_flgs[0].ip, p->ip);
+ n->ip_flgs[0].ip, p->ip,
+ nmb->header.name_trn_id);
}
else
{
queue_netbios_packet(d,ClientNMB,NMB_STATUS, cmd,
ans_name->name, ans_name->name_type,
0,0,0,n->my_name,NULL,
- False,False,send_ip,n->reply_to_ip);
+ False,False,send_ip,n->reply_to_ip, 0);
}
}
/* register the old or the new owners' ip */
- add_name_respond(d, n->fd, d->myip, n->response_id,&n->name,n->nb_flags,
+ add_name_respond(d, n->fd, d->myip, n->reply_id,&n->name,n->nb_flags,
GET_TTL(0), register_ip,
new_owner, n->reply_to_ip);
+
+ remove_response_record(d,n); /* remove the response record */
}
}
ans_name = &nmb->answers->rr_name;
- DEBUG(3,("response for %s from %s (bcast=%s)\n",
- namestr(ans_name), inet_ntoa(p->ip), BOOLSTR(bcast)));
+ DEBUG(3,("response for %s from %s(%d) (bcast=%s)\n",
+ namestr(ans_name), inet_ntoa(p->ip), p->port, BOOLSTR(bcast)));
debug_rr_type(nmb->answers->rr_type);
queue_netbios_packet(d1,ClientNMB,NMB_QUERY,NAME_QUERY_SRV_CHK,
work->work_group,0x1d,
0,0,0,NULL,NULL,
- False,False,back_ip,back_ip);
+ False,False,back_ip,back_ip,
+ 0);
return;
}
}