summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2001-11-26 03:11:44 +0000
committerTim Potter <tpot@samba.org>2001-11-26 03:11:44 +0000
commit585d0efbc6428e5876d354fee49c241c1bad809d (patch)
tree48ef6538dc6855f6084a63fde1097032cc9e2ebc /source3/lib
parent8b7434b2a0b8d138cd83e4feeecb9127d729c437 (diff)
downloadsamba-585d0efbc6428e5876d354fee49c241c1bad809d.tar.gz
samba-585d0efbc6428e5876d354fee49c241c1bad809d.tar.bz2
samba-585d0efbc6428e5876d354fee49c241c1bad809d.zip
Got medieval on another pointless extern. Removed extern struct ipzero
and replaced with two functions: void zero_ip(struct in_adder *ip); BOOL is_zero_ip(struct in_addr ip); (This used to be commit 778f5f77a66cda76348a7c6f64cd63afe2bfe077)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/interface.c8
-rw-r--r--source3/lib/util.c16
-rw-r--r--source3/lib/wins_srv.c6
3 files changed, 21 insertions, 9 deletions
diff --git a/source3/lib/interface.c b/source3/lib/interface.c
index d2e0b44fd4..a93390e643 100644
--- a/source3/lib/interface.c
+++ b/source3/lib/interface.c
@@ -26,7 +26,6 @@
static struct iface_struct *probed_ifaces;
static int total_probed;
-struct in_addr ipzero;
struct in_addr allones_ip;
struct in_addr loopback_ip;
@@ -42,7 +41,7 @@ Try and find an interface that matches an ip. If we cannot, return NULL
static struct interface *iface_find(struct in_addr ip, BOOL CheckMask)
{
struct interface *i;
- if (zero_ip(ip)) return local_interfaces;
+ if (is_zero_ip(ip)) return local_interfaces;
for (i=local_interfaces;i;i=i->next)
if (CheckMask) {
@@ -104,8 +103,8 @@ static void interpret_interface(char *token)
char *p;
int i, added=0;
- ip = ipzero;
- nmask = ipzero;
+ zero_ip(&ip);
+ zero_ip(&nmask);
/* first check if it is an interface name */
for (i=0;i<total_probed;i++) {
@@ -172,7 +171,6 @@ void load_interfaces(void)
ptr = lp_interfaces();
- ipzero = *interpret_addr2("0.0.0.0");
allones_ip = *interpret_addr2("255.255.255.255");
loopback_ip = *interpret_addr2("127.0.0.1");
diff --git a/source3/lib/util.c b/source3/lib/util.c
index dc948a406b..01fb51d5a2 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -841,13 +841,27 @@ struct in_addr *interpret_addr2(const char *str)
/*******************************************************************
check if an IP is the 0.0.0.0
******************************************************************/
-BOOL zero_ip(struct in_addr ip)
+BOOL is_zero_ip(struct in_addr ip)
{
uint32 a;
putip((char *)&a,(char *)&ip);
return(a == 0);
}
+/* Set an IP to 0.0.0.0 */
+
+void zero_ip(struct in_addr *ip)
+{
+ static BOOL init;
+ static struct in_addr ipzero;
+
+ if (!init) {
+ ipzero = *interpret_addr2("0.0.0.0");
+ init = True;
+ }
+
+ *ip = ipzero;
+}
#if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
/******************************************************************
diff --git a/source3/lib/wins_srv.c b/source3/lib/wins_srv.c
index 5a9b065008..92cd51d8bb 100644
--- a/source3/lib/wins_srv.c
+++ b/source3/lib/wins_srv.c
@@ -209,11 +209,11 @@ struct in_addr wins_srv_ip( void )
if( now >= entry->mourning ) /* Found a live one. */
{
/* If we don't have the IP, look it up. */
- if( zero_ip( entry->ip_addr ) )
+ if( is_zero_ip( entry->ip_addr ) )
entry->ip_addr = *interpret_addr2( entry->server );
/* If we still don't have the IP then kill it, else return it. */
- if( zero_ip( entry->ip_addr ) )
+ if( is_zero_ip( entry->ip_addr ) )
entry->mourning = now + NECROMANCYCLE;
else
return( entry->ip_addr );
@@ -278,7 +278,7 @@ void wins_srv_died( struct in_addr boothill_ip )
{
list_entry *entry;
- if( zero_ip( boothill_ip ) )
+ if( is_zero_ip( boothill_ip ) )
{
DEBUG( 4, ("wins_srv_died(): Invalid request to mark zero IP down.\n") );
return;