diff options
author | Jeremy Allison <jra@samba.org> | 2007-10-10 18:25:16 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2007-10-10 18:25:16 -0700 |
commit | 8e54530b52fd256137740107e9fdf000f00a7a30 (patch) | |
tree | f9ca56cc0b2eff78c3550c924c79ee4ca0666fd2 /source3/nmbd/nmbd_become_dmb.c | |
parent | 0ec55a246238b6cfb3727942c20cd55a16ab4d4a (diff) | |
download | samba-8e54530b52fd256137740107e9fdf000f00a7a30.tar.gz samba-8e54530b52fd256137740107e9fdf000f00a7a30.tar.bz2 samba-8e54530b52fd256137740107e9fdf000f00a7a30.zip |
Add start of IPv6 implementation. Currently most of this is avoiding
IPv6 in winbindd, but moves most of the socket functions that were
wrongly in lib/util.c into lib/util_sock.c and provides generic
IPv4/6 independent versions of most things. Still lots of work
to do, but now I can see how I'll fix the access check code.
Nasty part that remains is the name resolution code which is
used to returning arrays of in_addr structs.
Jeremy.
(This used to be commit 3f6bd0e1ec5cc6670f3d08f76fc2cd94c9cd1a08)
Diffstat (limited to 'source3/nmbd/nmbd_become_dmb.c')
-rw-r--r-- | source3/nmbd/nmbd_become_dmb.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/source3/nmbd/nmbd_become_dmb.c b/source3/nmbd/nmbd_become_dmb.c index a0250f205a..fb87927436 100644 --- a/source3/nmbd/nmbd_become_dmb.c +++ b/source3/nmbd/nmbd_become_dmb.c @@ -22,8 +22,6 @@ #include "includes.h" -extern struct in_addr allones_ip; - extern uint16 samba_nb_type; /* Samba's NetBIOS type. */ static void become_domain_master_browser_bcast(const char *); @@ -119,7 +117,7 @@ in workgroup %s on subnet %s\n", if( subrec == unicast_subnet ) { struct nmb_name nmbname; struct in_addr my_first_ip; - struct in_addr *nip; + const struct in_addr *nip; /* Put our name and first IP address into the workgroup struct as domain master browser. This @@ -129,14 +127,14 @@ in workgroup %s on subnet %s\n", make_nmb_name(&nmbname, global_myname(), 0x20); work->dmb_name = nmbname; - /* Pick the first interface ip address as the domain master browser ip. */ - nip = iface_n_ip(0); + /* Pick the first interface IPv4 address as the domain master browser ip. */ + nip = first_ipv4_iface(); if (!nip) { - DEBUG(0,("become_domain_master_stage2: Error. iface_n_ip returned NULL\n")); + DEBUG(0,("become_domain_master_stage2: " + "Error. get_interface returned NULL\n")); return; } - my_first_ip = *nip; putip((char *)&work->dmb_addr, &my_first_ip); @@ -204,10 +202,12 @@ workgroup %s on subnet %s\n", wg_name, subrec->subnet_name)); static void become_domain_master_query_success(struct subnet_record *subrec, struct userdata_struct *userdata, - struct nmb_name *nmbname, struct in_addr ip, + struct nmb_name *nmbname, struct in_addr ip, struct res_rec *rrec) { unstring name; + struct in_addr allones_ip; + pull_ascii_nstring(name, sizeof(name), nmbname->name); /* If the given ip is not ours, then we can't become a domain @@ -217,7 +217,9 @@ static void become_domain_master_query_success(struct subnet_record *subrec, /* BUG note. Samba 1.9.16p11 servers seem to return the broadcast address or zero ip for this query. Pretend this is ok. */ - if(ismyip(ip) || ip_equal(allones_ip, ip) || is_zero_ip(ip)) { + allones_ip.s_addr = htonl(INADDR_BROADCAST); + + if(ismyip_v4(ip) || ip_equal(allones_ip, ip) || is_zero_ip_v4(ip)) { if( DEBUGLVL( 3 ) ) { dbgtext( "become_domain_master_query_success():\n" ); dbgtext( "Our address (%s) ", inet_ntoa(ip) ); |