From cfb2b72dc6f1ab9e66daf53d4d7113997499049a Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sat, 14 Nov 2009 14:42:58 -0800 Subject: [PATCH] dnsmasq: VPN DNS fixes Turn DHCP and DNS debugging on with NM_DNSMASQ_DEBUG. Without --strict-order, dnsmasq will round-robin queries which in the case of VPN connections may result in the query going to the non-VPN nameserver. Also, allow dnsmasq to poll resolv.conf for nameserver updates so that when the default connection changes, it knows about the new nameservers. --- src/dnsmasq-manager/nm-dnsmasq-manager.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/dnsmasq-manager/nm-dnsmasq-manager.c b/src/dnsmasq-manager/nm-dnsmasq-manager.c index 6ad66b7ec5..5538c82ff2 100644 --- a/src/dnsmasq-manager/nm-dnsmasq-manager.c +++ b/src/dnsmasq-manager/nm-dnsmasq-manager.c @@ -268,11 +268,22 @@ create_dm_cmd_line (const char *iface, cmd = nm_cmd_line_new (); nm_cmd_line_add_string (cmd, dm_binary); + if (getenv ("NM_DNSMASQ_DEBUG")) { + nm_cmd_line_add_string (cmd, "--log-dhcp"); + nm_cmd_line_add_string (cmd, "--log-queries"); + } + nm_cmd_line_add_string (cmd, "--no-hosts"); nm_cmd_line_add_string (cmd, "--keep-in-foreground"); nm_cmd_line_add_string (cmd, "--bind-interfaces"); - nm_cmd_line_add_string (cmd, "--no-poll"); nm_cmd_line_add_string (cmd, "--except-interface=lo"); + nm_cmd_line_add_string (cmd, "--clear-on-reload"); + + /* Use strict order since in the case of VPN connections, the VPN's + * nameservers will be first in resolv.conf, and those need to be tried + * first by dnsmasq to successfully resolve names from the VPN. + */ + nm_cmd_line_add_string (cmd, "--strict-order"); s = g_string_new ("--listen-address="); addr.s_addr = nm_ip4_address_get_address (tmp);