dns/dnsmasq: harden build
MFH: 2025Q3 (cherry picked from commit 421cd1ecf286ff832c18d9c77e220fdad6f8bfb7)