diff --git a/0001-core-detect-route-metric-when-creating-nm-generated-.patch b/0001-core-detect-route-metric-when-creating-nm-generated-.patch deleted file mode 100644 index 2783a90..0000000 --- a/0001-core-detect-route-metric-when-creating-nm-generated-.patch +++ /dev/null @@ -1,369 +0,0 @@ -From 9588c4633a07147875d933556212716779e32a36 Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Thu, 4 Jun 2015 15:57:42 +0200 -Subject: [PATCH] core: detect route-metric when creating nm-generated-assumed - connection - -When generating a connection to assume it, also record the route-metric. -Do that by looking at the metric of the (best) default-route. - -This is especially important since d51975ed921a5876b76e081b8f3df4e2ca1f1ca9. -Now NM would also manage the default-route for assumed connections. -So the generated assumed connection would have a route metric based on -the device type, which might differ from the external configuration. -This caused NM to replace the externally configured default-route. - -https://bugzilla.gnome.org/show_bug.cgi?id=750405 -(cherry picked from commit bc75cd53a8c5ba525016bfddc1644be59a45ed41) ---- - src/nm-ip4-config.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- - src/nm-ip4-config.h | 1 + - src/nm-ip6-config.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- - src/nm-ip6-config.h | 1 + - 4 files changed, 90 insertions(+), 2 deletions(-) - -diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c -index db8c4b4..e5cb6c7 100644 ---- a/src/nm-ip4-config.c -+++ b/src/nm-ip4-config.c -@@ -56,6 +56,7 @@ typedef struct { - GArray *wins; - guint32 mtu; - NMIPConfigSource mtu_source; -+ gint64 route_metric; - } NMIP4ConfigPrivate; - - /* internal guint32 are assigned to gobject properties of type uint. Ensure, that uint is large enough */ -@@ -218,6 +219,10 @@ nm_ip4_config_capture (int ifindex, gboolean capture_resolv_conf) - i++; - } - -+ /* we detect the route metric based on the default route. All non-default -+ * routes have their route metrics explicitly set. */ -+ priv->route_metric = has_gateway ? (gint64) lowest_metric : (gint64) -1; -+ - /* If there is a host route to the gateway, ignore that route. It is - * automatically added by NetworkManager when needed. - */ -@@ -335,6 +340,7 @@ nm_ip4_config_commit (const NMIP4Config *config, int ifindex, gboolean routes_fu - void - nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIPConfig *setting, guint32 default_route_metric) - { -+ NMIP4ConfigPrivate *priv; - guint naddresses, nroutes, nnameservers, nsearches; - int i; - -@@ -343,6 +349,8 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIPConfig *setting, gu - - g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting)); - -+ priv = NM_IP4_CONFIG_GET_PRIVATE (config); -+ - g_object_freeze_notify (G_OBJECT (config)); - - naddresses = nm_setting_ip_config_get_num_addresses (setting); -@@ -362,6 +370,9 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIPConfig *setting, gu - nm_ip4_config_set_gateway (config, gateway); - } - -+ if (priv->route_metric == -1) -+ priv->route_metric = nm_setting_ip_config_get_route_metric (setting); -+ - /* Addresses */ - for (i = 0; i < naddresses; i++) { - NMIPAddress *s_addr = nm_setting_ip_config_get_address (setting, i); -@@ -430,6 +441,7 @@ nm_ip4_config_create_setting (const NMIP4Config *config) - guint naddresses, nroutes, nnameservers, nsearches; - const char *method = NULL; - int i; -+ gint64 route_metric; - - s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ()); - -@@ -445,6 +457,7 @@ nm_ip4_config_create_setting (const NMIP4Config *config) - nroutes = nm_ip4_config_get_num_routes (config); - nnameservers = nm_ip4_config_get_num_nameservers (config); - nsearches = nm_ip4_config_get_num_searches (config); -+ route_metric = nm_ip4_config_get_route_metric (config); - - /* Addresses */ - for (i = 0; i < naddresses; i++) { -@@ -480,7 +493,11 @@ nm_ip4_config_create_setting (const NMIP4Config *config) - /* Use 'disabled' if the method wasn't previously set */ - if (!method) - method = NM_SETTING_IP4_CONFIG_METHOD_DISABLED; -- g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, method, NULL); -+ -+ g_object_set (s_ip4, -+ NM_SETTING_IP_CONFIG_METHOD, method, -+ NM_SETTING_IP_CONFIG_ROUTE_METRIC, (gint64) route_metric, -+ NULL); - - /* Routes */ - for (i = 0; i < nroutes; i++) { -@@ -523,11 +540,15 @@ nm_ip4_config_create_setting (const NMIP4Config *config) - void - nm_ip4_config_merge (NMIP4Config *dst, const NMIP4Config *src) - { -+ NMIP4ConfigPrivate *dst_priv, *src_priv; - guint32 i; - - g_return_if_fail (src != NULL); - g_return_if_fail (dst != NULL); - -+ dst_priv = NM_IP4_CONFIG_GET_PRIVATE (dst); -+ src_priv = NM_IP4_CONFIG_GET_PRIVATE (src); -+ - g_object_freeze_notify (G_OBJECT (dst)); - - /* addresses */ -@@ -546,6 +567,11 @@ nm_ip4_config_merge (NMIP4Config *dst, const NMIP4Config *src) - for (i = 0; i < nm_ip4_config_get_num_routes (src); i++) - nm_ip4_config_add_route (dst, nm_ip4_config_get_route (src, i)); - -+ if (dst_priv->route_metric == -1) -+ dst_priv->route_metric = src_priv->route_metric; -+ else -+ dst_priv->route_metric = MIN (dst_priv->route_metric, src_priv->route_metric); -+ - /* domains */ - for (i = 0; i < nm_ip4_config_get_num_domains (src); i++) - nm_ip4_config_add_domain (dst, nm_ip4_config_get_domain (src, i)); -@@ -727,6 +753,8 @@ nm_ip4_config_subtract (NMIP4Config *dst, const NMIP4Config *src) - if (!nm_ip4_config_get_num_addresses (dst)) - nm_ip4_config_set_gateway (dst, 0); - -+ /* ignore route_metric */ -+ - /* routes */ - for (i = 0; i < nm_ip4_config_get_num_routes (src); i++) { - idx = _routes_get_index (dst, nm_ip4_config_get_route (src, i)); -@@ -796,6 +824,7 @@ nm_ip4_config_intersect (NMIP4Config *dst, const NMIP4Config *src) - i++; - } - -+ /* ignore route_metric */ - /* ignore nameservers */ - - /* default gateway */ -@@ -872,6 +901,11 @@ nm_ip4_config_replace (NMIP4Config *dst, const NMIP4Config *src, gboolean *relev - has_relevant_changes = TRUE; - } - -+ if (src_priv->route_metric != dst_priv->route_metric) { -+ dst_priv->route_metric = src_priv->route_metric; -+ has_minor_changes = TRUE; -+ } -+ - /* addresses */ - num = nm_ip4_config_get_num_addresses (src); - are_equal = num == nm_ip4_config_get_num_addresses (dst); -@@ -1153,6 +1187,14 @@ nm_ip4_config_get_gateway (const NMIP4Config *config) - return priv->gateway; - } - -+gint64 -+nm_ip4_config_get_route_metric (const NMIP4Config *config) -+{ -+ NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config); -+ -+ return priv->route_metric; -+} -+ - /******************************************************************/ - - void -@@ -1856,6 +1898,7 @@ nm_ip4_config_init (NMIP4Config *config) - priv->searches = g_ptr_array_new_with_free_func (g_free); - priv->nis = g_array_new (FALSE, TRUE, sizeof (guint32)); - priv->wins = g_array_new (FALSE, TRUE, sizeof (guint32)); -+ priv->route_metric = -1; - } - - static void -diff --git a/src/nm-ip4-config.h b/src/nm-ip4-config.h -index 4636752..ea8320d 100644 ---- a/src/nm-ip4-config.h -+++ b/src/nm-ip4-config.h -@@ -81,6 +81,7 @@ void nm_ip4_config_set_never_default (NMIP4Config *config, gboolean never_defaul - gboolean nm_ip4_config_get_never_default (const NMIP4Config *config); - void nm_ip4_config_set_gateway (NMIP4Config *config, guint32 gateway); - guint32 nm_ip4_config_get_gateway (const NMIP4Config *config); -+gint64 nm_ip4_config_get_route_metric (const NMIP4Config *config); - - /* Addresses */ - void nm_ip4_config_reset_addresses (NMIP4Config *config); -diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c -index 48aeb64..a528bf1 100644 ---- a/src/nm-ip6-config.c -+++ b/src/nm-ip6-config.c -@@ -50,6 +50,7 @@ typedef struct { - GPtrArray *domains; - GPtrArray *searches; - guint32 mss; -+ gint64 route_metric; - } NMIP6ConfigPrivate; - - -@@ -329,6 +330,10 @@ nm_ip6_config_capture (int ifindex, gboolean capture_resolv_conf, NMSettingIP6Co - i++; - } - -+ /* we detect the route metric based on the default route. All non-default -+ * routes have their route metrics explicitly set. */ -+ priv->route_metric = has_gateway ? (gint64) lowest_metric : (gint64) -1; -+ - /* If there is a host route to the gateway, ignore that route. It is - * automatically added by NetworkManager when needed. - */ -@@ -408,6 +413,7 @@ nm_ip6_config_commit (const NMIP6Config *config, int ifindex, gboolean routes_fu - void - nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIPConfig *setting, guint32 default_route_metric) - { -+ NMIP6ConfigPrivate *priv; - guint naddresses, nroutes, nnameservers, nsearches; - const char *gateway_str; - int i; -@@ -417,6 +423,8 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIPConfig *setting, gu - - g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting)); - -+ priv = NM_IP6_CONFIG_GET_PRIVATE (config); -+ - naddresses = nm_setting_ip_config_get_num_addresses (setting); - nroutes = nm_setting_ip_config_get_num_routes (setting); - nnameservers = nm_setting_ip_config_get_num_dns (setting); -@@ -437,6 +445,9 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIPConfig *setting, gu - nm_ip6_config_set_gateway (config, &gateway); - } - -+ if (priv->route_metric == -1) -+ priv->route_metric = nm_setting_ip_config_get_route_metric (setting); -+ - /* Addresses */ - for (i = 0; i < naddresses; i++) { - NMIPAddress *s_addr = nm_setting_ip_config_get_address (setting, i); -@@ -500,6 +511,7 @@ nm_ip6_config_create_setting (const NMIP6Config *config) - guint naddresses, nroutes, nnameservers, nsearches; - const char *method = NULL; - int i; -+ gint64 route_metric; - - s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ()); - -@@ -515,6 +527,7 @@ nm_ip6_config_create_setting (const NMIP6Config *config) - nroutes = nm_ip6_config_get_num_routes (config); - nnameservers = nm_ip6_config_get_num_nameservers (config); - nsearches = nm_ip6_config_get_num_searches (config); -+ route_metric = nm_ip6_config_get_route_metric (config); - - /* Addresses */ - for (i = 0; i < naddresses; i++) { -@@ -554,7 +567,11 @@ nm_ip6_config_create_setting (const NMIP6Config *config) - /* Use 'ignore' if the method wasn't previously set */ - if (!method) - method = NM_SETTING_IP6_CONFIG_METHOD_IGNORE; -- g_object_set (s_ip6, NM_SETTING_IP_CONFIG_METHOD, method, NULL); -+ -+ g_object_set (s_ip6, -+ NM_SETTING_IP_CONFIG_METHOD, method, -+ NM_SETTING_IP_CONFIG_ROUTE_METRIC, (gint64) route_metric, -+ NULL); - - /* Routes */ - for (i = 0; i < nroutes; i++) { -@@ -601,11 +618,15 @@ nm_ip6_config_create_setting (const NMIP6Config *config) - void - nm_ip6_config_merge (NMIP6Config *dst, const NMIP6Config *src) - { -+ NMIP6ConfigPrivate *dst_priv, *src_priv; - guint32 i; - - g_return_if_fail (src != NULL); - g_return_if_fail (dst != NULL); - -+ dst_priv = NM_IP6_CONFIG_GET_PRIVATE (dst); -+ src_priv = NM_IP6_CONFIG_GET_PRIVATE (src); -+ - g_object_freeze_notify (G_OBJECT (dst)); - - /* addresses */ -@@ -624,6 +645,11 @@ nm_ip6_config_merge (NMIP6Config *dst, const NMIP6Config *src) - for (i = 0; i < nm_ip6_config_get_num_routes (src); i++) - nm_ip6_config_add_route (dst, nm_ip6_config_get_route (src, i)); - -+ if (dst_priv->route_metric == -1) -+ dst_priv->route_metric = src_priv->route_metric; -+ else -+ dst_priv->route_metric = MIN (dst_priv->route_metric, src_priv->route_metric); -+ - /* domains */ - for (i = 0; i < nm_ip6_config_get_num_domains (src); i++) - nm_ip6_config_add_domain (dst, nm_ip6_config_get_domain (src, i)); -@@ -776,6 +802,8 @@ nm_ip6_config_subtract (NMIP6Config *dst, const NMIP6Config *src) - if (!nm_ip6_config_get_num_addresses (dst)) - nm_ip6_config_set_gateway (dst, NULL); - -+ /* ignore route_metric */ -+ - /* routes */ - for (i = 0; i < nm_ip6_config_get_num_routes (src); i++) { - idx = _routes_get_index (dst, nm_ip6_config_get_route (src, i)); -@@ -824,6 +852,7 @@ nm_ip6_config_intersect (NMIP6Config *dst, const NMIP6Config *src) - i++; - } - -+ /* ignore route_metric */ - /* ignore nameservers */ - - /* default gateway */ -@@ -902,6 +931,11 @@ nm_ip6_config_replace (NMIP6Config *dst, const NMIP6Config *src, gboolean *relev - has_relevant_changes = TRUE; - } - -+ if (src_priv->route_metric != dst_priv->route_metric) { -+ dst_priv->route_metric = src_priv->route_metric; -+ has_minor_changes = TRUE; -+ } -+ - /* addresses */ - num = nm_ip6_config_get_num_addresses (src); - are_equal = num == nm_ip6_config_get_num_addresses (dst); -@@ -1112,6 +1146,14 @@ nm_ip6_config_get_gateway (const NMIP6Config *config) - return IN6_IS_ADDR_UNSPECIFIED (&priv->gateway) ? NULL : &priv->gateway; - } - -+gint64 -+nm_ip6_config_get_route_metric (const NMIP6Config *config) -+{ -+ NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (config); -+ -+ return priv->route_metric; -+} -+ - /******************************************************************/ - - void -@@ -1672,6 +1714,7 @@ nm_ip6_config_init (NMIP6Config *config) - priv->nameservers = g_array_new (FALSE, TRUE, sizeof (struct in6_addr)); - priv->domains = g_ptr_array_new_with_free_func (g_free); - priv->searches = g_ptr_array_new_with_free_func (g_free); -+ priv->route_metric = -1; - } - - static void -diff --git a/src/nm-ip6-config.h b/src/nm-ip6-config.h -index 66f1588..c7f3f51 100644 ---- a/src/nm-ip6-config.h -+++ b/src/nm-ip6-config.h -@@ -81,6 +81,7 @@ void nm_ip6_config_set_never_default (NMIP6Config *config, gboolean never_defaul - gboolean nm_ip6_config_get_never_default (const NMIP6Config *config); - void nm_ip6_config_set_gateway (NMIP6Config *config, const struct in6_addr *); - const struct in6_addr *nm_ip6_config_get_gateway (const NMIP6Config *config); -+gint64 nm_ip6_config_get_route_metric (const NMIP6Config *config); - - /* Addresses */ - void nm_ip6_config_reset_addresses (NMIP6Config *config); --- -2.4.3 - diff --git a/0001-docs-fix-a-copy-paste-error-in-description-of-VLAN-f.patch b/0001-docs-fix-a-copy-paste-error-in-description-of-VLAN-f.patch deleted file mode 100644 index d32a224..0000000 --- a/0001-docs-fix-a-copy-paste-error-in-description-of-VLAN-f.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 3af6be7aa6f591a5d9889bd76a589ad3cd58a009 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= -Date: Fri, 17 Jul 2015 09:20:29 +0200 -Subject: [PATCH 1/2] docs: fix a copy/paste error in description of VLAN flags - -(cherry picked from commit 2af10ef4442311f08f30afc358b203a11c4c12b0) ---- - libnm-core/nm-setting-vlan.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libnm-core/nm-setting-vlan.c b/libnm-core/nm-setting-vlan.c -index f622ddc..d904ad5 100644 ---- a/libnm-core/nm-setting-vlan.c -+++ b/libnm-core/nm-setting-vlan.c -@@ -742,7 +742,7 @@ nm_setting_vlan_class_init (NMSettingVlanClass *setting_class) - * property: flags - * variable: VLAN_FLAGS, REORDER_HDR - * values: "GVRP", "LOOSE_BINDING" for VLAN_FLAGS; 0 or 1 for REORDER_HDR -- * description: Parent interface of the VLAN. -+ * description: VLAN flags. - * ---end--- - */ - g_object_class_install_property --- -2.4.3 - diff --git a/0002-cli-fix-verifying-flag-based-properties-rh-1244048.patch b/0002-cli-fix-verifying-flag-based-properties-rh-1244048.patch deleted file mode 100644 index 18d1852..0000000 --- a/0002-cli-fix-verifying-flag-based-properties-rh-1244048.patch +++ /dev/null @@ -1,123 +0,0 @@ -From 439ff3841d7b0aa845d7638b2bc732ecc89d2894 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= -Date: Fri, 17 Jul 2015 11:24:31 +0200 -Subject: [PATCH 2/2] cli: fix verifying flag-based properties (rh #1244048) - -Some of the properties changed from GParamSpecUInt to GParamSpecFlags, namely -NM_SETTING_VLAN_FLAGS -NM_SETTING_DCB_APP_FCOE_FLAGS -NM_SETTING_DCB_APP_ISCSI_FLAGS -NM_SETTING_DCB_APP_FIP_FLAGS -NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS -NM_SETTING_DCB_PRIORITY_GROUP_FLAGS - -(commit fcfb4b40badbb5cd944cee0c9819cb2649d0bb58) - -https://bugzilla.redhat.com/show_bug.cgi?id=1244048 - -(cherry picked from commit 94b1b53a913650b5dd027181fecc08ce5ad8654d) ---- - clients/cli/settings.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++--- - 1 file changed, 63 insertions(+), 3 deletions(-) - -diff --git a/clients/cli/settings.c b/clients/cli/settings.c -index 66e6f62..66759df 100644 ---- a/clients/cli/settings.c -+++ b/clients/cli/settings.c -@@ -2034,6 +2034,46 @@ validate_uint (NMSetting *setting, const char* prop, guint val, GError **error) - return success; - } - -+static char * -+flag_values_to_string (GFlagsValue *array, guint n) -+{ -+ GString *str; -+ guint i; -+ -+ str = g_string_new (NULL); -+ for (i = 0; i < n; i++) -+ g_string_append_printf (str, "%u, ", array[i].value); -+ if (str->len) -+ g_string_truncate (str, str->len-2); /* chop off trailing ', ' */ -+ return g_string_free (str, FALSE); -+} -+ -+static gboolean -+validate_flags (NMSetting *setting, const char* prop, guint val, GError **error) -+{ -+ GParamSpec *pspec; -+ GValue value = G_VALUE_INIT; -+ gboolean success = TRUE; -+ -+ pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (setting)), prop); -+ g_assert (G_IS_PARAM_SPEC (pspec)); -+ -+ g_value_init (&value, pspec->value_type); -+ g_value_set_flags (&value, val); -+ -+ if (g_param_value_validate (pspec, &value)) { -+ GParamSpecFlags *pspec_flags = (GParamSpecFlags *) pspec; -+ char *flag_values = flag_values_to_string (pspec_flags->flags_class->values, -+ pspec_flags->flags_class->n_values); -+ g_set_error (error, 1, 0, _("'%u' flags are not valid; use combination of %s"), -+ val, flag_values); -+ g_free (flag_values); -+ success = FALSE; -+ } -+ g_value_unset (&value); -+ return success; -+} -+ - static gboolean - check_and_set_string (NMSetting *setting, - const char *prop, -@@ -2257,6 +2297,26 @@ nmc_property_set_int64 (NMSetting *setting, const char *prop, const char *val, G - } - - static gboolean -+nmc_property_set_flags (NMSetting *setting, const char *prop, const char *val, GError **error) -+{ -+ unsigned long val_int; -+ -+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE); -+ -+ if (!nmc_string_to_uint (val, TRUE, 0, G_MAXUINT, &val_int)) { -+ g_set_error (error, 1, 0, _("'%s' is not a valid number (or out of range)"), val); -+ return FALSE; -+ } -+ -+ /* Validate the flags according to the property spec */ -+ if (!validate_flags (setting, prop, (guint) val_int, error)) -+ return FALSE; -+ -+ g_object_set (setting, prop, (guint) val_int, NULL); -+ return TRUE; -+} -+ -+static gboolean - nmc_property_set_bool (NMSetting *setting, const char *prop, const char *val, GError **error) - { - gboolean val_bool; -@@ -4495,8 +4555,8 @@ nmc_property_dcb_set_flags (NMSetting *setting, const char *prop, const char *va - g_strfreev (strv); - } - -- /* Validate the number according to the property spec */ -- if (!validate_uint (setting, prop, (guint) flags, error)) -+ /* Validate the flags according to the property spec */ -+ if (!validate_flags (setting, prop, (guint) flags, error)) - return FALSE; - - g_object_set (setting, prop, (guint) flags, NULL); -@@ -5927,7 +5987,7 @@ nmc_properties_init (void) - NULL); - nmc_add_prop_funcs (GLUE (VLAN, FLAGS), - nmc_property_vlan_get_flags, -- nmc_property_set_uint, -+ nmc_property_set_flags, - NULL, - NULL, - NULL, --- -2.4.3 - diff --git a/0002-core-fix-handling-route-metric-for-nm_ip4_config_mer.patch b/0002-core-fix-handling-route-metric-for-nm_ip4_config_mer.patch deleted file mode 100644 index 5c1e203..0000000 --- a/0002-core-fix-handling-route-metric-for-nm_ip4_config_mer.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 33081142111d9cd90828e9c9a657c2ab93bec84f Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Wed, 22 Jul 2015 14:17:08 +0200 -Subject: [PATCH 02/11] core: fix handling route-metric for - nm_ip4_config_merge() - -Fixes: bc75cd53a8c5ba525016bfddc1644be59a45ed41 -(cherry picked from commit 47cc91bef609fe6f0ec7c25deff0b0628842c240) ---- - src/nm-ip4-config.c | 2 +- - src/nm-ip6-config.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c -index 6d8dfba..1b48517 100644 ---- a/src/nm-ip4-config.c -+++ b/src/nm-ip4-config.c -@@ -570,7 +570,7 @@ nm_ip4_config_merge (NMIP4Config *dst, const NMIP4Config *src) - - if (dst_priv->route_metric == -1) - dst_priv->route_metric = src_priv->route_metric; -- else -+ else if (src_priv->route_metric != -1) - dst_priv->route_metric = MIN (dst_priv->route_metric, src_priv->route_metric); - - /* domains */ -diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c -index a528bf1..82c5662 100644 ---- a/src/nm-ip6-config.c -+++ b/src/nm-ip6-config.c -@@ -647,7 +647,7 @@ nm_ip6_config_merge (NMIP6Config *dst, const NMIP6Config *src) - - if (dst_priv->route_metric == -1) - dst_priv->route_metric = src_priv->route_metric; -- else -+ else if (src_priv->route_metric != -1) - dst_priv->route_metric = MIN (dst_priv->route_metric, src_priv->route_metric); - - /* domains */ --- -2.4.3 - diff --git a/0003-device-trivial-rename-private-field-in-NMDevicePriva.patch b/0003-device-trivial-rename-private-field-in-NMDevicePriva.patch deleted file mode 100644 index a9234b2..0000000 --- a/0003-device-trivial-rename-private-field-in-NMDevicePriva.patch +++ /dev/null @@ -1,123 +0,0 @@ -From 83dadca08ef9606a8541b26d3a2b93a66d828055 Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Wed, 22 Jul 2015 11:40:35 +0200 -Subject: [PATCH 03/11] device/trivial: rename private field in NMDevicePrivate - -Rename "default_route.v4_configure_first_time" to "v4_commit_first_time". - -For one, the name "commit" matches better to the @commit variable in ip4_config_merge_and_apply() -and ip6_config_merge_and_apply(). Then, we don't need this information -only for default-routes, so move the variable out of the @default_route -struct. - -(cherry picked from commit ad03cdbc73dad81aa8934afa2060ccbd9e776f7f) ---- - src/devices/nm-device.c | 27 +++++++++++++++------------ - 1 file changed, 15 insertions(+), 12 deletions(-) - -diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c -index bf4ca8e..867f384 100644 ---- a/src/devices/nm-device.c -+++ b/src/devices/nm-device.c -@@ -271,14 +271,15 @@ typedef struct { - struct { - gboolean v4_has; - gboolean v4_is_assumed; -- gboolean v4_configure_first_time; - NMPlatformIP4Route v4; - gboolean v6_has; - gboolean v6_is_assumed; -- gboolean v6_configure_first_time; - NMPlatformIP6Route v6; - } default_route; - -+ gboolean v4_commit_first_time; -+ gboolean v6_commit_first_time; -+ - /* DHCPv4 tracking */ - NMDhcpClient * dhcp4_client; - gulong dhcp4_state_sigid; -@@ -3302,7 +3303,7 @@ ip4_config_merge_and_apply (NMDevice *self, - priv->default_route.v4_is_assumed = TRUE; - - routes_full_sync = commit -- && priv->default_route.v4_configure_first_time -+ && priv->v4_commit_first_time - && !nm_device_uses_assumed_connection (self); - - if (!commit) { -@@ -3314,7 +3315,7 @@ ip4_config_merge_and_apply (NMDevice *self, - = nm_default_route_manager_ip4_connection_has_default_route (nm_default_route_manager_get (), - connection, &connection_is_never_default); - -- if ( !priv->default_route.v4_configure_first_time -+ if ( !priv->v4_commit_first_time - && !nm_device_uses_assumed_connection (self) - && connection_is_never_default) { - /* If the connection is explicitly configured as never-default, we enforce the (absense of the) -@@ -3330,7 +3331,7 @@ ip4_config_merge_and_apply (NMDevice *self, - - /* we are about to commit (for a non-assumed connection). Enforce whatever we have - * configured. */ -- priv->default_route.v4_configure_first_time = FALSE; -+ priv->v4_commit_first_time = FALSE; - priv->default_route.v4_is_assumed = FALSE; - - if (!connection_has_default_route) -@@ -3920,7 +3921,7 @@ ip6_config_merge_and_apply (NMDevice *self, - priv->default_route.v6_is_assumed = TRUE; - - routes_full_sync = commit -- && priv->default_route.v6_configure_first_time -+ && priv->v6_commit_first_time - && !nm_device_uses_assumed_connection (self); - - if (!commit) { -@@ -3932,7 +3933,7 @@ ip6_config_merge_and_apply (NMDevice *self, - = nm_default_route_manager_ip6_connection_has_default_route (nm_default_route_manager_get (), - connection, &connection_is_never_default); - -- if ( !priv->default_route.v6_configure_first_time -+ if ( !priv->v6_commit_first_time - && !nm_device_uses_assumed_connection (self) - && connection_is_never_default) { - /* If the connection is explicitly configured as never-default, we enforce the (absence of the) -@@ -3948,7 +3949,7 @@ ip6_config_merge_and_apply (NMDevice *self, - - /* we are about to commit (for a non-assumed connection). Enforce whatever we have - * configured. */ -- priv->default_route.v6_configure_first_time = FALSE; -+ priv->v6_commit_first_time = FALSE; - priv->default_route.v6_is_assumed = FALSE; - - if (!connection_has_default_route) -@@ -7930,10 +7931,11 @@ _cleanup_generic_post (NMDevice *self, CleanupType cleanup_type) - - priv->default_route.v4_has = FALSE; - priv->default_route.v4_is_assumed = TRUE; -- priv->default_route.v4_configure_first_time = TRUE; - priv->default_route.v6_has = FALSE; - priv->default_route.v6_is_assumed = TRUE; -- priv->default_route.v6_configure_first_time = TRUE; -+ -+ priv->v4_commit_first_time = TRUE; -+ priv->v6_commit_first_time = TRUE; - - nm_default_route_manager_ip4_update_default_route (nm_default_route_manager_get (), self); - nm_default_route_manager_ip6_update_default_route (nm_default_route_manager_get (), self); -@@ -8875,9 +8877,10 @@ nm_device_init (NMDevice *self) - priv->ip6_saved_properties = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free); - - priv->default_route.v4_is_assumed = TRUE; -- priv->default_route.v4_configure_first_time = TRUE; - priv->default_route.v6_is_assumed = TRUE; -- priv->default_route.v6_configure_first_time = TRUE; -+ -+ priv->v4_commit_first_time = TRUE; -+ priv->v6_commit_first_time = TRUE; - } - - static GObject* --- -2.4.3 - diff --git a/0004-device-move-setting-v4_commit_first_time-v6_commit_f.patch b/0004-device-move-setting-v4_commit_first_time-v6_commit_f.patch deleted file mode 100644 index 2282bfb..0000000 --- a/0004-device-move-setting-v4_commit_first_time-v6_commit_f.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 351a645ad63a9f84bef0fa8abaa0340dc1acbf21 Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Wed, 22 Jul 2015 11:56:05 +0200 -Subject: [PATCH 04/11] device: move setting - v4_commit_first_time/v6_commit_first_time to the end of merge_and_apply() - -(cherry picked from commit cbd246c9b04868ada07b4853753fdba26bca54f3) ---- - src/devices/nm-device.c | 23 +++++++++++++---------- - 1 file changed, 13 insertions(+), 10 deletions(-) - -diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c -index 867f384..5eeccbe 100644 ---- a/src/devices/nm-device.c -+++ b/src/devices/nm-device.c -@@ -3302,10 +3302,6 @@ ip4_config_merge_and_apply (NMDevice *self, - priv->default_route.v4_has = FALSE; - priv->default_route.v4_is_assumed = TRUE; - -- routes_full_sync = commit -- && priv->v4_commit_first_time -- && !nm_device_uses_assumed_connection (self); -- - if (!commit) { - /* during a non-commit event, we always pickup whatever is configured. */ - goto END_ADD_DEFAULT_ROUTE; -@@ -3331,7 +3327,6 @@ ip4_config_merge_and_apply (NMDevice *self, - - /* we are about to commit (for a non-assumed connection). Enforce whatever we have - * configured. */ -- priv->v4_commit_first_time = FALSE; - priv->default_route.v4_is_assumed = FALSE; - - if (!connection_has_default_route) -@@ -3385,8 +3380,15 @@ END_ADD_DEFAULT_ROUTE: - NM_DEVICE_GET_CLASS (self)->ip4_config_pre_commit (self, composite); - } - -+ routes_full_sync = commit -+ && priv->v4_commit_first_time -+ && !nm_device_uses_assumed_connection (self); -+ - success = nm_device_set_ip4_config (self, composite, default_route_metric, commit, routes_full_sync, out_reason); - g_object_unref (composite); -+ -+ if (commit) -+ priv->v4_commit_first_time = FALSE; - return success; - } - -@@ -3920,10 +3922,6 @@ ip6_config_merge_and_apply (NMDevice *self, - priv->default_route.v6_has = FALSE; - priv->default_route.v6_is_assumed = TRUE; - -- routes_full_sync = commit -- && priv->v6_commit_first_time -- && !nm_device_uses_assumed_connection (self); -- - if (!commit) { - /* during a non-commit event, we always pickup whatever is configured. */ - goto END_ADD_DEFAULT_ROUTE; -@@ -3949,7 +3947,6 @@ ip6_config_merge_and_apply (NMDevice *self, - - /* we are about to commit (for a non-assumed connection). Enforce whatever we have - * configured. */ -- priv->v6_commit_first_time = FALSE; - priv->default_route.v6_is_assumed = FALSE; - - if (!connection_has_default_route) -@@ -4006,8 +4003,14 @@ END_ADD_DEFAULT_ROUTE: - NM_DEVICE_GET_CLASS (self)->ip6_config_pre_commit (self, composite); - } - -+ routes_full_sync = commit -+ && priv->v6_commit_first_time -+ && !nm_device_uses_assumed_connection (self); -+ - success = nm_device_set_ip6_config (self, composite, commit, routes_full_sync, out_reason); - g_object_unref (composite); -+ if (commit) -+ priv->v6_commit_first_time = FALSE; - return success; - } - --- -2.4.3 - diff --git a/0005-device-always-assume-default-route-for-generate-assu.patch b/0005-device-always-assume-default-route-for-generate-assu.patch deleted file mode 100644 index 26984ad..0000000 --- a/0005-device-always-assume-default-route-for-generate-assu.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 0ab389e15cde106e0e66f25f5f3a74a8c0607f39 Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Wed, 22 Jul 2015 10:56:53 +0200 -Subject: [PATCH 05/11] device: always assume default-route for - generate-assumed-connections - -Commit d51975e changed, that we treat assumed and non-assumed -connections the same with respect to the default route. This is -certainly wrong, if we have an nm-generated-assumed connection -at hand. In this case, NM just generated a connection based on what -was configured on the system. Looking at that result and re-enforcing -the default-route is wrong. - -We want to manage the default-route for assumed, persistent connections. -If the connection was assumed and generated, we do not. - -This commit reverts d51975ed for nm-generated-assumed connection and -restores the previous behavior. - -https://bugzilla.redhat.com/show_bug.cgi?id=1244483 - -Fixes: d51975ed921a5876b76e081b8f3df4e2ca1f1ca9 -(cherry picked from commit bebeff69e89de04fdd53e21a0edb5d1fbfbfcf0b) ---- - src/devices/nm-device.c | 32 ++++++++++++++++++++------------ - 1 file changed, 20 insertions(+), 12 deletions(-) - -diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c -index 5eeccbe..a0aaf03 100644 ---- a/src/devices/nm-device.c -+++ b/src/devices/nm-device.c -@@ -3307,12 +3307,21 @@ ip4_config_merge_and_apply (NMDevice *self, - goto END_ADD_DEFAULT_ROUTE; - } - -+ if (nm_device_uses_generated_assumed_connection (self)) { -+ /* a generate-assumed-connection always detects the default route from platform */ -+ goto END_ADD_DEFAULT_ROUTE; -+ } -+ -+ /* At this point, we treat assumed and non-assumed connections alike. -+ * For assumed connections we do that because we still manage RA and DHCP -+ * leases for them, so we must extend/update the default route on commits. -+ */ -+ - connection_has_default_route - = nm_default_route_manager_ip4_connection_has_default_route (nm_default_route_manager_get (), - connection, &connection_is_never_default); - - if ( !priv->v4_commit_first_time -- && !nm_device_uses_assumed_connection (self) - && connection_is_never_default) { - /* If the connection is explicitly configured as never-default, we enforce the (absense of the) - * default-route only once. That allows the user to configure a connection as never-default, -@@ -3320,11 +3329,6 @@ ip4_config_merge_and_apply (NMDevice *self, - goto END_ADD_DEFAULT_ROUTE; - } - -- /* At this point, we treat assumed and non-assumed connections alike. -- * For assumed connections we do that because we still manage RA and DHCP -- * leases for them, so we must extend/update the default route on commits. -- */ -- - /* we are about to commit (for a non-assumed connection). Enforce whatever we have - * configured. */ - priv->default_route.v4_is_assumed = FALSE; -@@ -3927,12 +3931,21 @@ ip6_config_merge_and_apply (NMDevice *self, - goto END_ADD_DEFAULT_ROUTE; - } - -+ if (nm_device_uses_generated_assumed_connection (self)) { -+ /* a generate-assumed-connection always detects the default route from platform */ -+ goto END_ADD_DEFAULT_ROUTE; -+ } -+ -+ /* At this point, we treat assumed and non-assumed connections alike. -+ * For assumed connections we do that because we still manage RA and DHCP -+ * leases for them, so we must extend/update the default route on commits. -+ */ -+ - connection_has_default_route - = nm_default_route_manager_ip6_connection_has_default_route (nm_default_route_manager_get (), - connection, &connection_is_never_default); - - if ( !priv->v6_commit_first_time -- && !nm_device_uses_assumed_connection (self) - && connection_is_never_default) { - /* If the connection is explicitly configured as never-default, we enforce the (absence of the) - * default-route only once. That allows the user to configure a connection as never-default, -@@ -3940,11 +3953,6 @@ ip6_config_merge_and_apply (NMDevice *self, - goto END_ADD_DEFAULT_ROUTE; - } - -- /* At this point, we treat assumed and non-assumed connections alike. -- * For assumed connections we do that because we still manage RA and DHCP -- * leases for them, so we must extend/update the default route on commits. -- */ -- - /* we are about to commit (for a non-assumed connection). Enforce whatever we have - * configured. */ - priv->default_route.v6_is_assumed = FALSE; --- -2.4.3 - diff --git a/0006-default-route-manager-pick-up-platform-changes-after.patch b/0006-default-route-manager-pick-up-platform-changes-after.patch deleted file mode 100644 index 62f0089..0000000 --- a/0006-default-route-manager-pick-up-platform-changes-after.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 5e9dd4b267b7dacc96da6beca1df0ec9781c362b Mon Sep 17 00:00:00 2001 -From: Lubomir Rintel -Date: Wed, 22 Jul 2015 10:33:49 +0200 -Subject: [PATCH 06/11] default-route-manager: pick up platform changes after - NMDevice - -If a default route is configured externally, we want the device to pick the -change and register it with the default-route-manager first. - -https://bugzilla.redhat.com/show_bug.cgi?id=1244483 -(cherry picked from commit e67b52ed16afebce538f2f1844cf6e854e27c64d) ---- - src/nm-default-route-manager.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/src/nm-default-route-manager.c b/src/nm-default-route-manager.c -index fbb07ce..b36dd44 100644 ---- a/src/nm-default-route-manager.c -+++ b/src/nm-default-route-manager.c -@@ -1290,7 +1290,9 @@ _resync_idle_reschedule (NMDefaultRouteManager *self) - g_source_remove (priv->resync.idle_handle); - else - _LOGD (0, "resync: schedule on idle"); -- priv->resync.idle_handle = g_idle_add ((GSourceFunc) _resync_idle_now, self); -+ /* Schedule this at low priority so that on an external change to platform -+ * a NMDevice has a chance to picks up the changes first. */ -+ priv->resync.idle_handle = g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc) _resync_idle_now, self, NULL); - } else if (!priv->resync.idle_handle) { - priv->resync.idle_handle = g_timeout_add (priv->resync.backoff_wait_time_ms, (GSourceFunc) _resync_idle_now, self); - _LOGD (0, "resync: schedule in %u.%03u seconds (%u)", priv->resync.backoff_wait_time_ms/1000, --- -2.4.3 - diff --git a/0007-ip4-config-0.0.0.0-is-a-valid-gateway-too.patch b/0007-ip4-config-0.0.0.0-is-a-valid-gateway-too.patch deleted file mode 100644 index fe1f2db..0000000 --- a/0007-ip4-config-0.0.0.0-is-a-valid-gateway-too.patch +++ /dev/null @@ -1,252 +0,0 @@ -From f11e4c31ee9014304f05b4ccfc6e2b2c934e9ee4 Mon Sep 17 00:00:00 2001 -From: Lubomir Rintel -Date: Tue, 21 Jul 2015 23:07:34 +0200 -Subject: [PATCH 07/11] ip4-config: 0.0.0.0 is a valid gateway too - -It makes sense for point-to point links. - -https://bugzilla.redhat.com/show_bug.cgi?id=1244483 -(cherry picked from commit 063677101ab7d43a9aa94c70eb1ca3a201269043) ---- - src/devices/nm-device.c | 2 +- - src/nm-ip4-config.c | 67 ++++++++++++++++------ - src/nm-ip4-config.h | 2 + - .../plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 2 +- - 4 files changed, 53 insertions(+), 20 deletions(-) - -diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c -index a0aaf03..9f8c488 100644 ---- a/src/devices/nm-device.c -+++ b/src/devices/nm-device.c -@@ -3342,7 +3342,7 @@ ip4_config_merge_and_apply (NMDevice *self, - } - - gateway = nm_ip4_config_get_gateway (composite); -- if ( !gateway -+ if ( !nm_ip4_config_has_gateway (composite) - && nm_device_get_device_type (self) != NM_DEVICE_TYPE_MODEM) - goto END_ADD_DEFAULT_ROUTE; - -diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c -index 1b48517..035849e 100644 ---- a/src/nm-ip4-config.c -+++ b/src/nm-ip4-config.c -@@ -45,6 +45,7 @@ typedef struct { - - gboolean never_default; - guint32 gateway; -+ gboolean has_gateway; - GArray *addresses; - GArray *routes; - GArray *nameservers; -@@ -187,7 +188,7 @@ nm_ip4_config_capture (int ifindex, gboolean capture_resolv_conf) - guint i; - guint32 lowest_metric = G_MAXUINT32; - guint32 old_gateway = 0; -- gboolean has_gateway = FALSE; -+ gboolean old_has_gateway = FALSE; - - /* Slaves have no IP configuration */ - if (nm_platform_link_get_master (NM_PLATFORM_GET, ifindex) > 0) -@@ -204,6 +205,7 @@ nm_ip4_config_capture (int ifindex, gboolean capture_resolv_conf) - - /* Extract gateway from default route */ - old_gateway = priv->gateway; -+ old_has_gateway = priv->has_gateway; - for (i = 0; i < priv->routes->len; ) { - const NMPlatformIP4Route *route = &g_array_index (priv->routes, NMPlatformIP4Route, i); - -@@ -212,7 +214,7 @@ nm_ip4_config_capture (int ifindex, gboolean capture_resolv_conf) - priv->gateway = route->gateway; - lowest_metric = route->metric; - } -- has_gateway = TRUE; -+ priv->has_gateway = TRUE; - /* Remove the default route from the list */ - g_array_remove_index_fast (priv->routes, i); - continue; -@@ -222,12 +224,12 @@ nm_ip4_config_capture (int ifindex, gboolean capture_resolv_conf) - - /* we detect the route metric based on the default route. All non-default - * routes have their route metrics explicitly set. */ -- priv->route_metric = has_gateway ? (gint64) lowest_metric : (gint64) -1; -+ priv->route_metric = priv->has_gateway ? (gint64) lowest_metric : (gint64) -1; - - /* If there is a host route to the gateway, ignore that route. It is - * automatically added by NetworkManager when needed. - */ -- if (has_gateway) { -+ if (priv->has_gateway) { - for (i = 0; i < priv->routes->len; i++) { - const NMPlatformIP4Route *route = &g_array_index (priv->routes, NMPlatformIP4Route, i); - -@@ -243,7 +245,7 @@ nm_ip4_config_capture (int ifindex, gboolean capture_resolv_conf) - /* If the interface has the default route, and has IPv4 addresses, capture - * nameservers from /etc/resolv.conf. - */ -- if (priv->addresses->len && has_gateway && capture_resolv_conf) { -+ if (priv->addresses->len && priv->has_gateway && capture_resolv_conf) { - if (nm_ip4_config_capture_resolv_conf (priv->nameservers, NULL)) - _NOTIFY (config, PROP_NAMESERVERS); - } -@@ -253,7 +255,8 @@ nm_ip4_config_capture (int ifindex, gboolean capture_resolv_conf) - _NOTIFY (config, PROP_ROUTE_DATA); - _NOTIFY (config, PROP_ADDRESSES); - _NOTIFY (config, PROP_ROUTES); -- if (priv->gateway != old_gateway) -+ if ( priv->gateway != old_gateway -+ || priv->has_gateway != old_has_gateway) - _NOTIFY (config, PROP_GATEWAY); - - return config; -@@ -484,7 +487,7 @@ nm_ip4_config_create_setting (const NMIP4Config *config) - } - - /* Gateway */ -- if ( gateway -+ if ( nm_ip4_config_has_gateway (config) - && nm_setting_ip_config_get_num_addresses (s_ip4) > 0) { - g_object_set (s_ip4, - NM_SETTING_IP_CONFIG_GATEWAY, nm_utils_inet4_ntop (gateway, NULL), -@@ -561,7 +564,7 @@ nm_ip4_config_merge (NMIP4Config *dst, const NMIP4Config *src) - nm_ip4_config_add_nameserver (dst, nm_ip4_config_get_nameserver (src, i)); - - /* default gateway */ -- if (nm_ip4_config_get_gateway (src)) -+ if (nm_ip4_config_has_gateway (src)) - nm_ip4_config_set_gateway (dst, nm_ip4_config_get_gateway (src)); - - /* routes */ -@@ -752,11 +755,12 @@ nm_ip4_config_subtract (NMIP4Config *dst, const NMIP4Config *src) - } - - /* default gateway */ -- if (nm_ip4_config_get_gateway (src) == nm_ip4_config_get_gateway (dst)) -- nm_ip4_config_set_gateway (dst, 0); -+ if ( (nm_ip4_config_has_gateway (src) == nm_ip4_config_has_gateway (dst)) -+ && (nm_ip4_config_get_gateway (src) == nm_ip4_config_get_gateway (dst))) -+ nm_ip4_config_unset_gateway (dst); - - if (!nm_ip4_config_get_num_addresses (dst)) -- nm_ip4_config_set_gateway (dst, 0); -+ nm_ip4_config_unset_gateway (dst); - - /* ignore route_metric */ - -@@ -834,8 +838,10 @@ nm_ip4_config_intersect (NMIP4Config *dst, const NMIP4Config *src) - - /* default gateway */ - if ( !nm_ip4_config_get_num_addresses (dst) -- || (nm_ip4_config_get_gateway (src) != nm_ip4_config_get_gateway (dst))) -- nm_ip4_config_set_gateway (dst, 0); -+ || (nm_ip4_config_has_gateway (src) != nm_ip4_config_has_gateway (dst)) -+ || (nm_ip4_config_get_gateway (src) != nm_ip4_config_get_gateway (dst))) { -+ nm_ip4_config_unset_gateway (dst); -+ } - - /* routes */ - for (i = 0; i < nm_ip4_config_get_num_routes (dst); ) { -@@ -901,7 +907,8 @@ nm_ip4_config_replace (NMIP4Config *dst, const NMIP4Config *src, gboolean *relev - } - - /* default gateway */ -- if (src_priv->gateway != dst_priv->gateway) { -+ if ( src_priv->gateway != dst_priv->gateway -+ || src_priv->has_gateway != dst_priv->has_gateway) { - nm_ip4_config_set_gateway (dst, src_priv->gateway); - has_relevant_changes = TRUE; - } -@@ -1104,8 +1111,10 @@ nm_ip4_config_dump (const NMIP4Config *config, const char *detail) - g_message (" a: %s", nm_platform_ip4_address_to_string (nm_ip4_config_get_address (config, i))); - - /* default gateway */ -- tmp = nm_ip4_config_get_gateway (config); -- g_message (" gw: %s", nm_utils_inet4_ntop (tmp, NULL)); -+ if (nm_ip4_config_has_gateway (config)) { -+ tmp = nm_ip4_config_get_gateway (config); -+ g_message (" gw: %s", nm_utils_inet4_ntop (tmp, NULL)); -+ } - - /* nameservers */ - for (i = 0; i < nm_ip4_config_get_num_nameservers (config); i++) { -@@ -1185,12 +1194,33 @@ nm_ip4_config_set_gateway (NMIP4Config *config, guint32 gateway) - { - NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config); - -- if (priv->gateway != gateway) { -+ if (priv->gateway != gateway || !priv->has_gateway) { - priv->gateway = gateway; -+ priv->has_gateway = TRUE; -+ _NOTIFY (config, PROP_GATEWAY); -+ } -+} -+ -+void -+nm_ip4_config_unset_gateway (NMIP4Config *config) -+{ -+ NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config); -+ -+ if (priv->has_gateway) { -+ priv->gateway = 0; -+ priv->has_gateway = FALSE; - _NOTIFY (config, PROP_GATEWAY); - } - } - -+gboolean -+nm_ip4_config_has_gateway (const NMIP4Config *config) -+{ -+ NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config); -+ -+ return priv->has_gateway; -+} -+ - guint32 - nm_ip4_config_get_gateway (const NMIP4Config *config) - { -@@ -1832,6 +1862,7 @@ nm_ip4_config_hash (const NMIP4Config *config, GChecksum *sum, gboolean dns_only - g_return_if_fail (sum); - - if (!dns_only) { -+ hash_u32 (sum, nm_ip4_config_has_gateway (config)); - hash_u32 (sum, nm_ip4_config_get_gateway (config)); - - for (i = 0; i < nm_ip4_config_get_num_addresses (config); i++) { -@@ -2093,7 +2124,7 @@ get_property (GObject *object, guint prop_id, - } - break; - case PROP_GATEWAY: -- if (priv->gateway) -+ if (priv->has_gateway) - g_value_set_string (value, nm_utils_inet4_ntop (priv->gateway, NULL)); - else - g_value_set_string (value, NULL); -diff --git a/src/nm-ip4-config.h b/src/nm-ip4-config.h -index fb07240..2bb766a 100644 ---- a/src/nm-ip4-config.h -+++ b/src/nm-ip4-config.h -@@ -80,6 +80,8 @@ void nm_ip4_config_dump (const NMIP4Config *config, const char *detail); - void nm_ip4_config_set_never_default (NMIP4Config *config, gboolean never_default); - gboolean nm_ip4_config_get_never_default (const NMIP4Config *config); - void nm_ip4_config_set_gateway (NMIP4Config *config, guint32 gateway); -+void nm_ip4_config_unset_gateway (NMIP4Config *config); -+gboolean nm_ip4_config_has_gateway (const NMIP4Config *config); - guint32 nm_ip4_config_get_gateway (const NMIP4Config *config); - gint64 nm_ip4_config_get_route_metric (const NMIP4Config *config); - -diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c -index d2fb686..0edbe9b 100644 ---- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c -+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c -@@ -6405,7 +6405,7 @@ test_write_wired_static_ip6_only_gw (gconstpointer user_data) - g_assert (addr6); - - /* assert that the gateway was written and reloaded as expected */ -- if (!gateway6 || !strcmp (gateway6, "::")) { -+ if (!gateway6) { - g_assert (nm_setting_ip_config_get_gateway (s_ip6) == NULL); - g_assert (written_ifcfg_gateway == NULL); - } else { --- -2.4.3 - diff --git a/0008-libnm-core-properly-handle-NULL-ip-in-nm_utils_ipadd.patch b/0008-libnm-core-properly-handle-NULL-ip-in-nm_utils_ipadd.patch deleted file mode 100644 index 893a85d..0000000 --- a/0008-libnm-core-properly-handle-NULL-ip-in-nm_utils_ipadd.patch +++ /dev/null @@ -1,32 +0,0 @@ -From fa2b8fdbdfabaee292cf63adcc53ae026e6afbe3 Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Wed, 22 Jul 2015 13:06:29 +0200 -Subject: [PATCH 08/11] libnm-core: properly handle %NULL @ip in - nm_utils_ipaddr_valid() - -A is_valid() function should just accept NULL as input and -return "invalid". It certainly should not crash. - -Fixes: 21c8a6b20effbe1e689505a0cbb23594be06068c -(cherry picked from commit 2b55de856027657e567914361f501bbfbca050b4) ---- - libnm-core/nm-utils.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c -index 6a7ed61..3fb8676 100644 ---- a/libnm-core/nm-utils.c -+++ b/libnm-core/nm-utils.c -@@ -3353,6 +3353,9 @@ nm_utils_ipaddr_valid (int family, const char *ip) - - g_return_val_if_fail (family == AF_INET || family == AF_INET6 || family == AF_UNSPEC, FALSE); - -+ if (!ip) -+ return FALSE; -+ - if (family == AF_UNSPEC) - family = strchr (ip, ':') ? AF_INET6 : AF_INET; - --- -2.4.3 - diff --git a/0009-libnm-core-fix-nm-setting-ip-config.c-valid_ip-to-ha.patch b/0009-libnm-core-fix-nm-setting-ip-config.c-valid_ip-to-ha.patch deleted file mode 100644 index 0c16a20..0000000 --- a/0009-libnm-core-fix-nm-setting-ip-config.c-valid_ip-to-ha.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 89b630ff32f9111b3ed518c413b576adbf746e78 Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Wed, 22 Jul 2015 13:05:31 +0200 -Subject: [PATCH 09/11] libnm-core: fix nm-setting-ip-config.c:valid_ip() to - handle %NULL argument - -We call valid_ip() from nm_ip_route_new() to check whether an untrusted string -is a valid ip address. Properly handle %NULL argument. - -Fixes: 21c8a6b20effbe1e689505a0cbb23594be06068c -(cherry picked from commit 93425686947127e5bfc2d00521b35c4b75340ee5) ---- - libnm-core/nm-setting-ip-config.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/libnm-core/nm-setting-ip-config.c b/libnm-core/nm-setting-ip-config.c -index e6f0401..2e8d0c8 100644 ---- a/libnm-core/nm-setting-ip-config.c -+++ b/libnm-core/nm-setting-ip-config.c -@@ -74,6 +74,11 @@ canonicalize_ip (int family, const char *ip, gboolean null_any) - static gboolean - valid_ip (int family, const char *ip, GError **error) - { -+ if (!ip) { -+ g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_FAILED, -+ family == AF_INET ? _("Missing IPv4 address") : _("Missing IPv6 address'")); -+ return FALSE; -+ } - if (!nm_utils_ipaddr_valid (family, ip)) { - g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_FAILED, - family == AF_INET ? _("Invalid IPv4 address '%s'") : _("Invalid IPv6 address '%s"), --- -2.4.3 - diff --git a/0010-libnm-core-0.0.0.0-is-a-valid-gateway-too.patch b/0010-libnm-core-0.0.0.0-is-a-valid-gateway-too.patch deleted file mode 100644 index 3d34591..0000000 --- a/0010-libnm-core-0.0.0.0-is-a-valid-gateway-too.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 2958b3d1afc6c23757893837b0b4353df889794d Mon Sep 17 00:00:00 2001 -From: Lubomir Rintel -Date: Tue, 21 Jul 2015 23:07:34 +0200 -Subject: [PATCH 10/11] libnm-core: 0.0.0.0 is a valid gateway too - -It makes sense for point-to point links. - -https://bugzilla.redhat.com/show_bug.cgi?id=1244483 -(cherry picked from commit f14fd048ff84794f72892a1fe0209d56552b0e6e) ---- - libnm-core/nm-setting-ip-config.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libnm-core/nm-setting-ip-config.c b/libnm-core/nm-setting-ip-config.c -index 2e8d0c8..d637b5e 100644 ---- a/libnm-core/nm-setting-ip-config.c -+++ b/libnm-core/nm-setting-ip-config.c -@@ -2017,7 +2017,7 @@ set_property (GObject *object, guint prop_id, - gateway = g_value_get_string (value); - g_return_if_fail (!gateway || nm_utils_ipaddr_valid (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), gateway)); - g_free (priv->gateway); -- priv->gateway = canonicalize_ip (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), gateway, TRUE); -+ priv->gateway = canonicalize_ip (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), gateway, gateway == NULL); - break; - case PROP_ROUTES: - g_ptr_array_unref (priv->routes); --- -2.4.3 - diff --git a/0011-libnm-core-don-t-assert-against-non-NULL-ip-argument.patch b/0011-libnm-core-don-t-assert-against-non-NULL-ip-argument.patch deleted file mode 100644 index baf65ff..0000000 --- a/0011-libnm-core-don-t-assert-against-non-NULL-ip-argument.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 9cfdbf6a0655ce93c1aaf25ed8c571636bc4236e Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Wed, 22 Jul 2015 13:37:45 +0200 -Subject: [PATCH 11/11] libnm-core: don't assert against non-NULL @ip argument - to canonicalize_ip() - -Remove an assertion in canonicalize_ip() to assert that either a -non-NULL @ip is given, or @null_any is TRUE. - -The condition of the assert is not easy to understand without context. -Instead the caller should already handle %NULL properly. - -All callers that pass @null_any=FALSE to canonicalize_ip(), already assert -that the argument is not %NULL. With the exception of nm_ip_route_new() -which however checks for a valid @dest early on. - -(cherry picked from commit 7f129b976cf175ef7d3d75227761d14afad69dd3) ---- - libnm-core/nm-setting-ip-config.c | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -diff --git a/libnm-core/nm-setting-ip-config.c b/libnm-core/nm-setting-ip-config.c -index d637b5e..4b73d5f 100644 ---- a/libnm-core/nm-setting-ip-config.c -+++ b/libnm-core/nm-setting-ip-config.c -@@ -53,10 +53,8 @@ canonicalize_ip (int family, const char *ip, gboolean null_any) - char addr_str[NM_UTILS_INET_ADDRSTRLEN]; - int ret; - -- if (!ip) { -- g_return_val_if_fail (null_any == TRUE, NULL); -+ if (!ip) - return NULL; -- } - - ret = inet_pton (family, ip, addr_bytes); - g_return_val_if_fail (ret == 1, NULL); -@@ -2017,7 +2015,7 @@ set_property (GObject *object, guint prop_id, - gateway = g_value_get_string (value); - g_return_if_fail (!gateway || nm_utils_ipaddr_valid (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), gateway)); - g_free (priv->gateway); -- priv->gateway = canonicalize_ip (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), gateway, gateway == NULL); -+ priv->gateway = canonicalize_ip (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), gateway, FALSE); - break; - case PROP_ROUTES: - g_ptr_array_unref (priv->routes); --- -2.4.3 - diff --git a/NetworkManager.spec b/NetworkManager.spec index 8f6d10c..72b2da5 100644 --- a/NetworkManager.spec +++ b/NetworkManager.spec @@ -86,23 +86,6 @@ Source4: 20-connectivity-fedora.conf # Not upstream. Patch0: 0000-explain-dns1-dns2.patch -# https://bugzilla.redhat.com/show_bug.cgi?id=1244048 -Patch1: 0001-docs-fix-a-copy-paste-error-in-description-of-VLAN-f.patch -Patch2: 0002-cli-fix-verifying-flag-based-properties-rh-1244048.patch - -# https://bugzilla.redhat.com/show_bug.cgi?id=1245648 -Patch3: 0001-core-detect-route-metric-when-creating-nm-generated-.patch -Patch4: 0002-core-fix-handling-route-metric-for-nm_ip4_config_mer.patch -Patch5: 0003-device-trivial-rename-private-field-in-NMDevicePriva.patch -Patch6: 0004-device-move-setting-v4_commit_first_time-v6_commit_f.patch -Patch7: 0005-device-always-assume-default-route-for-generate-assu.patch -Patch8: 0006-default-route-manager-pick-up-platform-changes-after.patch -Patch9: 0007-ip4-config-0.0.0.0-is-a-valid-gateway-too.patch -Patch10: 0008-libnm-core-properly-handle-NULL-ip-in-nm_utils_ipadd.patch -Patch11: 0009-libnm-core-fix-nm-setting-ip-config.c-valid_ip-to-ha.patch -Patch12: 0010-libnm-core-0.0.0.0-is-a-valid-gateway-too.patch -Patch13: 0011-libnm-core-don-t-assert-against-non-NULL-ip-argument.patch - BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %if 0%{?fedora} && 0%{?fedora} < 20 @@ -381,24 +364,6 @@ by nm-connection-editor and nm-applet in a non-graphical environment. %patch0 -p1 -b .0000-explain-dns1-dns2.orig -# https://bugzilla.redhat.com/show_bug.cgi?id=1244048 -%patch1 -p1 -b .docs-fix-a-copy-paste-error-in-description-of-VLAN-f.patch -%patch2 -p1 -b .cli-fix-verifying-flag-based-properties-rh-1244048.patch - -# https://bugzilla.redhat.com/show_bug.cgi?id=1245648 -%patch3 -p1 -b .core-detect-route-metric-when-creating-nm-generated- -%patch4 -p1 -b .core-fix-handling-route-metric-for-nm_ip4_config_mer -%patch5 -p1 -b .device-trivial-rename-private-field-in-NMDevicePriva -%patch6 -p1 -b .device-move-setting-v4_commit_first_time-v6_commit_f -%patch7 -p1 -b .device-always-assume-default-route-for-generate-assu -%patch8 -p1 -b .default-route-manager-pick-up-platform-changes-after -%patch9 -p1 -b .ip4-config-0.0.0.0-is-a-valid-gateway-too -%patch10 -p1 -b .libnm-core-properly-handle-NULL-ip-in-nm_utils_ipadd -%patch11 -p1 -b .libnm-core-fix-nm-setting-ip-config.c-valid_ip-to-ha -%patch12 -p1 -b .libnm-core-0.0.0.0-is-a-valid-gateway-too -%patch13 -p1 -b .libnm-core-don-t-assert-against-non-NULL-ip-argument - - %build %if %{regen_docs}