Browse Source

NetworkManager package update

Signed-off-by: basebuilder_pel7ppc64bebuilder0 <basebuilder@powerel.org>
master
basebuilder_pel7ppc64bebuilder0 6 years ago
parent
commit
66a603eb3a
  1. 14
      SOURCES/00-server.conf
  2. 127
      SOURCES/0001-cloned-mac-address-permanent-rh1413312.patch
  3. 38
      SOURCES/0002-nm-wait-online-not-require-nm-service-rh1520865.patch
  4. 56912
      SOURCES/0003-po-import-translations-rh1481186.patch
  5. 277
      SOURCES/0004-bug-fixes-found-by-coverity.patch
  6. 149
      SOURCES/0005-clear-unsaved-flag-on-new-connections-rh1525078.patch
  7. 34
      SOURCES/0006-reload-qdiscs-and-tfilters-after-removal-rh1527197.patch
  8. 163
      SOURCES/0007-wwan-default-device-route-rh1527934.patch
  9. 324
      SOURCES/0008-dhcp-client-id-rh1531173.patch
  10. 1515
      SOURCES/0009-distinct-route-metric-rh1505893.patch
  11. 26
      SOURCES/0010-fix-set-connectivity-check-enabled-rh1534477.patch
  12. 167
      SOURCES/0011-fix-assertion-delete-volatile-connection-rh1506552.patch
  13. 30
      SOURCES/0012-device-increase-carrier-wait-time-rh1520826.patch
  14. 59
      SOURCES/0013-ifcfg-ovs-master-rh1519179.patch
  15. 51
      SOURCES/0014-device-skip-IP-conf-for-external-devices-rh1530288.patch
  16. 27
      SOURCES/0015-route-get-crash-rh1534721.patch
  17. 91
      SOURCES/0016-ovs-interface-dhcp-twice-rh1540063.patch
  18. 30
      SOURCES/0017-ensure-alignment-of-team-properties-rh1533830.patch
  19. 64
      SOURCES/0018-team-link-watchers-fixes-rh1533926.patch
  20. 56
      SOURCES/0019-update-team-runner-desc-rh1533799.patch
  21. 99
      SOURCES/0020-team-fix-runner-sys_prio-default-rh1533810.patch
  22. 985
      SOURCES/0021-avoid-symbol-clash-with-json-glib-rh1535905.patch
  23. 84
      SOURCES/0022-team-add-random-runner-rh1538699.patch
  24. 50
      SOURCES/0023-ppp-don-t-start-IPv6-configuration-rh1515829.patch
  25. 227
      SOURCES/0024-Revert-IPv4-rp_filter-handling-rh1492472.patch
  26. 109
      SOURCES/0025-team-clean-runner-tx-hash-on-set-rh1541922.patch
  27. 322
      SOURCES/0026-dhcp-fix-lease-renewal-rh1503587.patch
  28. 13
      SOURCES/10-slaves-order.conf
  29. 116
      SOURCES/9999-fix-pregen-doc.patch
  30. 50
      SOURCES/NetworkManager.conf
  31. 11
      SOURCES/README.nmcs

14
SOURCES/00-server.conf

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
# This configuration file changes NetworkManager's behavior to
# what's expected on "traditional UNIX server" type deployments.
#
# See "man NetworkManager.conf" for more information about these
# and other keys.

[main]
# Do not do automatic (DHCP/SLAAC) configuration on ethernet devices
# with no other matching connections.
no-auto-default=*

# Ignore the carrier (cable plugged in) state when attempting to
# activate static-IP connections.
ignore-carrier=*

127
SOURCES/0001-cloned-mac-address-permanent-rh1413312.patch

