dns: kill plugin child synchronously to avoid restart race (rh #1161232) (bgo #728342)

NM was killing the dnsmasq local caching nameserver process and immediately
starting a new one, and new process couldn't bind to 127.0.0.1 because the
old one hadn't quit yet.  Thus the new process quit, and the user was
left with no split DNS at all.

While this does introduce more synchronous waiting into the connection
process, it's not that much time and NM will kill dnsmasq if it hasn't
quit after 1 second.  The longer-term fix is to use dnsmasq's D-Bus
interface to update DNS without respawning it.

https://bugzilla.gnome.org/show_bug.cgi?id=728342
https://bugzilla.redhat.com/show_bug.cgi?id=1161232
This commit is contained in:
Dan Williams 2015-01-14 16:30:39 -06:00
parent 4df69a5576
commit 10aff12526

View file

@ -198,7 +198,8 @@ nm_dns_plugin_child_spawn (NMDnsPlugin *self,
return priv->pid;
}
gboolean nm_dns_plugin_child_kill (NMDnsPlugin *self)
gboolean
nm_dns_plugin_child_kill (NMDnsPlugin *self)
{
NMDnsPluginPrivate *priv = NM_DNS_PLUGIN_GET_PRIVATE (self);
@ -208,7 +209,7 @@ gboolean nm_dns_plugin_child_kill (NMDnsPlugin *self)
}
if (priv->pid) {
nm_utils_kill_child_async (priv->pid, SIGTERM, LOGD_DNS, priv->progname, 2000, NULL, NULL);
nm_utils_kill_child_sync (priv->pid, SIGTERM, LOGD_DNS, priv->progname, NULL, 1000, 0);
priv->pid = 0;
g_free (priv->progname);
priv->progname = NULL;