diff options
author | Jeremy Allison <jra@samba.org> | 1997-12-13 14:16:07 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1997-12-13 14:16:07 +0000 |
commit | 64f0348a3f994334abe64a4d4896109c3c8c9039 (patch) | |
tree | 50867cc9ccbc060ceb46ea1e8f8bd8ec2a8ca05e /source3/lib | |
parent | 164c9db4de87ea851a631f1c9d431e0a4525802e (diff) | |
download | samba-64f0348a3f994334abe64a4d4896109c3c8c9039.tar.gz samba-64f0348a3f994334abe64a4d4896109c3c8c9039.tar.xz samba-64f0348a3f994334abe64a4d4896109c3c8c9039.zip |
This is it ! The mega-merge of the JRA_NMBD_REWRITE branch
back into the main tree.
For the cvs logs of all the files starting nmbd_*.c, look
in the JRA_NMBD_REWRITE branch. That branch has now been
discontinued.
Jeremy.
(This used to be commit d80b0cb645f81d16734929a0b27a91c6650499bb)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/interface.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/source3/lib/interface.c b/source3/lib/interface.c index 8af2696a44..0008ad889d 100644 --- a/source3/lib/interface.c +++ b/source3/lib/interface.c @@ -24,7 +24,7 @@ extern int DEBUGLEVEL; struct in_addr ipzero; -struct in_addr wins_ip; +struct in_addr allones_ip; struct in_addr loopback_ip; static struct in_addr default_ip; static struct in_addr default_bcast; @@ -33,7 +33,7 @@ static BOOL got_ip=False; static BOOL got_bcast=False; static BOOL got_nmask=False; -struct interface *local_interfaces = NULL; +static struct interface *local_interfaces = NULL; struct interface *last_iface; @@ -262,7 +262,7 @@ static void interpret_interfaces(char *s, struct interface **interfaces, struct in_addr ip; ipzero = *interpret_addr2("0.0.0.0"); - wins_ip = *interpret_addr2("255.255.255.255"); + allones_ip = *interpret_addr2("255.255.255.255"); loopback_ip = *interpret_addr2("127.0.0.1"); while (next_token(&ptr,token,NULL)) { @@ -425,6 +425,33 @@ int iface_count(void) } /**************************************************************************** + True if we have two or more interfaces. + **************************************************************************/ +BOOL we_are_multihomed() +{ + static int multi = -1; + + if(multi == -1) + multi = (iface_count() > 1 ? True : False); + + return multi; +} + +/**************************************************************************** + return the Nth interface + **************************************************************************/ +struct interface *get_interface(int n) +{ + struct interface *i; + + for (i=local_interfaces;i && n;i=i->next) + n--; + + if (i) return i; + return NULL; +} + +/**************************************************************************** return IP of the Nth interface **************************************************************************/ struct in_addr *iface_n_ip(int n) @@ -453,7 +480,9 @@ static struct interface *iface_find(struct in_addr ip) } /* these 3 functions return the ip/bcast/nmask for the interface - most appropriate for the given ip address */ + most appropriate for the given ip address. If they can't find + an appropriate interface they return the requested field of the + first known interface. */ struct in_addr *iface_bcast(struct in_addr ip) { |