[Dnsmasq-discuss] [RFC PATCH 0/2] bind-dynamic: preserve interface state after failed scans
Dmitry Kuleshov
dmitry_kuleshov at ukr.net
Wed Sep 9 09:17:55 UTC 2026
Hi Simon,
I have been investigating disappearing listeners with bind-dynamic and listen-address on OpenWrt 25.12.5 / dnsmasq 2.93. Please consider the two attached patches for review.
I noticed that master already contains the TCP-child listener cleanup from Zhou Yuefu, extended by you, in commit 1da5cc2951d345efa2ed7206dbe86d201d9f2fe4. A local adaptation of the same approach passed my OpenWrt checks with a live TCP child and OpenVPN reload/restart. That result applies to my local 2.93 patch, not to a direct runtime test of the upstream commit. I am not resubmitting that fix.
A separate issue remains in enumerate_interfaces(): it modifies live state before both address-family scans succeed, then can garbage-collect listeners even when a scan fails. The netlink enumerator also does not check NLM_F_DUMP_INTR. An incomplete scan can therefore remove listeners for addresses which remain configured.
The attachments are:
902-1-shared-listener-gc-upstream.patch
A small independent fix: advance the list cursor when release_listener() retains a shared listener. Otherwise, removing its successor can unlink the retained listener too.
902-2-atomic-interface-snapshot-upstream.patch
An RFC implementation which stages interface records and auxiliary state, commits only after successful scans, and retains the previous state on failure. It rejects interrupted/failed dumps, bounds receive work and schedules retries, including bounded startup retries. Apply this after patch 1.
Base: upstream master a9880c595f052d63859d6ed8aa86a3a6b007bf20.
Neither patch depends on OpenWrt packaging or my separate no-auto-edns proposal. The existing upstream TCP-child cleanup is unchanged.
Validation after rebasing: clean patch application, default native builds, a combined DNS-only build, configuration checks, and 96 in-process regression cases under ASan/UBSan. The regression cases use synthetic syscall fixtures; these are not live kernel integration results. LeakSanitizer was disabled. Netlink sockets are prohibited in the build environment, so live address-change, OpenWrt/musl, DNSSEC and DHCP/RA protocol acceptance remain unverified.
One open design point is the shared iface_enumerate() contract. The RFC changes failure returns, including ENOBUFS, but does not make the separate DHCP/RA/ARP and lease-discovery consumers transactional. Their handling of partial callback effects needs review and runtime validation before treating this as a production fix.
I used AI assistance to develop and review these changes. I would appreciate your feedback on the approach, particularly whether the stricter enumeration behaviour should be isolated to the transactional caller. The small list-cursor fix can be considered independently.
Best regards,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20260909/65882007/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 902-1-shared-listener-gc-upstream.patch
Type: application/x-patch
Size: 1180 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20260909/65882007/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 902-2-atomic-interface-snapshot-upstream.patch
Type: application/x-patch
Size: 42763 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20260909/65882007/attachment-0003.bin>
More information about the Dnsmasq-discuss
mailing list