Safely reload config of dnsmasq and netifd

Hi, i'm developing some feature on OpenWrt and have some question about its source code, more specifically, netifd and dnsmasq. As far as i know, netifd will trigger hotplug script for some event related to "iface", which include dnsmasq. However, in my customized webpage, which related to both netifd and dnsmasq, after fill inputs, I submit the form and call "network reload" and "dnsmasq reload". Sometimes, the runtime config of dnsmasq (/var/etc/dnsmasq.conf) will be written in wrong way, which is the consequence of my "dnsmasq reload" and dnsmasq hotplug called by netifd confliction. Could you guys give me advices on this case, if I want a page that affects both netifd and dnsmasq, what should i do to avoid this. Thanks!

Ideally you call /sbin/reload_config and let OpenWrt figure out what to reload in which order.

1 Like

Thanks for your reply. For now, after half day of testing, the problem has not ocurring yet. But, after searching around, i found some topic about race condition in hotplug https://github.com/openwrt/openwrt/issues/8482
Maybe, for now, the problem is not occuring but could /sbin/reload_config completely resolve the issue? I'm afraid it's not because both netifd and procd fork and let their children do the jobs, the race might still occur.