From 5a338dc86fd0be95f3a82cfa67692814952068de Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Tue, 19 Jul 2016 15:21:33 +0200 Subject: [PATCH] Add source --- .gitignore | 1 + ...sq-clear-cache-and-restart-rh1338731.patch | 531 ------------------ sources | 2 +- 3 files changed, 2 insertions(+), 532 deletions(-) delete mode 100644 0001-dnsmasq-clear-cache-and-restart-rh1338731.patch diff --git a/.gitignore b/.gitignore index 5335206..ecdb1e3 100644 --- a/.gitignore +++ b/.gitignore @@ -326,3 +326,4 @@ network-manager-applet-0.8.1.tar.bz2 /NetworkManager-1.1.93.tar.xz /NetworkManager-1.1.94.tar.xz /NetworkManager-1.2.2.tar.xz +/NetworkManager-1.3.0.git20160621.072358da.tar.xz diff --git a/0001-dnsmasq-clear-cache-and-restart-rh1338731.patch b/0001-dnsmasq-clear-cache-and-restart-rh1338731.patch deleted file mode 100644 index bc5162c..0000000 --- a/0001-dnsmasq-clear-cache-and-restart-rh1338731.patch +++ /dev/null @@ -1,531 +0,0 @@ -From 594a225264fe501ec78a8d20ee5447d18e1175b5 Mon Sep 17 00:00:00 2001 -From: Beniamino Galvani -Date: Tue, 31 May 2016 17:04:03 +0200 -Subject: [PATCH 1/6] core: fix some memory leaks - -(cherry picked from commit ec53ed2cbaab754ddf1283658b5adfba8134e757) -(cherry picked from commit 70d194c159c80266140157db535700f8e44dbe0b) ---- - src/dhcp-manager/nm-dhcp-client.c | 2 ++ - src/nm-manager.c | 2 +- - src/nm-policy.c | 1 + - 3 files changed, 4 insertions(+), 1 deletion(-) - -diff --git a/src/dhcp-manager/nm-dhcp-client.c b/src/dhcp-manager/nm-dhcp-client.c -index 9f4cdf3..c102581 100644 ---- a/src/dhcp-manager/nm-dhcp-client.c -+++ b/src/dhcp-manager/nm-dhcp-client.c -@@ -884,7 +884,9 @@ dispose (GObject *object) - - g_clear_pointer (&priv->iface, g_free); - g_clear_pointer (&priv->hostname, g_free); -+ g_clear_pointer (&priv->fqdn, g_free); - g_clear_pointer (&priv->uuid, g_free); -+ g_clear_pointer (&priv->client_id, g_bytes_unref); - - if (priv->hwaddr) { - g_byte_array_free (priv->hwaddr, TRUE); -diff --git a/src/nm-manager.c b/src/nm-manager.c -index e64c68a..04b70cb 100644 ---- a/src/nm-manager.c -+++ b/src/nm-manager.c -@@ -3268,7 +3268,7 @@ validate_activation_request (NMManager *self, - NM_MANAGER_ERROR, - NM_MANAGER_ERROR_CONNECTION_NOT_AVAILABLE, - "Sharing IPv6 connections is not supported yet."); -- return NULL; -+ goto error; - } - - /* Check whether it's a VPN or not */ -diff --git a/src/nm-policy.c b/src/nm-policy.c -index 07bcce8..cb04f21 100644 ---- a/src/nm-policy.c -+++ b/src/nm-policy.c -@@ -913,6 +913,7 @@ block_autoconnect_for_device (NMPolicy *self, NMDevice *device) - NM_DEVICE_STATE_REASON_USER_REQUESTED); - } - } -+ g_slist_free (connections); - } - - static void --- -2.5.5 - - -From f5a98215c616a8a7f4acb9a3e03667444b8fda6e Mon Sep 17 00:00:00 2001 -From: Beniamino Galvani -Date: Tue, 24 May 2016 13:41:44 +0200 -Subject: [PATCH 2/6] dns/dnsmasq: cancel pending update on dispose - -There might be a pending "SetServersEx" D-Bus call when the plugin is -destroyed, ensure it gets canceled. - -(cherry picked from commit d376787ce1a9e8c4990ed98be143ab892c9d29ed) -(cherry picked from commit 7541ca0692668070e48adfc5fa8e4c6501600e16) ---- - src/dns-manager/nm-dns-dnsmasq.c | 21 ++++++++++++++++----- - 1 file changed, 16 insertions(+), 5 deletions(-) - -diff --git a/src/dns-manager/nm-dns-dnsmasq.c b/src/dns-manager/nm-dns-dnsmasq.c -index 4cee160..1df01e3 100644 ---- a/src/dns-manager/nm-dns-dnsmasq.c -+++ b/src/dns-manager/nm-dns-dnsmasq.c -@@ -48,6 +48,7 @@ G_DEFINE_TYPE (NMDnsDnsmasq, nm_dns_dnsmasq, NM_TYPE_DNS_PLUGIN) - typedef struct { - GDBusProxy *dnsmasq; - GCancellable *dnsmasq_cancellable; -+ GCancellable *update_cancellable; - gboolean running; - - GVariant *set_server_ex_args; -@@ -265,14 +266,20 @@ add_ip6_config (NMDnsDnsmasq *self, GVariantBuilder *servers, NMIP6Config *ip6, - } - - static void --dnsmasq_update_done (GObject *source, GAsyncResult *res, gpointer user_data) -+dnsmasq_update_done (GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) - { -- NMDnsDnsmasq *self = NM_DNS_DNSMASQ (user_data); -- NMDnsDnsmasqPrivate *priv = NM_DNS_DNSMASQ_GET_PRIVATE (self); -+ NMDnsDnsmasq *self; -+ NMDnsDnsmasqPrivate *priv; - gs_free_error GError *error = NULL; - gs_unref_variant GVariant *response = NULL; - -- response = g_dbus_proxy_call_finish (priv->dnsmasq, res, &error); -+ response = g_dbus_proxy_call_finish (proxy, res, &error); -+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) -+ return; -+ -+ self = NM_DNS_DNSMASQ (user_data); -+ priv = NM_DNS_DNSMASQ_GET_PRIVATE (self); -+ - if (!response) - _LOGW ("dnsmasq update failed: %s", error->message); - else -@@ -290,12 +297,15 @@ send_dnsmasq_update (NMDnsDnsmasq *self) - if (priv->running) { - _LOGD ("trying to update dnsmasq nameservers"); - -+ nm_clear_g_cancellable (&priv->update_cancellable); -+ priv->update_cancellable = g_cancellable_new (); -+ - g_dbus_proxy_call (priv->dnsmasq, - "SetServersEx", - priv->set_server_ex_args, - G_DBUS_CALL_FLAGS_NONE, - -1, -- NULL, -+ priv->update_cancellable, - (GAsyncReadyCallback) dnsmasq_update_done, - self); - g_clear_pointer (&priv->set_server_ex_args, g_variant_unref); -@@ -559,6 +569,7 @@ dispose (GObject *object) - NMDnsDnsmasqPrivate *priv = NM_DNS_DNSMASQ_GET_PRIVATE (object); - - nm_clear_g_cancellable (&priv->dnsmasq_cancellable); -+ nm_clear_g_cancellable (&priv->update_cancellable); - - g_clear_object (&priv->dnsmasq); - --- -2.5.5 - - -From ac4bfce7dde54a607c896e90a3269633a90f3bee Mon Sep 17 00:00:00 2001 -From: Beniamino Galvani -Date: Tue, 24 May 2016 14:14:25 +0200 -Subject: [PATCH 3/6] dns: clear dnsmasq cache after an update - -When the list of DNS servers changes, old DNS entries cached by -dnsmasq must be invalidated as the answers returned by new servers may -be different (especially, old NXDOMAIN entries may now be valid). Call -the dnsmasq "ClearCache" D-Bus method to achieve this. - -https://bugzilla.redhat.com/show_bug.cgi?id=1338731 -(cherry picked from commit 4feb58b50b9fd6caceda83bab907ad107ad8ed01) -(cherry picked from commit a701e5b7ba35a0730d756ab0c1b15f0414bee592) ---- - src/dns-manager/nm-dns-dnsmasq.c | 31 +++++++++++++++++++++++++++++-- - 1 file changed, 29 insertions(+), 2 deletions(-) - -diff --git a/src/dns-manager/nm-dns-dnsmasq.c b/src/dns-manager/nm-dns-dnsmasq.c -index 1df01e3..dd1234d 100644 ---- a/src/dns-manager/nm-dns-dnsmasq.c -+++ b/src/dns-manager/nm-dns-dnsmasq.c -@@ -266,6 +266,25 @@ add_ip6_config (NMDnsDnsmasq *self, GVariantBuilder *servers, NMIP6Config *ip6, - } - - static void -+dnsmasq_clear_cache_done (GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) -+{ -+ NMDnsDnsmasq *self; -+ gs_free_error GError *error = NULL; -+ gs_unref_variant GVariant *response = NULL; -+ -+ response = g_dbus_proxy_call_finish (proxy, res, &error); -+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) -+ return; -+ -+ self = NM_DNS_DNSMASQ (user_data); -+ -+ if (!response) -+ _LOGW ("dnsmasq cache clear failed: %s", error->message); -+ else -+ _LOGD ("dnsmasq update successful, cache cleared"); -+} -+ -+static void - dnsmasq_update_done (GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) - { - NMDnsDnsmasq *self; -@@ -282,8 +301,16 @@ dnsmasq_update_done (GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) - - if (!response) - _LOGW ("dnsmasq update failed: %s", error->message); -- else -- _LOGD ("dnsmasq update successful"); -+ else { -+ g_dbus_proxy_call (priv->dnsmasq, -+ "ClearCache", -+ NULL, -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ priv->update_cancellable, -+ (GAsyncReadyCallback) dnsmasq_clear_cache_done, -+ self); -+ } - } - - static void --- -2.5.5 - - -From b71ce01f5aa5af2851a4c5516a1c11b86b65b4b8 Mon Sep 17 00:00:00 2001 -From: Beniamino Galvani -Date: Sun, 1 May 2016 22:24:41 +0200 -Subject: [PATCH 4/6] core: introduce nm_utils_dnsmasq_status_to_string() - -(cherry picked from commit c0d322720a3956a40831c09f78a1dfbaf6fd9294) -(cherry picked from commit 84b0bb5ec82661a2b47928cc49879ed49fa18602) ---- - src/dns-manager/nm-dns-dnsmasq.c | 23 ++------------------ - src/dnsmasq-manager/nm-dnsmasq-manager.c | 36 ++++--------------------------- - src/nm-core-utils.c | 37 ++++++++++++++++++++++++++++++++ - src/nm-core-utils.h | 2 ++ - 4 files changed, 45 insertions(+), 53 deletions(-) - -diff --git a/src/dns-manager/nm-dns-dnsmasq.c b/src/dns-manager/nm-dns-dnsmasq.c -index dd1234d..aaa6a3e 100644 ---- a/src/dns-manager/nm-dns-dnsmasq.c -+++ b/src/dns-manager/nm-dns-dnsmasq.c -@@ -519,24 +519,6 @@ update (NMDnsPlugin *plugin, - - /****************************************************************/ - --static const char * --dm_exit_code_to_msg (int status) --{ -- if (status == 1) -- return "Configuration problem"; -- else if (status == 2) -- return "Network access problem (address in use; permissions; etc)"; -- else if (status == 3) -- return "Filesystem problem (missing file/directory; permissions; etc)"; -- else if (status == 4) -- return "Memory allocation failure"; -- else if (status == 5) -- return "Other problem"; -- else if (status >= 11) -- return "Lease-script 'init' process failure"; -- return "Unknown error"; --} -- - static void - child_quit (NMDnsPlugin *plugin, gint status) - { -@@ -547,9 +529,8 @@ child_quit (NMDnsPlugin *plugin, gint status) - if (WIFEXITED (status)) { - err = WEXITSTATUS (status); - if (err) { -- _LOGW ("dnsmasq exited with error: %s (%d)", -- dm_exit_code_to_msg (err), -- err); -+ _LOGW ("dnsmasq exited with error: %s", -+ nm_utils_dnsmasq_status_to_string (err, NULL, 0)); - } else - failed = FALSE; - } else if (WIFSTOPPED (status)) -diff --git a/src/dnsmasq-manager/nm-dnsmasq-manager.c b/src/dnsmasq-manager/nm-dnsmasq-manager.c -index 764aba2..12395db 100644 ---- a/src/dnsmasq-manager/nm-dnsmasq-manager.c -+++ b/src/dnsmasq-manager/nm-dnsmasq-manager.c -@@ -165,36 +165,6 @@ nm_cmd_line_add_string (NMCmdLine *cmd, const char *str) - /*******************************************/ - - static void --dm_exit_code (guint dm_exit_status) --{ -- char *msg = "Unknown error"; -- -- switch (dm_exit_status) { -- case 1: -- msg = "Configuration problem"; -- break; -- case 2: -- msg = "Network access problem (address in use; permissions; etc)"; -- break; -- case 3: -- msg = "Filesystem problem (missing file/directory; permissions; etc)"; -- break; -- case 4: -- msg = "Memory allocation failure"; -- break; -- case 5: -- msg = "Other problem"; -- break; -- default: -- if (dm_exit_status >= 11) -- msg = "Lease-script 'init' process failure"; -- break; -- } -- -- _LOGW ("dnsmasq exited with error: %s (%d)", msg, dm_exit_status); --} -- --static void - dm_watch_cb (GPid pid, gint status, gpointer user_data) - { - NMDnsMasqManager *manager = NM_DNSMASQ_MANAGER (user_data); -@@ -203,8 +173,10 @@ dm_watch_cb (GPid pid, gint status, gpointer user_data) - - if (WIFEXITED (status)) { - err = WEXITSTATUS (status); -- if (err != 0) -- dm_exit_code (err); -+ if (err != 0) { -+ _LOGW ("dnsmasq exited with error: %s", -+ nm_utils_dnsmasq_status_to_string (err, NULL, 0)); -+ } - } else if (WIFSTOPPED (status)) { - _LOGW ("dnsmasq stopped unexpectedly with signal %d", WSTOPSIG (status)); - } else if (WIFSIGNALED (status)) { -diff --git a/src/nm-core-utils.c b/src/nm-core-utils.c -index ef44a13..a2fbdfb 100644 ---- a/src/nm-core-utils.c -+++ b/src/nm-core-utils.c -@@ -3085,3 +3085,40 @@ nm_utils_lifetime_get (guint32 timestamp, - return TRUE; - } - -+const char * -+nm_utils_dnsmasq_status_to_string (int status, char *dest, guint size) -+{ -+ static char buffer[128]; -+ char *msg, *ret; -+ gs_free char *msg_free = NULL; -+ int len; -+ -+ if (status == 0) -+ msg = "Success"; -+ else if (status == 1) -+ msg = "Configuration problem"; -+ else if (status == 2) -+ msg = "Network access problem (address in use, permissions)"; -+ else if (status == 3) -+ msg = "Filesystem problem (missing file/directory, permissions)"; -+ else if (status == 4) -+ msg = "Memory allocation failure"; -+ else if (status == 5) -+ msg = "Other problem"; -+ else if (status >= 11) -+ msg = msg_free = g_strdup_printf ("Lease script failed with error %d", status - 10); -+ else -+ msg = "Unknown problem"; -+ -+ if (dest) { -+ ret = dest; -+ len = size; -+ } else { -+ ret = buffer; -+ len = sizeof (buffer); -+ } -+ -+ g_snprintf (ret, len, "%s (%d)", msg, status); -+ -+ return ret; -+} -diff --git a/src/nm-core-utils.h b/src/nm-core-utils.h -index ad0f995..b5083ac 100644 ---- a/src/nm-core-utils.h -+++ b/src/nm-core-utils.h -@@ -394,4 +394,6 @@ gboolean nm_utils_lifetime_get (guint32 timestamp, - - gboolean nm_utils_ip4_address_is_link_local (in_addr_t addr); - -+const char *nm_utils_dnsmasq_status_to_string (int status, char *dest, guint size); -+ - #endif /* __NM_CORE_UTILS_H__ */ --- -2.5.5 - - -From 4e78e89ac35954d38ff107c42295b1418042a13c Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Mon, 30 May 2016 12:52:23 +0200 -Subject: [PATCH 5/6] dns: log when dnsmasq process exits normally - -(cherry picked from commit a64d70f0df586d398aa1bcd74be131ed6dc75450) -(cherry picked from commit 2deee5286726fb2933822e105ffce634df695b35) ---- - src/dns-manager/nm-dns-dnsmasq.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/src/dns-manager/nm-dns-dnsmasq.c b/src/dns-manager/nm-dns-dnsmasq.c -index aaa6a3e..f8b2dd3 100644 ---- a/src/dns-manager/nm-dns-dnsmasq.c -+++ b/src/dns-manager/nm-dns-dnsmasq.c -@@ -531,8 +531,10 @@ child_quit (NMDnsPlugin *plugin, gint status) - if (err) { - _LOGW ("dnsmasq exited with error: %s", - nm_utils_dnsmasq_status_to_string (err, NULL, 0)); -- } else -+ } else { -+ _LOGD ("dnsmasq exited normally"); - failed = FALSE; -+ } - } else if (WIFSTOPPED (status)) - _LOGW ("dnsmasq stopped unexpectedly with signal %d", WSTOPSIG (status)); - else if (WIFSIGNALED (status)) --- -2.5.5 - - -From 3061adfc7d962ef645f2844dfce7df5e359509b5 Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Mon, 30 May 2016 12:58:57 +0200 -Subject: [PATCH 6/6] 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 -(cherry picked from commit 2e7f4aeb60579b092641cc8d65973baecbd5335b) -(cherry picked from commit 1f8ba33d8716858cc27cf319c85e176bcf11afa3) ---- - src/dns-manager/nm-dns-dnsmasq.c | 21 ++++++++++++++++++--- - src/dns-manager/nm-dns-plugin.c | 11 +++++++++++ - src/dns-manager/nm-dns-plugin.h | 2 ++ - 3 files changed, 31 insertions(+), 3 deletions(-) - -diff --git a/src/dns-manager/nm-dns-dnsmasq.c b/src/dns-manager/nm-dns-dnsmasq.c -index f8b2dd3..a9fcc88 100644 ---- a/src/dns-manager/nm-dns-dnsmasq.c -+++ b/src/dns-manager/nm-dns-dnsmasq.c -@@ -410,11 +410,16 @@ start_dnsmasq (NMDnsDnsmasq *self) - NMBusManager *dbus_mgr; - GDBusConnection *connection; - -+ if (priv->running) { -+ /* the dnsmasq process is running. Nothing to do. */ -+ return; -+ } - -- if ( priv->running -- || priv->dnsmasq -- || priv->dnsmasq_cancellable) -+ 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) { -@@ -446,6 +451,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); - -@@ -523,6 +535,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; - -@@ -542,6 +555,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); - } -diff --git a/src/dns-manager/nm-dns-plugin.c b/src/dns-manager/nm-dns-plugin.c -index d5cb882..f45b47f 100644 ---- a/src/dns-manager/nm-dns-plugin.c -+++ b/src/dns-manager/nm-dns-plugin.c -@@ -182,6 +182,17 @@ watch_cb (GPid pid, gint status, gpointer user_data) - } - - 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, - const char *pidfile, -diff --git a/src/dns-manager/nm-dns-plugin.h b/src/dns-manager/nm-dns-plugin.h -index 7ecaa42..b328218 100644 ---- a/src/dns-manager/nm-dns-plugin.h -+++ b/src/dns-manager/nm-dns-plugin.h -@@ -111,6 +111,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__ */ --- -2.5.5 - diff --git a/sources b/sources index 0aedb97..fec32f0 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -a922bf20c2243c9014fb14c4427ad035 NetworkManager-1.2.2.tar.xz +a0cc1a7bf3e85030b7bf53c3b981d4ce NetworkManager-1.3.0.git20160621.072358da.tar.xz