diff options
Diffstat (limited to 'src/dns')
| -rw-r--r-- | src/dns/nm-dns-dnsmasq.c | 28 | ||||
| -rw-r--r-- | src/dns/nm-dns-manager.c | 10 | ||||
| -rw-r--r-- | src/dns/nm-dns-plugin.c | 4 | ||||
| -rw-r--r-- | src/dns/nm-dns-plugin.h | 2 | ||||
| -rw-r--r-- | src/dns/nm-dns-systemd-resolved.c | 58 | ||||
| -rw-r--r-- | src/dns/nm-dns-unbound.c | 2 |
6 files changed, 55 insertions, 49 deletions
diff --git a/src/dns/nm-dns-dnsmasq.c b/src/dns/nm-dns-dnsmasq.c index 91f4c55b..b48c6b87 100644 --- a/src/dns/nm-dns-dnsmasq.c +++ b/src/dns/nm-dns-dnsmasq.c @@ -306,8 +306,6 @@ start_dnsmasq (NMDnsDnsmasq *self) const char *argv[15]; GPid pid = 0; guint idx = 0; - NMDBusManager *dbus_mgr; - GDBusConnection *connection; if (priv->running) { /* the dnsmasq process is running. Nothing to do. */ @@ -358,22 +356,16 @@ start_dnsmasq (NMDnsDnsmasq *self) return; } - dbus_mgr = nm_dbus_manager_get (); - g_return_if_fail (dbus_mgr); - - connection = nm_dbus_manager_get_connection (dbus_mgr); - g_return_if_fail (connection); - priv->dnsmasq_cancellable = g_cancellable_new (); - g_dbus_proxy_new (connection, - G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, - NULL, - DNSMASQ_DBUS_SERVICE, - DNSMASQ_DBUS_PATH, - DNSMASQ_DBUS_SERVICE, - priv->dnsmasq_cancellable, - dnsmasq_proxy_cb, - self); + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, + NULL, + DNSMASQ_DBUS_SERVICE, + DNSMASQ_DBUS_PATH, + DNSMASQ_DBUS_SERVICE, + priv->dnsmasq_cancellable, + dnsmasq_proxy_cb, + self); } static gboolean @@ -409,7 +401,7 @@ update (NMDnsPlugin *plugin, /*****************************************************************************/ static void -child_quit (NMDnsPlugin *plugin, gint status) +child_quit (NMDnsPlugin *plugin, int status) { NMDnsDnsmasq *self = NM_DNS_DNSMASQ (plugin); NMDnsDnsmasqPrivate *priv = NM_DNS_DNSMASQ_GET_PRIVATE (self); diff --git a/src/dns/nm-dns-manager.c b/src/dns/nm-dns-manager.c index a29fd81f..6a59b41c 100644 --- a/src/dns/nm-dns-manager.c +++ b/src/dns/nm-dns-manager.c @@ -310,7 +310,7 @@ _config_data_free (NMDnsConfigData *data) g_slice_free (NMDnsConfigData, data); } -static gint +static int _ip_config_data_cmp (const NMDnsIPConfigData *a, const NMDnsIPConfigData *b) { int a_prio, b_prio; @@ -333,7 +333,7 @@ _ip_config_data_cmp (const NMDnsIPConfigData *a, const NMDnsIPConfigData *b) return 0; } -static gint +static int _ip_config_lst_cmp (const CList *a, const CList *b, const void *user_data) @@ -482,7 +482,7 @@ merge_one_ip_config (NMResolvConfData *rc, } static GPid -run_netconfig (NMDnsManager *self, GError **error, gint *stdin_fd) +run_netconfig (NMDnsManager *self, GError **error, int *stdin_fd) { char *argv[5]; gs_free char *tmp = NULL; @@ -533,7 +533,7 @@ dispatch_netconfig (NMDnsManager *self, GError **error) { GPid pid; - gint fd; + int fd; int status; gssize l; nm_auto_free_gstring GString *str = NULL; @@ -970,6 +970,8 @@ compute_hash (NMDnsManager *self, const NMGlobalDnsConfig *global, guint8 buffer else { const CList *head; + /* FIXME(ip-config-checksum): this relies on the fact that an IP + * configuration without DNS parameters gives a zero checksum. */ head = _ip_config_lst_head (self); c_list_for_each_entry (ip_data, head, ip_config_lst) nm_ip_config_hash (ip_data->ip_config, sum, TRUE); diff --git a/src/dns/nm-dns-plugin.c b/src/dns/nm-dns-plugin.c index d9400e3e..48f04b00 100644 --- a/src/dns/nm-dns-plugin.c +++ b/src/dns/nm-dns-plugin.c @@ -124,7 +124,7 @@ _clear_pidfile (NMDnsPlugin *self) static void kill_existing (const char *progname, const char *pidfile, const char *kill_match) { - glong pid; + long pid; gs_free char *contents = NULL; gs_free char *cmdline_contents = NULL; guint64 start_time; @@ -167,7 +167,7 @@ out: } static void -watch_cb (GPid pid, gint status, gpointer user_data) +watch_cb (GPid pid, int status, gpointer user_data) { NMDnsPlugin *self = NM_DNS_PLUGIN (user_data); NMDnsPluginPrivate *priv = NM_DNS_PLUGIN_GET_PRIVATE (self); diff --git a/src/dns/nm-dns-plugin.h b/src/dns/nm-dns-plugin.h index 80b77d95..8a55921d 100644 --- a/src/dns/nm-dns-plugin.h +++ b/src/dns/nm-dns-plugin.h @@ -70,7 +70,7 @@ typedef struct { * 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); + void (*child_quit) (NMDnsPlugin *self, int status); } NMDnsPluginClass; GType nm_dns_plugin_get_type (void); diff --git a/src/dns/nm-dns-systemd-resolved.c b/src/dns/nm-dns-systemd-resolved.c index 1a73aae1..10797b86 100644 --- a/src/dns/nm-dns-systemd-resolved.c +++ b/src/dns/nm-dns-systemd-resolved.c @@ -65,7 +65,6 @@ typedef struct { GDBusProxy *resolve; GCancellable *init_cancellable; GCancellable *update_cancellable; - GCancellable *mdns_cancellable; CList request_queue_lst_head; } NMDnsSystemdResolvedPrivate; @@ -130,7 +129,7 @@ call_done (GObject *source, GAsyncResult *r, gpointer user_data) if (!v) { if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) return; - _LOGW ("Failed: %s\n", error->message); + _LOGW ("Failed: %s", error->message); g_error_free (error); } } @@ -192,7 +191,8 @@ prepare_one_interface (NMDnsSystemdResolved *self, InterfaceConfig *ic) GVariantBuilder dns, domains; NMCListElem *elem; NMSettingConnectionMdns mdns = NM_SETTING_CONNECTION_MDNS_DEFAULT; - const char *mdns_arg = NULL; + NMSettingConnectionLlmnr llmnr = NM_SETTING_CONNECTION_LLMNR_DEFAULT; + const char *mdns_arg = NULL, *llmnr_arg = NULL; g_variant_builder_init (&dns, G_VARIANT_TYPE ("(ia(iay))")); g_variant_builder_add (&dns, "i", ic->ifindex); @@ -208,8 +208,10 @@ prepare_one_interface (NMDnsSystemdResolved *self, InterfaceConfig *ic) update_add_ip_config (self, &dns, &domains, data); - if (NM_IS_IP4_CONFIG (ip_config)) + if (NM_IS_IP4_CONFIG (ip_config)) { mdns = NM_MAX (mdns, nm_ip4_config_mdns_get (NM_IP4_CONFIG (ip_config))); + llmnr = NM_MAX (llmnr, nm_ip4_config_llmnr_get (NM_IP4_CONFIG (ip_config))); + } } g_variant_builder_close (&dns); @@ -231,6 +233,22 @@ prepare_one_interface (NMDnsSystemdResolved *self, InterfaceConfig *ic) } nm_assert (mdns_arg); + switch (llmnr) { + case NM_SETTING_CONNECTION_LLMNR_NO: + llmnr_arg = "no"; + break; + case NM_SETTING_CONNECTION_LLMNR_RESOLVE: + llmnr_arg = "resolve"; + break; + case NM_SETTING_CONNECTION_LLMNR_YES: + llmnr_arg = "yes"; + break; + case NM_SETTING_CONNECTION_LLMNR_DEFAULT: + llmnr_arg = ""; + break; + } + nm_assert (llmnr_arg); + _request_item_append (&priv->request_queue_lst_head, "SetLinkDNS", g_variant_builder_end (&dns)); @@ -240,6 +258,9 @@ prepare_one_interface (NMDnsSystemdResolved *self, InterfaceConfig *ic) _request_item_append (&priv->request_queue_lst_head, "SetLinkMulticastDNS", g_variant_new ("(is)", ic->ifindex, mdns_arg ?: "")); + _request_item_append (&priv->request_queue_lst_head, + "SetLinkLLMNR", + g_variant_new ("(is)", ic->ifindex, llmnr_arg ?: "")); } static void @@ -370,28 +391,20 @@ static void nm_dns_systemd_resolved_init (NMDnsSystemdResolved *self) { NMDnsSystemdResolvedPrivate *priv = NM_DNS_SYSTEMD_RESOLVED_GET_PRIVATE (self); - NMDBusManager *dbus_mgr; - GDBusConnection *connection; c_list_init (&priv->request_queue_lst_head); - dbus_mgr = nm_dbus_manager_get (); - g_return_if_fail (dbus_mgr); - - connection = nm_dbus_manager_get_connection (dbus_mgr); - g_return_if_fail (connection); - priv->init_cancellable = g_cancellable_new (); - g_dbus_proxy_new (connection, - G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | - G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS, - NULL, - SYSTEMD_RESOLVED_DBUS_SERVICE, - SYSTEMD_RESOLVED_DBUS_PATH, - SYSTEMD_RESOLVED_DBUS_SERVICE ".Manager", - priv->init_cancellable, - resolved_proxy_created, - self); + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | + G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS, + NULL, + SYSTEMD_RESOLVED_DBUS_SERVICE, + SYSTEMD_RESOLVED_DBUS_PATH, + SYSTEMD_RESOLVED_DBUS_SERVICE ".Manager", + priv->init_cancellable, + resolved_proxy_created, + self); } NMDnsPlugin * @@ -410,7 +423,6 @@ dispose (GObject *object) g_clear_object (&priv->resolve); nm_clear_g_cancellable (&priv->init_cancellable); nm_clear_g_cancellable (&priv->update_cancellable); - nm_clear_g_cancellable (&priv->mdns_cancellable); G_OBJECT_CLASS (nm_dns_systemd_resolved_parent_class)->dispose (object); } diff --git a/src/dns/nm-dns-unbound.c b/src/dns/nm-dns-unbound.c index e06128aa..b900f29e 100644 --- a/src/dns/nm-dns-unbound.c +++ b/src/dns/nm-dns-unbound.c @@ -43,7 +43,7 @@ update (NMDnsPlugin *plugin, const CList *ip_config_lst_head, const char *hostname) { - char *argv[] = { DNSSEC_TRIGGER_SCRIPT, "--async", "--update", NULL }; + char *argv[] = { DNSSEC_TRIGGER_PATH, "--async", "--update", NULL }; int status; /* TODO: We currently call a script installed with the dnssec-trigger |