Hi, current dnsmasq has a bug [1] in handling hostname setting. When two hosts request equal hostname, dnsmasq will reset name in previous lease and change registered name to the most recent requestor adddress.
It does not work well with lease-script used by libvirt, because when lease name is reset, such change is not propagated to script. It changes only when dnsmasq is restarted. It does not load leases the same way, only one of leases would contain name. I have attached simple fix to propagate change to lease script. It would make lease handler report correct state and it works nice with libvirt. I am not sure current algorithm is the best one for leases reservation. Replacement of previous lease hostname works even without restart after attached change. 1. https://bugzilla.redhat.com/show_bug.cgi?id=1910621 -- Petr Menšík Software Engineer Red Hat, http://www.redhat.com/ email: pemen...@redhat.com PGP: DFCF908DB7C87E8E529925BC4931CA5B6C9FC5CB
>From bea12dc31409180f6cb3a0578c2340c0116ef003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemen...@redhat.com> Date: Fri, 2 Jul 2021 10:03:47 +0200 Subject: [PATCH] Modify and propagate changed lease If hostname is reset on existing lease, propagate such change to leases file and script. --- src/lease.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lease.c b/src/lease.c index b56647d..1a9f1c6 100644 --- a/src/lease.c +++ b/src/lease.c @@ -1021,6 +1021,7 @@ void lease_set_hostname(struct dhcp_lease *lease, const char *name, int auth, ch } kill_name(lease_tmp); + lease_tmp->flags |= LEASE_CHANGED; /* run script on change */ break; } } -- 2.31.1
_______________________________________________ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss