nmbd stuff
Stefan (metze) Metzmacher
metze at metzemix.de
Mon Nov 11 13:58:00 GMT 2002
Hi all,
I need help!!! why are there only 0.0.0.0 addresses???
(I modify nmbd a bit to make wrepld working)
here're the structs I use:
-----------------------------------
struct nmb_addr {
struct in_addr ip; /* address of the record */
time_t ttl; /* The time the record should be refreshed. */
struct in_addr owner; /* the adress of the wins server this
record comes from */
};
struct nmb_data {
uint16 nb_flags; /* Netbios flags. */
int wins_flags; /* similar to the netbios flags but
different ! */
struct in_addr owner; /* the adress of the wins server this
record comes from */
SMB_BIG_UINT id; /* unique id */
time_t ttl; /* The time the record must be removed (do not
remove if 0). */
time_t refresh_time; /* The time the record should be refreshed. */
int num_addrs; /* Number of ip_records entries. */
struct nmb_addr *addrs; /* The ip_record list for this name. */
};
/* This structure represents an entry in a local netbios name list. */
struct name_record {
ubi_trNode node[1];
struct subnet_record *subnet;
enum name_source source; /* Where the name came from. */
struct nmb_name name; /* The netbios name. */
struct nmb_data data; /* address,... of the netbios name */
};
---------------------------------------------------------
here the code that didn't work????
struct nmb_record *namerec;
struct nmb_addr *addr_list;
...
/* Copy the IPs. */
namerec->data.num_addrs = num_addrs;
for(i=0;i<num_addrs;i++) {
namerec->data.addrs[i] = addr_list[i];
/* namerec->data.addrs[i].ttl = addr_list[i].ttl;
namerec->data.addrs[i].owner = addr_list[i].owner;
namerec->data.addrs[i].ip = addr_list[i].ip;
*/ DEBUG(0,("NAME: %-19s OWNER: %s/%s IP: %s/%s %s\n",
nmb_namestr(&namerec->name),
inet_ntoa(namerec->data.addrs[i].owner),
inet_ntoa(addr_list[i].owner),
inet_ntoa(namerec->data.addrs[i].ip),
inet_ntoa(addr_list[i].ip),
inet_ntoa(addr_list[0].ip)));
}
/* Data source. */
namerec->source = source;
/* Now add the record to the name list. */
update_name_in_namelist( subrec, namerec );
DEBUG( 3, ( "add_name_to_subnet: Added netbios name %s with first IP %s \
ttl=%d nb_flags=%2x to subnet %s\n",
nmb_namestr( &namerec->name ),
inet_ntoa( addr_list[0].ip ), /* <---- here
it works !!! ???? */
ttl,
(unsigned int)nb_flags,
subrec->subnet_name ) );
-------------------------------
and here the logs:
[2002/11/11 14:48:59, 0] nmbd/nmbd_namelistdb.c:add_name_to_subnet(243)
NAME: *<00> OWNER: 0.0.0.0/0.0.0.0 IP: 0.0.0.0/0.0.0.0 0.0.0.0
[2002/11/11 14:48:59, 3] nmbd/nmbd_namelistdb.c:add_name_to_subnet(269)
add_name_to_subnet: Added netbios name *<00> with first IP 192.168.0.250
ttl=0 nb_flags=60 to subnet WINS_SERVER_SUBNET
the right ip is 192.168.0.250
metze
-----------------------------------------------------------------------------
Stefan "metze" Metzmacher <metze at metzemix.de>
More information about the samba-technical
mailing list