50 lines
1.6 KiB
Diff
50 lines
1.6 KiB
Diff
From 1bcad678066745e98ca29dc4883241f4e5e32ac9 Mon Sep 17 00:00:00 2001
|
|
From: Simon Kelley <simon@thekelleys.org.uk>
|
|
Date: Thu, 27 Oct 2022 12:04:58 +0100
|
|
Subject: [PATCH] Fix in dhcpv4 rapid-commit code.
|
|
|
|
1) Cosmetic: don't log the tags twice.
|
|
|
|
2) Functional. If a host has an old lease for a different address,
|
|
the rapid-commit will appear to work, but the old lease will
|
|
not be removed and the new lease will not be recorded, so
|
|
the client and server will have conflicting state, leading to
|
|
problems later.
|
|
Conflict:NA
|
|
Reference:https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=commit;h=id=1bcad678066745e98ca29dc4883241f4e5e32ac9
|
|
---
|
|
src/rfc2131.c | 9 ++++++++-
|
|
1 file changed, 8 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/rfc2131.c b/src/rfc2131.c
|
|
index 2056cba..17e97b5 100644
|
|
--- a/src/rfc2131.c
|
|
+++ b/src/rfc2131.c
|
|
@@ -1153,15 +1153,22 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|
tagif_netid = run_tag_if(&context->netid);
|
|
}
|
|
|
|
- log_tags(tagif_netid, ntohl(mess->xid));
|
|
apply_delay(mess->xid, recvtime, tagif_netid);
|
|
|
|
if (option_bool(OPT_RAPID_COMMIT) && option_find(mess, sz, OPTION_RAPID_COMMIT, 0))
|
|
{
|
|
rapid_commit = 1;
|
|
+ /* If a lease exists for this host and another address, squash it. */
|
|
+ if (lease && lease->addr.s_addr != mess->yiaddr.s_addr)
|
|
+ {
|
|
+ lease_prune(lease, now);
|
|
+ lease = NULL;
|
|
+ }
|
|
goto rapid_commit;
|
|
}
|
|
|
|
+ log_tags(tagif_netid, ntohl(mess->xid));
|
|
+
|
|
daemon->metrics[METRIC_DHCPOFFER]++;
|
|
log_packet("DHCPOFFER" , &mess->yiaddr, emac, emac_len, iface_name, NULL, NULL, mess->xid);
|
|
|
|
--
|
|
2.27.0
|
|
|