Add upstream patches that went into RHEL

- device: don't change MTU unless explicitly configured (rh #1460760)
- core: don't remove external IPv4 addresses (rh #1459813)
- cli: fix output of iface in overview output (rh#1460219)
- ppp: unexport NMPPPManager instance on dispose (rh#1459579)
- cli: remove spurious device names from wifi subcommands output (rh#1460527)
This commit is contained in:
Lubomir Rintel 2017-06-22 12:52:23 +02:00
parent ebf02b63fe
commit a2ab3fed9e
8 changed files with 3894 additions and 1 deletions

View File

@ -0,0 +1,225 @@
From 5231db02204ce3c45e2415eedbd915fa56445401 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Mon, 15 May 2017 17:17:26 +0200
Subject: [PATCH] core: add configuration flag to choose slaves activation
order
Commits 39d0559d9a7a ("platform: sort links by name instead of
ifindex") and 529a0a1a7f19 ("manager: sort slaves to be autoconnected
by device name") changed the order of activation of slaves. Introduce
a system-wide configuration property to preserve the old behavior.
https://bugzilla.redhat.com/show_bug.cgi?id=1452585
(cherry picked from commit 31656a066bfb3edc106f5efd5d2be46396824930)
(cherry picked from commit 3fefef8594ef2690c56fd44a6ce4836decaaee56)
---
man/NetworkManager.conf.xml | 13 +++++++++++++
src/nm-config.h | 1 +
src/nm-manager.c | 26 ++++++++++++++++++++------
src/platform/nm-platform.c | 26 +++++++++++++++-----------
src/platform/nm-platform.h | 2 +-
src/platform/tests/test-common.c | 2 +-
src/platform/tests/test-general.c | 2 +-
7 files changed, 52 insertions(+), 20 deletions(-)
diff --git a/man/NetworkManager.conf.xml b/man/NetworkManager.conf.xml
index 2a8ba76..5e76c0a 100644
--- a/man/NetworkManager.conf.xml
+++ b/man/NetworkManager.conf.xml
@@ -409,6 +409,19 @@ no-auto-default=*
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>slaves-order</varname></term>
+ <listitem>
+ <para>
+ This key specifies in which order slave connections are
+ auto-activated on boot or when the master activates
+ them. Allowed values are <literal>name</literal> (order
+ connection by interface name, the default), or
+ <literal>index</literal> (order slaves by their kernel
+ index).
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
</refsect1>
diff --git a/src/nm-config.h b/src/nm-config.h
index 283d6a1..ae695fc 100644
--- a/src/nm-config.h
+++ b/src/nm-config.h
@@ -63,6 +63,7 @@
#define NM_CONFIG_KEYFILE_KEY_MAIN_DHCP "dhcp"
#define NM_CONFIG_KEYFILE_KEY_MAIN_DEBUG "debug"
#define NM_CONFIG_KEYFILE_KEY_MAIN_HOSTNAME_MODE "hostname-mode"
+#define NM_CONFIG_KEYFILE_KEY_MAIN_SLAVES_ORDER "slaves-order"
#define NM_CONFIG_KEYFILE_KEY_LOGGING_BACKEND "backend"
#define NM_CONFIG_KEYFILE_KEY_CONFIG_ENABLE "enable"
#define NM_CONFIG_KEYFILE_KEY_ATOMIC_SECTION_WAS ".was"
diff --git a/src/nm-manager.c b/src/nm-manager.c
index a740219..3d94ce9 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -2459,10 +2459,14 @@ platform_query_devices (NMManager *self)
NMPlatformLink *links;
int i;
gboolean guess_assume;
+ const char *order;
guess_assume = nm_config_get_first_start (nm_config_get ());
-
- links_array = nm_platform_link_get_all (NM_PLATFORM_GET);
+ order = nm_config_data_get_value_cached (NM_CONFIG_GET_DATA,
+ NM_CONFIG_KEYFILE_GROUP_MAIN,
+ NM_CONFIG_KEYFILE_KEY_MAIN_SLAVES_ORDER,
+ NM_CONFIG_GET_VALUE_STRIP);
+ links_array = nm_platform_link_get_all (NM_PLATFORM_GET, !nm_streq0 (order, "index"));
links = (NMPlatformLink *) links_array->data;
for (i = 0; i < links_array->len; i++) {
gs_free NMConfigDeviceStateData *dev_state = NULL;
@@ -3016,7 +3020,7 @@ out:
}
static gint
-compare_slaves (gconstpointer a, gconstpointer b, gpointer _unused)
+compare_slaves (gconstpointer a, gconstpointer b, gpointer sort_by_name)
{
const SlaveConnectionInfo *a_info = a;
const SlaveConnectionInfo *b_info = b;
@@ -3027,8 +3031,12 @@ compare_slaves (gconstpointer a, gconstpointer b, gpointer _unused)
if (!b_info->device)
return -1;
- return g_strcmp0 (nm_device_get_iface (a_info->device),
- nm_device_get_iface (b_info->device));
+ if (GPOINTER_TO_INT (sort_by_name)) {
+ return g_strcmp0 (nm_device_get_iface (a_info->device),
+ nm_device_get_iface (b_info->device));
+ }
+
+ return nm_device_get_ifindex (a_info->device) - nm_device_get_ifindex (b_info->device);
}
static void
@@ -3042,11 +3050,17 @@ autoconnect_slaves (NMManager *self,
if (should_connect_slaves (NM_CONNECTION (master_connection), master_device)) {
gs_free SlaveConnectionInfo *slaves = NULL;
guint i, n_slaves = 0;
+ const char *value;
slaves = find_slaves (self, master_connection, master_device, &n_slaves);
if (n_slaves > 1) {
+ value = nm_config_data_get_value_cached (NM_CONFIG_GET_DATA,
+ NM_CONFIG_KEYFILE_GROUP_MAIN,
+ NM_CONFIG_KEYFILE_KEY_MAIN_SLAVES_ORDER,
+ NM_CONFIG_GET_VALUE_STRIP);
g_qsort_with_data (slaves, n_slaves, sizeof (slaves[0]),
- compare_slaves, NULL);
+ compare_slaves,
+ GINT_TO_POINTER (!nm_streq0 (value, "index")));
}
for (i = 0; i < n_slaves; i++) {
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 767187d..a244ff3 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -437,7 +437,8 @@ nm_platform_sysctl_get_int_checked (NMPlatform *self, const char *pathid, int di
static int
_link_get_all_presort (gconstpointer p_a,
- gconstpointer p_b)
+ gconstpointer p_b,
+ gpointer sort_by_name)
{
const NMPlatformLink *a = p_a;
const NMPlatformLink *b = p_b;
@@ -448,13 +449,16 @@ _link_get_all_presort (gconstpointer p_a,
if (b->ifindex == 1)
return 1;
- /* Initialized links first */
- if (a->initialized > b->initialized)
- return -1;
- if (a->initialized < b->initialized)
- return 1;
+ if (GPOINTER_TO_INT (sort_by_name)) {
+ /* Initialized links first */
+ if (a->initialized > b->initialized)
+ return -1;
+ if (a->initialized < b->initialized)
+ return 1;
- return strcmp (a->name, b->name);
+ return strcmp (a->name, b->name);
+ } else
+ return a->ifindex - b->ifindex;
}
/**
@@ -465,7 +469,7 @@ _link_get_all_presort (gconstpointer p_a,
* owned by the caller and should be freed with g_array_unref().
*/
GArray *
-nm_platform_link_get_all (NMPlatform *self)
+nm_platform_link_get_all (NMPlatform *self, gboolean sort_by_name)
{
GArray *links, *result;
guint i, j, nresult;
@@ -479,9 +483,9 @@ nm_platform_link_get_all (NMPlatform *self)
if (!links || links->len == 0)
return links;
- /* first sort the links by their ifindex. Below we will sort further by moving
- * children/slaves to the end. */
- g_array_sort (links, _link_get_all_presort);
+ /* first sort the links by their ifindex or name. Below we will sort
+ * further by moving children/slaves to the end. */
+ g_array_sort_with_data (links, _link_get_all_presort, GINT_TO_POINTER (sort_by_name));
unseen = g_hash_table_new (g_direct_hash, g_direct_equal);
for (i = 0; i < links->len; i++) {
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index 43be17f..1b8fa13 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -763,7 +763,7 @@ const NMPlatformLink *nm_platform_link_get (NMPlatform *self, int ifindex);
const NMPlatformLink *nm_platform_link_get_by_ifname (NMPlatform *self, const char *ifname);
const NMPlatformLink *nm_platform_link_get_by_address (NMPlatform *self, gconstpointer address, size_t length);
-GArray *nm_platform_link_get_all (NMPlatform *self);
+GArray *nm_platform_link_get_all (NMPlatform *self, gboolean sort_by_name);
NMPlatformError nm_platform_link_dummy_add (NMPlatform *self, const char *name, const NMPlatformLink **out_link);
NMPlatformError nm_platform_link_bridge_add (NMPlatform *self, const char *name, const void *address, size_t address_len, const NMPlatformLink **out_link);
NMPlatformError nm_platform_link_bond_add (NMPlatform *self, const char *name, const NMPlatformLink **out_link);
diff --git a/src/platform/tests/test-common.c b/src/platform/tests/test-common.c
index 04db862..a9d0694 100644
--- a/src/platform/tests/test-common.c
+++ b/src/platform/tests/test-common.c
@@ -185,7 +185,7 @@ link_callback (NMPlatform *platform, int obj_type_i, int ifindex, NMPlatformLink
/* Check the data */
g_assert (received->ifindex > 0);
- links = nm_platform_link_get_all (NM_PLATFORM_GET);
+ links = nm_platform_link_get_all (NM_PLATFORM_GET, TRUE);
for (i = 0; i < links->len; i++) {
cached = &g_array_index (links, NMPlatformLink, i);
if (cached->ifindex == received->ifindex) {
diff --git a/src/platform/tests/test-general.c b/src/platform/tests/test-general.c
index 2ccfac7..e772662 100644
--- a/src/platform/tests/test-general.c
+++ b/src/platform/tests/test-general.c
@@ -48,7 +48,7 @@ test_link_get_all (void)
platform = nm_linux_platform_new (TRUE, NM_PLATFORM_NETNS_SUPPORT_DEFAULT);
- links = nm_platform_link_get_all (platform);
+ links = nm_platform_link_get_all (platform, TRUE);
}
/*****************************************************************************/
--
2.9.3

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,63 @@
From 8850e02a3d3b6442c7b0f5e658892e167a74f81d Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 9 Jun 2017 15:18:20 +0200
Subject: [PATCH 1/2] cli: fix output of iface in overview output
Fixes: f14845cc200e21ed3aafadc2f9456cb0e2791f56
https://bugzilla.redhat.com/show_bug.cgi?id=1460219
(cherry picked from commit 126b0874f19fa3647c0343d73dfdb48d6154bc08)
(cherry picked from commit be4e1000e8c88753e9ca0fee38c15712e5c1dd16)
---
clients/cli/general.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clients/cli/general.c b/clients/cli/general.c
index 12e76ef..4406c84 100644
--- a/clients/cli/general.c
+++ b/clients/cli/general.c
@@ -1139,7 +1139,7 @@ device_overview (NmCli *nmc, NMDevice *device)
if ( nm_device_get_ip_iface (device)
&& g_strcmp0 (nm_device_get_ip_iface (device), nm_device_get_iface (device))
&& g_strcmp0 (nm_device_get_ip_iface (device), ""))
- g_string_append_printf (outbuf, "%s %s,", _("iface"), nm_device_get_ip_iface (device));
+ g_string_append_printf (outbuf, "%s %s, ", _("iface"), nm_device_get_ip_iface (device));
if (nm_device_get_physical_port_id (device))
g_string_append_printf (outbuf, "%s %s, ", _("port"), nm_device_get_physical_port_id (device));
--
2.9.3
From d37fefb8b9ee7c6beacf8ea49acbcad83453553d Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 9 Jun 2017 15:23:44 +0200
Subject: [PATCH 2/2] cli: minor refactoring of if-condition in device_overview
Note that nm_device_get_ip_iface() never returns an emptry string "".
(cherry picked from commit ee5fdcbfb50ec19b82715440e1c45f3c8e6ee5ea)
(cherry picked from commit c9c0a138294819d1c987d420918fa10d18e9a353)
---
clients/cli/general.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/clients/cli/general.c b/clients/cli/general.c
index 4406c84..68fab6e 100644
--- a/clients/cli/general.c
+++ b/clients/cli/general.c
@@ -1136,9 +1136,9 @@ device_overview (NmCli *nmc, NMDevice *device)
else
g_string_append_printf (outbuf, "%s, ", _("hw"));
- if ( nm_device_get_ip_iface (device)
- && g_strcmp0 (nm_device_get_ip_iface (device), nm_device_get_iface (device))
- && g_strcmp0 (nm_device_get_ip_iface (device), ""))
+ if (!NM_IN_STRSET (nm_device_get_ip_iface (device),
+ NULL,
+ nm_device_get_iface (device)))
g_string_append_printf (outbuf, "%s %s, ", _("iface"), nm_device_get_ip_iface (device));
if (nm_device_get_physical_port_id (device))
--
2.9.3

View File

@ -0,0 +1,526 @@
From 6f9227609de574d1e69154d30025429a78aea4a9 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Wed, 7 Jun 2017 16:09:18 +0200
Subject: [PATCH 1/8] ppp: cast int argument for variadic
g_signal_emit(NM_PPP_MANAGER_STATE_CHANGE) call
(cherry picked from commit 7b5251b35c23a625959aac9a1ff617a955b3daa3)
(cherry picked from commit 2aa4239cba745c67c6b4fa165c5c366d51c961a9)
---
src/ppp/nm-ppp-manager.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/ppp/nm-ppp-manager.c b/src/ppp/nm-ppp-manager.c
index c7836a8..37d7a46 100644
--- a/src/ppp/nm-ppp-manager.c
+++ b/src/ppp/nm-ppp-manager.c
@@ -365,7 +365,7 @@ impl_ppp_manager_set_state (NMPPPManager *manager,
GDBusMethodInvocation *context,
guint32 state)
{
- g_signal_emit (manager, signals[STATE_CHANGED], 0, state);
+ g_signal_emit (manager, signals[STATE_CHANGED], 0, (guint) state);
g_dbus_method_invocation_return_value (context, NULL);
}
@@ -692,7 +692,7 @@ ppp_watch_cb (GPid pid, gint status, gpointer user_data)
_LOGD ("pppd pid %d cleaned up", priv->pid);
priv->pid = 0;
priv->ppp_watch_id = 0;
- g_signal_emit (manager, signals[STATE_CHANGED], 0, NM_PPP_STATUS_DEAD);
+ g_signal_emit (manager, signals[STATE_CHANGED], 0, (guint) NM_PPP_STATUS_DEAD);
}
static gboolean
@@ -704,7 +704,7 @@ pppd_timed_out (gpointer data)
_ppp_cleanup (manager);
_ppp_kill (manager);
- g_signal_emit (manager, signals[STATE_CHANGED], 0, NM_PPP_STATUS_DEAD);
+ g_signal_emit (manager, signals[STATE_CHANGED], 0, (guint) NM_PPP_STATUS_DEAD);
return FALSE;
}
--
2.9.3
From 7d485d2b0eec62a4b8345e261c958b9e15423220 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Wed, 7 Jun 2017 16:28:18 +0200
Subject: [PATCH 2/8] ppp: unexport NMPPPManager instance on dispose()
Let's explicitly unexports on dispose(). Probably that already
happened, because NMExportedObject asserts that it is unexported
during !quitting.
During quitting, we probably don't tear down the manager.
Anyway, we should always unexport.
(cherry picked from commit f07dca941dc327e11c4252688020d5fd0b9b3567)
(cherry picked from commit 5e656b5872e6399d6536e3fb043ca9c63e298774)
---
src/ppp/nm-ppp-manager.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/ppp/nm-ppp-manager.c b/src/ppp/nm-ppp-manager.c
index 37d7a46..fd0b991 100644
--- a/src/ppp/nm-ppp-manager.c
+++ b/src/ppp/nm-ppp-manager.c
@@ -1234,8 +1234,12 @@ static void
dispose (GObject *object)
{
NMPPPManager *self = (NMPPPManager *) object;
+ NMExportedObject *exported = NM_EXPORTED_OBJECT (self);
NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (self);
+ if (nm_exported_object_is_exported (exported))
+ nm_exported_object_unexport (exported);
+
_ppp_cleanup (self);
_ppp_kill (self);
--
2.9.3
From ca9bd14f512a060df129da9d490591886ce22ef7 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 9 Jun 2017 13:57:47 +0200
Subject: [PATCH 3/8] ppp: inline and drop trivial function
remove_timeout_handler()
(cherry picked from commit 0f16649ba27942e12c550449cc1669355118890f)
(cherry picked from commit 620adbcc7b2eb630299b9c0595b48e4823ccecde)
---
src/ppp/nm-ppp-manager.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/src/ppp/nm-ppp-manager.c b/src/ppp/nm-ppp-manager.c
index fd0b991..efaf73a 100644
--- a/src/ppp/nm-ppp-manager.c
+++ b/src/ppp/nm-ppp-manager.c
@@ -179,14 +179,6 @@ monitor_stats (NMPPPManager *manager)
/*****************************************************************************/
static void
-remove_timeout_handler (NMPPPManager *manager)
-{
- NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager);
-
- nm_clear_g_source (&priv->ppp_timeout_handler);
-}
-
-static void
cancel_get_secrets (NMPPPManager *self)
{
NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (self);
@@ -415,7 +407,7 @@ impl_ppp_manager_set_ip4_config (NMPPPManager *manager,
_LOGI ("(IPv4 Config Get) reply received.");
- remove_timeout_handler (manager);
+ nm_clear_g_source (&priv->ppp_timeout_handler);
config = nm_ip4_config_new (nm_platform_link_get_ifindex (NM_PLATFORM_GET, priv->ip_iface));
@@ -511,7 +503,7 @@ impl_ppp_manager_set_ip6_config (NMPPPManager *manager,
_LOGI ("(IPv6 Config Get) reply received.");
- remove_timeout_handler (manager);
+ nm_clear_g_source (&priv->ppp_timeout_handler);
config = nm_ip6_config_new (nm_platform_link_get_ifindex (NM_PLATFORM_GET, priv->ip_iface));
--
2.9.3
From 848af80037e21e9cc6bf9459f39f10ad314217eb Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 9 Jun 2017 14:00:14 +0200
Subject: [PATCH 4/8] ppp/trivial: fix whitespace
(cherry picked from commit 5c5fbe0a9f90c53215c70cc7a76ea011560172b8)
(cherry picked from commit 105ef99cbf7f503f05826430df0f8acf1d1f3af9)
---
src/ppp/nm-ppp-manager.c | 76 ++++++++++++++++++++++++------------------------
1 file changed, 38 insertions(+), 38 deletions(-)
diff --git a/src/ppp/nm-ppp-manager.c b/src/ppp/nm-ppp-manager.c
index efaf73a..558082f 100644
--- a/src/ppp/nm-ppp-manager.c
+++ b/src/ppp/nm-ppp-manager.c
@@ -595,64 +595,64 @@ ppp_exit_code (guint pppd_exit_status, GPid pid)
const char *msg;
switch (pppd_exit_status) {
- case 1:
- msg = "Fatal pppd error";
+ case 1:
+ msg = "Fatal pppd error";
break;
- case 2:
- msg = "pppd options error";
+ case 2:
+ msg = "pppd options error";
break;
- case 3:
- msg = "No root priv error";
+ case 3:
+ msg = "No root priv error";
break;
- case 4:
- msg = "No ppp module error";
+ case 4:
+ msg = "No ppp module error";
break;
- case 5:
- msg = "pppd received a signal";
+ case 5:
+ msg = "pppd received a signal";
break;
- case 6:
- msg = "Serial port lock failed";
+ case 6:
+ msg = "Serial port lock failed";
break;
- case 7:
- msg = "Serial port open failed";
+ case 7:
+ msg = "Serial port open failed";
break;
- case 8:
- msg = "Connect script failed";
+ case 8:
+ msg = "Connect script failed";
break;
- case 9:
- msg = "Pty program error";
+ case 9:
+ msg = "Pty program error";
break;
- case 10:
- msg = "PPP negotiation failed";
+ case 10:
+ msg = "PPP negotiation failed";
break;
- case 11:
- msg = "Peer didn't authenticatie itself";
+ case 11:
+ msg = "Peer didn't authenticatie itself";
break;
- case 12:
- msg = "Link idle: Idle Seconds reached.";
+ case 12:
+ msg = "Link idle: Idle Seconds reached.";
break;
- case 13:
- msg = "Connect time limit reached.";
+ case 13:
+ msg = "Connect time limit reached.";
break;
- case 14:
+ case 14:
msg = "Callback negotiated, call should come back.";
break;
- case 15:
- msg = "Lack of LCP echo responses";
+ case 15:
+ msg = "Lack of LCP echo responses";
break;
- case 16:
- msg = "A modem hung up the phone";
+ case 16:
+ msg = "A modem hung up the phone";
break;
- case 17:
- msg = "Loopback detected";
+ case 17:
+ msg = "Loopback detected";
break;
- case 18:
- msg = "The init script failed";
+ case 18:
+ msg = "The init script failed";
break;
- case 19:
+ case 19:
msg = "Authentication error.\n"
- "We failed to authenticate ourselves to the peer.\n"
- "Maybe bad account or password?";
+ "We failed to authenticate ourselves to the peer.\n"
+ "Maybe bad account or password?";
break;
default:
msg = "Unknown error";
--
2.9.3
From e2f6a3d1900949971adc1d44eb7c78465c11fb17 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 9 Jun 2017 14:12:58 +0200
Subject: [PATCH 5/8] ppp: refactor ppp_exit_code() to split out error to
string conversion
ppp_exit_code() does too much or too little. Either it should log
about all reasons why pppd exited, including signals, or it should
just do the status to string conversion. Split it.
(cherry picked from commit 3f64910b5249a8535deffddd0fd574c25b28dcea)
(cherry picked from commit ccda61b6fc0eb90a32ea2a4bc360c82406a26331)
---
src/ppp/nm-ppp-manager.c | 89 ++++++++++++++----------------------------------
1 file changed, 26 insertions(+), 63 deletions(-)
diff --git a/src/ppp/nm-ppp-manager.c b/src/ppp/nm-ppp-manager.c
index 558082f..d9044a4 100644
--- a/src/ppp/nm-ppp-manager.c
+++ b/src/ppp/nm-ppp-manager.c
@@ -589,74 +589,37 @@ nm_cmd_line_add_int (NMCmdLine *cmd, int i)
/*****************************************************************************/
+NM_UTILS_LOOKUP_STR_DEFINE_STATIC (pppd_exit_code_to_str, int,
+ NM_UTILS_LOOKUP_DEFAULT ("Unknown error"),
+ NM_UTILS_LOOKUP_STR_ITEM ( 1, "Fatal pppd error");
+ NM_UTILS_LOOKUP_STR_ITEM ( 2, "pppd options error"),
+ NM_UTILS_LOOKUP_STR_ITEM ( 3, "No root priv error"),
+ NM_UTILS_LOOKUP_STR_ITEM ( 4, "No ppp module error"),
+ NM_UTILS_LOOKUP_STR_ITEM ( 5, "pppd received a signal"),
+ NM_UTILS_LOOKUP_STR_ITEM ( 6, "Serial port lock failed"),
+ NM_UTILS_LOOKUP_STR_ITEM ( 7, "Serial port open failed"),
+ NM_UTILS_LOOKUP_STR_ITEM ( 8, "Connect script failed"),
+ NM_UTILS_LOOKUP_STR_ITEM ( 9, "Pty program error"),
+ NM_UTILS_LOOKUP_STR_ITEM (10, "PPP negotiation failed"),
+ NM_UTILS_LOOKUP_STR_ITEM (11, "Peer didn't authenticatie itself"),
+ NM_UTILS_LOOKUP_STR_ITEM (12, "Link idle: Idle Seconds reached."),
+ NM_UTILS_LOOKUP_STR_ITEM (13, "Connect time limit reached."),
+ NM_UTILS_LOOKUP_STR_ITEM (14, "Callback negotiated, call should come back."),
+ NM_UTILS_LOOKUP_STR_ITEM (15, "Lack of LCP echo responses"),
+ NM_UTILS_LOOKUP_STR_ITEM (16, "A modem hung up the phone"),
+ NM_UTILS_LOOKUP_STR_ITEM (17, "Loopback detected"),
+ NM_UTILS_LOOKUP_STR_ITEM (18, "The init script failed"),
+ NM_UTILS_LOOKUP_STR_ITEM (19, "Authentication error.\n"
+ "We failed to authenticate ourselves to the peer.\n"
+ "Maybe bad account or password?"),
+);
+
static void
ppp_exit_code (guint pppd_exit_status, GPid pid)
{
const char *msg;
- switch (pppd_exit_status) {
- case 1:
- msg = "Fatal pppd error";
- break;
- case 2:
- msg = "pppd options error";
- break;
- case 3:
- msg = "No root priv error";
- break;
- case 4:
- msg = "No ppp module error";
- break;
- case 5:
- msg = "pppd received a signal";
- break;
- case 6:
- msg = "Serial port lock failed";
- break;
- case 7:
- msg = "Serial port open failed";
- break;
- case 8:
- msg = "Connect script failed";
- break;
- case 9:
- msg = "Pty program error";
- break;
- case 10:
- msg = "PPP negotiation failed";
- break;
- case 11:
- msg = "Peer didn't authenticatie itself";
- break;
- case 12:
- msg = "Link idle: Idle Seconds reached.";
- break;
- case 13:
- msg = "Connect time limit reached.";
- break;
- case 14:
- msg = "Callback negotiated, call should come back.";
- break;
- case 15:
- msg = "Lack of LCP echo responses";
- break;
- case 16:
- msg = "A modem hung up the phone";
- break;
- case 17:
- msg = "Loopback detected";
- break;
- case 18:
- msg = "The init script failed";
- break;
- case 19:
- msg = "Authentication error.\n"
- "We failed to authenticate ourselves to the peer.\n"
- "Maybe bad account or password?";
- break;
- default:
- msg = "Unknown error";
- }
+ msg = pppd_exit_code_to_str (pppd_exit_status);
_LOGW ("pppd pid %d exited with error: %s", pid, msg);
}
--
2.9.3
From b2b6bf1cecc61d82590041aadee52cb9e95064b2 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 9 Jun 2017 14:13:36 +0200
Subject: [PATCH 6/8] ppp: don't log newlines
(cherry picked from commit a814b96ebf02fa88f1a431d0a7459723a3af670d)
(cherry picked from commit 38b5d356de300f717df9c262c4fbf7ea0053aee6)
---
src/ppp/nm-ppp-manager.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/ppp/nm-ppp-manager.c b/src/ppp/nm-ppp-manager.c
index d9044a4..93660ef 100644
--- a/src/ppp/nm-ppp-manager.c
+++ b/src/ppp/nm-ppp-manager.c
@@ -609,8 +609,8 @@ NM_UTILS_LOOKUP_STR_DEFINE_STATIC (pppd_exit_code_to_str, int,
NM_UTILS_LOOKUP_STR_ITEM (16, "A modem hung up the phone"),
NM_UTILS_LOOKUP_STR_ITEM (17, "Loopback detected"),
NM_UTILS_LOOKUP_STR_ITEM (18, "The init script failed"),
- NM_UTILS_LOOKUP_STR_ITEM (19, "Authentication error.\n"
- "We failed to authenticate ourselves to the peer.\n"
+ NM_UTILS_LOOKUP_STR_ITEM (19, "Authentication error. "
+ "We failed to authenticate ourselves to the peer. "
"Maybe bad account or password?"),
);
--
2.9.3
From 13d2ba85f0ea1835cd5b18fe2844d49d0a1f5592 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 9 Jun 2017 14:19:05 +0200
Subject: [PATCH 7/8] ppp: cleanup logging pppd exit reason in ppp_watch_cb
- don't use assert but be more graceful with g_return_if_fail().
- in case of failure, don't log a debug message after the warning.
One message is sufficient, drop "pppd pid %d cleaned up".
- print GPid type as long long.
- increase log level to warning. pppd dying unexpectedly warrants a
warning.
(cherry picked from commit 250e7239511f4c8de6831e3c16d8d5f6fac383dc)
(cherry picked from commit b87327a5fea4e80a33849b8ff9735c4b61b9434d)
---
src/ppp/nm-ppp-manager.c | 36 ++++++++++++++++--------------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/src/ppp/nm-ppp-manager.c b/src/ppp/nm-ppp-manager.c
index 93660ef..575bf11 100644
--- a/src/ppp/nm-ppp-manager.c
+++ b/src/ppp/nm-ppp-manager.c
@@ -615,36 +615,32 @@ NM_UTILS_LOOKUP_STR_DEFINE_STATIC (pppd_exit_code_to_str, int,
);
static void
-ppp_exit_code (guint pppd_exit_status, GPid pid)
-{
- const char *msg;
-
- msg = pppd_exit_code_to_str (pppd_exit_status);
-
- _LOGW ("pppd pid %d exited with error: %s", pid, msg);
-}
-
-static void
-ppp_watch_cb (GPid pid, gint status, gpointer user_data)
+ppp_watch_cb (GPid pid, int status, gpointer user_data)
{
NMPPPManager *manager = NM_PPP_MANAGER (user_data);
NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager);
- guint err;
+ int err;
+ const long long lpid = (long long) pid;
- g_assert (pid == priv->pid);
+ g_return_if_fail (pid == priv->pid);
if (WIFEXITED (status)) {
err = WEXITSTATUS (status);
- if (err != 0)
- ppp_exit_code (err, priv->pid);
+ if (err) {
+ _LOGW ("pppd pid %lld exited with error %d: %s",
+ lpid, err,
+ pppd_exit_code_to_str (err));
+ } else
+ _LOGD ("pppd pid %lld exited with success", lpid);
} else if (WIFSTOPPED (status)) {
- _LOGI ("pppd pid %d stopped unexpectedly with signal %d", priv->pid, WSTOPSIG (status));
+ _LOGW ("pppd pid %lld stopped unexpectedly with signal %d",
+ lpid, WSTOPSIG (status));
} else if (WIFSIGNALED (status)) {
- _LOGI ("pppd pid %d died with signal %d", priv->pid, WTERMSIG (status));
+ _LOGW ("pppd pid %lld died with signal %d",
+ lpid, WTERMSIG (status));
} else
- _LOGI ("pppd pid %d died from an unknown cause", priv->pid);
+ _LOGW ("pppd pid %lld died from an unknown cause", lpid);
- _LOGD ("pppd pid %d cleaned up", priv->pid);
priv->pid = 0;
priv->ppp_watch_id = 0;
g_signal_emit (manager, signals[STATE_CHANGED], 0, (guint) NM_PPP_STATUS_DEAD);
@@ -971,7 +967,7 @@ _ppp_manager_start (NMPPPManager *manager,
goto out;
}
- _LOGI ("pppd started with pid %d", priv->pid);
+ _LOGI ("pppd started with pid %lld", (long long) priv->pid);
priv->ppp_watch_id = g_child_watch_add (priv->pid, (GChildWatchFunc) ppp_watch_cb, manager);
priv->ppp_timeout_handler = g_timeout_add_seconds (timeout_secs, pppd_timed_out, manager);
--
2.9.3
From baf5a6b24119671bb8a0edea2fc4830750c16305 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 9 Jun 2017 15:11:24 +0200
Subject: [PATCH 8/8] ppp: fix cancelling timeout when pppd process exits
Otherwise, we get pppd_timed_out() later, which will
emit a DEAD state change at unexpected times.
(cherry picked from commit b9af32b056ae7c93b33644b8a24641a86bf66e2c)
(cherry picked from commit 1b954fe09b3b968aa883bba1027f47487ac4808e)
---
src/ppp/nm-ppp-manager.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/ppp/nm-ppp-manager.c b/src/ppp/nm-ppp-manager.c
index 575bf11..6343df8 100644
--- a/src/ppp/nm-ppp-manager.c
+++ b/src/ppp/nm-ppp-manager.c
@@ -643,6 +643,7 @@ ppp_watch_cb (GPid pid, int status, gpointer user_data)
priv->pid = 0;
priv->ppp_watch_id = 0;
+ _ppp_cleanup (manager);
g_signal_emit (manager, signals[STATE_CHANGED], 0, (guint) NM_PPP_STATUS_DEAD);
}
--
2.9.3

View File

@ -0,0 +1,49 @@
From 7e13e49f15a43f54391380c76f7074bdaa300d03 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Sun, 11 Jun 2017 22:31:43 +0200
Subject: [PATCH] cli: remove spurious device names from output
When running one of:
nmcli device wifi list ifname wlan0
nmcli device wifi connect ... ifname wlan0
nmcli wrongly adds the device name to the output.
Do the completion only when requested.
Fixes: 8679793f6b711847d3209ab3cfbd95ab4a2e2488
Fixes: 1a0dfd31c4af5f3e42b4fc8363a2065d8c5a325b
(cherry picked from commit d2b4332b36686dd5d7382d996743f0ffa1a0fdda)
(cherry picked from commit 73e664e3b15e47b20dcdc92d4cde7f8492069f17)
---
clients/cli/devices.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/clients/cli/devices.c b/clients/cli/devices.c
index 387edef..50983de 100644
--- a/clients/cli/devices.c
+++ b/clients/cli/devices.c
@@ -2653,7 +2653,8 @@ do_device_wifi_list (NmCli *nmc, int argc, char **argv)
return NMC_RESULT_ERROR_USER_INPUT;
}
ifname = *argv;
- complete_device (devices, ifname, TRUE);
+ if (argc == 1 && nmc->complete)
+ complete_device (devices, ifname, TRUE);
} else if (strcmp (*argv, "bssid") == 0 || strcmp (*argv, "hwaddr") == 0) {
/* hwaddr is deprecated and will be removed later */
argc--;
@@ -2900,7 +2901,8 @@ do_device_wifi_connect_network (NmCli *nmc, int argc, char **argv)
goto finish;
}
ifname = *argv;
- complete_device (devices, ifname, TRUE);
+ if (argc == 1 && nmc->complete)
+ complete_device (devices, ifname, TRUE);
} else if (strcmp (*argv, "bssid") == 0) {
argc--;
argv++;
--
2.9.3

View File

@ -0,0 +1,135 @@
From a222f7e0554fe8057a6d9c6749acbd066798fa9d Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 13 Jun 2017 12:26:51 +0200
Subject: [PATCH 1/1] device: don't set MTU of device unless explicitly
configured
Since commit 2b51d3967 "device: merge branch 'th/device-mtu-bgo777251'",
we always set the MTU for certain device types during activation. Even
if the MTU is neither specified via the connection nor other means, like
DHCP.
Revert that change. On activation, if nothing explicitly configures the
MTU, leave it unchanged. This is like what we do with ethernet's
cloned-mac-address, which has a default value "preserve".
So, as last resort the default value for MTU is now 0 (don't change),
instead of depending on the device type.
Note that you also can override the default value in global
configuration via NetworkManager.conf.
This behavior makes sense, because whenever NM actively resets the MTU,
it remembers the previous value and restores it when deactivating
the connection. That wasn't implemented before 2b51d3967, and the
MTU would depend on which connection was previously active. That
is no longer an issue as the MTU gets reset when deactivating.
https://bugzilla.redhat.com/show_bug.cgi?id=1460760
(cherry picked from commit 4ca3002b86948847711cd5b1937008baef3c30da)
(cherry picked from commit 588841f2e086774420a7ff4452d87e45ffae578a)
---
man/NetworkManager.conf.xml | 2 +-
src/devices/nm-device-infiniband.c | 2 +-
src/devices/nm-device-ip-tunnel.c | 2 +-
src/devices/nm-device-private.h | 4 ----
src/devices/nm-device-vlan.c | 2 +-
src/devices/nm-device.c | 2 +-
src/devices/wifi/nm-device-wifi.c | 2 +-
7 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/man/NetworkManager.conf.xml b/man/NetworkManager.conf.xml
index 5e76c0ace..71c62cc15 100644
--- a/man/NetworkManager.conf.xml
+++ b/man/NetworkManager.conf.xml
@@ -655,7 +655,7 @@ ipv6.ip6-privacy=0
</varlistentry>
<varlistentry>
<term><varname>ethernet.mtu</varname></term>
- <listitem><para>If configured explicitly to 0, the MTU is not reconfigured during device activation unless it is required due to IPv6 constraints. If left unspecified, a DHCP/IPv6 SLAAC provided value is used or a default of 1500.</para></listitem>
+ <listitem><para>If configured explicitly to 0, the MTU is not reconfigured during device activation unless it is required due to IPv6 constraints. If left unspecified, a DHCP/IPv6 SLAAC provided value is used or the MTU is not reconfigured during activation.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>ethernet.wake-on-lan</varname></term>
diff --git a/src/devices/nm-device-infiniband.c b/src/devices/nm-device-infiniband.c
index f7875d099..7e0412703 100644
--- a/src/devices/nm-device-infiniband.c
+++ b/src/devices/nm-device-infiniband.c
@@ -139,7 +139,7 @@ get_configured_mtu (NMDevice *device, gboolean *out_is_user_config)
}
}
*out_is_user_config = (mtu != 0);
- return mtu ?: NM_DEVICE_DEFAULT_MTU_INFINIBAND;
+ return mtu;
}
static gboolean
diff --git a/src/devices/nm-device-ip-tunnel.c b/src/devices/nm-device-ip-tunnel.c
index 53b7cf4e5..2f505ef4c 100644
--- a/src/devices/nm-device-ip-tunnel.c
+++ b/src/devices/nm-device-ip-tunnel.c
@@ -767,7 +767,7 @@ get_configured_mtu (NMDevice *self, gboolean *out_is_user_config)
}
}
*out_is_user_config = (mtu != 0);
- return mtu ?: NM_DEVICE_DEFAULT_MTU_WIRED;
+ return mtu;
}
static NMDeviceCapabilities
diff --git a/src/devices/nm-device-private.h b/src/devices/nm-device-private.h
index a4067f9c2..9eccafdc6 100644
--- a/src/devices/nm-device-private.h
+++ b/src/devices/nm-device-private.h
@@ -116,10 +116,6 @@ gboolean nm_device_ipv6_sysctl_set (NMDevice *self, const char *property, const
/*****************************************************************************/
-#define NM_DEVICE_DEFAULT_MTU_WIRED ((guint32) 1500)
-#define NM_DEVICE_DEFAULT_MTU_WIRELESS ((guint32) 1500)
-#define NM_DEVICE_DEFAULT_MTU_INFINIBAND ((guint32) 0)
-
gint64 nm_device_get_configured_mtu_from_connection_default (NMDevice *self,
const char *property_name);
diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c
index 06db64465..a74da8f22 100644
--- a/src/devices/nm-device-vlan.c
+++ b/src/devices/nm-device-vlan.c
@@ -586,7 +586,7 @@ get_configured_mtu (NMDevice *self, gboolean *out_is_user_config)
if (ifindex > 0)
mtu = nm_platform_link_get_mtu (nm_device_get_platform (NM_DEVICE (self)), ifindex);
- return mtu ?: NM_DEVICE_DEFAULT_MTU_WIRED;
+ return mtu;
}
/*****************************************************************************/
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index e60995d57..e37b24bff 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -7150,7 +7150,7 @@ nm_device_get_configured_mtu_for_wired (NMDevice *self, gboolean *out_is_user_co
}
*out_is_user_config = FALSE;
- return NM_DEVICE_DEFAULT_MTU_WIRED;
+ return 0;
}
/*****************************************************************************/
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
index 7359be96e..20692ed9e 100644
--- a/src/devices/wifi/nm-device-wifi.c
+++ b/src/devices/wifi/nm-device-wifi.c
@@ -2742,7 +2742,7 @@ get_configured_mtu (NMDevice *device, gboolean *out_is_user_config)
}
}
*out_is_user_config = (mtu != 0);
- return mtu ?: NM_DEVICE_DEFAULT_MTU_WIRELESS;
+ return mtu;
}
static gboolean
--
2.13.0

View File

@ -0,0 +1,51 @@
From 59aa2a26b4a712131b38e155d3c1d70a74183636 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Tue, 13 Jun 2017 14:44:22 +0200
Subject: [PATCH] core: sort addresses in captured IPv4 configuration
When IPv4 addresses are synchronized to platform, the order of IPv4
addresses matters because the first address is considered the primary
one. Thus, nm_ip4_config_capture() should put the primary address as
first, otherwise during synchronization addresses will be removed and
added back with a different primary/secondary role.
https://bugzilla.redhat.com/show_bug.cgi?id=1459813
(cherry picked from commit b6fa87a4c07c968614d123750be47a74de62f04d)
(cherry picked from commit 9819ffe7d42f08bb082ae2d9e125a7dd3bfe6420)
---
src/nm-ip4-config.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c
index 20532e8..ae6af9c 100644
--- a/src/nm-ip4-config.c
+++ b/src/nm-ip4-config.c
@@ -248,6 +248,16 @@ notify_addresses (NMIP4Config *self)
_notify (self, PROP_ADDRESSES);
}
+static gint
+sort_captured_addresses (gconstpointer a, gconstpointer b)
+{
+ const NMPlatformIP4Address *addr_a = a, *addr_b = b;
+
+ /* Primary addresses first */
+ return NM_FLAGS_HAS (addr_a->n_ifa_flags, IFA_F_SECONDARY) -
+ NM_FLAGS_HAS (addr_b->n_ifa_flags, IFA_F_SECONDARY);
+}
+
NMIP4Config *
nm_ip4_config_capture (NMPlatform *platform, int ifindex, gboolean capture_resolv_conf)
{
@@ -269,6 +279,8 @@ nm_ip4_config_capture (NMPlatform *platform, int ifindex, gboolean capture_resol
g_array_unref (priv->routes);
priv->addresses = nm_platform_ip4_address_get_all (platform, ifindex);
+ g_array_sort (priv->addresses, sort_captured_addresses);
+
priv->routes = nm_platform_ip4_route_get_all (platform, ifindex, NM_PLATFORM_GET_ROUTE_FLAGS_WITH_DEFAULT | NM_PLATFORM_GET_ROUTE_FLAGS_WITH_NON_DEFAULT);
/* Extract gateway from default route */
--
2.9.3

View File

@ -9,7 +9,7 @@
%global epoch_version 1
%global rpm_version 1.8.0
%global real_version 1.8.0
%global release_version 5
%global release_version 6
%global snapshot %{nil}
%global git_sha %{nil}
@ -92,7 +92,9 @@ Patch8: 0008-utf8safe-fixes-rh1443114.patch
Patch9: 0009-ifcfg-rh-fix-null-next-hop.patch
Patch10: 0010-bluetooth-nap-crash-rh1454385.patch
Patch11: 0011-device-release-removed-slaves-rh1448907.patch
Patch12: 0012-config-slaves-order-rh1452585.patch
Patch13: 0013-nmcli-fix-8021x-password-raw-rh1456362.patch
Patch14: 0014-translations-rh1382625.patch
Patch15: 0015-ifcfg-rh-legacy-netmask-rh1445414.patch
Patch16: 0016-tui-connect-crash-rh1456826.patch
Patch17: 0017-libnm-fix-reject-vlan-id-4095-rh1456911.patch
@ -105,6 +107,11 @@ Patch23: 0023-persist-nm-owned-in-device-state-rh1376199.patch
Patch24: 0024-fix-delayed-assume-master-rh1452062.patch
Patch25: 0025-improve-logging-assume-rh1452062.patch
Patch26: 0026-apply-route-penality-only-with-defroute-rh1459604.patch
Patch27: 0027-cli-fix-interface-overview-rh1460219.patch
Patch28: 0028-ppp-unexport-ppp-manager-on-dispose.patch
Patch29: 0029-cli-wifi-spurious-output.patch
Patch30: 0030-device-mtu-preserve-rh1460760.patch
Patch31: 0031-don-t-remove-ext-ipv4-addresses-rh1459813.patch
Requires(post): systemd
Requires(preun): systemd
@ -369,7 +376,9 @@ by nm-connection-editor and nm-applet in a non-graphical environment.
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
@ -382,6 +391,11 @@ by nm-connection-editor and nm-applet in a non-graphical environment.
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%build
%if %{with regen_docs}
@ -694,6 +708,13 @@ fi
%endif
%changelog
* Thu Jun 22 2017 Lubomir Rintel <lkundrak@v3.sk> - 1:1.8.0-6
- device: don't change MTU unless explicitly configured (rh #1460760)
- core: don't remove external IPv4 addresses (rh #1459813)
- cli: fix output of iface in overview output (rh#1460219)
- ppp: unexport NMPPPManager instance on dispose (rh#1459579)
- cli: remove spurious device names from wifi subcommands output (rh#1460527)
* Fri Jun 9 2017 Lubomir Rintel <lkundrak@v3.sk> - 1:1.8.0-5
- bond: fix crash comparing mode while generating bond connection (rh #1459580)
- connectivity: fix route penalty if WWAN and BT device using ip-ifindex (rh #1459932)