[Dnsmasq-discuss] dnsmasq launch race condition

Perette Barella perette at barella.org
Wed Apr 8 20:39:13 BST 2009


dnsmasq has a race condition on OS X.  I believe the problem is that  
if dnsmasq starts before IP V4 is fully up, it can't bind to a IP V4  
port and therefore won't resolve anything.  It will, of course,  
happily resolve local dns requests.

Of course, maybe the problem report should be against launchd, the OS  
X replacement for /etc/rc*, which doesn't have much in the way of  
dependency resolving.

Below is a time-delay launchd.plist file that will, in a rather stupid  
way, fix the problem.  I think 10 seconds might be excessive, but  
then, it's not like UNIX servers are booting more than every few  
months.  If there's a better solution, I'd be glad to learn it.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
	 "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>uk.org.thekelleys.dnsmasq</string>
	<key>ProgramArguments</key>
	<array>
		<string>/bin/bash</string>
		<string>-c</string>
		<string>sleep 10 &amp;&amp; exec /usr/local/sbin/dnsmasq -k</string>
	</array>
	<key>RunAtLoad</key><false/>
         <key>AbandonProcessGroup</key><false/>
         <key>KeepAlive</key>
         <dict>
                 <key>NetworkState</key><true/>
         </dict>
</dict>
</plist>

Perette




More information about the Dnsmasq-discuss mailing list