mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-15 06:38:05 +02:00
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
111 lines
4.2 KiB
C
111 lines
4.2 KiB
C
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
|
/* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
* any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*
|
|
* Copyright (C) 2010 Red Hat, Inc.
|
|
*/
|
|
|
|
#ifndef __NETWORKMANAGER_DNS_PLUGIN_H__
|
|
#define __NETWORKMANAGER_DNS_PLUGIN_H__
|
|
|
|
#include "nm-default.h"
|
|
#include "nm-dns-manager.h"
|
|
|
|
#include "nm-config-data.h"
|
|
|
|
#define NM_TYPE_DNS_PLUGIN (nm_dns_plugin_get_type ())
|
|
#define NM_DNS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DNS_PLUGIN, NMDnsPlugin))
|
|
#define NM_DNS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DNS_PLUGIN, NMDnsPluginClass))
|
|
#define NM_IS_DNS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DNS_PLUGIN))
|
|
#define NM_IS_DNS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DNS_PLUGIN))
|
|
#define NM_DNS_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DNS_PLUGIN, NMDnsPluginClass))
|
|
|
|
#define NM_DNS_PLUGIN_FAILED "failed"
|
|
#define NM_DNS_PLUGIN_CHILD_QUIT "child-quit"
|
|
|
|
typedef struct {
|
|
GObject parent;
|
|
} NMDnsPlugin;
|
|
|
|
typedef struct {
|
|
GObjectClass parent;
|
|
|
|
/* Methods */
|
|
|
|
/* Called when DNS information is changed. 'configs' is an array
|
|
* of pointers to NMDnsIPConfigData sorted by priority.
|
|
* 'global_config' is the optional global DNS
|
|
* configuration.
|
|
*/
|
|
gboolean (*update) (NMDnsPlugin *self,
|
|
const NMDnsIPConfigData **configs,
|
|
const NMGlobalDnsConfig *global_config,
|
|
const char *hostname);
|
|
|
|
/* Subclasses should override and return TRUE if they start a local
|
|
* caching nameserver that listens on localhost and would block any
|
|
* other local caching nameserver from operating.
|
|
*/
|
|
gboolean (*is_caching) (NMDnsPlugin *self);
|
|
|
|
/* Subclasses should override this and return their plugin name */
|
|
const char *(*get_name) (NMDnsPlugin *self);
|
|
|
|
/* Signals */
|
|
|
|
/* Emitted by the plugin and consumed by NMDnsManager when
|
|
* some error happens with the nameserver subprocess. Causes NM to fall
|
|
* back to writing out a non-local-caching resolv.conf until the next
|
|
* DNS update.
|
|
*/
|
|
void (*failed) (NMDnsPlugin *self);
|
|
|
|
/* Emitted by the plugin base class when the nameserver subprocess
|
|
* quits. This signal is consumed by the plugin subclasses and not
|
|
* by NMDnsManager. If the subclass decides the exit status (as returned
|
|
* by waitpid(2)) is fatal it should then emit the 'failed' signal.
|
|
*/
|
|
void (*child_quit) (NMDnsPlugin *self, gint status);
|
|
} NMDnsPluginClass;
|
|
|
|
GType nm_dns_plugin_get_type (void);
|
|
|
|
gboolean nm_dns_plugin_is_caching (NMDnsPlugin *self);
|
|
|
|
const char *nm_dns_plugin_get_name (NMDnsPlugin *self);
|
|
|
|
gboolean nm_dns_plugin_update (NMDnsPlugin *self,
|
|
const NMDnsIPConfigData **configs,
|
|
const NMGlobalDnsConfig *global_config,
|
|
const char *hostname);
|
|
|
|
/* For subclasses/plugins */
|
|
|
|
/* Spawn a child process and watch for it to quit. 'argv' is the NULL-terminated
|
|
* argument vector to spawn the child with, where argv[0] is the full path to
|
|
* the child's executable. If 'pidfile' is given the process owning the PID
|
|
* contained in 'pidfile' will be killed if its command line matches 'kill_match'
|
|
* and the pidfile will be deleted.
|
|
*/
|
|
GPid nm_dns_plugin_child_spawn (NMDnsPlugin *self,
|
|
const char **argv,
|
|
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__ */
|
|
|