summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Kelley <simon@thekelleys.org.uk>2012-09-24 15:09:33 +0100
committerSimon Kelley <simon@thekelleys.org.uk>2012-09-24 15:09:33 +0100
commit35239a302ac9de0f54ce163550208f7f39ff68f2 (patch)
tree2d445d482255953006f6bbb8b5164992c7d0107a
parentdb3946c35807340e1d7f4eca31a57cdef1ad4ab9 (diff)
downloaddnsmasq-2.64test5.tar.gz
Tweak dhcp-config sanity checking.v2.64test5
-rw-r--r--src/dhcp-common.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/dhcp-common.c b/src/dhcp-common.c
index da982aa..269f481 100644
--- a/src/dhcp-common.c
+++ b/src/dhcp-common.c
@@ -255,7 +255,7 @@ void dhcp_update_configs(struct dhcp_config *configs)
in at most one dhcp-host. Since /etc/hosts can be re-read by SIGHUP,
restore the status-quo ante first. */
- struct dhcp_config *config;
+ struct dhcp_config *config, *conf_tmp;
struct crec *crec;
int prot = AF_INET;
@@ -297,7 +297,8 @@ void dhcp_update_configs(struct dhcp_config *configs)
config->hostname, daemon->addrbuff);
}
- if (prot == AF_INET && !config_find_by_address(configs, crec->addr.addr.addr.addr4))
+ if (prot == AF_INET &&
+ (!(conf_tmp = config_find_by_address(configs, crec->addr.addr.addr.addr4)) || conf_tmp == config))
{
config->addr = crec->addr.addr.addr.addr4;
config->flags |= CONFIG_ADDR | CONFIG_ADDR_HOSTS;
@@ -305,7 +306,8 @@ void dhcp_update_configs(struct dhcp_config *configs)
}
#ifdef HAVE_DHCP6
- if (prot == AF_INET6 && !config_find_by_address6(configs, &crec->addr.addr.addr.addr6, 128, 0))
+ if (prot == AF_INET6 &&
+ (!(conf_tmp = config_find_by_address6(configs, &crec->addr.addr.addr.addr6, 128, 0)) || conf_tmp == config))
{
memcpy(&config->addr6, &crec->addr.addr.addr.addr6, IN6ADDRSZ);
config->flags |= CONFIG_ADDR6 | CONFIG_ADDR_HOSTS;