<html aria-label="message body"><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div><div>Hi!</div><div><br></div><div>The attached patch adds three ubus methods to dnsmasq: add_lease, delete_lease and get_leases.  These are the ubus equivalent of the existing dbus AddDhcpLease/DeleteDhcpLease, plus get_leases which has no dbus counterpart.</div><div><br></div><div>The use case is HA DHCP on OpenWrt: when a dnsmasq instance creates or removes a lease, an external daemon replicates it to peer nodes via the new ubus methods, so that all instances share a consistent lease database.</div><div><br></div><div>The implementation follows the same internal APIs as the dbus path (lease4_allocate, lease_set_hwaddr, lease_set_expires, etc.) with a few improvements: hostname validation via legal_hostname(), IPv6 domain lookup with get_domain6(), and script-triggering flag suppression for injected leases (preventing dhcp-script ping-pong).</div><div><br></div><div>No extra per-lease storage is required.  get_leases iterates the existing lease linked list on demand.</div><div><br></div><div>I am aware of the 2021 discussion around Eduardo Aguilar's lease method proposal.  This takes a different approach: it hooks directly into the ubus method table (not log_packet()), stores no extra data, and mirrors the existing dbus design rather than introducing a new one.</div><div><br></div><div>The patch is tested on an OpenWrt HA cluster.  If there is interest, I also have a self-contained contrib daemon (contrib/lease-sync/) that uses these methods, which I could submit separately.</div><div><br></div><div>Browsable code: <a href="https://github.com/pgaufillet/dnsmasq/tree/submission/lease-sync-patches">https://github.com/pgaufillet/dnsmasq/tree/submission/lease-sync-patches</a>, and for information <a href="https://github.com/pgaufillet/openwrt-ha-feed">https://github.com/pgaufillet/openwrt-ha-feed</a> </div><div><br></div><div>N.B. This work has been performed using Claude Code, among other tools.</div><div><br></div><div>Pierre Gaufillet</div></div><div></div></body></html>