[Dnsmasq-discuss] Is updating dnsmasq.conf supposed to update dnsmasq.plist?
Perette Barella
perette at barella.org
Tue Aug 3 22:49:11 BST 2010
The .plist file is a Mac-only thing. As such, it is not part of the "standard" dnsmasq distribution, but something that MacPorts adds.
For reference, the full contents of the file are:
<?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>org.macports.dnsmasq</string>
<key>ProgramArguments</key>
<array>
<string>/opt/local/sbin/dnsmasq</string>
<string>-k</string>
<string>-r</string>
<string>/etc/resolv.conf</string>
</array>
<key>KeepAlive</key>
<dict>
<key>NetworkState</key>
<true/>
</dict>
</dict>
</plist>
This file is statically installed this way as part of the MacPorts dnsmasq package, and no, it isn't updated programatically. This XML file is used by launchd(8) on OS X to know when and how to launch dnsmasq during boot. (For other UNIX folks, launchd(8) is the replacement for init(8) and inetd(8)). This is resulting in dnsmasq being invoked with a command line of:
/opt/local/sbin/dnsmasq/dnsmasq -k -r /etc/resolv.conf
Since command-line options override the config file options in dnsmasq (as with most other utilities), your config file is ignored in preference of the .plist/command line option. So it's MacPorts fault. Why the MacPorts people decided that "-r /etc/resolv.conf" should be specified on the command line, I don't know, but it seems like a poor choice to me; you can just remove the lines corresponding to "-r" and "/etc/resolv.conf" and then it'll use your config file. Maybe you should log a bug report with MacPorts.
-k is a reasonable command-line option for operating under launchd, which doesn't want processes to fork/exec. (It will by default try to spawn another instance of the process if/when it dies.) Don't remove that.
Peri
On 2010年08月03日, at 17:14, John Puffs wrote:
> I could NOT get it to work because my router constantly overwrites my resolv.conf file. So I set up dnsmasq.conf to read a separate file instead (resolv2.conf). Still did not work. I finally went into the dnsmasq.plist file and saw that /etc/resolv.conf was listed. I changed that and everything was fine.
>
> I have since made other changes to dnsmasq.conf and do not see my dnsmasq.plist updating.
>
> Is updating dnsmasq.conf supposed to re-write options to dnsmasq.plist?
>
> Where does dnsmasq get it's options from; dnsmasq.conf, dnsmasq.plist or both??
>
> I have dnsmasq.conf set to read /etc/hosts as well as a separate hosts file I use for blocking around 16,000 sites. Apparently this is working fine as it does block the sites and doing a dig shows it is going to 127.0.0.1 for any site. YET there is nothing in my plist to indicate that dnsmasq is supposed to read a separate hosts file. This makes me believe idnsmasq gets it's options from both dnsmasq.conf and dnsmasq.plist...
>
> So I guess I have 2 questions:
>
> 1. is updating dsnmasq.conf supposed to pass variables to dnsmasq.plist? If so I don't think mine is.. Why?
> 2. What variables NEED to be in the .plist file as compared to the conf file?
More information about the Dnsmasq-discuss
mailing list