@ -0,0 +1,127 @@ @@ -0,0 +1,127 @@
From cf4fabd8dd1235312ebc21becda6378b770eb822 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 24 Feb 2017 20:25:56 +0100
Subject: [PATCH] Revert "device: change default value for cloned-mac-address
to "preserve" (bgo#770611)"

https://bugzilla.redhat.com/show_bug.cgi?id=1413312

This reverts commit fae5ecec5a4d9987a1915441602cb78275a9f490.
---
clients/common/settings-docs.c.in | 4 ++--
libnm-core/nm-setting-wired.c | 7 +++----
libnm-core/nm-setting-wireless.c | 7 +++----
man/NetworkManager.conf.xml | 4 ++--
src/devices/nm-device.c | 3 ++-
5 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/clients/common/settings-docs.c.in b/clients/common/settings-docs.c.in
index bf544ab6e..12991cc06 100644
--- a/clients/common/settings-docs.c.in
+++ b/clients/common/settings-docs.c.in
@@ -7,7 +7,7 @@
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_BAND N_("802.11 frequency band of the network. One of \"a\" for 5GHz 802.11a or \"bg\" for 2.4GHz 802.11. This will lock associations to the Wi-Fi network to the specific band, i.e. if \"a\" is specified, the device will not associate with the same network in the 2.4GHz band even if the network's settings are compatible. This setting depends on specific driver capability and may not work with all drivers.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_BSSID N_("If specified, directs the device to only associate with the given access point. This capability is highly driver dependent and not supported by all devices. Note: this property does not control the BSSID used when creating an Ad-Hoc network and is unlikely to in the future.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_CHANNEL N_("Wireless channel to use for the Wi-Fi connection. The device will only join (or create for Ad-Hoc networks) a Wi-Fi network on the specified channel. Because channel numbers overlap between bands, this property also requires the \"band\" property to be set.")
-#define DESCRIBE_DOC_NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS N_("If specified, request that the device use this MAC address instead. This is known as MAC cloning or spoofing. Beside explicitly specifying a MAC address, the special values \"preserve\", \"permanent\", \"random\" and \"stable\" are supported. \"preserve\" means not to touch the MAC address on activation. \"permanent\" means to use the permanent hardware address of the device. \"random\" creates a random MAC address on each connect. \"stable\" creates a hashed MAC address based on connection.stable-id and a machine dependent key. If unspecified, the value can be overwritten via global defaults, see manual of NetworkManager.conf. If still unspecified, it defaults to \"preserve\" (older versions of NetworkManager may use a different default value). On D-Bus, this field is expressed as \"assigned-mac-address\" or the deprecated \"cloned-mac-address\".")
+#define DESCRIBE_DOC_NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS N_("If specified, request that the device use this MAC address instead of its permanent MAC address. This is known as MAC cloning or spoofing. Beside explicitly specifying a MAC address, the special values \"preserve\", \"permanent\", \"random\" and \"stable\" are supported. \"preserve\" means not to touch the MAC address on activation. \"permanent\" means to use the permanent hardware address of the device. \"random\" creates a random MAC address on each connect. \"stable\" creates a hashed MAC address based on connection.stable-id and a machine dependent key. If unspecified, the value can be overwritten via global defaults, see manual of NetworkManager.conf. If still unspecified, it defaults to \"permanent\". On D-Bus, this field is expressed as \"assigned-mac-address\" or the deprecated \"cloned-mac-address\".")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_GENERATE_MAC_ADDRESS_MASK N_("With \"cloned-mac-address\" setting \"random\" or \"stable\", by default all bits of the MAC address are scrambled and a locally-administered, unicast MAC address is created. This property allows to specify that certain bits are fixed. Note that the least significant bit of the first MAC address will always be unset to create a unicast MAC address. If the property is NULL, it is eligible to be overwritten by a default connection setting. If the value is still NULL or an empty string, the default is to create a locally-administered, unicast MAC address. If the value contains one MAC address, this address is used as mask. The set bits of the mask are to be filled with the current MAC address of the device, while the unset bits are subject to randomization. Setting \"FE:FF:FF:00:00:00\" means to preserve the OUI of the current MAC address and only randomize the lower 3 bytes using the \"random\" or \"stable\" algorithm. If the value contains one additional MAC address after the mask, this address is used instead of the current MAC address to fill the bits that shall not be randomized. For example, a value of \"FE:FF:FF:00:00:00 68:F7:28:00:00:00\" will set the OUI of the MAC address to 68:F7:28, while the lower bits are randomized. A value of \"02:00:00:00:00:00 00:00:00:00:00:00\" will create a fully scrambled globally-administered, burned-in MAC address. If the value contains more than one additional MAC addresses, one of them is chosen randomly. For example, \"02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00\" will create a fully scrambled MAC address, randomly locally or globally administered.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_HIDDEN N_("If TRUE, indicates this network is a non-broadcasting network that hides its SSID. In this case various workarounds may take place, such as probe-scanning the SSID for more reliable network discovery. However, these workarounds expose inherent insecurities with hidden SSID networks, and thus hidden SSID networks should be used with caution.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MAC_ADDRESS N_("If specified, this connection will only apply to the Wi-Fi device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing).")
@@ -87,7 +87,7 @@
#define DESCRIBE_DOC_NM_SETTING_802_1X_SUBJECT_MATCH N_("Substring to be matched against the subject of the certificate presented by the authentication server. When unset, no verification of the authentication server certificate's subject is performed. This property provides little security, if any, and its use is deprecated in favor of NMSetting8021x:domain-suffix-match.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_SYSTEM_CA_CERTS N_("When TRUE, overrides the \"ca-path\" and \"phase2-ca-path\" properties using the system CA directory specified at configure time with the --system-ca-path switch. The certificates in this directory are added to the verification chain in addition to any certificates specified by the \"ca-cert\" and \"phase2-ca-cert\" properties. If the path provided with --system-ca-path is rather a file name (bundle of trusted CA certificates), it overrides \"ca-cert\" and \"phase2-ca-cert\" properties instead (sets ca_cert/ca_cert2 options for wpa_supplicant).")
#define DESCRIBE_DOC_NM_SETTING_WIRED_AUTO_NEGOTIATE N_("If TRUE, enforce auto-negotiation of port speed and duplex mode. If FALSE, \"speed\" and \"duplex\" properties should be both set or link configuration will be skipped.")
-#define DESCRIBE_DOC_NM_SETTING_WIRED_CLONED_MAC_ADDRESS N_("If specified, request that the device use this MAC address instead. This is known as MAC cloning or spoofing. Beside explicitly specifying a MAC address, the special values \"preserve\", \"permanent\", \"random\" and \"stable\" are supported. \"preserve\" means not to touch the MAC address on activation. \"permanent\" means to use the permanent hardware address if the device has one (otherwise this is treated as \"preserve\"). \"random\" creates a random MAC address on each connect. \"stable\" creates a hashed MAC address based on connection.stable-id and a machine dependent key. If unspecified, the value can be overwritten via global defaults, see manual of NetworkManager.conf. If still unspecified, it defaults to \"preserve\" (older versions of NetworkManager may use a different default value). On D-Bus, this field is expressed as \"assigned-mac-address\" or the deprecated \"cloned-mac-address\".")
+#define DESCRIBE_DOC_NM_SETTING_WIRED_CLONED_MAC_ADDRESS N_("If specified, request that the device use this MAC address instead of its permanent MAC address. This is known as MAC cloning or spoofing. Beside explicitly specifying a MAC address, the special values \"preserve\", \"permanent\", \"random\" and \"stable\" are supported. \"preserve\" means not to touch the MAC address on activation. \"permanent\" means to use the permanent hardware address if the device has one (otherwise this is treated as \"preserve\"). \"random\" creates a random MAC address on each connect. \"stable\" creates a hashed MAC address based on connection.stable-id and a machine dependent key. If unspecified, the value can be overwritten via global defaults, see manual of NetworkManager.conf. If still unspecified, it defaults to \"permanent\". On D-Bus, this field is expressed as \"assigned-mac-address\" or the deprecated \"cloned-mac-address\".")
#define DESCRIBE_DOC_NM_SETTING_WIRED_DUPLEX N_("Can be specified only when \"auto-negotiate\" is \"off\". In that case, statically configures the device to use that specified duplex mode, either \"half\" or \"full\". Must be set together with the \"speed\" property if specified. Before specifying a duplex mode be sure your device supports it.")
#define DESCRIBE_DOC_NM_SETTING_WIRED_GENERATE_MAC_ADDRESS_MASK N_("With \"cloned-mac-address\" setting \"random\" or \"stable\", by default all bits of the MAC address are scrambled and a locally-administered, unicast MAC address is created. This property allows to specify that certain bits are fixed. Note that the least significant bit of the first MAC address will always be unset to create a unicast MAC address. If the property is NULL, it is eligible to be overwritten by a default connection setting. If the value is still NULL or an empty string, the default is to create a locally-administered, unicast MAC address. If the value contains one MAC address, this address is used as mask. The set bits of the mask are to be filled with the current MAC address of the device, while the unset bits are subject to randomization. Setting \"FE:FF:FF:00:00:00\" means to preserve the OUI of the current MAC address and only randomize the lower 3 bytes using the \"random\" or \"stable\" algorithm. If the value contains one additional MAC address after the mask, this address is used instead of the current MAC address to fill the bits that shall not be randomized. For example, a value of \"FE:FF:FF:00:00:00 68:F7:28:00:00:00\" will set the OUI of the MAC address to 68:F7:28, while the lower bits are randomized. A value of \"02:00:00:00:00:00 00:00:00:00:00:00\" will create a fully scrambled globally-administered, burned-in MAC address. If the value contains more than one additional MAC addresses, one of them is chosen randomly. For example, \"02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00\" will create a fully scrambled MAC address, randomly locally or globally administered.")
#define DESCRIBE_DOC_NM_SETTING_WIRED_MAC_ADDRESS N_("If specified, this connection will only apply to the Ethernet device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing).")
diff --git a/libnm-core/nm-setting-wired.c b/libnm-core/nm-setting-wired.c
index 9d255e1d0..f36283a7e 100644
--- a/libnm-core/nm-setting-wired.c
+++ b/libnm-core/nm-setting-wired.c
@@ -1144,8 +1144,8 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_wired_class)
/**
* NMSettingWired:cloned-mac-address:
*
- * If specified, request that the device use this MAC address instead.
- * This is known as MAC cloning or spoofing.
+ * If specified, request that the device use this MAC address instead of its
+ * permanent MAC address. This is known as MAC cloning or spoofing.
*
* Beside explicitly specifying a MAC address, the special values "preserve", "permanent",
* "random" and "stable" are supported.
@@ -1157,8 +1157,7 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_wired_class)
* machine dependent key.
*
* If unspecified, the value can be overwritten via global defaults, see manual
- * of NetworkManager.conf. If still unspecified, it defaults to "preserve"
- * (older versions of NetworkManager may use a different default value).
+ * of NetworkManager.conf. If still unspecified, it defaults to "permanent".
*
* On D-Bus, this field is expressed as "assigned-mac-address" or the deprecated
* "cloned-mac-address".
diff --git a/libnm-core/nm-setting-wireless.c b/libnm-core/nm-setting-wireless.c
index 0a3915bfc..8f457ffcc 100644
--- a/libnm-core/nm-setting-wireless.c
+++ b/libnm-core/nm-setting-wireless.c
@@ -1350,8 +1350,8 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_wireless_class)
/**
* NMSettingWireless:cloned-mac-address:
*
- * If specified, request that the device use this MAC address instead.
- * This is known as MAC cloning or spoofing.
+ * If specified, request that the device use this MAC address instead of its
+ * permanent MAC address. This is known as MAC cloning or spoofing.
*
* Beside explicitly specifying a MAC address, the special values "preserve", "permanent",
* "random" and "stable" are supported.
@@ -1362,8 +1362,7 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_wireless_class)
* machine dependent key.
*
* If unspecified, the value can be overwritten via global defaults, see manual
- * of NetworkManager.conf. If still unspecified, it defaults to "preserve"
- * (older versions of NetworkManager may use a different default value).
+ * of NetworkManager.conf. If still unspecified, it defaults to "permanent".
*
* On D-Bus, this field is expressed as "assigned-mac-address" or the deprecated
* "cloned-mac-address".
diff --git a/man/NetworkManager.conf.xml b/man/NetworkManager.conf.xml
index 446540aa1..fc106a51e 100644
--- a/man/NetworkManager.conf.xml
+++ b/man/NetworkManager.conf.xml
@@ -659,7 +659,7 @@ ipv6.ip6-privacy=0
</varlistentry>
<varlistentry>
<term><varname>ethernet.cloned-mac-address</varname></term>
- <listitem><para>If left unspecified, it defaults to "preserve".</para></listitem>
+ <listitem><para>If left unspecified, it defaults to "permanent".</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>ethernet.generate-mac-address-mask</varname></term>
@@ -724,7 +724,7 @@ ipv6.ip6-privacy=0
</varlistentry>
<varlistentry>
<term><varname>wifi.cloned-mac-address</varname></term>
- <listitem><para>If left unspecified, it defaults to "preserve".</para></listitem>
+ <listitem><para>If left unspecified, it defaults to "permanent".</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>wifi.generate-mac-address-mask</varname></term>
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index afc81dcde..f75cc86e3 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -13624,7 +13624,8 @@ _get_cloned_mac_address_setting (NMDevice *self, NMConnection *connection, gbool
is_wifi ? "wifi.cloned-mac-address" : "ethernet.cloned-mac-address",
self);

- addr = NM_CLONED_MAC_PRESERVE;
+ /* RHEL patches the default to permanent (rh#1413312) */
+ addr = NM_CLONED_MAC_PERMANENT;

if (!a) {
if (is_wifi) {
--
2.14.3

38
SOURCES/0002-nm-wait-online-not-require-nm-service-rh1520865.patch

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
From 5ad9e8b26c48b456251175eb211fd52f6b8d207c Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 8 Dec 2017 14:20:35 +0100
Subject: [PATCH 1/1] Revert "systemd: let "NetworkManager-wait-online.service"
require "NetworkManager.service""

Upstream changes "NetworkManager-wait-online.service" to require NM.

See
- https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=28b97f02f64ecf94e22c8929dfd0ba64151bd9d3
- https://bugzilla.redhat.com/show_bug.cgi?id=1452866#c50
- https://github.com/systemd/systemd/commit/9db307820e6f545665fc87f255af737228b7183c

This is a change in behavior, that we want to avoid for RHEL.
See also Fedora bug https://bugzilla.redhat.com/show_bug.cgi?id=1513613

This reverts commit 28b97f02f64ecf94e22c8929dfd0ba64151bd9d3.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1520865
---
data/NetworkManager-wait-online.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/data/NetworkManager-wait-online.service.in b/data/NetworkManager-wait-online.service.in
index 896324685..1753d2039 100644
--- a/data/NetworkManager-wait-online.service.in
+++ b/data/NetworkManager-wait-online.service.in
@@ -1,7 +1,7 @@
[Unit]
Description=Network Manager Wait Online
Documentation=man:nm-online(1)
-Requires=NetworkManager.service
+Requisite=NetworkManager.service
After=NetworkManager.service
Before=network-online.target

--
2.14.3

56912
SOURCES/0003-po-import-translations-rh1481186.patch

File diff suppressed because it is too large Load Diff

277
SOURCES/0004-bug-fixes-found-by-coverity.patch

@ -0,0 +1,277 @@ @@ -0,0 +1,277 @@
From 62b5ab4f78de027021bb5557568e607270314f82 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 12 Dec 2017 10:22:59 +0100
Subject: [PATCH 1/7] core: fix uninialized boolean variable in
reset_autoconnect_all()

It's not critical, because at worst we get a false-positive that
something changed.

Found by coverity.

Fixes: 4e7b05de7981c28eba6db48eb16476372594fed2
(cherry picked from commit fbc6008260f58b625e3a6bd26129c66b51904012)
(cherry picked from commit 387377d8fce937de4ed583fdf631d6dcf35edf93)
---
src/nm-policy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/nm-policy.c b/src/nm-policy.c
index 8dfb0ab00..4d0ef91a1 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -1409,7 +1409,7 @@ reset_autoconnect_all (NMPolicy *self,
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (self);
NMSettingsConnection *const*connections = NULL;
guint i;
- gboolean changed;
+ gboolean changed = FALSE;

_LOGD (LOGD_DEVICE, "re-enabling autoconnect for all connections%s%s%s",
device ? " on " : "",
--
2.14.3


From 3b3e530fedfceafb694a961482e22e64c0a76348 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 12 Dec 2017 10:27:51 +0100
Subject: [PATCH 2/7] core: avoid dereferencing NULL in
nm_utils_resolve_conf_parse()

Found by coverity.

Fixes: 8f1ef161f4dd5ac197b622ac681d55d64c176797
(cherry picked from commit a7087b1f0539d43783c67c36ba9ed2165f81cb77)
(cherry picked from commit 1bb6b3a79f1e8cf2790aca1f78ccafad8ef7d56c)
---
src/nm-core-utils.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/nm-core-utils.c b/src/nm-core-utils.c
index 40a0c352a..f6b33a149 100644
--- a/src/nm-core-utils.c
+++ b/src/nm-core-utils.c
@@ -1960,8 +1960,7 @@ nm_utils_resolve_conf_parse (int addr_family,
gsize i_tokens;

tokens = nm_utils_strsplit_set (s, " \t");
- nm_assert (tokens);
- for (i_tokens = 0; tokens[i_tokens]; i_tokens++) {
+ for (i_tokens = 0; tokens && tokens[i_tokens]; i_tokens++) {
gs_free char *t = g_strstrip (g_strdup (tokens[i_tokens]));

if ( _nm_utils_dns_option_validate (t, NULL, NULL,
--
2.14.3


From f67c30627b7c8369b957909abb84be27011ee2aa Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 12 Dec 2017 10:31:01 +0100
Subject: [PATCH 3/7] libnm: fix checking argument in
nm_team_link_watcher_new_arp_ping()

Found by coverity.

Fixes: 6c93e32212f9901e882d5a9ca221d037162bc740
(cherry picked from commit fb2da4b26c86a1916ad52cba00d6e6c725e74f4c)
(cherry picked from commit ccdfe9d3e500d0b695de2f528745924583c81c27)
---
libnm-core/nm-setting-team.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libnm-core/nm-setting-team.c b/libnm-core/nm-setting-team.c
index d36882783..88008e422 100644
--- a/libnm-core/nm-setting-team.c
+++ b/libnm-core/nm-setting-team.c
@@ -249,7 +249,7 @@ nm_team_link_watcher_new_arp_ping (gint init_wait,
return NULL;
}

- if (strpbrk (target_host, " \\/\t=\"\'")) {
+ if (strpbrk (source_host, " \\/\t=\"\'")) {
g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_FAILED,
_("source-host '%s' contains invalid characters"), source_host);
return NULL;
--
2.14.3


From fbf92a9d6e73a9b47a149fd451a6d4edfbe00c05 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 12 Dec 2017 10:37:59 +0100
Subject: [PATCH 4/7] platform: fix crash hashing NMPlatformTfilter and
NMPlatformQdisc

@kind might be NULL. There are 3 forms of the hash-update functions for
string: str(), str0(), and strarr().

- str0() is when the string might be NULL.
- str() does not allow the string to be NULL
- strarr() is like str(), except it adds a G_STATIC_ASSERT()
that the argument is a C array.

The reason why a difference between str() and str0() exists, is
because str0() hashes NULL different from a "" or any other string.
This has an overhead, because it effectively must hash another bit
of information that tells whether a string was passed or not.

The reason is, that hashing a tupple of two strings should always
yield a different hash value, even for "aa",""; "a","a"; "","aa",
where naive concatentation would yield identical hash values in all
three cases.

Fixes: e75fc8279becce29e688551930d85e59e1280c89
(cherry picked from commit 27e8fffdb833748dfeb6648b8768c4ef48822841)
(cherry picked from commit 99eef7a2ea3e7f79e2f449a04d7a3c78ba05f427)
---
src/platform/nm-platform.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 2ca379e4e..70675579f 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -5320,7 +5320,7 @@ nm_platform_qdisc_to_string (const NMPlatformQdisc *qdisc, char *buf, gsize len)
void
nm_platform_qdisc_hash_update (const NMPlatformQdisc *obj, NMHashState *h)
{
- nm_hash_update_str (h, obj->kind);
+ nm_hash_update_str0 (h, obj->kind);
nm_hash_update_vals (h,
obj->ifindex,
obj->addr_family,
@@ -5387,17 +5387,17 @@ nm_platform_tfilter_to_string (const NMPlatformTfilter *tfilter, char *buf, gsiz
void
nm_platform_tfilter_hash_update (const NMPlatformTfilter *obj, NMHashState *h)
{
- nm_hash_update_str (h, obj->kind);
+ nm_hash_update_str0 (h, obj->kind);
nm_hash_update_vals (h,
obj->ifindex,
obj->addr_family,
obj->handle,
obj->parent,
obj->info);
- nm_hash_update_str (h, obj->action.kind);
if (obj->action.kind) {
+ nm_hash_update_str (h, obj->action.kind);
if (nm_streq (obj->action.kind, NM_PLATFORM_ACTION_KIND_SIMPLE))
- nm_hash_update_str (h, obj->action.simple.sdata);
+ nm_hash_update_strarr (h, obj->action.simple.sdata);
}
}

--
2.14.3


From 55a7ac49eb196937bc76db4a292832b266df5398 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 12 Dec 2017 10:49:09 +0100
Subject: [PATCH 5/7] platform: assert() for valid item in
nm_platform_link_get_all()

Coverity thinks that item might be NULL, but actually it
cannot. Unclear how to avoid the false positive.

(cherry picked from commit 62d4dba74bac791c06ba70547f81b78eab5b9dc5)
(cherry picked from commit 490911c6fa368692b4a6dfefdc2a1e253b40f7df)
---
src/platform/nm-platform.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 70675579f..c7ed90e3f 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -667,6 +667,7 @@ skip:
/* There is a loop, pop the first (remaining) element from the list.
* This can happen for veth pairs where each peer is parent of the other end. */
item = NMP_OBJECT_CAST_LINK (links->pdata[first_idx]);
+ nm_assert (item);
g_hash_table_remove (unseen, GINT_TO_POINTER (item->ifindex));
g_ptr_array_add (result, links->pdata[first_idx]);
links->pdata[first_idx] = NULL;
--
2.14.3


From 954ae22f4219db60aeee641a3026d37fe7b71614 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 12 Dec 2017 10:59:26 +0100
Subject: [PATCH 6/7] cli: avoid out-of-bounds-read for show_device_info()

Probably not critical, because it will still include
the terminating NULL, and just continue to fill the
temporary buffer with static addresses.

Found by coverity.

Fixes: bfb9fd0d2f3d602a69537fe7776426ee9202ce9e
(cherry picked from commit c274b565a66e0c2932377554ce4d33a4772602e4)
(cherry picked from commit 7fb865947cd131d34703f0dc7ce153fb2e6676fc)
---
clients/cli/devices.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clients/cli/devices.c b/clients/cli/devices.c
index 467ce427d..da969fbe7 100644
--- a/clients/cli/devices.c
+++ b/clients/cli/devices.c
@@ -1116,8 +1116,8 @@ show_device_info (NMDevice *device, NmCli *nmc)
(const NMMetaAbstractInfo *const*) nmc_fields_dev_show_general,
FALSE, NULL, NULL);

- row = g_new0 (NmcOutputField, _NM_META_SETTING_TYPE_NUM + 1);
- for (i = 0; i < _NM_META_SETTING_TYPE_NUM; i++)
+ row = g_new0 (NmcOutputField, G_N_ELEMENTS (nmc_fields_dev_show_general));
+ for (i = 0; i < G_N_ELEMENTS (nmc_fields_dev_show_general); i++)
row[i].info = (const NMMetaAbstractInfo *) &nmc_fields_dev_show_general[i];

print_required_fields (&nmc->nmc_config, NMC_OF_FLAG_MAIN_HEADER_ONLY,
--
2.14.3


From 187d0038f5e929b338a005804386851d3d5c7e8b Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 12 Dec 2017 11:05:52 +0100
Subject: [PATCH 7/7] core: avoid leaks parsing team link-watcher

Found by coverity.

(cherry picked from commit f44f21c87e157c84ab865334f115e9fecd302465)
(cherry picked from commit 7673a3badc475998fc8f4169d0e2831d1625f1f9)
---
libnm-core/nm-utils.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
index 6cc92ec8d..9aafdd914 100644
--- a/libnm-core/nm-utils.c
+++ b/libnm-core/nm-utils.c
@@ -5185,13 +5185,16 @@ _nm_utils_team_link_watcher_from_json (json_t *json_element)
g_return_val_if_fail (json_element, NULL);

json_object_foreach (json_element, j_key, j_val) {
- if (nm_streq (j_key, "name"))
+ if (nm_streq (j_key, "name")) {
+ g_free (name);
name = strdup (json_string_value (j_val));
- else if (nm_streq (j_key, "target_host"))
+ } else if (nm_streq (j_key, "target_host")) {
+ g_free (target_host);
target_host = strdup (json_string_value (j_val));
- else if (nm_streq (j_key, "source_host"))
+ } else if (nm_streq (j_key, "source_host")) {
+ g_free (source_host);
source_host = strdup (json_string_value (j_val));
- else if (NM_IN_STRSET (j_key, "delay_up", "init_wait"))
+ } else if (NM_IN_STRSET (j_key, "delay_up", "init_wait"))
val1 = json_integer_value (j_val);
else if (NM_IN_STRSET (j_key, "delay_down", "interval"))
val2 = json_integer_value (j_val);
--
2.14.3

149
SOURCES/0005-clear-unsaved-flag-on-new-connections-rh1525078.patch

@ -0,0 +1,149 @@ @@ -0,0 +1,149 @@
From dac6c0c2bf30af21d4876bcbd579f97cedf9f0a3 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Wed, 20 Dec 2017 09:54:29 +0100
Subject: [PATCH] settings: clear unsaved flag on new settings-connection

When a new settings-connection is populated with the actual settings
read from disk by the plugin, calling nm_settings_connection_update()
with KEEP mode also marks it as unsaved, which should not happen on a
new connection just written to (or read from) disk.

Introduce a new KEEP_SAVED persist mode that is similar to KEEP but
clears the UNSAVED flag.

Fixes: 023ce50d2188af557b4f2af39ec5a3342612aa2f

https://bugzilla.redhat.com/show_bug.cgi?id=1525078
(cherry picked from commit 5fff928a6b746393e15487c348892b5ecaf8a416)
(cherry picked from commit b1b463d0dca46a25c5e46732949811c2c31fa4b2)
---
src/settings/nm-settings-connection.c | 1 +
src/settings/nm-settings-connection.h | 3 +++
src/settings/plugins/ibft/nms-ibft-connection.c | 2 +-
src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c | 2 +-
src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c | 2 +-
src/settings/plugins/ifnet/nms-ifnet-connection.c | 2 +-
src/settings/plugins/ifnet/nms-ifnet-plugin.c | 2 +-
src/settings/plugins/keyfile/nms-keyfile-connection.c | 2 +-
src/settings/plugins/keyfile/nms-keyfile-plugin.c | 2 +-
9 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c
index b6e894049..62f2de399 100644
--- a/src/settings/nm-settings-connection.c
+++ b/src/settings/nm-settings-connection.c
@@ -517,6 +517,7 @@ set_persist_mode (NMSettingsConnection *self, NMSettingsConnectionPersistMode pe
TRUE);
return;
case NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP:
+ case NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP_SAVED:
/* Nothing to do */
return;
}
diff --git a/src/settings/nm-settings-connection.h b/src/settings/nm-settings-connection.h
index fc8ad1de1..d7a999697 100644
--- a/src/settings/nm-settings-connection.h
+++ b/src/settings/nm-settings-connection.h
@@ -137,6 +137,9 @@ gboolean nm_settings_connection_has_unmodified_applied_connection (NMSettingsCon

typedef enum {
NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP,
+
+ /* like KEEP, but always clears the UNSAVED flag */
+ NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP_SAVED,
NM_SETTINGS_CONNECTION_PERSIST_MODE_DISK,

/* unsaved, only sets the unsaved flag, but it doesn't touch
diff --git a/src/settings/plugins/ibft/nms-ibft-connection.c b/src/settings/plugins/ibft/nms-ibft-connection.c
index 2a7c5f4a0..fb7f18f8d 100644
--- a/src/settings/plugins/ibft/nms-ibft-connection.c
+++ b/src/settings/plugins/ibft/nms-ibft-connection.c
@@ -62,7 +62,7 @@ nms_ibft_connection_new (const GPtrArray *block, GError **error)
/* Update settings with what was read from iscsiadm */
if (!nm_settings_connection_update (NM_SETTINGS_CONNECTION (object),
source,
- NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP,
+ NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP_SAVED,
NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE,
NULL,
error))
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c
index 3cf5c978c..6979fdaaa 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c
@@ -442,7 +442,7 @@ nm_ifcfg_connection_new (NMConnection *source,
if (nm_settings_connection_update (NM_SETTINGS_CONNECTION (object),
tmp,
full_path
- ? NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP /* connection is already on disk */
+ ? NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP_SAVED
: NM_SETTINGS_CONNECTION_PERSIST_MODE_UNSAVED,
NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE,
NULL,
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c
index 04e74bbda..2b388d1d9 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c
@@ -315,7 +315,7 @@ update_connection (SettingsPluginIfcfg *self,

if (!nm_settings_connection_update (NM_SETTINGS_CONNECTION (connection_by_uuid),
NM_CONNECTION (connection_new),
- NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP,
+ NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP_SAVED,
NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE,
"ifcfg-update",
&local)) {
diff --git a/src/settings/plugins/ifnet/nms-ifnet-connection.c b/src/settings/plugins/ifnet/nms-ifnet-connection.c
index e7cd19cd2..ce0b3f2bf 100644
--- a/src/settings/plugins/ifnet/nms-ifnet-connection.c
+++ b/src/settings/plugins/ifnet/nms-ifnet-connection.c
@@ -190,7 +190,7 @@ nm_ifnet_connection_new (NMConnection *source, const char *conn_name)
tmp,
update_unsaved
? NM_SETTINGS_CONNECTION_PERSIST_MODE_UNSAVED
- : NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP,
+ : NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP_SAVED,
NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE,
NULL,
NULL)) {
diff --git a/src/settings/plugins/ifnet/nms-ifnet-plugin.c b/src/settings/plugins/ifnet/nms-ifnet-plugin.c
index 38d23f306..d89e988ba 100644
--- a/src/settings/plugins/ifnet/nms-ifnet-plugin.c
+++ b/src/settings/plugins/ifnet/nms-ifnet-plugin.c
@@ -271,7 +271,7 @@ reload_connections (NMSettingsPlugin *config)
/* Update existing connection with new settings */
if (!nm_settings_connection_update (NM_SETTINGS_CONNECTION (old),
NM_CONNECTION (new),
- NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP,
+ NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP_SAVED,
NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE,
"ifnet-update",
&error)) {
diff --git a/src/settings/plugins/keyfile/nms-keyfile-connection.c b/src/settings/plugins/keyfile/nms-keyfile-connection.c
index 5a6d8a76e..5f72a9fab 100644
--- a/src/settings/plugins/keyfile/nms-keyfile-connection.c
+++ b/src/settings/plugins/keyfile/nms-keyfile-connection.c
@@ -163,7 +163,7 @@ nms_keyfile_connection_new (NMConnection *source,
tmp,
update_unsaved
? NM_SETTINGS_CONNECTION_PERSIST_MODE_UNSAVED
- : NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP,
+ : NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP_SAVED,
NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE,
NULL,
error)) {
diff --git a/src/settings/plugins/keyfile/nms-keyfile-plugin.c b/src/settings/plugins/keyfile/nms-keyfile-plugin.c
index bc64b3ca4..222768db4 100644
--- a/src/settings/plugins/keyfile/nms-keyfile-plugin.c
+++ b/src/settings/plugins/keyfile/nms-keyfile-plugin.c
@@ -260,7 +260,7 @@ update_connection (NMSKeyfilePlugin *self,

if (!nm_settings_connection_update (NM_SETTINGS_CONNECTION (connection_by_uuid),
NM_CONNECTION (connection_new),
- NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP,
+ NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP_SAVED,
NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE,
"keyfile-update",
&local)) {
--
2.14.3

34
SOURCES/0006-reload-qdiscs-and-tfilters-after-removal-rh1527197.patch

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
From ccd98ba2146ed7285e781f73f81f456d8a5a5988 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Mon, 8 Jan 2018 13:51:53 +0100
Subject: [PATCH] platform-linux: reload qdiscs and tfilters after removing
them

Kernel (as of 4.14) merely ACKs our RTM_DELQDISC and RTM_DELTFILTER, not
bothering to signal the full RTM_DEL* message unless the removal is
external to NetworkManager.

https://bugzilla.redhat.com/show_bug.cgi?id=1527197
(cherry picked from commit f3b4053a91e48ba56c07d70e8ac7305e2f51924f)
---
src/platform/nm-linux-platform.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 10d1a6efe..e66ab9449 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -4680,7 +4680,10 @@ do_delete_object (NMPlatform *platform, const NMPObject *obj_id, struct nl_msg *
wait_for_nl_response_to_string (seq_result, s_buf, sizeof (s_buf)),
log_detail);

- if (NMP_OBJECT_GET_TYPE (obj_id) == NMP_OBJECT_TYPE_IP6_ADDRESS) {
+ if (NM_IN_SET (NMP_OBJECT_GET_TYPE (obj_id),
+ NMP_OBJECT_TYPE_IP6_ADDRESS,
+ NMP_OBJECT_TYPE_QDISC,
+ NMP_OBJECT_TYPE_TFILTER)) {
/* In rare cases, the object is still there after we receive the ACK from
* kernel. Need to refetch.
*
--
2.14.3

163
SOURCES/0007-wwan-default-device-route-rh1527934.patch

@ -0,0 +1,163 @@ @@ -0,0 +1,163 @@
From 19ba1a19f4d3261e47420deb2882d8533bdbc5d8 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Wed, 20 Dec 2017 13:53:56 +0100
Subject: [PATCH 1/3] wwan: fix checks on IP configuration

Don't call nm_utils_parse_inaddr_bin() if the string returned by
mm_bearer_ip_config_get_address() and mm_bearer_ip_config_get_gateway()
is NULL, as the function requires a valid pointer. Throw an error if the
address is NULL, but allow an empty gateway.

Fixes: 7837afe87f0f269c0cc4de1c9c217529d760e83b
(cherry picked from commit 8ddc6caf98e2c4f1e796f50cdbeee567aba9be9d)
(cherry picked from commit f4dc5bd782e709c541174aac3fd3a160ca5f53ba)
---
src/devices/wwan/nm-modem-broadband.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c
index 6e5f10a06..9fc147da9 100644
--- a/src/devices/wwan/nm-modem-broadband.c
+++ b/src/devices/wwan/nm-modem-broadband.c
@@ -883,24 +883,25 @@ static_stage3_ip4_done (NMModemBroadband *self)

/* Fully fail if invalid IP address retrieved */
address_string = mm_bearer_ip_config_get_address (self->_priv.ipv4_config);
- if (!nm_utils_parse_inaddr_bin (AF_INET, address_string, &address_network)) {
+ if ( !address_string
+ || !nm_utils_parse_inaddr_bin (AF_INET, address_string, &address_network)) {
error = g_error_new (NM_DEVICE_ERROR,
NM_DEVICE_ERROR_INVALID_CONNECTION,
- "(%s) retrieving IP4 configuration failed: invalid address given '%s'",
+ "(%s) retrieving IP4 configuration failed: invalid address given %s%s%s",
nm_modem_get_uid (NM_MODEM (self)),
- address_string);
+ NM_PRINT_FMT_QUOTE_STRING (address_string));
goto out;
}

/* Missing gateway not a hard failure */
gw_string = mm_bearer_ip_config_get_gateway (self->_priv.ipv4_config);
- if ( !gw_string
- || !nm_utils_parse_inaddr_bin (AF_INET, gw_string, &gw)) {
+ if ( gw_string
+ && !nm_utils_parse_inaddr_bin (AF_INET, gw_string, &gw)) {
error = g_error_new (NM_DEVICE_ERROR,
NM_DEVICE_ERROR_INVALID_CONNECTION,
- "(%s) retrieving IP4 configuration failed: invalid gateway address %s%s%s",
+ "(%s) retrieving IP4 configuration failed: invalid gateway address \"%s\"",
nm_modem_get_uid (NM_MODEM (self)),
- NM_PRINT_FMT_QUOTE_STRING (gw_string));
+ gw_string);
goto out;
}

--
2.14.3

From 0be2bf3ca528a02237665b3c34ac00e6a6a89d7b Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Wed, 20 Dec 2017 14:26:57 +0100
Subject: [PATCH 2/3] wwan: add default route even if modem didn't return a
gateway

If the modem didn't return a gateway, add a device route.

Fixes: 5c299454b49b165f645c25fd3e083c0bb747ad91
(cherry picked from commit ec32edb21f7b34064731c737594643a3b9bda337)
(cherry picked from commit d9512bc807f103fe891409629d1b17ff4594d9c4)
---
src/devices/wwan/nm-modem-broadband.c | 34 +++++++++++++++-------------------
1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c
index 9fc147da9..cd7c48ef3 100644
--- a/src/devices/wwan/nm-modem-broadband.c
+++ b/src/devices/wwan/nm-modem-broadband.c
@@ -875,6 +875,8 @@ static_stage3_ip4_done (NMModemBroadband *self)
NMPlatformIP4Address address;
const gchar **dns;
guint i;
+ guint32 ip4_route_table, ip4_route_metric;
+ NMPlatformIP4Route *r;

g_assert (self->_priv.ipv4_config);
g_assert (self->_priv.bearer);
@@ -920,26 +922,20 @@ static_stage3_ip4_done (NMModemBroadband *self)

_LOGI (" address %s/%d", address_string, address.plen);

- if (gw) {
- guint32 ip4_route_table, ip4_route_metric;

- nm_modem_get_route_parameters (NM_MODEM (self),
- &ip4_route_table,
- &ip4_route_metric,
- NULL,
- NULL);
- {
- const NMPlatformIP4Route r = {
- .rt_source = NM_IP_CONFIG_SOURCE_WWAN,
- .gateway = gw,
- .table_coerced = nm_platform_route_table_coerce (ip4_route_table),
- .metric = ip4_route_metric,
- };
-
- _LOGI (" gateway %s", gw_string);
- nm_ip4_config_add_route (config, &r, NULL);
- }
- }
+ nm_modem_get_route_parameters (NM_MODEM (self),
+ &ip4_route_table,
+ &ip4_route_metric,
+ NULL,
+ NULL);
+ r = &(NMPlatformIP4Route) {
+ .rt_source = NM_IP_CONFIG_SOURCE_WWAN,
+ .gateway = gw,
+ .table_coerced = nm_platform_route_table_coerce (ip4_route_table),
+ .metric = ip4_route_metric,
+ };
+ nm_ip4_config_add_route (config, r, NULL);
+ _LOGI (" gateway %s", gw_string);

/* DNS servers */
dns = mm_bearer_ip_config_get_dns (self->_priv.ipv4_config);
--
2.14.3

From 345d3abb0ae2a322bc1a19c59c2a229a06657ce6 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Wed, 20 Dec 2017 14:28:05 +0100
Subject: [PATCH 3/3] wwan: clear idle source id when the callback runs

Fixes: f0996d0eb82254ea794cf9607e4a9b4e2dc3d029
(cherry picked from commit 5d372fd30ea71e8f3e6bb8b77c1e7a680165a3ce)
(cherry picked from commit 4ca7e3d0cfb6a75b02e183b369bf2d35c38ca6a6)
---
src/devices/wwan/nm-modem-broadband.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c
index cd7c48ef3..dc0ce303c 100644
--- a/src/devices/wwan/nm-modem-broadband.c
+++ b/src/devices/wwan/nm-modem-broadband.c
@@ -881,6 +881,8 @@ static_stage3_ip4_done (NMModemBroadband *self)
g_assert (self->_priv.ipv4_config);
g_assert (self->_priv.bearer);

+ self->_priv.idle_id_ip4 = 0;
+
_LOGI ("IPv4 static configuration:");

/* Fully fail if invalid IP address retrieved */
@@ -986,6 +988,7 @@ stage3_ip6_done (NMModemBroadband *self)

g_assert (self->_priv.ipv6_config);

+ self->_priv.idle_id_ip6 = 0;
memset (&address, 0, sizeof (address));

ip_method = get_bearer_ip_method (self->_priv.ipv6_config);
--
2.14.3

324
SOURCES/0008-dhcp-client-id-rh1531173.patch

@ -0,0 +1,324 @@ @@ -0,0 +1,324 @@
From ce8c21737b1b952044219111b2358b1602983138 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Thu, 4 Jan 2018 16:12:40 +0100
Subject: [PATCH 1/2] dhcp: cleanup handling of ipv4.dhcp-client-id and avoid
assertion failure

The internal client asserts that the length of the client ID is not more
than MAX_CLIENT_ID_LEN. Avoid that assert by truncating the string.

Also add new nm_dhcp_client_set_client_id_*() setters, that either
set the ID based on a string (in our common dhclient specific
format), or based on the binary data (as obtained from systemd client).

Also, add checks and assertions that the client ID which is
set via nm_dhcp_client_set_client_id() is always of length
of at least 2 (as required by rfc2132, section-9.14).

(cherry picked from commit 686afe531ab3774cd818feda8361de74101971f5)
(cherry picked from commit 41a89aeebac146000de97b778800e755db29568f)
---
libnm-core/nm-setting-ip4-config.c | 2 +-
src/dhcp/nm-dhcp-client.c | 67 ++++++++++++++++++----
src/dhcp/nm-dhcp-client.h | 9 ++-
src/dhcp/nm-dhcp-dhclient-utils.c | 8 ++-
src/dhcp/nm-dhcp-systemd.c | 18 ++----
src/dhcp/nm-dhcp-utils.c | 9 ++-
src/nm-types.h | 2 +
.../src/libsystemd-network/sd-dhcp-client.c | 1 +
8 files changed, 88 insertions(+), 28 deletions(-)

diff --git a/libnm-core/nm-setting-ip4-config.c b/libnm-core/nm-setting-ip4-config.c
index 26e7f5056..d9c0cbb14 100644
--- a/libnm-core/nm-setting-ip4-config.c
+++ b/libnm-core/nm-setting-ip4-config.c
@@ -191,7 +191,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}

- if (priv->dhcp_client_id && !strlen (priv->dhcp_client_id)) {
+ if (priv->dhcp_client_id && !priv->dhcp_client_id[0]) {
g_set_error_literal (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
diff --git a/src/dhcp/nm-dhcp-client.c b/src/dhcp/nm-dhcp-client.c
index 20ea092f0..1f19db148 100644
--- a/src/dhcp/nm-dhcp-client.c
+++ b/src/dhcp/nm-dhcp-client.c
@@ -186,19 +186,69 @@ nm_dhcp_client_get_client_id (NMDhcpClient *self)
return NM_DHCP_CLIENT_GET_PRIVATE (self)->client_id;
}

+static void
+_set_client_id (NMDhcpClient *self, GBytes *client_id, gboolean take)
+{
+ NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE (self);
+
+ nm_assert (!client_id || g_bytes_get_size (client_id) >= 2);
+
+ if ( priv->client_id == client_id
+ || ( priv->client_id
+ && g_bytes_equal (priv->client_id, client_id))) {
+ if (take && client_id)
+ g_bytes_unref (client_id);
+ return;
+ }
+
+ if (priv->client_id)
+ g_bytes_unref (priv->client_id);
+ priv->client_id = client_id;
+ if (!take && client_id)
+ g_bytes_ref (client_id);
+}
+
void
nm_dhcp_client_set_client_id (NMDhcpClient *self, GBytes *client_id)
{
- NMDhcpClientPrivate *priv;
+ g_return_if_fail (NM_IS_DHCP_CLIENT (self));
+ g_return_if_fail (!client_id || g_bytes_get_size (client_id) >= 2);
+
+ _set_client_id (self, client_id, FALSE);
+}
+
+void
+nm_dhcp_client_set_client_id_bin (NMDhcpClient *self,
+ guint8 type,
+ const guint8 *client_id,
+ gsize len)
+{
+ guint8 *buf;
+ GBytes *b;

g_return_if_fail (NM_IS_DHCP_CLIENT (self));
+ g_return_if_fail (client_id);
+ g_return_if_fail (len > 0);
+
+ buf = g_malloc (len + 1);
+ buf[0] = type;
+ memcpy (buf + 1, client_id, len);
+ b = g_bytes_new_take (buf, len + 1);
+ _set_client_id (self, b, TRUE);
+}

- priv = NM_DHCP_CLIENT_GET_PRIVATE (self);
+void
+nm_dhcp_client_set_client_id_str (NMDhcpClient *self,
+ const char *dhcp_client_id)
+{
+ g_return_if_fail (NM_IS_DHCP_CLIENT (self));
+ g_return_if_fail (!dhcp_client_id || dhcp_client_id[0]);

- if (priv->client_id && client_id && g_bytes_equal (priv->client_id, client_id))
- return;
- g_clear_pointer (&priv->client_id, g_bytes_unref);
- priv->client_id = client_id ? g_bytes_ref (client_id) : NULL;
+ _set_client_id (self,
+ dhcp_client_id
+ ? nm_dhcp_utils_client_id_string_to_bytes (dhcp_client_id)
+ : NULL,
+ TRUE);
}

const char *
@@ -448,7 +498,6 @@ nm_dhcp_client_start_ip4 (NMDhcpClient *self,
const char *last_ip4_address)
{
NMDhcpClientPrivate *priv;
- gs_unref_bytes GBytes *tmp = NULL;

g_return_val_if_fail (NM_IS_DHCP_CLIENT (self), FALSE);

@@ -462,9 +511,7 @@ nm_dhcp_client_start_ip4 (NMDhcpClient *self,
else
_LOGI ("activation: beginning transaction (timeout in %u seconds)", (guint) priv->timeout);

- if (dhcp_client_id)
- tmp = nm_dhcp_utils_client_id_string_to_bytes (dhcp_client_id);
- nm_dhcp_client_set_client_id (self, tmp);
+ nm_dhcp_client_set_client_id_str (self, dhcp_client_id);

g_clear_pointer (&priv->hostname, g_free);
priv->hostname = g_strdup (hostname);
diff --git a/src/dhcp/nm-dhcp-client.h b/src/dhcp/nm-dhcp-client.h
index 02804002f..2c6341682 100644
--- a/src/dhcp/nm-dhcp-client.h
+++ b/src/dhcp/nm-dhcp-client.h
@@ -173,7 +173,14 @@ gboolean nm_dhcp_client_handle_event (gpointer unused,
const char *reason,
NMDhcpClient *self);

-void nm_dhcp_client_set_client_id (NMDhcpClient *self, GBytes *client_id);
+void nm_dhcp_client_set_client_id (NMDhcpClient *self,
+ GBytes *client_id);
+void nm_dhcp_client_set_client_id_bin (NMDhcpClient *self,
+ guint8 type,
+ const guint8 *client_id,
+ gsize len);
+void nm_dhcp_client_set_client_id_str (NMDhcpClient *self,
+ const char *dhcp_client_id);

/*****************************************************************************
* Client data
diff --git a/src/dhcp/nm-dhcp-dhclient-utils.c b/src/dhcp/nm-dhcp-dhclient-utils.c
index e63e6a869..4df90d76a 100644
--- a/src/dhcp/nm-dhcp-dhclient-utils.c
+++ b/src/dhcp/nm-dhcp-dhclient-utils.c
@@ -178,7 +178,7 @@ read_client_id (const char *str)
gs_free char *s = NULL;
char *p;

- g_assert (!strncmp (str, CLIENTID_TAG, NM_STRLEN (CLIENTID_TAG)));
+ nm_assert (!strncmp (str, CLIENTID_TAG, NM_STRLEN (CLIENTID_TAG)));

str += NM_STRLEN (CLIENTID_TAG);
while (g_ascii_isspace (*str))
@@ -198,6 +198,9 @@ read_client_id (const char *str)
if (s[strlen (s) - 1] == ';')
s[strlen (s) - 1] = '\0';

+ if (!s[0])
+ return NULL;
+
return nm_dhcp_utils_client_id_string_to_bytes (s);
}

@@ -329,8 +332,7 @@ nm_dhcp_dhclient_create_config (const char *interface,
continue;

/* Otherwise capture and return the existing client id */
- if (out_new_client_id)
- *out_new_client_id = read_client_id (p);
+ NM_SET_OUT (out_new_client_id, read_client_id (p));
}

/* Override config file hostname and use one from the connection */
diff --git a/src/dhcp/nm-dhcp-systemd.c b/src/dhcp/nm-dhcp-systemd.c
index 9b1a44332..f79b7cb1e 100644
--- a/src/dhcp/nm-dhcp-systemd.c
+++ b/src/dhcp/nm-dhcp-systemd.c
@@ -489,19 +489,13 @@ _save_client_id (NMDhcpSystemd *self,
const uint8_t *client_id,
size_t len)
{
- gs_unref_bytes GBytes *b = NULL;
- gs_free char *buf = NULL;
-
g_return_if_fail (self != NULL);
g_return_if_fail (client_id != NULL);
g_return_if_fail (len > 0);

if (!nm_dhcp_client_get_client_id (NM_DHCP_CLIENT (self))) {
- buf = g_malloc (len + 1);
- buf[0] = type;
- memcpy (buf + 1, client_id, len);
- b = g_bytes_new (buf, len + 1);
- nm_dhcp_client_set_client_id (NM_DHCP_CLIENT (self), b);
+ nm_dhcp_client_set_client_id_bin (NM_DHCP_CLIENT (self),
+ type, client_id, len);
}
}

@@ -543,7 +537,7 @@ bound4_handle (NMDhcpSystemd *self)
add_requests_to_options (options, dhcp4_requests);
dhcp_lease_save (lease, priv->lease_file);

- sd_dhcp_client_get_client_id(priv->client4, &type, &client_id, &client_id_len);
+ sd_dhcp_client_get_client_id (priv->client4, &type, &client_id, &client_id_len);
if (client_id)
_save_client_id (self, type, client_id, client_id_len);

@@ -691,14 +685,14 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
override_client_id = nm_dhcp_client_get_client_id (client);
if (override_client_id) {
client_id = g_bytes_get_data (override_client_id, &client_id_len);
- g_assert (client_id && client_id_len);
+ nm_assert (client_id && client_id_len >= 2);
sd_dhcp_client_set_client_id (priv->client4,
client_id[0],
client_id + 1,
- client_id_len - 1);
+ NM_MIN (client_id_len - 1, _NM_SD_MAX_CLIENT_ID_LEN));
} else if (lease) {
r = sd_dhcp_lease_get_client_id (lease, (const void **) &client_id, &client_id_len);
- if (r == 0 && client_id_len) {
+ if (r == 0 && client_id_len >= 2) {
sd_dhcp_client_set_client_id (priv->client4,
client_id[0],
client_id + 1,
diff --git a/src/dhcp/nm-dhcp-utils.c b/src/dhcp/nm-dhcp-utils.c
index 4b2d57b90..50ca2abe2 100644
--- a/src/dhcp/nm-dhcp-utils.c
+++ b/src/dhcp/nm-dhcp-utils.c
@@ -750,8 +750,15 @@ nm_dhcp_utils_client_id_string_to_bytes (const char *client_id)
g_return_val_if_fail (client_id && client_id[0], NULL);

/* Try as hex encoded */
- if (strchr (client_id, ':'))
+ if (strchr (client_id, ':')) {
bytes = nm_utils_hexstr2bin (client_id);
+
+ /* the result must be at least two bytes long,
+ * because @client_id contains a delimiter
+ * but nm_utils_hexstr2bin() does not allow
+ * leading nor trailing delimiters. */
+ nm_assert (!bytes || g_bytes_get_size (bytes) >= 2);
+ }
if (!bytes) {
/* Fall back to string */
len = strlen (client_id);
diff --git a/src/nm-types.h b/src/nm-types.h
index cc657397e..02163f87e 100644
--- a/src/nm-types.h
+++ b/src/nm-types.h
@@ -25,6 +25,8 @@
#error "nm-utils-private.h" must not be used outside of libnm-core/. Do you want "nm-core-internal.h"?
#endif

+#define _NM_SD_MAX_CLIENT_ID_LEN (sizeof (guint32) + 128)
+
/* core */
typedef struct _NMExportedObject NMExportedObject;
typedef struct _NMActiveConnection NMActiveConnection;
diff --git a/src/systemd/src/libsystemd-network/sd-dhcp-client.c b/src/systemd/src/libsystemd-network/sd-dhcp-client.c
index fc6ad422d..5eab00502 100644
--- a/src/systemd/src/libsystemd-network/sd-dhcp-client.c
+++ b/src/systemd/src/libsystemd-network/sd-dhcp-client.c
@@ -311,6 +311,7 @@ int sd_dhcp_client_set_client_id(
assert_return(client, -EINVAL);
assert_return(data, -EINVAL);
assert_return(data_len > 0 && data_len <= MAX_CLIENT_ID_LEN, -EINVAL);
+ G_STATIC_ASSERT_EXPR (_NM_SD_MAX_CLIENT_ID_LEN == MAX_CLIENT_ID_LEN);

switch (type) {

--
2.14.3


From 161a554575f0e043ecf2d50b6108fa102fa9a982 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 9 Jan 2018 15:55:23 +0100
Subject: [PATCH 2/2] dhcp: fix check for client-id in _set_client_id()

Fixes: 686afe531ab3774cd818feda8361de74101971f5
(cherry picked from commit 0e1fb1dbd282f546820c1ab8326cf4cf550ae2ae)
(cherry picked from commit 8998ce629da8954a15c3cfc9aadb0d74bbcc116b)
---
src/dhcp/nm-dhcp-client.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/dhcp/nm-dhcp-client.c b/src/dhcp/nm-dhcp-client.c
index 1f19db148..ea3938d63 100644
--- a/src/dhcp/nm-dhcp-client.c
+++ b/src/dhcp/nm-dhcp-client.c
@@ -195,6 +195,7 @@ _set_client_id (NMDhcpClient *self, GBytes *client_id, gboolean take)

if ( priv->client_id == client_id
|| ( priv->client_id
+ && client_id
&& g_bytes_equal (priv->client_id, client_id))) {
if (take && client_id)
g_bytes_unref (client_id);
--
2.14.3

1515
SOURCES/0009-distinct-route-metric-rh1505893.patch

File diff suppressed because it is too large Load Diff

26
SOURCES/0010-fix-set-connectivity-check-enabled-rh1534477.patch

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
From 3e04e749dc9726b8e0d9a9ae71c29c78231230f0 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Mon, 18 Dec 2017 09:03:56 +0100
Subject: [PATCH] manager: fix connectivity-check-enabled property

(cherry picked from commit 99fea5f3801e9fa1fbc6d9e56e1d9f6db63caccc)
(cherry picked from commit 643d80ec913a313209ccbc5567def4b466ab546c)
---
src/nm-manager.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/nm-manager.c b/src/nm-manager.c
index c011bfd0e..001fae553 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -6652,7 +6652,7 @@ get_property (GObject *object, guint prop_id,
#else
vbool = FALSE;
#endif
- g_value_set_boolean (value, FALSE);
+ g_value_set_boolean (value, vbool);
break;
case PROP_PRIMARY_CONNECTION:
nm_utils_g_value_set_object_path (value, priv->primary_connection);
--
2.14.3

167
SOURCES/0011-fix-assertion-delete-volatile-connection-rh1506552.patch

@ -0,0 +1,167 @@ @@ -0,0 +1,167 @@
From abef55ece4d33b1a7e887bdf5452a48040d8ee8c Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Mon, 18 Dec 2017 17:25:10 +0100
Subject: [PATCH 1/1] settings: avoid assertion when deleting connections

If a volatile connection is deleted by user when it was already being
deleted internally because the device vanished, we may hit the
following failed assertion:

file src/settings/nm-settings-connection.c: line 2196
(nm_settings_connection_signal_remove): should not be reached

The @removed flag keeps track of whether we already signaled the
connection removal. Instead of throwing an assertion if we try to emit
the signal again, just return without action because this can happen
in the situation described above.

While at it, remove the @allow_reuse argument from
nm_settings_connection_signal_remove(): we should never emit the
signal twice. Instead, we should reset the @removed flag when the
connection is added.

Fixes: a9384452ed61ca3f1c6e1db175f499307da9c388

https://bugzilla.redhat.com/show_bug.cgi?id=1506552
(cherry picked from commit 98ac0f404ed8103324b7d03cf04c24946f4543ff)
(cherry picked from commit 39e1c65494d489b2cd9d63140c98d4fb4185003a)
---
src/settings/nm-settings-connection.c | 23 +++++++++++++++-------
src/settings/nm-settings-connection.h | 4 +++-
src/settings/nm-settings.c | 2 ++
.../plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c | 4 ++--
src/settings/plugins/ifnet/nms-ifnet-plugin.c | 4 ++--
src/settings/plugins/keyfile/nms-keyfile-plugin.c | 2 +-
6 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c
index 62f2de399..37a0b3a6c 100644
--- a/src/settings/nm-settings-connection.c
+++ b/src/settings/nm-settings-connection.c
@@ -794,7 +794,7 @@ nm_settings_connection_delete (NMSettingsConnection *self,
/* Remove connection from seen-bssids database file */
remove_entry_from_db (self, "seen-bssids");

- nm_settings_connection_signal_remove (self, FALSE);
+ nm_settings_connection_signal_remove (self);
return TRUE;
}

@@ -2188,15 +2188,24 @@ impl_settings_connection_clear_secrets (NMSettingsConnection *self,
/*****************************************************************************/

void
-nm_settings_connection_signal_remove (NMSettingsConnection *self, gboolean allow_reuse)
+nm_settings_connection_added (NMSettingsConnection *self)
{
NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);

- if (!allow_reuse) {
- if (priv->removed)
- g_return_if_reached ();
- priv->removed = TRUE;
- }
+ /* FIXME: we should always dispose connections that are removed
+ * and not reuse them, but currently plugins keep alive unmanaged
+ * (e.g. NM_CONTROLLED=no) connections. */
+ priv->removed = FALSE;
+}
+
+void
+nm_settings_connection_signal_remove (NMSettingsConnection *self)
+{
+ NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
+
+ if (priv->removed)
+ return;
+ priv->removed = TRUE;
g_signal_emit_by_name (self, NM_SETTINGS_CONNECTION_REMOVED);
}

diff --git a/src/settings/nm-settings-connection.h b/src/settings/nm-settings-connection.h
index d7a999697..29ec05dd1 100644
--- a/src/settings/nm-settings-connection.h
+++ b/src/settings/nm-settings-connection.h
@@ -193,7 +193,9 @@ void nm_settings_connection_recheck_visibility (NMSettingsConnection *self);
gboolean nm_settings_connection_check_permission (NMSettingsConnection *self,
const char *permission);

-void nm_settings_connection_signal_remove (NMSettingsConnection *self, gboolean allow_reuse);
+void nm_settings_connection_added (NMSettingsConnection *self);
+
+void nm_settings_connection_signal_remove (NMSettingsConnection *self);

gboolean nm_settings_connection_get_unsaved (NMSettingsConnection *self);

diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c
index 21fdf9e06..d54305c13 100644
--- a/src/settings/nm-settings.c
+++ b/src/settings/nm-settings.c
@@ -1004,6 +1004,8 @@ claim_connection (NMSettings *self, NMSettingsConnection *connection)
/* Exported D-Bus signal */
g_signal_emit (self, signals[NEW_CONNECTION], 0, connection);
}
+
+ nm_settings_connection_added (connection);
}

static gboolean
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c
index 2b388d1d9..0743fc9ff 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c
@@ -161,7 +161,7 @@ remove_connection (SettingsPluginIfcfg *self, NMIfcfgConnection *connection)
g_object_ref (connection);
g_hash_table_remove (priv->connections, nm_connection_get_uuid (NM_CONNECTION (connection)));
if (!unmanaged && !unrecognized)
- nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (connection), FALSE);
+ nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (connection));
g_object_unref (connection);

/* Emit changes _after_ removing the connection */
@@ -331,7 +331,7 @@ update_connection (SettingsPluginIfcfg *self,
/* Unexport the connection by telling the settings service it's
* been removed.
*/
- nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (connection_by_uuid), TRUE);
+ nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (connection_by_uuid));
/* Remove the path so that claim_connection() doesn't complain later when
* interface gets managed and connection is re-added. */
nm_connection_set_path (NM_CONNECTION (connection_by_uuid), NULL);
diff --git a/src/settings/plugins/ifnet/nms-ifnet-plugin.c b/src/settings/plugins/ifnet/nms-ifnet-plugin.c
index d89e988ba..8332358f9 100644
--- a/src/settings/plugins/ifnet/nms-ifnet-plugin.c
+++ b/src/settings/plugins/ifnet/nms-ifnet-plugin.c
@@ -262,7 +262,7 @@ reload_connections (NMSettingsPlugin *config)
NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS)) {
nm_log_info (LOGD_SETTINGS, "Auto refreshing %s", conn_name);

- nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (old), FALSE);
+ nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (old));
track_new_connection (self, new);
if (is_managed_plugin () && is_managed (conn_name))
g_signal_emit_by_name (self, NM_SETTINGS_PLUGIN_CONNECTION_ADDED, new);
@@ -305,7 +305,7 @@ reload_connections (NMSettingsPlugin *config)
*/
if ( nm_ifnet_connection_get_conn_name (NM_IFNET_CONNECTION (candidate))
&& !g_hash_table_lookup (new_connections, uuid)) {
- nm_settings_connection_signal_remove (candidate, FALSE);
+ nm_settings_connection_signal_remove (candidate);
g_hash_table_iter_remove (&iter);
}
}
diff --git a/src/settings/plugins/keyfile/nms-keyfile-plugin.c b/src/settings/plugins/keyfile/nms-keyfile-plugin.c
index 222768db4..cb5f2c9f0 100644
--- a/src/settings/plugins/keyfile/nms-keyfile-plugin.c
+++ b/src/settings/plugins/keyfile/nms-keyfile-plugin.c
@@ -107,7 +107,7 @@ remove_connection (NMSKeyfilePlugin *self, NMSKeyfileConnection *connection)
g_signal_handlers_disconnect_by_func (connection, connection_removed_cb, self);
removed = g_hash_table_remove (NMS_KEYFILE_PLUGIN_GET_PRIVATE (self)->connections,
nm_connection_get_uuid (NM_CONNECTION (connection)));
- nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (connection), FALSE);
+ nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (connection));
g_object_unref (connection);

g_return_if_fail (removed);
--
2.14.3

30
SOURCES/0012-device-increase-carrier-wait-time-rh1520826.patch

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
From 511649ebb6941679d0ade0ff401ba7669f620619 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Fri, 5 Jan 2018 16:55:55 +0100
Subject: [PATCH] device: increase carrier wait time to 6 seconds

Some NICs need longer to establish the link, increase the timeout from
5 to 6 seconds.

https://bugzilla.redhat.com/show_bug.cgi?id=1520826
(cherry picked from commit 156344b8beec88b68f335fe13c5db91d62fcb3fc)
(cherry picked from commit 3c60d6354044e3d88b010d489c0e76f8dd1163c9)
---
src/devices/nm-device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 40c425a5b..babef21ad 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -87,7 +87,7 @@ _LOG_DECLARE_SELF (NMDevice);
#define DHCP_NUM_TRIES_MAX 3
#define DEFAULT_AUTOCONNECT TRUE

-#define CARRIER_WAIT_TIME_MS 5000
+#define CARRIER_WAIT_TIME_MS 6000
#define CARRIER_WAIT_TIME_AFTER_MTU_MS 10000

#define NM_DEVICE_AUTH_RETRIES_UNSET -1
--
2.14.3

59
SOURCES/0013-ifcfg-ovs-master-rh1519179.patch

@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
From c778d9a252debf4cee02df51400a3b33e5afa304 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Thu, 18 Jan 2018 10:13:43 +0100
Subject: [PATCH] ifcfg: don't forget master of ovs interfaces

https://bugzilla.redhat.com/show_bug.cgi?id=1519179
(cherry picked from commit 1440fe6a8804c0d2da162ebc91d35a55c5e83f42)
---
src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c | 17 +++++++++++++++++
src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c | 6 ++++++
2 files changed, 23 insertions(+)

diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
index b9900eec3..bdd3ee0a1 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
@@ -293,6 +293,23 @@ make_connection_setting (const char *file,
check_if_bond_slave (ifcfg, s_con);
check_if_team_slave (ifcfg, s_con);

+ nm_clear_g_free (&value);
+ v = svGetValueStr (ifcfg, "OVS_PORT_UUID", &value);
+ if (!v)
+ v = svGetValueStr (ifcfg, "OVS_PORT", &value);
+ if (v) {
+ const char *old_value;
+
+ if ((old_value = nm_setting_connection_get_master (s_con))) {
+ PARSE_WARNING ("Already configured as slave of %s. Ignoring OVS_PORT=\"%s\"",
+ old_value, v);
+ } else {
+ g_object_set (s_con, NM_SETTING_CONNECTION_MASTER, v, NULL);
+ g_object_set (s_con, NM_SETTING_CONNECTION_SLAVE_TYPE,
+ NM_SETTING_OVS_PORT_SETTING_NAME, NULL);
+ }
+ }
+
nm_clear_g_free (&value);
v = svGetValueStr (ifcfg, "GATEWAY_PING_TIMEOUT", &value);
if (v) {
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
index 5cb8ee98f..e9dd08b7d 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
@@ -1832,6 +1832,12 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg)
NM_SETTING_WIRED_SETTING_NAME,
NM_SETTING_VLAN_SETTING_NAME))
svUnsetValue (ifcfg, "TYPE");
+ } else if (nm_setting_connection_is_slave_type (s_con, NM_SETTING_OVS_PORT_SETTING_NAME)) {
+ svSetValueStr (ifcfg, "OVS_PORT_UUID", master);
+ svSetValueStr (ifcfg, "OVS_PORT", master_iface);
+ } else {
+ _LOGW ("don't know how to set master for a %s slave",
+ nm_setting_connection_get_slave_type (s_con));
}
}

--
2.14.3

51
SOURCES/0014-device-skip-IP-conf-for-external-devices-rh1530288.patch

@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
From d07570b2dad62b582f39310f4abea036060f85a0 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Thu, 18 Jan 2018 11:43:09 +0100
Subject: [PATCH] device: skip IP configuration phase for external devices

We already avoid committing the IP configuration for external devices
(see commit 60334a2893fe). However, we still start DHCP/IPv6-autoconf
and, especially, we change sysctl values of the device.

To be sure that no action is taken on the device, return early from
the IP configuration phase, as in the method=disabled/ignore case.

https://bugzilla.redhat.com/show_bug.cgi?id=1530288
(cherry picked from commit 22f32a16f5aa0a24fd124ad5788959936e22acff)
(cherry picked from commit a169247b7dda0c27707861e6cbc808ecfd4c5e85)
---
src/devices/nm-device.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index babef21ad..b3b31ea45 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -8159,6 +8159,12 @@ nm_device_activate_stage3_ip4_start (NMDevice *self)

g_assert (priv->ip4_state == IP_WAIT);

+ if (nm_device_sys_iface_state_is_external (self)) {
+ _set_ip_state (self, AF_INET, IP_DONE);
+ check_ip_state (self, FALSE);
+ return TRUE;
+ }
+
_set_ip_state (self, AF_INET, IP_CONF);
ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip4_config_start (self, &ip4_config, &failure_reason);
if (ret == NM_ACT_STAGE_RETURN_SUCCESS) {
@@ -8200,6 +8206,12 @@ nm_device_activate_stage3_ip6_start (NMDevice *self)

g_assert (priv->ip6_state == IP_WAIT);

+ if (nm_device_sys_iface_state_is_external (self)) {
+ _set_ip_state (self, AF_INET6, IP_DONE);
+ check_ip_state (self, FALSE);
+ return TRUE;
+ }
+
_set_ip_state (self, AF_INET6, IP_CONF);
ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip6_config_start (self, &ip6_config, &failure_reason);
if (ret == NM_ACT_STAGE_RETURN_SUCCESS) {
--
2.14.3

27
SOURCES/0015-route-get-crash-rh1534721.patch

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
From abca0de3543a49157ca17b46313f7b9f77193abe Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Sun, 14 Jan 2018 15:17:14 +0100
Subject: [PATCH 1/1] platform: fix wrong cleanup function in ip_route_get()

Fixes: 33a2a7c3e3738b184233980a66f0093f073f97b1
(cherry picked from commit 3de3f59ffd9fdc02332ab928352a1b8f8ae77982)
(cherry picked from commit c17315d555c812f8b14d36a34856f8030ecbfdc5)
---
src/platform/nm-linux-platform.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index e66ab9449..fe270e88d 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -6416,7 +6416,7 @@ ip_route_get (NMPlatform *platform,
int try_count = 0;
WaitForNlResponseResult seq_result;
int nle;
- nm_auto_nlmsg NMPObject *route = NULL;
+ nm_auto_nmpobj NMPObject *route = NULL;

nm_assert (NM_IS_LINUX_PLATFORM (platform));
nm_assert (NM_IN_SET (addr_family, AF_INET, AF_INET6));
--
2.14.3

91
SOURCES/0016-ovs-interface-dhcp-twice-rh1540063.patch

@ -0,0 +1,91 @@ @@ -0,0 +1,91 @@
From a645c8dd7190aa075227728e5f234a5169bfbab1 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Fri, 2 Feb 2018 17:25:04 +0100
Subject: [PATCH] ovs-interface: avoid starting ip[46] configuration more than
once

OvsInterface can postpone the stage3_ip[46]_config until the link
actually appears. It ought to restart the stage only when the link
appears, not upon further changes to it (which would trip an assertion
when starting the DHCP client while one already exists).

https://bugzilla.redhat.com/show_bug.cgi?id=1540063
---
src/devices/ovs/nm-device-ovs-interface.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/src/devices/ovs/nm-device-ovs-interface.c b/src/devices/ovs/nm-device-ovs-interface.c
index 426521c52..1342ed948 100644
--- a/src/devices/ovs/nm-device-ovs-interface.c
+++ b/src/devices/ovs/nm-device-ovs-interface.c
@@ -35,8 +35,13 @@ _LOG_DECLARE_SELF(NMDeviceOvsInterface);

/*****************************************************************************/

+typedef struct {
+ gboolean waiting_for_interface;
+} NMDeviceOvsInterfacePrivate;
+
struct _NMDeviceOvsInterface {
NMDevice parent;
+ NMDeviceOvsInterfacePrivate _priv;
};

struct _NMDeviceOvsInterfaceClass {
@@ -45,6 +50,8 @@ struct _NMDeviceOvsInterfaceClass {

G_DEFINE_TYPE (NMDeviceOvsInterface, nm_device_ovs_interface, NM_TYPE_DEVICE)

+#define NM_DEVICE_OVS_INTERFACE_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMDeviceOvsInterface, NM_IS_DEVICE_OVS_INTERFACE)
+
/*****************************************************************************/

static const char *
@@ -109,7 +116,10 @@ static void
link_changed (NMDevice *device,
const NMPlatformLink *pllink)
{
- if (nm_device_get_state (device) == NM_DEVICE_STATE_IP_CONFIG) {
+ NMDeviceOvsInterfacePrivate *priv = NM_DEVICE_OVS_INTERFACE_GET_PRIVATE (device);
+
+ if (priv->waiting_for_interface) {
+ priv->waiting_for_interface = FALSE;
nm_device_bring_up (device, TRUE, NULL);
nm_device_activate_schedule_stage3_ip_config_start (device);
}
@@ -131,11 +141,15 @@ act_stage3_ip4_config_start (NMDevice *device,
NMIP4Config **out_config,
NMDeviceStateReason *out_failure_reason)
{
+ NMDeviceOvsInterfacePrivate *priv = NM_DEVICE_OVS_INTERFACE_GET_PRIVATE (device);
+
if (!_is_internal_interface (device))
return NM_ACT_STAGE_RETURN_IP_FAIL;

- if (!nm_device_get_ip_ifindex (device))
+ if (!nm_device_get_ip_ifindex (device)) {
+ priv->waiting_for_interface = TRUE;
return NM_ACT_STAGE_RETURN_POSTPONE;
+ }

return NM_DEVICE_CLASS (nm_device_ovs_interface_parent_class)->act_stage3_ip4_config_start (device, out_config, out_failure_reason);
}
@@ -145,11 +159,15 @@ act_stage3_ip6_config_start (NMDevice *device,
NMIP6Config **out_config,
NMDeviceStateReason *out_failure_reason)
{
+ NMDeviceOvsInterfacePrivate *priv = NM_DEVICE_OVS_INTERFACE_GET_PRIVATE (device);
+
if (!_is_internal_interface (device))
return NM_ACT_STAGE_RETURN_IP_FAIL;

- if (!nm_device_get_ip_ifindex (device))
+ if (!nm_device_get_ip_ifindex (device)) {
+ priv->waiting_for_interface = TRUE;
return NM_ACT_STAGE_RETURN_POSTPONE;
+ }

return NM_DEVICE_CLASS (nm_device_ovs_interface_parent_class)->act_stage3_ip6_config_start (device, out_config, out_failure_reason);
}
--
2.14.3

30
SOURCES/0017-ensure-alignment-of-team-properties-rh1533830.patch

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
From fa3efd3ed6d91447d24e6f3f3d6c58180a0c36f0 Mon Sep 17 00:00:00 2001
From: Francesco Giudici <fgiudici@redhat.com>
Date: Fri, 19 Jan 2018 11:52:57 +0100
Subject: [PATCH] libnm-core: ensure alignment of team.config and other team
properties

https://bugzilla.redhat.com/show_bug.cgi?id=1533830
(cherry picked from commit 381c1a19b6d1903ec3d791df8d8a933fd9c306f3)
---
libnm-core/nm-setting-team.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libnm-core/nm-setting-team.c b/libnm-core/nm-setting-team.c
index 01b22d9bd..60bdf5f6b 100644
--- a/libnm-core/nm-setting-team.c
+++ b/libnm-core/nm-setting-team.c
@@ -1485,8 +1485,10 @@ set_property (GObject *object, guint prop_id,
break;
}

- if (align_config)
+ if (align_config) {
_nm_utils_json_append_gvalue (&priv->config, _prop_to_keys[prop_id], align_value);
+ _align_team_properties (setting);
+ }
}

static void
--
2.14.3

64
SOURCES/0018-team-link-watchers-fixes-rh1533926.patch

@ -0,0 +1,64 @@ @@ -0,0 +1,64 @@
From 97d153d9e34916b386bc6ef5d824859328acb569 Mon Sep 17 00:00:00 2001
From: Francesco Giudici <fgiudici@redhat.com>
Date: Fri, 19 Jan 2018 19:27:44 +0100
Subject: [PATCH 1/2] nmcli: clear link-watchers before adding the new ones we
want to set

(cherry picked from commit ff16252a71306716677885d8de1ece140407f551)
---
clients/common/nm-meta-setting-desc.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
index d4f162fb4..53d8350d7 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -4038,6 +4038,7 @@ _set_fcn_team_link_watchers (ARGS_SET_FCN)
const char *const*iter;
NMTeamLinkWatcher *watcher;

+ nm_setting_team_clear_link_watchers (NM_SETTING_TEAM (setting));
strv = nmc_strsplit_set (value, ",", 0);
for (iter = (const char *const*) strv; *iter; iter++) {
watcher = _parse_team_link_watcher (*iter, error);
@@ -4110,6 +4111,7 @@ _set_fcn_team_port_link_watchers (ARGS_SET_FCN)
const char *const*iter;
NMTeamLinkWatcher *watcher;

+ nm_setting_team_port_clear_link_watchers (NM_SETTING_TEAM_PORT (setting));
strv = nmc_strsplit_set (value, ",", 0);
for (iter = (const char *const*) strv; *iter; iter++) {
watcher = _parse_team_link_watcher (*iter, error);
--
2.14.3


From 4f76b01f10397dd84c5a6a75ea53cf89592e341d Mon Sep 17 00:00:00 2001
From: Francesco Giudici <fgiudici@redhat.com>
Date: Fri, 19 Jan 2018 19:53:10 +0100
Subject: [PATCH 2/2] doc: fix describe message for team link watchers

(cherry picked from commit d7f3c79881f0c4db5e14f7cce01b90ef63cacb4f)
---
clients/common/nm-meta-setting-desc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
index 53d8350d7..46b06fd40 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -4959,10 +4959,10 @@ static const NMMetaPropertyType _pt_gobject_devices = {
"Properties available for the 'nsna_ping' link watcher:\n" \
" 'init-wait', 'interval', 'missed-max', 'target-host'*\n\n" \
"Properties available for the 'arp_ping' include all the ones for 'nsna_ping' and:\n" \
- " 'source-host', 'validate-active', 'validate-inactive', 'send-always'.\n\n" \
+ " 'source-host'*, 'validate-active', 'validate-inactive', 'send-always'.\n\n" \
"Properties flagged with a '*' are mandatory.\n\n" \
"Example:\n" \
- " name=arp_ping,source-host=172.16.1.1,target-host=172.16.1.254; name=ethtool,delay-up=3\n")
+ " name=arp_ping source-host=172.16.1.1 target-host=172.16.1.254, name=ethtool delay-up=3\n")


#define DEFINE_DCB_PROPRITY_PROPERTY_TYPE \
--
2.14.3

56
SOURCES/0019-update-team-runner-desc-rh1533799.patch

@ -0,0 +1,56 @@ @@ -0,0 +1,56 @@
From c6e1b3abc03d686441869c184206780e43a1c13b Mon Sep 17 00:00:00 2001
From: Francesco Giudici <fgiudici@redhat.com>
Date: Fri, 12 Jan 2018 14:05:24 +0100
Subject: [PATCH 1/2] libnm-core: update team.runner description

https://bugzilla.redhat.com/show_bug.cgi?id=1533799
(cherry picked from commit 112f8bd5aff2c5d543699d968f56c7f98be07eec)
---
libnm-core/nm-setting-team.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/libnm-core/nm-setting-team.c b/libnm-core/nm-setting-team.c
index 88008e422..01b22d9bd 100644
--- a/libnm-core/nm-setting-team.c
+++ b/libnm-core/nm-setting-team.c
@@ -1656,6 +1656,10 @@ nm_setting_team_class_init (NMSettingTeamClass *setting_class)
* Corresponds to the teamd runner.name.
* Permitted values are: "roundrobin", "broadcast", "activebackup",
* "loadbalance", "lacp".
+ * When setting the runner, all the properties specific to the runner
+ * will be reset to the default value; all the properties specific to
+ * other runners will be set to an empty value (or if not possible to
+ * a default value).
*
* Since: 1.10.2
**/
--
2.14.3


From bcababf6126650e9d9bea7d2c48582f435c287c2 Mon Sep 17 00:00:00 2001
From: Francesco Giudici <fgiudici@redhat.com>
Date: Fri, 12 Jan 2018 15:20:23 +0100
Subject: [PATCH 2/2] libnm-core: docs update requires also settings-docs.c.in
update

Fixes: c6e1b3abc03d686441869c184206780e43a1c13b
---
clients/common/settings-docs.c.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clients/common/settings-docs.c.in b/clients/common/settings-docs.c.in
index bf544ab6e..bf5753c57 100644
--- a/clients/common/settings-docs.c.in
+++ b/clients/common/settings-docs.c.in
@@ -325,7 +325,7 @@
#define DESCRIBE_DOC_NM_SETTING_TEAM_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_TEAM_NOTIFY_PEERS_COUNT N_("Corresponds to the teamd notify_peers.count.")
#define DESCRIBE_DOC_NM_SETTING_TEAM_NOTIFY_PEERS_INTERVAL N_("Corresponds to the teamd notify_peers.interval.")
-#define DESCRIBE_DOC_NM_SETTING_TEAM_RUNNER N_("Corresponds to the teamd runner.name. Permitted values are: \"roundrobin\", \"broadcast\", \"activebackup\", \"loadbalance\", \"lacp\".")
+#define DESCRIBE_DOC_NM_SETTING_TEAM_RUNNER N_("Corresponds to the teamd runner.name. Permitted values are: \"roundrobin\", \"broadcast\", \"activebackup\", \"loadbalance\", \"lacp\". When setting the runner, all the properties specific to the runner will be reset to the default value; all the properties specific to other runners will be set to an empty value (or if not possible to a default value).")
#define DESCRIBE_DOC_NM_SETTING_TEAM_RUNNER_ACTIVE N_("Corresponds to the teamd runner.active.")
#define DESCRIBE_DOC_NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY N_("Corresponds to the teamd runner.agg_select_policy.")
#define DESCRIBE_DOC_NM_SETTING_TEAM_RUNNER_FAST_RATE N_("Corresponds to the teamd runner.fast_rate.")
--
2.14.3

99
SOURCES/0020-team-fix-runner-sys_prio-default-rh1533810.patch

@ -0,0 +1,99 @@ @@ -0,0 +1,99 @@
From f219090fdd1bc0ed068f95ee03ce12823d6968d3 Mon Sep 17 00:00:00 2001
From: Francesco Giudici <fgiudici@redhat.com>
Date: Fri, 12 Jan 2018 18:33:59 +0100
Subject: [PATCH 1/2] cli: get team defaults from setting header files

this allows centralizing default values definition and allows quicker
and safer update of default values.

(cherry picked from commit c6448f724b1debb39973f4bfbf9ce4f79218b936)
---
clients/common/nm-meta-setting-desc.c | 8 ++++----
libnm-core/nm-utils.c | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
index 9d0ac9061..d4f162fb4 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -6625,7 +6625,7 @@ static const NMMetaPropertyInfo *const property_infos_TEAM[] = {
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
- .value = 50,
+ .value = NM_SETTING_TEAM_RUNNER_TX_BALANCER_INTERVAL_DEFAULT,
.nick = "default",
}
),
@@ -6642,7 +6642,7 @@ static const NMMetaPropertyInfo *const property_infos_TEAM[] = {
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
- .value = 255,
+ .value = NM_SETTING_TEAM_RUNNER_SYS_PRIO_DEFAULT,
.nick = "default",
}
),
@@ -6698,7 +6698,7 @@ static const NMMetaPropertyInfo *const property_infos_TEAM_PORT[] = {
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
- .value = -1,
+ .value = NM_SETTING_TEAM_PORT_QUEUE_ID_DEFAULT,
.nick = "default",
}
),
@@ -6723,7 +6723,7 @@ static const NMMetaPropertyInfo *const property_infos_TEAM_PORT[] = {
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
- .value = 255,
+ .value = NM_SETTING_TEAM_PORT_LACP_PRIO_DEFAULT,
.nick = "default",
}
),
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
index df58409bf..ce3536c84 100644
--- a/libnm-core/nm-utils.c
+++ b/libnm-core/nm-utils.c
@@ -5151,9 +5151,9 @@ _json_team_normalize_defaults (json_t *json, gboolean reset)
_json_delete_object_on_string_match (json, "runner", "hwaddr_policy", NULL,
NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_DEFAULT);
} else if (nm_streq (runner, NM_SETTING_TEAM_RUNNER_LACP)) {
- runner_tx_balancer_interval = 50;
+ runner_tx_balancer_interval = NM_SETTING_TEAM_RUNNER_TX_BALANCER_INTERVAL_DEFAULT;
runner_active = TRUE;
- runner_sys_prio = 255;
+ runner_sys_prio = NM_SETTING_TEAM_RUNNER_SYS_PRIO_DEFAULT;
runner_min_ports = 0;
_json_delete_object_on_string_match (json, "runner", "agg_select_policy", NULL,
NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_DEFAULT);
--
2.14.3


From c34cd5e09a50b015c59491aa4506b64e30f217bc Mon Sep 17 00:00:00 2001
From: Francesco Giudici <fgiudici@redhat.com>
Date: Fri, 12 Jan 2018 18:32:47 +0100
Subject: [PATCH 2/2] libnm-core: team: fix runner sys_prio default value

(cherry picked from commit 2c99eba42fdd69c7e5719f19d24aa944dfaaf666)
---
libnm-core/nm-setting-team.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libnm-core/nm-setting-team.h b/libnm-core/nm-setting-team.h
index 452078363..d423901f6 100644
--- a/libnm-core/nm-setting-team.h
+++ b/libnm-core/nm-setting-team.h
@@ -150,7 +150,7 @@ NMTeamLinkWatcherArpPingFlags nm_team_link_watcher_get_flags (NMTeamLinkWatcher
#define NM_SETTING_TEAM_RUNNER_DEFAULT NM_SETTING_TEAM_RUNNER_ROUNDROBIN
#define NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_DEFAULT NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_SAME_ALL
#define NM_SETTING_TEAM_RUNNER_TX_BALANCER_INTERVAL_DEFAULT 50
-#define NM_SETTING_TEAM_RUNNER_SYS_PRIO_DEFAULT 255
+#define NM_SETTING_TEAM_RUNNER_SYS_PRIO_DEFAULT 65535
#define NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_DEFAULT NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_LACP_PRIO


--
2.14.3

985
SOURCES/0021-avoid-symbol-clash-with-json-glib-rh1535905.patch

@ -0,0 +1,985 @@ @@ -0,0 +1,985 @@
From 66ae13f012a7416db839c6d6158b9c85cd9a27c5 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Tue, 26 Dec 2017 09:28:54 +0100
Subject: [PATCH 1/6] core: load jansson on demand

Avoid using it if the symbols clash is detected.

(cherry picked from commit cd476e4dc922f0acfd65b02639032ee67339ad95)
---
Makefile.am | 12 +++--
configure.ac | 12 ++++-
libnm-core/nm-jansson.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++++
libnm-core/nm-jansson.h | 46 +++++++++++++++++++
libnm-core/nm-utils.c | 78 +++++++++++++++++++------------
5 files changed, 232 insertions(+), 35 deletions(-)
create mode 100644 libnm-core/nm-jansson.c
create mode 100644 libnm-core/nm-jansson.h

diff --git a/Makefile.am b/Makefile.am
index a189262c1..69d61c4fe 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -518,6 +518,14 @@ libnm_core_lib_c_real = \
libnm-core/nm-utils.c \
libnm-core/nm-vpn-editor-plugin.c \
libnm-core/nm-vpn-plugin-info.c
+
+if WITH_JANSSON
+libnm_core_lib_h_priv += \
+ libnm-core/nm-jansson.h
+libnm_core_lib_c_real += \
+ libnm-core/nm-jansson.c
+endif
+
libnm_core_lib_c_mkenums = \
libnm-core/nm-core-enum-types.c

@@ -598,10 +606,6 @@ libnm_core_libnm_core_la_LIBADD = \
$(UUID_LIBS) \
$(LIBUDEV_LIBS)

-if WITH_JANSSON
-libnm_core_libnm_core_la_LIBADD += $(JANSSON_LIBS)
-endif
-
libnm_core_libnm_core_la_LDFLAGS = \
$(CODE_COVERAGE_LDFLAGS)

diff --git a/configure.ac b/configure.ac
index 05ba94971..5b5090318 100644
--- a/configure.ac
+++ b/configure.ac
@@ -664,7 +664,17 @@ else
if test "$have_jansson" = "no"; then
AC_MSG_ERROR([jansson is needed for team configuration validation. Use --disable-json-validation to build without it.])
fi
- AC_DEFINE(WITH_JANSSON, 1, [Define if JANSSON is enabled])
+
+ AC_DEFINE(WITH_JANSSON, 1, [Define if JANSSON is enabled])
+
+ AC_CHECK_TOOLS(READELF, [eu-readelf readelf])
+ JANSSON_LIBDIR=`$PKG_CONFIG --variable=libdir jansson`
+ JANSSON_SONAME=`$READELF -d $JANSSON_LIBDIR/libjansson.so |sed -n 's/.*SONAME.*\[[\([^]]*\)]]/\1/p'`
+
+ if test "$JANSSON_SONAME" = ""; then
+ AC_MSG_ERROR(Unable to locate the Jansson library)
+ fi
+ AC_DEFINE_UNQUOTED(JANSSON_SONAME, "$JANSSON_SONAME", [Define to path to the Jansson shared library])
fi
AM_CONDITIONAL(WITH_JANSSON, test "${enable_json_validation}" != "no")

diff --git a/libnm-core/nm-jansson.c b/libnm-core/nm-jansson.c
new file mode 100644
index 000000000..0f7bd3213
--- /dev/null
+++ b/libnm-core/nm-jansson.c
@@ -0,0 +1,119 @@
+/*
+ * 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 of the License, 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 2017, 2018 Red Hat, Inc.
+ */
+
+#define _GNU_SOURCE
+#include <link.h>
+
+#include "nm-default.h"
+
+#define NM_JAONSSON_C
+#include "nm-jansson.h"
+
+void *_nm_jansson_json_object_iter_value;
+void *_nm_jansson_json_object_key_to_iter;
+void *_nm_jansson_json_integer;
+void *_nm_jansson_json_object_del;
+void *_nm_jansson_json_array_get;
+void *_nm_jansson_json_array_size;
+void *_nm_jansson_json_array_append_new;
+void *_nm_jansson_json_string;
+void *_nm_jansson_json_object_iter_next;
+void *_nm_jansson_json_loads;
+void *_nm_jansson_json_dumps;
+void *_nm_jansson_json_object_iter_key;
+void *_nm_jansson_json_object;
+void *_nm_jansson_json_object_get;
+void *_nm_jansson_json_array;
+void *_nm_jansson_json_false;
+void *_nm_jansson_json_delete;
+void *_nm_jansson_json_true;
+void *_nm_jansson_json_object_size;
+void *_nm_jansson_json_object_set_new;
+void *_nm_jansson_json_object_iter;
+void *_nm_jansson_json_object_iter_at;
+void *_nm_jansson_json_integer_value;
+void *_nm_jansson_json_string_value;
+
+#define TRY_BIND_SYMBOL(symbol) \
+ G_STMT_START { \
+ void *sym = dlsym (handle, #symbol); \
+ if (_nm_jansson_ ## symbol && sym != _nm_jansson_ ## symbol) \
+ return FALSE; \
+ _nm_jansson_ ## symbol = sym; \
+ } G_STMT_END
+
+static gboolean
+bind_symbols (void *handle)
+{
+ TRY_BIND_SYMBOL (json_object_iter_value);
+ TRY_BIND_SYMBOL (json_object_key_to_iter);
+ TRY_BIND_SYMBOL (json_integer);
+ TRY_BIND_SYMBOL (json_object_del);
+ TRY_BIND_SYMBOL (json_array_get);
+ TRY_BIND_SYMBOL (json_array_size);
+ TRY_BIND_SYMBOL (json_array_append_new);
+ TRY_BIND_SYMBOL (json_string);
+ TRY_BIND_SYMBOL (json_object_iter_next);
+ TRY_BIND_SYMBOL (json_loads);
+ TRY_BIND_SYMBOL (json_dumps);
+ TRY_BIND_SYMBOL (json_object_iter_key);
+ TRY_BIND_SYMBOL (json_object);
+ TRY_BIND_SYMBOL (json_object_get);
+ TRY_BIND_SYMBOL (json_array);
+ TRY_BIND_SYMBOL (json_false);
+ TRY_BIND_SYMBOL (json_delete);
+ TRY_BIND_SYMBOL (json_true);
+ TRY_BIND_SYMBOL (json_object_size);
+ TRY_BIND_SYMBOL (json_object_set_new);
+ TRY_BIND_SYMBOL (json_object_iter);
+ TRY_BIND_SYMBOL (json_object_iter_at);
+ TRY_BIND_SYMBOL (json_integer_value);
+ TRY_BIND_SYMBOL (json_string_value);
+
+ return TRUE;
+}
+
+gboolean
+nm_jansson_load (void)
+{
+ static enum {
+ UNKNOWN,
+ AVAILABLE,
+ MISSING,
+ } state = UNKNOWN;
+ void *handle;
+
+ if (G_LIKELY (state != UNKNOWN))
+ goto out;
+
+ /* First just resolve the symbols to see if there's a conflict already. */
+ if (!bind_symbols (RTLD_DEFAULT))
+ goto out;
+
+ handle = dlopen (JANSSON_SONAME, RTLD_LAZY | RTLD_LOCAL | RTLD_NODELETE | RTLD_DEEPBIND);
+ if (!handle)
+ goto out;
+
+ /* Now do the actual binding. */
+ if (!bind_symbols (handle))
+ goto out;
+
+ state = AVAILABLE;
+out:
+ return state == AVAILABLE;
+}
diff --git a/libnm-core/nm-jansson.h b/libnm-core/nm-jansson.h
new file mode 100644
index 000000000..043986878
--- /dev/null
+++ b/libnm-core/nm-jansson.h
@@ -0,0 +1,46 @@
+/*
+ * 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 of the License, 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 2017, 2018 Red Hat, Inc.
+ */
+
+gboolean nm_jansson_load (void);
+
+#ifndef NM_JAONSSON_C
+#define json_object_iter_value (*_nm_jansson_json_object_iter_value)
+#define json_object_key_to_iter (*_nm_jansson_json_object_key_to_iter)
+#define json_integer (*_nm_jansson_json_integer)
+#define json_object_del (*_nm_jansson_json_object_del)
+#define json_array_get (*_nm_jansson_json_array_get)
+#define json_array_size (*_nm_jansson_json_array_size)
+#define json_array_append_new (*_nm_jansson_json_array_append_new)
+#define json_string (*_nm_jansson_json_string)
+#define json_object_iter_next (*_nm_jansson_json_object_iter_next)
+#define json_loads (*_nm_jansson_json_loads)
+#define json_dumps (*_nm_jansson_json_dumps)
+#define json_object_iter_key (*_nm_jansson_json_object_iter_key)
+#define json_object (*_nm_jansson_json_object)
+#define json_object_get (*_nm_jansson_json_object_get)
+#define json_array (*_nm_jansson_json_array)
+#define json_false (*_nm_jansson_json_false)
+#define json_delete (*_nm_jansson_json_delete)
+#define json_true (*_nm_jansson_json_true)
+#define json_object_size (*_nm_jansson_json_object_size)
+#define json_object_set_new (*_nm_jansson_json_object_set_new)
+#define json_object_iter (*_nm_jansson_json_object_iter)
+#define json_object_iter_at (*_nm_jansson_json_object_iter_at)
+#define json_integer_value (*_nm_jansson_json_integer_value)
+#define json_string_value (*_nm_jansson_json_string_value)
+#endif
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
index ce3536c84..8d7bf08f9 100644
--- a/libnm-core/nm-utils.c
+++ b/libnm-core/nm-utils.c
@@ -36,6 +36,7 @@
#include <linux/pkt_sched.h>

#if WITH_JANSSON
+#include "nm-jansson.h"
#include <jansson.h>
#endif

@@ -4891,6 +4892,41 @@ const char **nm_utils_enum_get_values (GType type, gint from, gint to)

/*****************************************************************************/

+static gboolean
+_nm_utils_is_json_object_no_validation (const char *str, GError **error)
+{
+ if (str) {
+ /* libjansson also requires only utf-8 encoding. */
+ if (!g_utf8_validate (str, -1, NULL)) {
+ g_set_error_literal (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("not valid utf-8"));
+ return FALSE;
+ }
+ while (g_ascii_isspace (str[0]))
+ str++;
+ }
+
+ /* do some very basic validation to see if this might be a JSON object. */
+ if (str[0] == '{') {
+ gsize l;
+
+ l = strlen (str) - 1;
+ while (l > 0 && g_ascii_isspace (str[l]))
+ l--;
+
+ if (str[l] == '}')
+ return TRUE;
+ }
+
+ g_set_error_literal (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("is not a JSON object"));
+ return FALSE;
+}
+
#if WITH_JANSSON

/* Added in Jansson v2.3 (released Jan 27 2012) */
@@ -5363,6 +5399,9 @@ nm_utils_is_json_object (const char *str, GError **error)
return FALSE;
}

+ if (!nm_jansson_load ())
+ return _nm_utils_is_json_object_no_validation (str, error);
+
json = json_loads (str, JSON_REJECT_DUPLICATES, &jerror);
if (!json) {
g_set_error (error,
@@ -5413,6 +5452,8 @@ _nm_utils_team_config_equal (const char *conf1,

if (nm_streq0 (conf1, conf2))
return TRUE;
+ else if (!nm_jansson_load ())
+ return FALSE;

/* A NULL configuration is equivalent to default value '{}' */
json1 = json_loads (conf1 ?: "{}", JSON_REJECT_DUPLICATES, &jerror);
@@ -5470,6 +5511,9 @@ _nm_utils_team_config_get (const char *conf,
if (!key)
return NULL;

+ if (!nm_jansson_load ())
+ return NULL;
+
json = json_loads (conf ?: "{}", JSON_REJECT_DUPLICATES, &jerror);

/* Invalid json in conf */
@@ -5577,6 +5621,9 @@ _nm_utils_team_config_set (char **conf,

g_return_val_if_fail (key, FALSE);

+ if (!nm_jansson_load ())
+ return FALSE;
+
json = json_loads (*conf?: "{}", JSON_REJECT_DUPLICATES, &jerror);
if (!json)
return FALSE;
@@ -5694,19 +5741,6 @@ nm_utils_is_json_object (const char *str, GError **error)
{
g_return_val_if_fail (!error || !*error, FALSE);

- if (str) {
- /* libjansson also requires only utf-8 encoding. */
- if (!g_utf8_validate (str, -1, NULL)) {
- g_set_error_literal (error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("not valid utf-8"));
- return FALSE;
- }
- while (g_ascii_isspace (str[0]))
- str++;
- }
-
if (!str || !str[0]) {
g_set_error_literal (error,
NM_CONNECTION_ERROR,
@@ -5715,23 +5749,7 @@ nm_utils_is_json_object (const char *str, GError **error)
return FALSE;
}

- /* do some very basic validation to see if this might be a JSON object. */
- if (str[0] == '{') {
- gsize l;
-
- l = strlen (str) - 1;
- while (l > 0 && g_ascii_isspace (str[l]))
- l--;
-
- if (str[l] == '}')
- return TRUE;
- }
-
- g_set_error_literal (error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("is not a JSON object"));
- return FALSE;
+ return _nm_utils_is_json_object_no_validation (str, error);
}

gboolean
--
2.14.3


From 75dfbfcef40c44b2a04779351d0974b5e36818c2 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 9 Jan 2018 07:10:24 +0100
Subject: [PATCH 2/6] libnm/trivial: don't use non-leading tabs

(cherry picked from commit 950a14128bc249626af0770f0003cf83d491bd54)
---
libnm-core/nm-jansson.h | 48 ++++++++++++++++++++++++------------------------
1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/libnm-core/nm-jansson.h b/libnm-core/nm-jansson.h
index 043986878..e3718d93c 100644
--- a/libnm-core/nm-jansson.h
+++ b/libnm-core/nm-jansson.h
@@ -19,28 +19,28 @@
gboolean nm_jansson_load (void);

#ifndef NM_JAONSSON_C
-#define json_object_iter_value (*_nm_jansson_json_object_iter_value)
-#define json_object_key_to_iter (*_nm_jansson_json_object_key_to_iter)
-#define json_integer (*_nm_jansson_json_integer)
-#define json_object_del (*_nm_jansson_json_object_del)
-#define json_array_get (*_nm_jansson_json_array_get)
-#define json_array_size (*_nm_jansson_json_array_size)
-#define json_array_append_new (*_nm_jansson_json_array_append_new)
-#define json_string (*_nm_jansson_json_string)
-#define json_object_iter_next (*_nm_jansson_json_object_iter_next)
-#define json_loads (*_nm_jansson_json_loads)
-#define json_dumps (*_nm_jansson_json_dumps)
-#define json_object_iter_key (*_nm_jansson_json_object_iter_key)
-#define json_object (*_nm_jansson_json_object)
-#define json_object_get (*_nm_jansson_json_object_get)
-#define json_array (*_nm_jansson_json_array)
-#define json_false (*_nm_jansson_json_false)
-#define json_delete (*_nm_jansson_json_delete)
-#define json_true (*_nm_jansson_json_true)
-#define json_object_size (*_nm_jansson_json_object_size)
-#define json_object_set_new (*_nm_jansson_json_object_set_new)
-#define json_object_iter (*_nm_jansson_json_object_iter)
-#define json_object_iter_at (*_nm_jansson_json_object_iter_at)
-#define json_integer_value (*_nm_jansson_json_integer_value)
-#define json_string_value (*_nm_jansson_json_string_value)
+#define json_object_iter_value (*_nm_jansson_json_object_iter_value)
+#define json_object_key_to_iter (*_nm_jansson_json_object_key_to_iter)
+#define json_integer (*_nm_jansson_json_integer)
+#define json_object_del (*_nm_jansson_json_object_del)
+#define json_array_get (*_nm_jansson_json_array_get)
+#define json_array_size (*_nm_jansson_json_array_size)
+#define json_array_append_new (*_nm_jansson_json_array_append_new)
+#define json_string (*_nm_jansson_json_string)
+#define json_object_iter_next (*_nm_jansson_json_object_iter_next)
+#define json_loads (*_nm_jansson_json_loads)
+#define json_dumps (*_nm_jansson_json_dumps)
+#define json_object_iter_key (*_nm_jansson_json_object_iter_key)
+#define json_object (*_nm_jansson_json_object)
+#define json_object_get (*_nm_jansson_json_object_get)
+#define json_array (*_nm_jansson_json_array)
+#define json_false (*_nm_jansson_json_false)
+#define json_delete (*_nm_jansson_json_delete)
+#define json_true (*_nm_jansson_json_true)
+#define json_object_size (*_nm_jansson_json_object_size)
+#define json_object_set_new (*_nm_jansson_json_object_set_new)
+#define json_object_iter (*_nm_jansson_json_object_iter)
+#define json_object_iter_at (*_nm_jansson_json_object_iter_at)
+#define json_integer_value (*_nm_jansson_json_integer_value)
+#define json_string_value (*_nm_jansson_json_string_value)
#endif
--
2.14.3


From bbcb9ebefcffab302d192dcd60c084c2698dff24 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 9 Jan 2018 06:20:18 +0100
Subject: [PATCH 3/6] libnm: rename "libnm-core/nm-jansson.h" to
"libnm-core/nm-json.h"

We already have "shared/nm-utils/nm-jansson.h". Avoid reusing the same file name.

(cherry picked from commit b6b6baa7735e09a95fa9504e9a9746cdc4e970e6)
---
Makefile.am | 4 +-
libnm-core/nm-jansson.c | 119 ------------------------------------------------
libnm-core/nm-jansson.h | 46 -------------------
libnm-core/nm-json.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++++
libnm-core/nm-json.h | 46 +++++++++++++++++++
libnm-core/nm-utils.c | 2 +-
6 files changed, 168 insertions(+), 168 deletions(-)
delete mode 100644 libnm-core/nm-jansson.c
delete mode 100644 libnm-core/nm-jansson.h
create mode 100644 libnm-core/nm-json.c
create mode 100644 libnm-core/nm-json.h

diff --git a/Makefile.am b/Makefile.am
index 69d61c4fe..639921d50 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -521,9 +521,9 @@ libnm_core_lib_c_real = \

if WITH_JANSSON
libnm_core_lib_h_priv += \
- libnm-core/nm-jansson.h
+ libnm-core/nm-json.h
libnm_core_lib_c_real += \
- libnm-core/nm-jansson.c
+ libnm-core/nm-json.c
endif

libnm_core_lib_c_mkenums = \
diff --git a/libnm-core/nm-jansson.c b/libnm-core/nm-jansson.c
deleted file mode 100644
index 0f7bd3213..000000000
--- a/libnm-core/nm-jansson.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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 of the License, 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 2017, 2018 Red Hat, Inc.
- */
-
-#define _GNU_SOURCE
-#include <link.h>
-
-#include "nm-default.h"
-
-#define NM_JAONSSON_C
-#include "nm-jansson.h"
-
-void *_nm_jansson_json_object_iter_value;
-void *_nm_jansson_json_object_key_to_iter;
-void *_nm_jansson_json_integer;
-void *_nm_jansson_json_object_del;
-void *_nm_jansson_json_array_get;
-void *_nm_jansson_json_array_size;
-void *_nm_jansson_json_array_append_new;
-void *_nm_jansson_json_string;
-void *_nm_jansson_json_object_iter_next;
-void *_nm_jansson_json_loads;
-void *_nm_jansson_json_dumps;
-void *_nm_jansson_json_object_iter_key;
-void *_nm_jansson_json_object;
-void *_nm_jansson_json_object_get;
-void *_nm_jansson_json_array;
-void *_nm_jansson_json_false;
-void *_nm_jansson_json_delete;
-void *_nm_jansson_json_true;
-void *_nm_jansson_json_object_size;
-void *_nm_jansson_json_object_set_new;
-void *_nm_jansson_json_object_iter;
-void *_nm_jansson_json_object_iter_at;
-void *_nm_jansson_json_integer_value;
-void *_nm_jansson_json_string_value;
-
-#define TRY_BIND_SYMBOL(symbol) \
- G_STMT_START { \
- void *sym = dlsym (handle, #symbol); \
- if (_nm_jansson_ ## symbol && sym != _nm_jansson_ ## symbol) \
- return FALSE; \
- _nm_jansson_ ## symbol = sym; \
- } G_STMT_END
-
-static gboolean
-bind_symbols (void *handle)
-{
- TRY_BIND_SYMBOL (json_object_iter_value);
- TRY_BIND_SYMBOL (json_object_key_to_iter);
- TRY_BIND_SYMBOL (json_integer);
- TRY_BIND_SYMBOL (json_object_del);
- TRY_BIND_SYMBOL (json_array_get);
- TRY_BIND_SYMBOL (json_array_size);
- TRY_BIND_SYMBOL (json_array_append_new);
- TRY_BIND_SYMBOL (json_string);
- TRY_BIND_SYMBOL (json_object_iter_next);
- TRY_BIND_SYMBOL (json_loads);
- TRY_BIND_SYMBOL (json_dumps);
- TRY_BIND_SYMBOL (json_object_iter_key);
- TRY_BIND_SYMBOL (json_object);
- TRY_BIND_SYMBOL (json_object_get);
- TRY_BIND_SYMBOL (json_array);
- TRY_BIND_SYMBOL (json_false);
- TRY_BIND_SYMBOL (json_delete);
- TRY_BIND_SYMBOL (json_true);
- TRY_BIND_SYMBOL (json_object_size);
- TRY_BIND_SYMBOL (json_object_set_new);
- TRY_BIND_SYMBOL (json_object_iter);
- TRY_BIND_SYMBOL (json_object_iter_at);
- TRY_BIND_SYMBOL (json_integer_value);
- TRY_BIND_SYMBOL (json_string_value);
-
- return TRUE;
-}
-
-gboolean
-nm_jansson_load (void)
-{
- static enum {
- UNKNOWN,
- AVAILABLE,
- MISSING,
- } state = UNKNOWN;
- void *handle;
-
- if (G_LIKELY (state != UNKNOWN))
- goto out;
-
- /* First just resolve the symbols to see if there's a conflict already. */
- if (!bind_symbols (RTLD_DEFAULT))
- goto out;
-
- handle = dlopen (JANSSON_SONAME, RTLD_LAZY | RTLD_LOCAL | RTLD_NODELETE | RTLD_DEEPBIND);
- if (!handle)
- goto out;
-
- /* Now do the actual binding. */
- if (!bind_symbols (handle))
- goto out;
-
- state = AVAILABLE;
-out:
- return state == AVAILABLE;
-}
diff --git a/libnm-core/nm-jansson.h b/libnm-core/nm-jansson.h
deleted file mode 100644
index e3718d93c..000000000
--- a/libnm-core/nm-jansson.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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 of the License, 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 2017, 2018 Red Hat, Inc.
- */
-
-gboolean nm_jansson_load (void);
-
-#ifndef NM_JAONSSON_C
-#define json_object_iter_value (*_nm_jansson_json_object_iter_value)
-#define json_object_key_to_iter (*_nm_jansson_json_object_key_to_iter)
-#define json_integer (*_nm_jansson_json_integer)
-#define json_object_del (*_nm_jansson_json_object_del)
-#define json_array_get (*_nm_jansson_json_array_get)
-#define json_array_size (*_nm_jansson_json_array_size)
-#define json_array_append_new (*_nm_jansson_json_array_append_new)
-#define json_string (*_nm_jansson_json_string)
-#define json_object_iter_next (*_nm_jansson_json_object_iter_next)
-#define json_loads (*_nm_jansson_json_loads)
-#define json_dumps (*_nm_jansson_json_dumps)
-#define json_object_iter_key (*_nm_jansson_json_object_iter_key)
-#define json_object (*_nm_jansson_json_object)
-#define json_object_get (*_nm_jansson_json_object_get)
-#define json_array (*_nm_jansson_json_array)
-#define json_false (*_nm_jansson_json_false)
-#define json_delete (*_nm_jansson_json_delete)
-#define json_true (*_nm_jansson_json_true)
-#define json_object_size (*_nm_jansson_json_object_size)
-#define json_object_set_new (*_nm_jansson_json_object_set_new)
-#define json_object_iter (*_nm_jansson_json_object_iter)
-#define json_object_iter_at (*_nm_jansson_json_object_iter_at)
-#define json_integer_value (*_nm_jansson_json_integer_value)
-#define json_string_value (*_nm_jansson_json_string_value)
-#endif
diff --git a/libnm-core/nm-json.c b/libnm-core/nm-json.c
new file mode 100644
index 000000000..1f7d4398a
--- /dev/null
+++ b/libnm-core/nm-json.c
@@ -0,0 +1,119 @@
+/*
+ * 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 of the License, 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 2017, 2018 Red Hat, Inc.
+ */
+
+#define _GNU_SOURCE
+#include <link.h>
+
+#include "nm-default.h"
+
+#define NM_JAONSSON_C
+#include "nm-json.h"
+
+void *_nm_jansson_json_object_iter_value;
+void *_nm_jansson_json_object_key_to_iter;
+void *_nm_jansson_json_integer;
+void *_nm_jansson_json_object_del;
+void *_nm_jansson_json_array_get;
+void *_nm_jansson_json_array_size;
+void *_nm_jansson_json_array_append_new;
+void *_nm_jansson_json_string;
+void *_nm_jansson_json_object_iter_next;
+void *_nm_jansson_json_loads;
+void *_nm_jansson_json_dumps;
+void *_nm_jansson_json_object_iter_key;
+void *_nm_jansson_json_object;
+void *_nm_jansson_json_object_get;
+void *_nm_jansson_json_array;
+void *_nm_jansson_json_false;
+void *_nm_jansson_json_delete;
+void *_nm_jansson_json_true;
+void *_nm_jansson_json_object_size;
+void *_nm_jansson_json_object_set_new;
+void *_nm_jansson_json_object_iter;
+void *_nm_jansson_json_object_iter_at;
+void *_nm_jansson_json_integer_value;
+void *_nm_jansson_json_string_value;
+
+#define TRY_BIND_SYMBOL(symbol) \
+ G_STMT_START { \
+ void *sym = dlsym (handle, #symbol); \
+ if (_nm_jansson_ ## symbol && sym != _nm_jansson_ ## symbol) \
+ return FALSE; \
+ _nm_jansson_ ## symbol = sym; \
+ } G_STMT_END
+
+static gboolean
+bind_symbols (void *handle)
+{
+ TRY_BIND_SYMBOL (json_object_iter_value);
+ TRY_BIND_SYMBOL (json_object_key_to_iter);
+ TRY_BIND_SYMBOL (json_integer);
+ TRY_BIND_SYMBOL (json_object_del);
+ TRY_BIND_SYMBOL (json_array_get);
+ TRY_BIND_SYMBOL (json_array_size);
+ TRY_BIND_SYMBOL (json_array_append_new);
+ TRY_BIND_SYMBOL (json_string);
+ TRY_BIND_SYMBOL (json_object_iter_next);
+ TRY_BIND_SYMBOL (json_loads);
+ TRY_BIND_SYMBOL (json_dumps);
+ TRY_BIND_SYMBOL (json_object_iter_key);
+ TRY_BIND_SYMBOL (json_object);
+ TRY_BIND_SYMBOL (json_object_get);
+ TRY_BIND_SYMBOL (json_array);
+ TRY_BIND_SYMBOL (json_false);
+ TRY_BIND_SYMBOL (json_delete);
+ TRY_BIND_SYMBOL (json_true);
+ TRY_BIND_SYMBOL (json_object_size);
+ TRY_BIND_SYMBOL (json_object_set_new);
+ TRY_BIND_SYMBOL (json_object_iter);
+ TRY_BIND_SYMBOL (json_object_iter_at);
+ TRY_BIND_SYMBOL (json_integer_value);
+ TRY_BIND_SYMBOL (json_string_value);
+
+ return TRUE;
+}
+
+gboolean
+nm_jansson_load (void)
+{
+ static enum {
+ UNKNOWN,
+ AVAILABLE,
+ MISSING,
+ } state = UNKNOWN;
+ void *handle;
+
+ if (G_LIKELY (state != UNKNOWN))
+ goto out;
+
+ /* First just resolve the symbols to see if there's a conflict already. */
+ if (!bind_symbols (RTLD_DEFAULT))
+ goto out;
+
+ handle = dlopen (JANSSON_SONAME, RTLD_LAZY | RTLD_LOCAL | RTLD_NODELETE | RTLD_DEEPBIND);
+ if (!handle)
+ goto out;
+
+ /* Now do the actual binding. */
+ if (!bind_symbols (handle))
+ goto out;
+
+ state = AVAILABLE;
+out:
+ return state == AVAILABLE;
+}
diff --git a/libnm-core/nm-json.h b/libnm-core/nm-json.h
new file mode 100644
index 000000000..e3718d93c
--- /dev/null
+++ b/libnm-core/nm-json.h
@@ -0,0 +1,46 @@
+/*
+ * 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 of the License, 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 2017, 2018 Red Hat, Inc.
+ */
+
+gboolean nm_jansson_load (void);
+
+#ifndef NM_JAONSSON_C
+#define json_object_iter_value (*_nm_jansson_json_object_iter_value)
+#define json_object_key_to_iter (*_nm_jansson_json_object_key_to_iter)
+#define json_integer (*_nm_jansson_json_integer)
+#define json_object_del (*_nm_jansson_json_object_del)
+#define json_array_get (*_nm_jansson_json_array_get)
+#define json_array_size (*_nm_jansson_json_array_size)
+#define json_array_append_new (*_nm_jansson_json_array_append_new)
+#define json_string (*_nm_jansson_json_string)
+#define json_object_iter_next (*_nm_jansson_json_object_iter_next)
+#define json_loads (*_nm_jansson_json_loads)
+#define json_dumps (*_nm_jansson_json_dumps)
+#define json_object_iter_key (*_nm_jansson_json_object_iter_key)
+#define json_object (*_nm_jansson_json_object)
+#define json_object_get (*_nm_jansson_json_object_get)
+#define json_array (*_nm_jansson_json_array)
+#define json_false (*_nm_jansson_json_false)
+#define json_delete (*_nm_jansson_json_delete)
+#define json_true (*_nm_jansson_json_true)
+#define json_object_size (*_nm_jansson_json_object_size)
+#define json_object_set_new (*_nm_jansson_json_object_set_new)
+#define json_object_iter (*_nm_jansson_json_object_iter)
+#define json_object_iter_at (*_nm_jansson_json_object_iter_at)
+#define json_integer_value (*_nm_jansson_json_integer_value)
+#define json_string_value (*_nm_jansson_json_string_value)
+#endif
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
index 8d7bf08f9..ebbbfd3a4 100644
--- a/libnm-core/nm-utils.c
+++ b/libnm-core/nm-utils.c
@@ -36,7 +36,7 @@
#include <linux/pkt_sched.h>

#if WITH_JANSSON
-#include "nm-jansson.h"
+#include "nm-json.h"
#include <jansson.h>
#endif

--
2.14.3


From 0aa9273d334afec1d54878587b4f7fb9e2410f92 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 9 Jan 2018 07:15:40 +0100
Subject: [PATCH 4/6] libnm: fix spelling for NM_JAONSSON_C define

(cherry picked from commit 288877848067c08abfd82d3ee72765f89ec79968)
---
libnm-core/nm-json.c | 2 +-
libnm-core/nm-json.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libnm-core/nm-json.c b/libnm-core/nm-json.c
index 1f7d4398a..d58898ce2 100644
--- a/libnm-core/nm-json.c
+++ b/libnm-core/nm-json.c
@@ -21,7 +21,7 @@

#include "nm-default.h"

-#define NM_JAONSSON_C
+#define NM_JANSSON_C
#include "nm-json.h"

void *_nm_jansson_json_object_iter_value;
diff --git a/libnm-core/nm-json.h b/libnm-core/nm-json.h
index e3718d93c..50b52e4f2 100644
--- a/libnm-core/nm-json.h
+++ b/libnm-core/nm-json.h
@@ -18,7 +18,7 @@

gboolean nm_jansson_load (void);

-#ifndef NM_JAONSSON_C
+#ifndef NM_JANSSON_C
#define json_object_iter_value (*_nm_jansson_json_object_iter_value)
#define json_object_key_to_iter (*_nm_jansson_json_object_key_to_iter)
#define json_integer (*_nm_jansson_json_integer)
--
2.14.3


From 5269978e379c3a03cb5b159beef747329a645446 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 9 Jan 2018 07:17:06 +0100
Subject: [PATCH 5/6] libnm: add include guard to nm-json.h

(cherry picked from commit ee56c9250fc88eb1983bc587dc5052a70cb88e0f)
---
libnm-core/nm-json.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/libnm-core/nm-json.h b/libnm-core/nm-json.h
index 50b52e4f2..513b8d369 100644
--- a/libnm-core/nm-json.h
+++ b/libnm-core/nm-json.h
@@ -15,6 +15,8 @@
*
* Copyright 2017, 2018 Red Hat, Inc.
*/
+#ifndef __NM_JSON_H__
+#define __NM_JSON_H__

gboolean nm_jansson_load (void);

@@ -44,3 +46,5 @@ gboolean nm_jansson_load (void);
#define json_integer_value (*_nm_jansson_json_integer_value)
#define json_string_value (*_nm_jansson_json_string_value)
#endif
+
+#endif /* __NM_JSON_H__ */
--
2.14.3


From ec630dc256b3e9cb80cd3ca9872c5a405ae21646 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 9 Jan 2018 07:30:31 +0100
Subject: [PATCH 6/6] libnm: cleanup include in "libnm-core/nm-json.c"

We already define _GNU_SOURCE in "config.h", depending
on configure checks.

Also, we always should first include "config.h" (which means
to first include "nm-default.h").

Also, we don't need the entire <link.h>, <dlfcn.h> suffices.

(cherry picked from commit 84576ce86155e195985a1924c90782eb9e2e5beb)
---
libnm-core/nm-json.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libnm-core/nm-json.c b/libnm-core/nm-json.c
index d58898ce2..f9042b1f3 100644
--- a/libnm-core/nm-json.c
+++ b/libnm-core/nm-json.c
@@ -16,14 +16,13 @@
* Copyright 2017, 2018 Red Hat, Inc.
*/

-#define _GNU_SOURCE
-#include <link.h>
-
#include "nm-default.h"

#define NM_JANSSON_C
#include "nm-json.h"

+#include <dlfcn.h>
+
void *_nm_jansson_json_object_iter_value;
void *_nm_jansson_json_object_key_to_iter;
void *_nm_jansson_json_integer;
--
2.14.3

84
SOURCES/0022-team-add-random-runner-rh1538699.patch

@ -0,0 +1,84 @@ @@ -0,0 +1,84 @@
From 10760b100c71d637cad76eef4bed59c1d63679c2 Mon Sep 17 00:00:00 2001
From: Francesco Giudici <fgiudici@redhat.com>
Date: Mon, 5 Feb 2018 15:24:36 +0100
Subject: [PATCH] libnm-core: team: add support to runner "random"

https://bugzilla.redhat.com/show_bug.cgi?id=1538699
(cherry picked from commit 31d9a9de14dc7e529763e3210337bb6dd628a8a3)
---
clients/common/nm-meta-setting-desc.c | 1 +
libnm-core/nm-setting-team.c | 1 +
libnm-core/nm-setting-team.h | 1 +
libnm-core/tests/test-setting.c | 14 ++++++++++++++
4 files changed, 17 insertions(+)

diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
index 46b06fd40..d829fa7d4 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -6594,6 +6594,7 @@ static const NMMetaPropertyInfo *const property_infos_TEAM[] = {
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = VALUES_STATIC (NM_SETTING_TEAM_RUNNER_BROADCAST,
NM_SETTING_TEAM_RUNNER_ROUNDROBIN,
+ NM_SETTING_TEAM_RUNNER_RANDOM,
NM_SETTING_TEAM_RUNNER_ACTIVEBACKUP,
NM_SETTING_TEAM_RUNNER_LOADBALANCE,
NM_SETTING_TEAM_RUNNER_LACP),
diff --git a/libnm-core/nm-setting-team.c b/libnm-core/nm-setting-team.c
index 60bdf5f6b..1db2428d9 100644
--- a/libnm-core/nm-setting-team.c
+++ b/libnm-core/nm-setting-team.c
@@ -1171,6 +1171,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
if ( priv->runner
&& g_ascii_strcasecmp (priv->runner, NM_SETTING_TEAM_RUNNER_BROADCAST)
&& g_ascii_strcasecmp (priv->runner, NM_SETTING_TEAM_RUNNER_ROUNDROBIN)
+ && g_ascii_strcasecmp (priv->runner, NM_SETTING_TEAM_RUNNER_RANDOM)
&& g_ascii_strcasecmp (priv->runner, NM_SETTING_TEAM_RUNNER_ACTIVEBACKUP)
&& g_ascii_strcasecmp (priv->runner, NM_SETTING_TEAM_RUNNER_LOADBALANCE)
&& g_ascii_strcasecmp (priv->runner, NM_SETTING_TEAM_RUNNER_LACP)) {
diff --git a/libnm-core/nm-setting-team.h b/libnm-core/nm-setting-team.h
index d423901f6..8e5178a45 100644
--- a/libnm-core/nm-setting-team.h
+++ b/libnm-core/nm-setting-team.h
@@ -131,6 +131,7 @@ NMTeamLinkWatcherArpPingFlags nm_team_link_watcher_get_flags (NMTeamLinkWatcher

#define NM_SETTING_TEAM_RUNNER_BROADCAST "broadcast"
#define NM_SETTING_TEAM_RUNNER_ROUNDROBIN "roundrobin"
+#define NM_SETTING_TEAM_RUNNER_RANDOM "random"
#define NM_SETTING_TEAM_RUNNER_ACTIVEBACKUP "activebackup"
#define NM_SETTING_TEAM_RUNNER_LOADBALANCE "loadbalance"
#define NM_SETTING_TEAM_RUNNER_LACP "lacp"
diff --git a/libnm-core/tests/test-setting.c b/libnm-core/tests/test-setting.c
index efdcee258..a7282f91b 100644
--- a/libnm-core/tests/test-setting.c
+++ b/libnm-core/tests/test-setting.c
@@ -967,6 +967,18 @@ test_runner_broadcast_sync_from_config (void)
NULL);
}

+static void
+test_runner_random_sync_from_config (void)
+{
+ _test_team_config_sync ("{\"runner\": {\"name\": \"random\"}}",
+ 0, 0, 0, 0,
+ NM_SETTING_TEAM_RUNNER_RANDOM,
+ NULL,
+ NULL, NULL, -1,
+ FALSE, FALSE, -1, -1, NULL,
+ NULL);
+}
+
static void
test_runner_activebackup_sync_from_config (void)
{
@@ -1603,6 +1615,8 @@ main (int argc, char **argv)
test_runner_roundrobin_sync_from_config);
g_test_add_func ("/libnm/settings/team/sync_runner_from_config_broadcast",
test_runner_broadcast_sync_from_config);
+ g_test_add_func ("/libnm/settings/team/sync_runner_from_config_random",
+ test_runner_random_sync_from_config);
g_test_add_func ("/libnm/settings/team/sync_runner_from_config_activebackup",
test_runner_activebackup_sync_from_config);
g_test_add_func ("/libnm/settings/team/sync_runner_from_config_loadbalance",
--
2.14.3

50
SOURCES/0023-ppp-don-t-start-IPv6-configuration-rh1515829.patch

@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
From a5f395ec33af68cb924b797fed833d472ce090b1 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Tue, 6 Feb 2018 10:04:53 +0100
Subject: [PATCH] ppp: don't start IPv6 configuration on the device

If IPV6CP terminates before IPCP, pppd enters the RUNNING phase and we
start IP configuration without having an IP interface set, which
triggers assertions. Instead, reimplement stage3_ip6_config_start to
be a no-op. Note that IPv6 configuration on PPP devices has never been
supported by NM.

This is a simpler version of upstream commit dd98ada33f33 ("ppp:
introduce SetIfindex pppd plugin D-Bus method") that doesn't require
changing the internal plugin API.

https://bugzilla.redhat.com/show_bug.cgi?id=1515829
(cherry picked from commit 258f4fc76961f564c5d63d1eaf5246b21c2d0ce0)
---
src/devices/nm-device-ppp.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/src/devices/nm-device-ppp.c b/src/devices/nm-device-ppp.c
index 8b3968d51..639ec44a7 100644
--- a/src/devices/nm-device-ppp.c
+++ b/src/devices/nm-device-ppp.c
@@ -207,6 +207,14 @@ act_stage3_ip4_config_start (NMDevice *device,
return NM_ACT_STAGE_RETURN_POSTPONE;
}

+static NMActStageReturn
+act_stage3_ip6_config_start (NMDevice *self,
+ NMIP6Config **out_config,
+ NMDeviceStateReason *out_failure_reason)
+{
+ return NM_ACT_STAGE_RETURN_IP_FAIL;
+}
+
static gboolean
create_and_realize (NMDevice *device,
NMConnection *connection,
@@ -273,6 +281,7 @@ nm_device_ppp_class_init (NMDevicePppClass *klass)

parent_class->act_stage2_config = act_stage2_config;
parent_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start;
+ parent_class->act_stage3_ip6_config_start = act_stage3_ip6_config_start;
parent_class->check_connection_compatible = check_connection_compatible;
parent_class->create_and_realize = create_and_realize;
parent_class->deactivate = deactivate;
--
2.14.3

227
SOURCES/0024-Revert-IPv4-rp_filter-handling-rh1492472.patch

@ -0,0 +1,227 @@ @@ -0,0 +1,227 @@
From 687b84414f8ecee51785e600ba58f7e2cfd40767 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Fri, 2 Feb 2018 17:07:06 +0100
Subject: [PATCH] Revert "device: apply a loose IPv4 rp_filter when it would
interfere with multihoming"

Don't touch it until we're sure we're doing the right thing.
https://bugzilla.redhat.com/show_bug.cgi?id=1492472

This reverts commit cae3cef60fe6b37929e69d103663882274ad46bc.
---
src/devices/nm-device.c | 172 ------------------------------------------------
1 file changed, 172 deletions(-)

diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index b3b31ea..fe280df 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -379,9 +379,6 @@ typedef struct _NMDevicePrivate {
NMIP4Config * wwan_ip4_config; /* WWAN configuration */
GSList * vpn4_configs; /* VPNs which use this device */

- bool v4_has_shadowed_routes;
- const char *ip4_rp_filter;
-
/* DHCPv4 tracking */
struct {
NMDhcpClient * client;
@@ -851,47 +848,6 @@ init_ip6_config_dns_priority (NMDevice *self, NMIP6Config *config)

/*****************************************************************************/

-static gboolean
-nm_device_ipv4_sysctl_set (NMDevice *self, const char *property, const char *value)
-{
- NMPlatform *platform = nm_device_get_platform (self);
- gs_free char *value_to_free = NULL;
- const char *value_to_set;
- char buf[NM_UTILS_SYSCTL_IP_CONF_PATH_BUFSIZE];
-
- if (!nm_device_get_ip_ifindex (self))
- return FALSE;
-
- if (value) {
- value_to_set = value;
- } else {
- /* Set to a default value when we've got a NULL @value. */
- value_to_free = nm_platform_sysctl_get (platform,
- NMP_SYSCTL_PATHID_ABSOLUTE (nm_utils_sysctl_ip_conf_path (AF_INET, buf, "default", property)));
- value_to_set = value_to_free;
- }
-
- return nm_platform_sysctl_set (platform,
- NMP_SYSCTL_PATHID_ABSOLUTE (nm_utils_sysctl_ip_conf_path (AF_INET, buf, nm_device_get_ip_iface (self), property)),
- value_to_set);
-}
-
-static guint32
-nm_device_ipv4_sysctl_get_uint32 (NMDevice *self, const char *property, guint32 fallback)
-{
- char buf[NM_UTILS_SYSCTL_IP_CONF_PATH_BUFSIZE];
-
- if (!nm_device_get_ip_ifindex (self))
- return fallback;
-
- return nm_platform_sysctl_get_int_checked (nm_device_get_platform (self),
- NMP_SYSCTL_PATHID_ABSOLUTE (nm_utils_sysctl_ip_conf_path (AF_INET, buf, nm_device_get_ip_iface (self), property)),
- 10,
- 0,
- G_MAXUINT32,
- fallback);
-}
-
gboolean
nm_device_ipv6_sysctl_set (NMDevice *self, const char *property, const char *value)
{
@@ -2876,126 +2832,6 @@ link_changed_cb (NMPlatform *platform,

/*****************************************************************************/

-typedef struct {
- in_addr_t network;
- guint8 plen;
-} IP4RPFilterData;
-
-static guint
-_v4_has_shadowed_routes_detect_hash (const IP4RPFilterData *d)
-{
- NMHashState h;
-
- nm_hash_init (&h, 1105201169u);
- nm_hash_update_vals (&h,
- d->network,
- d->plen);
- return nm_hash_complete (&h);
-}
-
-static gboolean
-_v4_has_shadowed_routes_detect_equal (const IP4RPFilterData *d1, const IP4RPFilterData *d2)
-{
- return d1->network == d2->network && d1->plen == d2->plen;
-}
-
-static gboolean
-_v4_has_shadowed_routes_detect (NMDevice *self)
-{
- NMPlatform *platform;
- int ifindex;
- NMPLookup lookup;
- const NMDedupMultiHeadEntry *head_entry;
- NMDedupMultiIter iter;
- const NMPObject *o;
- guint data_len;
- gs_unref_hashtable GHashTable *data_hash = NULL;
- gs_free IP4RPFilterData *data_arr = NULL;
-
- ifindex = nm_device_get_ip_ifindex (self);
- if (ifindex <= 0)
- return FALSE;
-
- platform = nm_device_get_platform (self);
-
- head_entry = nm_platform_lookup (platform,
- nmp_lookup_init_object (&lookup,
- NMP_OBJECT_TYPE_IP4_ROUTE,
- ifindex));
- if (!head_entry)
- return FALSE;
-
- /* first, create a lookup index @data_hash for all network/plen pairs. */
- data_len = 0;
- data_arr = g_new (IP4RPFilterData, head_entry->len);
- data_hash = g_hash_table_new ((GHashFunc) _v4_has_shadowed_routes_detect_hash,
- (GEqualFunc) _v4_has_shadowed_routes_detect_equal);
-
- nmp_cache_iter_for_each (&iter, head_entry, &o) {
- const NMPlatformIP4Route *r = NMP_OBJECT_CAST_IP4_ROUTE (o);
- IP4RPFilterData *d;
-
- nm_assert (r->ifindex == ifindex);
-
- if ( NM_PLATFORM_IP_ROUTE_IS_DEFAULT (r)
- || r->table_coerced)
- continue;
-
- d = &data_arr[data_len++];
- d->network = nm_utils_ip4_address_clear_host_address (r->network, r->plen);
- d->plen = r->plen;
- g_hash_table_add (data_hash, d);
- }
-
- /* then, search if there is any route on another interface with the same
- * network/plen destination. If yes, we consider this a multihoming
- * setup. */
- head_entry = nm_platform_lookup (platform,
- nmp_lookup_init_obj_type (&lookup,
- NMP_OBJECT_TYPE_IP4_ROUTE));
- nmp_cache_iter_for_each (&iter, head_entry, &o) {
- const NMPlatformIP4Route *r = NMP_OBJECT_CAST_IP4_ROUTE (o);
- IP4RPFilterData d;
-
- if ( r->ifindex == ifindex
- || NM_PLATFORM_IP_ROUTE_IS_DEFAULT (r)
- || r->table_coerced)
- continue;
-
- d.network = nm_utils_ip4_address_clear_host_address (r->network, r->plen);
- d.plen = r->plen;
- if (g_hash_table_contains (data_hash, &d))
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-ip4_rp_filter_update (NMDevice *self)
-{
- NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
- const char *ip4_rp_filter;
-
- if ( priv->v4_has_shadowed_routes
- || nm_device_get_best_default_route (self, AF_INET)) {
- if (nm_device_ipv4_sysctl_get_uint32 (self, "rp_filter", 0) != 1) {
- /* Don't touch the rp_filter if it's not strict. */
- return;
- }
- /* Loose rp_filter */
- ip4_rp_filter = "2";
- } else {
- /* Default rp_filter */
- ip4_rp_filter = NULL;
- }
-
- if (ip4_rp_filter != priv->ip4_rp_filter) {
- nm_device_ipv4_sysctl_set (self, "rp_filter", ip4_rp_filter);
- priv->ip4_rp_filter = ip4_rp_filter;
- }
-}
-
static void
link_changed (NMDevice *self, const NMPlatformLink *pllink)
{
@@ -10259,9 +10095,6 @@ nm_device_set_ip4_config (NMDevice *self,

concheck_periodic_update (self);

- if (!nm_device_sys_iface_state_is_external_or_assume (self))
- ip4_rp_filter_update (self);
-
if (has_changes) {
NMSettingsConnection *settings_connection;

@@ -11284,11 +11117,6 @@ queued_ip4_config_change (gpointer user_data)

set_unmanaged_external_down (self, TRUE);

- if (!nm_device_sys_iface_state_is_external_or_assume (self)) {
- priv->v4_has_shadowed_routes = _v4_has_shadowed_routes_detect (self);;
- ip4_rp_filter_update (self);
- }
-
return FALSE;
}

--
2.14.3

109
SOURCES/0025-team-clean-runner-tx-hash-on-set-rh1541922.patch

@ -0,0 +1,109 @@ @@ -0,0 +1,109 @@
From 01d1f64ad408947fbeaebbf2768828504044377f Mon Sep 17 00:00:00 2001
From: Francesco Giudici <fgiudici@redhat.com>
Date: Mon, 5 Feb 2018 17:50:33 +0100
Subject: [PATCH 1/2] nmcli: team: clear runner-tx-hash before adding new
hashes

https://bugzilla.redhat.com/show_bug.cgi?id=1541922
(cherry picked from commit 350dbb55abf3a80267c398e6f64c2cee4645475a)
---
clients/common/nm-meta-setting-desc.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
index d829fa7d4..85b272cbc 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -3976,6 +3976,9 @@ _set_fcn_team_runner_tx_hash (ARGS_SET_FCN)
return FALSE;
}

+ while (nm_setting_team_get_num_runner_tx_hash (NM_SETTING_TEAM (setting)))
+ nm_setting_team_remove_runner_tx_hash (NM_SETTING_TEAM (setting), 0);
+
while (strv && strv[i])
nm_setting_team_add_runner_tx_hash (NM_SETTING_TEAM (setting), strv[i++]);
g_strfreev (strv);
--
2.14.3


From 11f0ca1f23e000e7cbd246a176d8470c8b6ee8a6 Mon Sep 17 00:00:00 2001
From: Francesco Giudici <fgiudici@redhat.com>
Date: Tue, 6 Feb 2018 16:44:11 +0100
Subject: [PATCH 2/2] nmcli: team: do strict checking on runner-tx-hashes

Substrings matching the heading of valid values were allowed if not
ambiguous (e.g.: "et" for "eth"). Moreover, upper case variants were
accepted too.
Do a plain string comparison check against the valid values.
Improve also the error message: give a list of valid tx-hashes.

(cherry picked from commit fd5b3f802ec204392ada9ee9b75978059323fab4)
---
clients/common/nm-meta-setting-desc.c | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
index 85b272cbc..94404e908 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -3950,12 +3950,19 @@ _validate_fcn_team_config (const char *value, char **out_to_free, GError **error
}

static gboolean
-_is_valid_team_runner_tx_hash_element (const char *tx_hash_element)
+_is_valid_team_runner_tx_hash_element (const char *tx_hash_element,
+ GError **error)
{
- const char *valid_tx_hashes[] = { "eth", "vlan", "ipv4", "ipv6", "ip",
- "l3", "tcp", "udp", "sctp", "l4", NULL };
- if (nmc_string_is_valid (tx_hash_element, valid_tx_hashes, NULL))
+ nm_assert (!error || !*error);
+
+ if (NM_IN_STRSET (tx_hash_element,
+ "eth", "vlan", "ipv4", "ipv6", "ip",
+ "l3", "tcp", "udp", "sctp", "l4")) {
return TRUE;
+ }
+
+ g_set_error (error, 1, 0, "'%s' is not valid. %s", tx_hash_element,
+ "Valid tx-hashes: [eth, vlan, ipv4, ipv6, ip, l3, tcp, udp, sctp, l4]");
return FALSE;
}

@@ -3963,24 +3970,24 @@ static gboolean
_set_fcn_team_runner_tx_hash (ARGS_SET_FCN)
{
char **strv = NULL;
- guint i = 0;
+ char *const*iter;

g_return_val_if_fail (error == NULL || *error == NULL, FALSE);

strv = _nm_utils_strv_cleanup (g_strsplit_set (value, " \t,", 0),
TRUE, TRUE, TRUE);
- if (!verify_string_list (strv, property_info->property_name,
- _is_valid_team_runner_tx_hash_element,
- error)) {
- g_strfreev (strv);
- return FALSE;
+ for (iter = strv; strv && *iter; iter++) {
+ if (!_is_valid_team_runner_tx_hash_element (*iter, error)) {
+ g_strfreev (strv);
+ return FALSE;
+ }
}

while (nm_setting_team_get_num_runner_tx_hash (NM_SETTING_TEAM (setting)))
nm_setting_team_remove_runner_tx_hash (NM_SETTING_TEAM (setting), 0);

- while (strv && strv[i])
- nm_setting_team_add_runner_tx_hash (NM_SETTING_TEAM (setting), strv[i++]);
+ for (iter = strv; strv && *iter; iter++)
+ nm_setting_team_add_runner_tx_hash (NM_SETTING_TEAM (setting), *iter);
g_strfreev (strv);

return TRUE;
--
2.14.3

322
SOURCES/0026-dhcp-fix-lease-renewal-rh1503587.patch

@ -0,0 +1,322 @@ @@ -0,0 +1,322 @@
From 2d98ce90188fdf4d21c2b597ba848d249a2d4e09 Mon Sep 17 00:00:00 2001
From: Francesco Giudici <fgiudici@redhat.com>
Date: Mon, 15 Jan 2018 12:49:33 +0100
Subject: [PATCH 1/3] device: always consider both ip families when deciding to
fail

Example: when dhcpv4 lease renewal fails, if ipv4.may-fail was "yes",
check also if we have a successful ipv6 conf: if not fail.
Previously we just ignored the other ip family status.

(cherry picked from commit da0fee4d9f16d0de6323ea709e459b79b5158dad)
---
src/devices/nm-device.c | 53 ++++++++++++++++++++++++++++---------------------
1 file changed, 30 insertions(+), 23 deletions(-)

diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index f8651e2e1..345034185 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -3774,21 +3774,24 @@ get_ip_config_may_fail (NMDevice *self, int addr_family)
/*
* check_ip_state
*
- * Transition the device from IP_CONFIG to the next state according to the
- * outcome of IPv4 and IPv6 configuration. @may_fail indicates that we are
- * called just after the initial configuration and thus IPv4/IPv6 are allowed to
- * fail if the ipvx.may-fail properties say so, because the IP methods couldn't
- * even be started.
+ * When @full_state_update is TRUE, transition the device from IP_CONFIG to the
+ * next state according to the outcome of IPv4 and IPv6 configuration. @may_fail
+ * indicates that we are called just after the initial configuration and thus
+ * IPv4/IPv6 are allowed to fail if the ipvx.may-fail properties say so, because
+ * the IP methods couldn't even be started.
+ * If @full_state_update is FALSE, just check if the connection should be failed
+ * due to the state of both ip families and the ipvx.may-fail settings.
*/
static void
-check_ip_state (NMDevice *self, gboolean may_fail)
+check_ip_state (NMDevice *self, gboolean may_fail, gboolean full_state_update)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
gboolean ip4_disabled = FALSE, ip6_ignore = FALSE;
NMSettingIPConfig *s_ip4, *s_ip6;
NMDeviceState state;

- if (nm_device_get_state (self) != NM_DEVICE_STATE_IP_CONFIG)
+ if ( full_state_update
+ && nm_device_get_state (self) != NM_DEVICE_STATE_IP_CONFIG)
return;

/* Don't progress into IP_CHECK or SECONDARIES if we're waiting for the
@@ -3835,9 +3838,12 @@ check_ip_state (NMDevice *self, gboolean may_fail)
state = NM_DEVICE_STATE_FAILED;
}

- nm_device_state_changed (self,
- state,
- NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE);
+ if ( full_state_update
+ || state == NM_DEVICE_STATE_FAILED) {
+ nm_device_state_changed (self,
+ state,
+ NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE);
+ }
return;
}

@@ -3850,7 +3856,8 @@ check_ip_state (NMDevice *self, gboolean may_fail)
/* If at least a method has completed, proceed with activation */
if ( (priv->ip4_state == IP_DONE && !ip4_disabled)
|| (priv->ip6_state == IP_DONE && !ip6_ignore)) {
- nm_device_state_changed (self, NM_DEVICE_STATE_IP_CHECK, NM_DEVICE_STATE_REASON_NONE);
+ if (full_state_update)
+ nm_device_state_changed (self, NM_DEVICE_STATE_IP_CHECK, NM_DEVICE_STATE_REASON_NONE);
return;
}
}
@@ -3892,7 +3899,7 @@ nm_device_slave_notify_enslave (NMDevice *self, gboolean success)

if (activating) {
if (success)
- check_ip_state (self, FALSE);
+ check_ip_state (self, FALSE, TRUE);
else
nm_device_queue_state (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_UNKNOWN);
} else
@@ -5268,7 +5275,7 @@ nm_device_ip_method_failed (NMDevice *self,
_set_ip_state (self, addr_family, IP_FAIL);

if (get_ip_config_may_fail (self, addr_family))
- check_ip_state (self, FALSE);
+ check_ip_state (self, FALSE, (nm_device_get_state (self) == NM_DEVICE_STATE_IP_CONFIG));
else
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
}
@@ -7997,7 +8004,7 @@ nm_device_activate_stage3_ip4_start (NMDevice *self)

if (nm_device_sys_iface_state_is_external (self)) {
_set_ip_state (self, AF_INET, IP_DONE);
- check_ip_state (self, FALSE);
+ check_ip_state (self, FALSE, TRUE);
return TRUE;
}

@@ -8010,7 +8017,7 @@ nm_device_activate_stage3_ip4_start (NMDevice *self)
g_object_unref (ip4_config);
} else if (ret == NM_ACT_STAGE_RETURN_IP_DONE) {
_set_ip_state (self, AF_INET, IP_DONE);
- check_ip_state (self, FALSE);
+ check_ip_state (self, FALSE, TRUE);
} else if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, failure_reason);
return FALSE;
@@ -8044,7 +8051,7 @@ nm_device_activate_stage3_ip6_start (NMDevice *self)

if (nm_device_sys_iface_state_is_external (self)) {
_set_ip_state (self, AF_INET6, IP_DONE);
- check_ip_state (self, FALSE);
+ check_ip_state (self, FALSE, TRUE);
return TRUE;
}

@@ -8061,7 +8068,7 @@ nm_device_activate_stage3_ip6_start (NMDevice *self)
nm_device_activate_schedule_ip6_config_result (self);
} else if (ret == NM_ACT_STAGE_RETURN_IP_DONE) {
_set_ip_state (self, AF_INET6, IP_DONE);
- check_ip_state (self, FALSE);
+ check_ip_state (self, FALSE, TRUE);
} else if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, failure_reason);
return FALSE;
@@ -8111,7 +8118,7 @@ activate_stage3_ip_config_start (NMDevice *self)
/* Proxy */
nm_device_set_proxy_config (self, NULL);

- check_ip_state (self, TRUE);
+ check_ip_state (self, TRUE, TRUE);
}

static void
@@ -8250,7 +8257,7 @@ activate_stage4_ip4_config_timeout (NMDevice *self)

_set_ip_state (self, AF_INET, IP_FAIL);

- check_ip_state (self, FALSE);
+ check_ip_state (self, FALSE, TRUE);
}

/*
@@ -8306,7 +8313,7 @@ activate_stage4_ip6_config_timeout (NMDevice *self)

_set_ip_state (self, AF_INET6, IP_FAIL);

- check_ip_state (self, FALSE);
+ check_ip_state (self, FALSE, TRUE);
}

/*
@@ -8554,7 +8561,7 @@ activate_stage5_ip4_config_result (NMDevice *self)

/* Enter the IP_CHECK state if this is the first method to complete */
_set_ip_state (self, AF_INET, IP_DONE);
- check_ip_state (self, FALSE);
+ check_ip_state (self, FALSE, TRUE);
}

void
@@ -8709,7 +8716,7 @@ activate_stage5_ip6_config_commit (NMDevice *self)
_LOGD (LOGD_DEVICE | LOGD_IP6, "IPv6 DAD: awaiting termination");
} else {
_set_ip_state (self, AF_INET6, IP_DONE);
- check_ip_state (self, FALSE);
+ check_ip_state (self, FALSE, TRUE);
}
}
} else {
@@ -11195,7 +11202,7 @@ queued_ip6_config_change (gpointer user_data)
_LOGD (LOGD_DEVICE | LOGD_IP6, "IPv6 DAD terminated");
g_clear_object (&priv->dad6_ip6_config);
_set_ip_state (self, AF_INET6, IP_DONE);
- check_ip_state (self, FALSE);
+ check_ip_state (self, FALSE, TRUE);
if (priv->rt6_temporary_not_available)
nm_device_activate_schedule_ip6_config_result (self);
}
--
2.14.3


From 56353bfb82e6d744b64f117f346b25b18526bf2d Mon Sep 17 00:00:00 2001
From: Francesco Giudici <fgiudici@redhat.com>
Date: Mon, 15 Jan 2018 12:17:54 +0100
Subject: [PATCH 2/3] device: never stop trying renewing the lease

Always reschedule a lease renewal attempt: just clear the scheduled
renewal if the connection is really deactivated.

(cherry picked from commit 1a20ff86d585b826d1769d0aa0adeca3aa1a183a)
---
src/devices/nm-device.c | 36 ++++++++++++++++++++++++++++++++----
1 file changed, 32 insertions(+), 4 deletions(-)

diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 345034185..f6d3f4c04 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -5900,15 +5900,23 @@ dhcp4_fail (NMDevice *self, gboolean timeout)
&& (timeout || (priv->ip4_state == IP_CONF))
&& !priv->dhcp4.was_active)
nm_device_activate_schedule_ip4_config_timeout (self);
- else if (priv->ip4_state == IP_DONE || priv->dhcp4.was_active) {
+ else if ( priv->dhcp4.num_tries_left < DHCP_NUM_TRIES_MAX
+ || priv->ip4_state == IP_DONE
+ || priv->dhcp4.was_active) {
/* Don't fail immediately when the lease expires but try to
* restart DHCP for a predefined number of times.
*/
if (priv->dhcp4.num_tries_left) {
priv->dhcp4.num_tries_left--;
dhcp_schedule_restart (self, AF_INET, "lease expired");
- } else
+ } else {
nm_device_ip_method_failed (self, AF_INET, NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED);
+ /* We failed the ipv4 method but schedule again the retries if the ipv6 method is
+ * configured, keeping the connection up.
+ */
+ if (nm_device_get_state (self) != NM_DEVICE_STATE_FAILED)
+ dhcp_schedule_restart (self, AF_INET, "renewal failed");
+ }
} else
g_warn_if_reached ();
}
@@ -5950,6 +5958,12 @@ dhcp4_state_changed (NMDhcpClient *client,
break;
}

+ /* After some failures, we have been able to renew the lease:
+ * update the ip state
+ */
+ if (priv->ip4_state == IP_FAIL)
+ _set_ip_state (self, AF_INET, IP_CONF);
+
g_free (priv->dhcp4.pac_url);
priv->dhcp4.pac_url = g_strdup (g_hash_table_lookup (options, "wpad"));
nm_device_set_proxy_config (self, priv->dhcp4.pac_url);
@@ -6640,15 +6654,23 @@ dhcp6_fail (NMDevice *self, gboolean timeout)
&& (timeout || (priv->ip6_state == IP_CONF))
&& !priv->dhcp6.was_active)
nm_device_activate_schedule_ip6_config_timeout (self);
- else if (priv->ip6_state == IP_DONE || priv->dhcp6.was_active) {
+ else if ( priv->dhcp6.num_tries_left < DHCP_NUM_TRIES_MAX
+ || priv->ip6_state == IP_DONE
+ || priv->dhcp6.was_active) {
/* Don't fail immediately when the lease expires but try to
* restart DHCP for a predefined number of times.
*/
if (priv->dhcp6.num_tries_left) {
priv->dhcp6.num_tries_left--;
dhcp_schedule_restart (self, AF_INET6, "lease expired");
- } else
+ } else {
nm_device_ip_method_failed (self, AF_INET6, NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED);
+ /* We failed the ipv6 method but schedule again the retries if the ipv4 method is
+ * configured, keeping the connection up.
+ */
+ if (nm_device_get_state (self) != NM_DEVICE_STATE_FAILED)
+ dhcp_schedule_restart (self, AF_INET6, "renewal failed");
+ }
} else
g_warn_if_reached ();
} else {
@@ -6715,6 +6737,12 @@ dhcp6_state_changed (NMDhcpClient *client,
}
}

+ /* After long time we have been able to renew the lease:
+ * update the ip state
+ */
+ if (priv->ip6_state == IP_FAIL)
+ _set_ip_state (self, AF_INET6, IP_CONF);
+
priv->dhcp6.num_tries_left = DHCP_NUM_TRIES_MAX;

if (priv->ip6_state == IP_CONF) {
--
2.14.3


From b6d2ad3312eea21effbd8d6d5fe32056ccf89cb8 Mon Sep 17 00:00:00 2001
From: Francesco Giudici <fgiudici@redhat.com>
Date: Thu, 8 Feb 2018 18:28:10 +0100
Subject: [PATCH 3/3] device: enable DHCPv6 retries on lease renewal failure

https://bugzilla.gnome.org/show_bug.cgi?id=792745
(cherry picked from commit 1289450146e2b212cabca500cb8009f910651661)
---
src/devices/nm-device.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index f6d3f4c04..eb91dc257 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -6633,13 +6633,15 @@ static void
dhcp6_fail (NMDevice *self, gboolean timeout)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
+ gboolean is_dhcp_managed;

_LOGD (LOGD_DHCP6, "DHCPv6 failed: timeout %d, num tries left %u",
timeout, priv->dhcp6.num_tries_left);

+ is_dhcp_managed = (priv->dhcp6.mode == NM_NDISC_DHCP_LEVEL_MANAGED);
dhcp6_cleanup (self, CLEANUP_TYPE_DECONFIGURE, FALSE);

- if (priv->dhcp6.mode == NM_NDISC_DHCP_LEVEL_MANAGED) {
+ if (is_dhcp_managed || priv->dhcp6.num_tries_left < DHCP_NUM_TRIES_MAX) {
/* Don't fail if there are static addresses configured on
* the device, instead retry after some time.
*/
--
2.14.3

13
SOURCES/10-slaves-order.conf

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
# This configuration file changes NetworkManager's behavior to order
# slaves by ifindex when they are autoactivated.
#
# See "man NetworkManager.conf" for more information about these
# and other keys.
#
# Do not edit this file; it will be overwritten on upgrades. If you
# want to override the values here, or set additional values, you can
# do so by adding another file (eg, "99-local.conf") in
# /etc/NetworkManager/conf.d/ and setting keys there.

[main]
slaves-order=index

116
SOURCES/9999-fix-pregen-doc.patch

@ -0,0 +1,116 @@ @@ -0,0 +1,116 @@
From f3930619ad245fab5f7ba0e4d390daaf1970f27c Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Wed, 25 Oct 2017 18:16:59 +0200
Subject: [PATCH] patch documentation with the proper default values

We don't regenerate the documentation for RHEL builds, but
the docs from the tarball are generated with a certain set
of defaults.

Patch the man pages with the proper values.
---
docs/api/html/NetworkManager.conf.html | 10 +++++-----
docs/api/html/gdbus-org.freedesktop.NetworkManager.Device.html | 2 +-
man/NetworkManager.conf.5 | 8 ++++----
3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/docs/api/html/NetworkManager.conf.html b/docs/api/html/NetworkManager.conf.html
index ec32a39cf..5d7e7e8a0 100644
--- a/docs/api/html/NetworkManager.conf.html
+++ b/docs/api/html/NetworkManager.conf.html
@@ -183,7 +183,7 @@ plugins-=remove-me
clients to be installed. The <code class="literal">internal</code>
option uses a built-in DHCP client which is not currently as
featureful as the external clients.</p>
-<p>If this key is missing, it defaults to <code class="literal">internal</code>.
+<p>If this key is missing, it defaults to <code class="literal">dhclient</code>.
It the chosen plugin is not available, clients are looked for
in this order: <code class="literal">dhclient</code>, <code class="literal">dhcpcd</code>,
<code class="literal">internal</code>.</p>
@@ -341,7 +341,7 @@ no-auto-default=*
<p>Set the <code class="filename">resolv.conf</code>
management mode. The default value depends on NetworkManager build
options, and this version of NetworkManager was build with a default of
- "<code class="literal">symlink</code>".
+ "<code class="literal">file</code>".
Regardless of this setting, NetworkManager will
always write resolv.conf to its runtime state directory
<code class="filename">/var/run/NetworkManager/resolv.conf</code>.</p>
@@ -622,7 +622,7 @@ ipv6.ip6-privacy=0
</tr>
<tr>
<td><p><span class="term"><code class="varname">ethernet.cloned-mac-address</code></span></p></td>
-<td><p>If left unspecified, it defaults to "preserve".</p></td>
+<td><p>If left unspecified, it defaults to "permanent".</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="varname">ethernet.generate-mac-address-mask</code></span></p></td>
@@ -692,7 +692,7 @@ ipv6.ip6-privacy=0
</tr>
<tr>
<td><p><span class="term"><code class="varname">wifi.cloned-mac-address</code></span></p></td>
-<td><p>If left unspecified, it defaults to "preserve".</p></td>
+<td><p>If left unspecified, it defaults to "permanent".</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="varname">wifi.generate-mac-address-mask</code></span></p></td>
@@ -1363,4 +1363,4 @@ interface-name:vboxnet*,except:interface-name:vboxnet2
<div class="footer">
<hr>Generated by GTK-Doc V1.26</div>
</body>
-</html>
\ No newline at end of file
+</html>
diff --git a/docs/api/html/gdbus-org.freedesktop.NetworkManager.Device.html b/docs/api/html/gdbus-org.freedesktop.NetworkManager.Device.html
index 4f62d52fc..14bc3c4c5 100644
--- a/docs/api/html/gdbus-org.freedesktop.NetworkManager.Device.html
+++ b/docs/api/html/gdbus-org.freedesktop.NetworkManager.Device.html
@@ -538,4 +538,4 @@ Real readable b
<div class="footer">
<hr>Generated by GTK-Doc V1.26</div>
</body>
-</html>
\ No newline at end of file
+</html>
diff --git a/man/NetworkManager.conf.5 b/man/NetworkManager.conf.5
index aa31c809a..6649f0307 100644
--- a/man/NetworkManager.conf.5
+++ b/man/NetworkManager.conf.5
@@ -144,7 +144,7 @@ internal
option uses a built\-in DHCP client which is not currently as featureful as the external clients\&.
.sp
If this key is missing, it defaults to
-internal\&. It the chosen plugin is not available, clients are looked for in this order:
+dhclient\&. It the chosen plugin is not available, clients are looked for in this order:
dhclient,
dhcpcd,
internal\&.
@@ -252,7 +252,7 @@ rc\-manager\ \&unmanaged
.RS 4
Set the
resolv\&.conf
-management mode\&. The default value depends on NetworkManager build options, and this version of NetworkManager was build with a default of "symlink"\&. Regardless of this setting, NetworkManager will always write resolv\&.conf to its runtime state directory
+management mode\&. The default value depends on NetworkManager build options, and this version of NetworkManager was build with a default of "file"\&. Regardless of this setting, NetworkManager will always write resolv\&.conf to its runtime state directory
/var/run/NetworkManager/resolv\&.conf\&.
.sp
symlink: If
@@ -601,7 +601,7 @@ If left unspecified, the default value is 3 tries before failing the connection\
.PP
\fIethernet\&.cloned\-mac\-address\fR
.RS 4
-If left unspecified, it defaults to "preserve"\&.
+If left unspecified, it defaults to "permanent"\&.
.RE
.PP
\fIethernet\&.generate\-mac\-address\-mask\fR
@@ -673,7 +673,7 @@ If left unspecified, default value of 60 seconds is used\&.
.PP
\fIwifi\&.cloned\-mac\-address\fR
.RS 4
-If left unspecified, it defaults to "preserve"\&.
+If left unspecified, it defaults to "permanent"\&.
.RE
.PP
\fIwifi\&.generate\-mac\-address\-mask\fR
--
2.14.3

50
SOURCES/NetworkManager.conf

@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
# Configuration file for NetworkManager.
#
# See "man 5 NetworkManager.conf" for details.
#
# The directories /usr/lib/NetworkManager/conf.d/ and /var/run/NetworkManager/conf.d/
# can contain additional configuration snippets installed by packages. These files are
# read before NetworkManager.conf and have thus lowest priority.
# The directory /etc/NetworkManager/conf.d/ can contain additional configuration
# snippets. Those snippets are merged last and overwrite the settings from this main
# file.
#
# The files within one conf.d/ directory are read in asciibetical order.
#
# If /etc/NetworkManager/conf.d/ contains a file with the same name as
# /usr/lib/NetworkManager/conf.d/, the latter file is shadowed and thus ignored.
# Hence, to disable loading a file from /usr/lib/NetworkManager/conf.d/ you can
# put an empty file to /etc with the same name. The same applies with respect
# to the directory /var/run/NetworkManager/conf.d where files in /var/run shadow
# /usr/lib and are themselves shadowed by files under /etc.
#
# If two files define the same key, the one that is read afterwards will overwrite
# the previous one.

[main]
#plugins=ifcfg-rh,ibft


[logging]
# When debugging NetworkManager, enabling debug logging is of great help.
#
# Logfiles contain no passwords and little sensitive information. But please
# check before posting the file online. You can also personally hand over the
# logfile to a NM developer to treat it confidential. Meet us on #nm on freenode.
# Please post full logfiles except minimal modifications of private data.
#
# You can also change the log-level at runtime via
# $ nmcli general logging level TRACE domains ALL
# However, usually it's cleaner to enable debug logging
# in the configuration and restart NetworkManager so that
# debug logging is enabled from the start.
#
# You will find the logfiles in syslog, for example via
# $ journalctl -u NetworkManager
#
# Note that debug logging of NetworkManager can be quite verbose. Some messages
# might be rate-limited by the logging daemon (see RateLimitIntervalSec, RateLimitBurst
# in man journald.conf).
#
#level=TRACE
#domains=ALL

11
SOURCES/README.nmcs

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
NOTE: if NetworkManager is not installed or not enabled, the configuration
added by this package has *no effect*.

The NetworkManager-config-server package a NetworkManager configuration file
to make it behave more like the old "network" service. In particular, it
prevents NetworkManager from automatically running DHCP on unconfigured
ethernet devices, and allows connections with static IP addresses to be
brought up even on ethernet devices with no carrier.

This package is intended to be installed by default for server
deployments.
Loading…
Cancel
Save