summary refs log tree commit diff
path: root/src/platform/nm-platform.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2019-12-18 18:29:24 +0100
committerMichael Biebl <biebl@debian.org>2019-12-18 18:29:24 +0100
commit28028b26b3371756811e95d894f709f4b1207c00 (patch)
tree6fe7316fd743b51042db47601a8ef8814b3134ac /src/platform/nm-platform.c
parente22609983008e1a669196ad64ba3a59ae8c76e0d (diff)
New upstream version 1.22.0 upstream/1.22.0
Diffstat (limited to 'src/platform/nm-platform.c')
-rw-r--r--src/platform/nm-platform.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 0a7acba9..6795dde7 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -1,19 +1,5 @@
-/* nm-platform.c - Handle runtime kernel networking configuration
- *
- * 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, 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.
- *
+// SPDX-License-Identifier: GPL-2.0+
+/*
  * Copyright (C) 2012 - 2018 Red Hat, Inc.
  */
 
@@ -4152,11 +4138,12 @@ nm_platform_ip4_address_sync (NMPlatform *self,
 		}
 	}
 	ip4_addr_subnets_destroy_index (plat_subnets, plat_addresses);
-	ip4_addr_subnets_destroy_index (known_subnets, known_addresses);
 
 	if (!known_addresses)
 		return TRUE;
 
+	ip4_addr_subnets_destroy_index (known_subnets, known_addresses);
+
 	ifa_flags =   nm_platform_kernel_support_get (NM_PLATFORM_KERNEL_SUPPORT_TYPE_EXTENDED_IFA_FLAGS)
 	            ? IFA_F_NOPREFIXROUTE
 	            : 0;
@@ -6097,13 +6084,14 @@ nm_platform_ip4_address_to_string (const NMPlatformIP4Address *address, char *bu
 	str_time_p = _lifetime_summary_to_string (now, address->timestamp, address->preferred, address->lifetime, str_time, sizeof (str_time));
 
 	g_snprintf (buf, len,
-	            "%s/%d lft %s pref %s%s%s%s%s%s src %s",
+	            "%s/%d lft %s pref %s%s%s%s%s%s src %s%s",
 	            s_address, address->plen, str_lft_p, str_pref_p, str_time_p,
 	            str_peer ?: "",
 	            str_dev,
 	            _to_string_ifa_flags (address->n_ifa_flags, s_flags, sizeof (s_flags)),
 	            str_label,
-	            nmp_utils_ip_config_source_to_string (address->addr_source, s_source, sizeof (s_source)));
+	            nmp_utils_ip_config_source_to_string (address->addr_source, s_source, sizeof (s_source)),
+	            address->external ? " ext" : "");
 	g_free (str_peer);
 	return buf;
 }
@@ -6204,12 +6192,13 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address, char *bu
 	str_time_p = _lifetime_summary_to_string (now, address->timestamp, address->preferred, address->lifetime, str_time, sizeof (str_time));
 
 	g_snprintf (buf, len,
-	            "%s/%d lft %s pref %s%s%s%s%s src %s",
+	            "%s/%d lft %s pref %s%s%s%s%s src %s%s",
 	            s_address, address->plen, str_lft_p, str_pref_p, str_time_p,
 	            str_peer ?: "",
 	            str_dev,
 	            _to_string_ifa_flags (address->n_ifa_flags, s_flags, sizeof (s_flags)),
-	            nmp_utils_ip_config_source_to_string (address->addr_source, s_source, sizeof (s_source)));
+	            nmp_utils_ip_config_source_to_string (address->addr_source, s_source, sizeof (s_source)),
+	            address->external ? " ext" : "");
 	g_free (str_peer);
 	return buf;
 }
@@ -7315,7 +7304,8 @@ nm_platform_ip4_address_hash_update (const NMPlatformIP4Address *obj, NMHashStat
 	                     obj->n_ifa_flags,
 	                     obj->plen,
 	                     obj->address,
-	                     obj->peer_address);
+	                     obj->peer_address,
+	                     NM_HASH_COMBINE_BOOLS (guint8, obj->external));
 	nm_hash_update_strarr (h, obj->label);
 }
 
@@ -7333,6 +7323,7 @@ nm_platform_ip4_address_cmp (const NMPlatformIP4Address *a, const NMPlatformIP4A
 	NM_CMP_FIELD (a, b, preferred);
 	NM_CMP_FIELD (a, b, n_ifa_flags);
 	NM_CMP_FIELD_STR (a, b, label);
+	NM_CMP_FIELD_UNSAFE (a, b, external);
 	return 0;
 }
 
@@ -7348,7 +7339,8 @@ nm_platform_ip6_address_hash_update (const NMPlatformIP6Address *obj, NMHashStat
 	                     obj->n_ifa_flags,
 	                     obj->plen,
 	                     obj->address,
-	                     obj->peer_address);
+	                     obj->peer_address,
+	                     NM_HASH_COMBINE_BOOLS (guint8, obj->external));
 }
 
 int
@@ -7368,6 +7360,7 @@ nm_platform_ip6_address_cmp (const NMPlatformIP6Address *a, const NMPlatformIP6A
 	NM_CMP_FIELD (a, b, lifetime);
 	NM_CMP_FIELD (a, b, preferred);
 	NM_CMP_FIELD (a, b, n_ifa_flags);
+	NM_CMP_FIELD_UNSAFE (a, b, external);
 	return 0;
 }