From d160d93d8fad563400aa1e1274437df1fbd4ecbf Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 7 Jun 1996 03:34:22 +0000 Subject: - added predict.c, moving the routines from util.c - added iface_count() and iface_n_ip() routines so its easy to loop over the local interface list - made readsize a normal loadparm global - check for null w in add_domain_entry() - set the deathtime to time()-1 for doamin entries with servertype==0 This allows servers that are shutting down to be removed - add the 0x1c name at startup if we are a WINS server. Previously we added it only if we were a master - loop over interfaces in add_my_domains(), so people don't have to have a lmhosts file to get lp_workgroup() on all interfaces - set add to True for find_workgroupstruct() in nmbsync, and check for null return - remove some ugly "errno = EBADF" bits. they just confused things. (This used to be commit 88b191b48836eeb7937f25b37d0bdd4a2276e5a7) --- source3/lib/interface.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'source3/lib/interface.c') diff --git a/source3/lib/interface.c b/source3/lib/interface.c index a47ef6e47e..f2a535d80c 100644 --- a/source3/lib/interface.c +++ b/source3/lib/interface.c @@ -388,6 +388,33 @@ BOOL ismybcast(struct in_addr bcast) return False; } +/**************************************************************************** + how many interfaces do we have + **************************************************************************/ +int iface_count(void) +{ + int ret = 0; + struct interface *i; + + for (i=interfaces;i;i=i->next) + ret++; + return ret; +} + +/**************************************************************************** + return IP of the Nth interface + **************************************************************************/ +struct in_addr *iface_n_ip(int n) +{ + struct interface *i; + + for (i=interfaces;i && n;i=i->next) + n--; + + if (i) return &i->ip; + return NULL; +} + static struct interface *iface_find(struct in_addr ip) { struct interface *i; -- cgit