mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
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.
This commit is contained in:
@@ -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);
|
tagif_netid = run_tag_if(&context->netid);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_tags(tagif_netid, ntohl(mess->xid));
|
|
||||||
apply_delay(mess->xid, recvtime, tagif_netid);
|
apply_delay(mess->xid, recvtime, tagif_netid);
|
||||||
|
|
||||||
if (option_bool(OPT_RAPID_COMMIT) && option_find(mess, sz, OPTION_RAPID_COMMIT, 0))
|
if (option_bool(OPT_RAPID_COMMIT) && option_find(mess, sz, OPTION_RAPID_COMMIT, 0))
|
||||||
{
|
{
|
||||||
rapid_commit = 1;
|
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;
|
goto rapid_commit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_tags(tagif_netid, ntohl(mess->xid));
|
||||||
|
|
||||||
daemon->metrics[METRIC_DHCPOFFER]++;
|
daemon->metrics[METRIC_DHCPOFFER]++;
|
||||||
log_packet("DHCPOFFER" , &mess->yiaddr, emac, emac_len, iface_name, NULL, NULL, mess->xid);
|
log_packet("DHCPOFFER" , &mess->yiaddr, emac, emac_len, iface_name, NULL, NULL, mess->xid);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user