diff options
author | Andrew Tridgell <tridge@samba.org> | 2002-07-15 10:35:28 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2002-07-15 10:35:28 +0000 |
commit | e90b65284812aaa5ff9e9935ce9bbad7791cbbcd (patch) | |
tree | 9e744d1dc2f93934a4b49166a37383d3cb2b2139 /source3/lib/interface.c | |
parent | ec167dc9cc0ec2ee461837c25a371d2981744208 (diff) | |
download | samba-e90b65284812aaa5ff9e9935ce9bbad7791cbbcd.tar.gz samba-e90b65284812aaa5ff9e9935ce9bbad7791cbbcd.tar.xz samba-e90b65284812aaa5ff9e9935ce9bbad7791cbbcd.zip |
updated the 3.0 branch from the head branch - ready for alpha18
(This used to be commit 03ac082dcb375b6f3ca3d810a6a6367542bc23ce)
Diffstat (limited to 'source3/lib/interface.c')
-rw-r--r-- | source3/lib/interface.c | 46 |
1 files changed, 7 insertions, 39 deletions
diff --git a/source3/lib/interface.c b/source3/lib/interface.c index d43001342e7..0d751a9c7cf 100644 --- a/source3/lib/interface.c +++ b/source3/lib/interface.c @@ -276,19 +276,6 @@ int iface_count(void) } /**************************************************************************** - True if we have two or more interfaces. - **************************************************************************/ -BOOL we_are_multihomed(void) -{ - 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) @@ -331,40 +318,21 @@ struct in_addr *iface_n_bcast(int n) } -/**************************************************************************** -this function provides a simple hash of the configured interfaces. It is -used to detect a change in interfaces to tell us whether to discard -the current wins.dat file. -Note that the result is independent of the order of the interfaces - **************************************************************************/ -unsigned iface_hash(void) -{ - unsigned ret = 0; - struct interface *i; - - for (i=local_interfaces;i;i=i->next) { - unsigned x1 = (unsigned)str_checksum(inet_ntoa(i->ip)); - unsigned x2 = (unsigned)str_checksum(inet_ntoa(i->nmask)); - ret ^= (x1 ^ x2); - } - - return ret; -} - - /* these 3 functions return the ip/bcast/nmask for the interface 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) +struct in_addr *iface_ip(struct in_addr ip) { struct interface *i = iface_find(ip, True); - return(i ? &i->bcast : &local_interfaces->bcast); + return(i ? &i->ip : &local_interfaces->ip); } -struct in_addr *iface_ip(struct in_addr ip) +/* + return True if a IP is directly reachable on one of our interfaces +*/ +BOOL iface_local(struct in_addr ip) { - struct interface *i = iface_find(ip, True); - return(i ? &i->ip : &local_interfaces->ip); + return iface_find(ip, True) ? True : False; } |