import of dnsmasq-2.1.tar.gz

This commit is contained in:
Simon Kelley
2004-01-29 16:48:35 +00:00
parent 9e4abcb5ac
commit 1ab84e2f35
18 changed files with 356 additions and 106 deletions

View File

@@ -269,5 +269,18 @@ struct dhcp_config *find_config(struct dhcp_config *configs,
return NULL;
}
void set_configs_from_cache(struct dhcp_config *configs)
/* Some people like to keep all static IP addresses in /etc/hosts.
This goes through /etc/hosts and sets static addresses for any DHCP config
records which don't have an address and whose name matches. */
{
struct dhcp_config *config;
struct crec *crec;
for (config = configs; config; config = config->next)
if (config->addr.s_addr == 0 && config->hostname &&
(crec = cache_find_by_name(NULL, config->hostname, 0, F_IPV4)) &&
(crec->flags & F_HOSTS))
config->addr = crec->addr.addr.addr4;
}