summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-02-24 20:05:39 +0000
committerJeremy Allison <jra@samba.org>1998-02-24 20:05:39 +0000
commit4680e65bb5a6da5131135a155573e1d2592ed1b0 (patch)
tree7e9243354a37bfc231bf329e7dc0a501b8f20926
parentcadfca4cf58003518e9afef55b9a36c33f044b3c (diff)
downloadsamba-4680e65bb5a6da5131135a155573e1d2592ed1b0.tar.gz
samba-4680e65bb5a6da5131135a155573e1d2592ed1b0.tar.bz2
samba-4680e65bb5a6da5131135a155573e1d2592ed1b0.zip
Fixed bug reported by Janne.Harju@nmp.nokia.com. When used in broadcast
only mode nmbd was not reporting WORKGROUP<0> and WORKGROUP<1e> names to a unicast node status query (although it was registering these names on the network). Also tidied up code in nmbd_mynames.c so that all known IP addresses are registered in the unicast subnet in this case rather than just the first, as was previously done. Jeremy. (This used to be commit eb71c5edcbb983ed4a1b0f57139bd66b671c67fa)
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/nmbd/nmbd_become_lmb.c2
-rw-r--r--source3/nmbd/nmbd_mynames.c40
3 files changed, 37 insertions, 7 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index a5a7ceec69..6f8edb445e 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -483,6 +483,8 @@ void add_domain_names(time_t t);
/*The following definitions come from nmbd_become_lmb.c */
+void insert_permanent_name_into_unicast( struct subnet_record *subrec,
+ struct nmb_name *nmbname, uint16 nb_type );
void unbecome_local_master_success(struct subnet_record *subrec,
struct userdata_struct *userdata,
struct nmb_name *released_name,
diff --git a/source3/nmbd/nmbd_become_lmb.c b/source3/nmbd/nmbd_become_lmb.c
index 2420b2ec4b..b58244104d 100644
--- a/source3/nmbd/nmbd_become_lmb.c
+++ b/source3/nmbd/nmbd_become_lmb.c
@@ -35,7 +35,7 @@ extern uint16 samba_nb_type; /* Samba's NetBIOS name type. */
our IP address if it already exists.
******************************************************************/
-static void insert_permanent_name_into_unicast( struct subnet_record *subrec,
+void insert_permanent_name_into_unicast( struct subnet_record *subrec,
struct nmb_name *nmbname, uint16 nb_type )
{
struct name_record *namerec;
diff --git a/source3/nmbd/nmbd_mynames.c b/source3/nmbd/nmbd_mynames.c
index 9441449bed..30804ab807 100644
--- a/source3/nmbd/nmbd_mynames.c
+++ b/source3/nmbd/nmbd_mynames.c
@@ -29,6 +29,7 @@ extern int DEBUGLEVEL;
extern char **my_netbios_names;
extern pstring myname;
extern fstring myworkgroup;
+extern pstring scope;
extern uint16 samba_nb_type; /* Samba's NetBIOS type. */
@@ -97,14 +98,41 @@ Exiting.\n", myworkgroup, subrec->subnet_name));
for (i=0; my_netbios_names[i]; i++)
{
- add_name_to_subnet(unicast_subnet, my_netbios_names[i],0x20,samba_nb_type, PERMANENT_TTL,
- SELF_NAME, 1, &FIRST_SUBNET->myip);
+ for(subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec))
+ {
+ /*
+ * Ensure all the IP addresses are added if we are multihomed.
+ */
+ struct nmb_name nmbname;
+
+ make_nmb_name(&nmbname, my_netbios_names[i],0x20, scope);
+ insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type);
+
+ make_nmb_name(&nmbname, my_netbios_names[i],0x3, scope);
+ insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type);
+
+ make_nmb_name(&nmbname, my_netbios_names[i],0x0, scope);
+ insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type);
+ }
+ }
+
+ /*
+ * Add the WORKGROUP<0> and WORKGROUP<1e> group names to the unicast subnet
+ * also for the same reasons.
+ */
+
+ for(subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec))
+ {
+ /*
+ * Ensure all the IP addresses are added if we are multihomed.
+ */
+ struct nmb_name nmbname;
- add_name_to_subnet(unicast_subnet, my_netbios_names[i],0x3,samba_nb_type, PERMANENT_TTL,
- SELF_NAME, 1, &FIRST_SUBNET->myip);
+ make_nmb_name(&nmbname, myworkgroup, 0x0, scope);
+ insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type|NB_GROUP);
- add_name_to_subnet(unicast_subnet, my_netbios_names[i],0x0,samba_nb_type, PERMANENT_TTL,
- SELF_NAME, 1, &FIRST_SUBNET->myip);
+ make_nmb_name(&nmbname, myworkgroup, 0x1e, scope);
+ insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type|NB_GROUP);
}
}