Alin Nastac
2017-04-20 09:34:56 UTC
Hosts that migrate from one network to another could request their
old IP address which might be already in use by another statically
configured host. Currently non-authoritative dnsmasq servers will
ignore such requests, but ISC DHCP client will send discovery packets
next carrying the same requested IP address and dnsmasq will end up
allocating a new lease for it without checking first if is already
used by another host.
---
src/rfc2131.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/rfc2131.c b/src/rfc2131.c
index 6a8f0db..9987745 100644
--- a/src/rfc2131.c
+++ b/src/rfc2131.c
@@ -1141,10 +1141,12 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
else
{
/* INIT-REBOOT */
- if (!lease && !option_bool(OPT_AUTHORITATIVE))
- return 0;
-
- if (lease && lease->addr.s_addr != mess->yiaddr.s_addr)
+ if (!lease)
+ {
+ if (!option_bool(OPT_AUTHORITATIVE))
+ message = _("lease not found");
+ }
+ else if (lease->addr.s_addr != mess->yiaddr.s_addr)
message = _("wrong address");
}
}
old IP address which might be already in use by another statically
configured host. Currently non-authoritative dnsmasq servers will
ignore such requests, but ISC DHCP client will send discovery packets
next carrying the same requested IP address and dnsmasq will end up
allocating a new lease for it without checking first if is already
used by another host.
---
src/rfc2131.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/rfc2131.c b/src/rfc2131.c
index 6a8f0db..9987745 100644
--- a/src/rfc2131.c
+++ b/src/rfc2131.c
@@ -1141,10 +1141,12 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
else
{
/* INIT-REBOOT */
- if (!lease && !option_bool(OPT_AUTHORITATIVE))
- return 0;
-
- if (lease && lease->addr.s_addr != mess->yiaddr.s_addr)
+ if (!lease)
+ {
+ if (!option_bool(OPT_AUTHORITATIVE))
+ message = _("lease not found");
+ }
+ else if (lease->addr.s_addr != mess->yiaddr.s_addr)
message = _("wrong address");
}
}
--
2.7.4
2.7.4