[OpenWrt-Devel] [PATCH] dnsmasq: add reload to init script and use it by dhcp client

2014-01-15 Thread Ulrich Weber
avoids nasty race condition between manual "dnsmasq restart" and "killall -HUP dnsmasq" by dhcp client, killing the init script accidentially Signed-off-by: Ulrich Weber --- package/network/ipv6/6relayd/files/6relayd-update | 2 +- package/network/services/dnsmasq/files/dnsmasq.init | 9 ++

Re: [OpenWrt-Devel] [PATCH] dnsmasq: add reload to init script and use it by dhcp client

2014-01-15 Thread John Crispin
Hi, On 15/01/2014 11:43, Ulrich Weber wrote: > avoids nasty race condition between manual "dnsmasq restart" and > "killall -HUP dnsmasq" by dhcp client, killing the init script accidentially please make a more elaborate description of what race you mean John > Signed-off-by: Ulrich Webe

Re: [OpenWrt-Devel] [PATCH] dnsmasq: add reload to init script and use it by dhcp client

2014-01-15 Thread Ulrich Weber
if you enter "/etc/init.d/dnsmasq restart" and "killall -HUP dnsmasq" (as in the dhcp scripts) at the same time its racy. killall will also send a HUP signal to the init script, which is killed then. I found this while investigating a non running dnsmasq after system start. Thought this was the

Re: [OpenWrt-Devel] [PATCH] dnsmasq: add reload to init script and use it by dhcp client

2014-01-15 Thread Bastian Bittorf
* Ulrich Weber [15.01.2014 20:05]: > avoids nasty race condition between manual "dnsmasq restart" and > "killall -HUP dnsmasq" by dhcp client, killing the init script accidentially > +reload_service() { > + DNSMASQ_PID=$(cat /var/run/dnsmasq.pid) > + > + if [ "$DNSMASQ_PID" != "" ] > +

Re: [OpenWrt-Devel] [PATCH] dnsmasq: add reload to init script and use it by dhcp client

2014-01-16 Thread Ulrich Weber
Found the bug I was searching for. Depending on the time dnsmasq needs to stop, procd might already start a new process while the old process is still exiting. Can be reproduced if a sleep 1 is added in the exiting function of dnsmasq and /etc/init.d/dnsmasq restart is executed. Not sure whats t