[Samba] Re: problem with nmbd renewing WINS registration
Jeremy Allison
jra at samba.org
Thu Mar 28 17:00:59 GMT 2002
On Thu, Mar 28, 2002 at 09:50:01AM -0700, Jason Barker wrote:
> Here is the full length namelist.debug:
> (The times are now around 16:34-16:54 instead of 10:25 as was in the earlier
> post, that is because I restarted nmbd again yesterday in order to change
> it's log level to 2.)
Try this patch please. I think I may have nailed it....
Jeremy.
-------------- next part --------------
Index: nmbd/nmbd_mynames.c
===================================================================
RCS file: /data/cvs/samba/source/nmbd/nmbd_mynames.c,v
retrieving revision 1.14.4.4
diff -u -r1.14.4.4 nmbd_mynames.c
--- nmbd/nmbd_mynames.c 2002/01/16 19:23:17 1.14.4.4
+++ nmbd/nmbd_mynames.c 2002/03/29 00:43:14
@@ -80,7 +80,36 @@
initiate_myworkgroup_startup(subrec, work);
}
+/*******************************************************************
+ Utility function to add a name to the unicast subnet, or add in
+ our IP address if it already exists.
+******************************************************************/
+static void insert_refresh_name_into_unicast( struct subnet_record *subrec,
+ struct nmb_name *nmbname, uint16 nb_type )
+{
+ struct name_record *namerec;
+
+ if (!we_are_a_wins_client()) {
+ insert_permanent_name_into_unicast(subrec, nmbname, nb_type);
+ return;
+ }
+
+ if((namerec = find_name_on_subnet(unicast_subnet, nmbname, FIND_SELF_NAME)) == NULL)
+ {
+ /* The name needs to be created on the unicast subnet. */
+ (void)add_name_to_subnet( unicast_subnet, nmbname->name,
+ nmbname->name_type, nb_type,
+ MIN(lp_max_ttl(), MAX_REFRESH_TIME), SELF_NAME, 1, &subrec->myip);
+ }
+ else
+ {
+ /* The name already exists on the unicast subnet. Add our local
+ IP for the given broadcast subnet to the name. */
+ add_ip_to_name_record( namerec, subrec->myip);
+ }
+}
+
/****************************************************************************
Add my workgroup and my given names to the subnet lists.
Also add the magic Samba names.
@@ -115,13 +144,13 @@
struct nmb_name nmbname;
make_nmb_name(&nmbname, my_netbios_names[i],0x20);
- insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type);
+ insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type);
make_nmb_name(&nmbname, my_netbios_names[i],0x3);
- insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type);
+ insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type);
make_nmb_name(&nmbname, my_netbios_names[i],0x0);
- insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type);
+ insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type);
}
}
@@ -138,10 +167,10 @@
struct nmb_name nmbname;
make_nmb_name(&nmbname, global_myworkgroup, 0x0);
- insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type|NB_GROUP);
+ insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type|NB_GROUP);
make_nmb_name(&nmbname, global_myworkgroup, 0x1e);
- insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type|NB_GROUP);
+ insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type|NB_GROUP);
}
/*
More information about the samba
mailing list