mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 22:50:08 +01:00
dnsmasq: properly handling respawning of dnsmask
Otherwise, when killing dnsmasq it does not get respawned:
dnsmasq[0x560dd7e43cf0]: dnsmasq exited normally
dns-mgr: plugin dnsmasq child quit unexpectedly
dns-mgr: update-dns: updating resolv.conf
dns-mgr: config: 100 best v4 enp0s25
dns-mgr: config: 100 best v6 enp0s25
dns-mgr: config: 100 default v6 lo
dns-mgr: config: 100 default v4 lo
dns-mgr: update-dns: updating plugin dnsmasq
dnsmasq[0x560dd7e43cf0]: adding nameserver '192.168.0.2@enp0s25'
dnsmasq[0x560dd7e43cf0]: trying to update dnsmasq nameservers
dns-mgr: update-resolv-conf: write internal file /var/run/NetworkManager/resolv.conf succeeded but don't update /etc/resolv.conf as it points to resolv.conf.nm
dnsmasq[0x560dd7e43cf0]: dnsmasq disappeared
Previously, we would create priv->dnsmasq proxy only once,
and not respawn the process at all.
https://bugzilla.gnome.org/show_bug.cgi?id=766996
This commit is contained in:
parent
a64d70f0df
commit
2e7f4aeb60
3 changed files with 32 additions and 4 deletions
|
|
@ -431,11 +431,16 @@ start_dnsmasq (NMDnsDnsmasq *self)
|
|||
NMBusManager *dbus_mgr;
|
||||
GDBusConnection *connection;
|
||||
|
||||
|
||||
if ( priv->running
|
||||
|| priv->dnsmasq
|
||||
|| priv->dnsmasq_cancellable)
|
||||
if (priv->running) {
|
||||
/* the dnsmasq process is running. Nothing to do. */
|
||||
return;
|
||||
}
|
||||
|
||||
if (nm_dns_plugin_child_pid ((NMDnsPlugin *) self) > 0) {
|
||||
/* if we already have a child process spawned, don't do
|
||||
* it again. */
|
||||
return;
|
||||
}
|
||||
|
||||
dm_binary = nm_utils_find_helper ("dnsmasq", DNSMASQ_PATH, NULL);
|
||||
if (!dm_binary) {
|
||||
|
|
@ -467,6 +472,13 @@ start_dnsmasq (NMDnsDnsmasq *self)
|
|||
if (!pid)
|
||||
return;
|
||||
|
||||
if ( priv->dnsmasq
|
||||
|| priv->dnsmasq_cancellable) {
|
||||
/* we already have a proxy or are about to create it.
|
||||
* We are done. */
|
||||
return;
|
||||
}
|
||||
|
||||
dbus_mgr = nm_bus_manager_get ();
|
||||
g_return_if_fail (dbus_mgr);
|
||||
|
||||
|
|
@ -522,6 +534,7 @@ static void
|
|||
child_quit (NMDnsPlugin *plugin, gint status)
|
||||
{
|
||||
NMDnsDnsmasq *self = NM_DNS_DNSMASQ (plugin);
|
||||
NMDnsDnsmasqPrivate *priv = NM_DNS_DNSMASQ_GET_PRIVATE (self);
|
||||
gboolean failed = TRUE;
|
||||
int err;
|
||||
|
||||
|
|
@ -541,6 +554,8 @@ child_quit (NMDnsPlugin *plugin, gint status)
|
|||
else
|
||||
_LOGW ("dnsmasq died from an unknown cause");
|
||||
|
||||
priv->running = FALSE;
|
||||
|
||||
if (failed)
|
||||
g_signal_emit_by_name (self, NM_DNS_PLUGIN_FAILED);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,6 +177,17 @@ watch_cb (GPid pid, gint status, gpointer user_data)
|
|||
g_signal_emit (self, signals[CHILD_QUIT], 0, status);
|
||||
}
|
||||
|
||||
GPid
|
||||
nm_dns_plugin_child_pid (NMDnsPlugin *self)
|
||||
{
|
||||
NMDnsPluginPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (NM_IS_DNS_PLUGIN (self), 0);
|
||||
|
||||
priv = NM_DNS_PLUGIN_GET_PRIVATE (self);
|
||||
return priv->pid;
|
||||
}
|
||||
|
||||
GPid
|
||||
nm_dns_plugin_child_spawn (NMDnsPlugin *self,
|
||||
const char **argv,
|
||||
|
|
|
|||
|
|
@ -103,6 +103,8 @@ GPid nm_dns_plugin_child_spawn (NMDnsPlugin *self,
|
|||
const char *pidfile,
|
||||
const char *kill_match);
|
||||
|
||||
GPid nm_dns_plugin_child_pid (NMDnsPlugin *self);
|
||||
|
||||
gboolean nm_dns_plugin_child_kill (NMDnsPlugin *self);
|
||||
|
||||
#endif /* __NETWORKMANAGER_DNS_PLUGIN_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue