about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2020-05-30 00:23:54 +0200
committerMichael Biebl <biebl@debian.org>2020-05-30 00:23:54 +0200
commit45e8e1149027529194982212c804c0468aa01d98 (patch)
treef3acb5e5824dd8b13f1a48bb516b0c92c5f052fd /src
parentd460892bbfece74fb6d3cd846bf6ef548290be41 (diff)
New upstream version 1.24.2 upstream/1.24.2
Diffstat (limited to 'src')
-rw-r--r--src/devices/nm-device-ip-tunnel.c35
-rw-r--r--src/devices/nm-device.c13
-rw-r--r--src/nm-active-connection.c4
-rw-r--r--src/platform/nm-linux-platform.c24
-rw-r--r--src/platform/nm-platform.h4
-rw-r--r--src/platform/tests/test-common.c2
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c14
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.c4
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.h2
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c12
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-802-1x-password-raw2
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wired-802-1x-password-raw1
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c3
13 files changed, 93 insertions, 27 deletions
diff --git a/src/devices/nm-device-ip-tunnel.c b/src/devices/nm-device-ip-tunnel.c
index 0a33c82e..2c9a6050 100644
--- a/src/devices/nm-device-ip-tunnel.c
+++ b/src/devices/nm-device-ip-tunnel.c
@@ -667,7 +667,8 @@ create_and_realize (NMDevice *device,
 
 	mode = nm_setting_ip_tunnel_get_mode (s_ip_tunnel);
 
-	if (   nm_device_hw_addr_get_cloned (device,
+	if (   _nm_ip_tunnel_mode_is_layer2 (mode)
+	    && nm_device_hw_addr_get_cloned (device,
 	                                     connection,
 	                                     FALSE,
 	                                     &hwaddr,
@@ -686,13 +687,6 @@ create_and_realize (NMDevice *device,
 			g_return_val_if_reached (FALSE);
 		}
 
-		if (NM_IN_SET (mode, NM_IP_TUNNEL_MODE_GRE)) {
-			g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED,
-			             "Invalid hardware address '%s' for tunnel type",
-			             hwaddr);
-			return FALSE;
-		}
-
 		mac_address_valid = TRUE;
 	}
 
@@ -849,7 +843,10 @@ create_and_realize (NMDevice *device,
 			lnk_ip6tnl.is_tap = (mode == NM_IP_TUNNEL_MODE_IP6GRETAP);
 
 			r = nm_platform_link_ip6gre_add (nm_device_get_platform (device),
-			                                 iface, &lnk_ip6tnl, out_plink);
+			                                 iface,
+			                                 mac_address_valid ? mac_address : NULL,
+			                                 mac_address_valid ? ETH_ALEN : 0,
+			                                 &lnk_ip6tnl, out_plink);
 		} else {
 			lnk_ip6tnl.proto = nm_setting_ip_tunnel_get_mode (s_ip_tunnel) == NM_IP_TUNNEL_MODE_IPIP6
 			                       ? IPPROTO_IPIP
@@ -929,6 +926,23 @@ can_reapply_change (NMDevice *device,
 	                                         error);
 }
 
+static NMActStageReturn
+act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
+{
+	NMDeviceIPTunnel *self = NM_DEVICE_IP_TUNNEL (device);
+	NMDeviceIPTunnelPrivate *priv = NM_DEVICE_IP_TUNNEL_GET_PRIVATE (self);
+
+	if (   _nm_ip_tunnel_mode_is_layer2 (priv->mode)
+	    && !nm_device_hw_addr_set_cloned (device,
+	                                      nm_device_get_applied_connection (device),
+	                                      FALSE)) {
+		*out_failure_reason = NM_DEVICE_STATE_REASON_CONFIG_FAILED;
+		return NM_ACT_STAGE_RETURN_FAILURE;
+	}
+
+	return NM_ACT_STAGE_RETURN_SUCCESS;
+}
+
 /*****************************************************************************/
 
 static void
@@ -1078,7 +1092,8 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *klass)
 	                                                        NM_LINK_TYPE_IPIP,
 	                                                        NM_LINK_TYPE_SIT);
 
-	device_class->act_stage1_prepare_set_hwaddr_ethernet = TRUE;
+
+	device_class->act_stage1_prepare = act_stage1_prepare;
 	device_class->link_changed = link_changed;
 	device_class->can_reapply_change = can_reapply_change;
 	device_class->complete_connection = complete_connection;
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 8a22cba8..76c24a38 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -10879,6 +10879,7 @@ fw_change_zone (NMDevice *self)
 	NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
 	NMConnection *applied_connection;
 	NMSettingConnection *s_con;
+	const char *zone;
 
 	nm_assert (priv->fw_state >= FIREWALL_STATE_INITIALIZED);
 
@@ -10896,9 +10897,19 @@ fw_change_zone (NMDevice *self)
 	if (G_UNLIKELY (!priv->fw_mgr))
 		priv->fw_mgr = g_object_ref (nm_firewall_manager_get ());
 
+	zone = nm_setting_connection_get_zone (s_con);
+#if WITH_FIREWALLD_ZONE
+	if (!zone || zone[0] == '\0') {
+		if (   nm_streq0 (nm_device_get_effective_ip_config_method (self, AF_INET),
+		                  NM_SETTING_IP4_CONFIG_METHOD_SHARED)
+		    || nm_streq0 (nm_device_get_effective_ip_config_method (self, AF_INET6),
+		                  NM_SETTING_IP6_CONFIG_METHOD_SHARED))
+			zone = "nm-shared";
+	}
+#endif
 	priv->fw_call = nm_firewall_manager_add_or_change_zone (priv->fw_mgr,
 	                                                        nm_device_get_ip_iface (self),
-	                                                        nm_setting_connection_get_zone (s_con),
+	                                                        zone,
 	                                                        FALSE, /* change zone */
 	                                                        fw_change_zone_cb,
 	                                                        self);
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c
index 63dd8910..f1bb1ede 100644
--- a/src/nm-active-connection.c
+++ b/src/nm-active-connection.c
@@ -996,7 +996,9 @@ parent_state_cb (NMActiveConnection *parent_ac,
 		return;
 
 	unwatch_parent (self, TRUE);
-	g_signal_emit (self, signals[PARENT_ACTIVE], 0, parent_ac);
+
+	if (parent_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED)
+		g_signal_emit (self, signals[PARENT_ACTIVE], 0, parent_ac);
 }
 
 static void
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 014cca71..a721fc7c 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -726,9 +726,9 @@ _link_type_from_rtnl_type (const char *name) \
 	}
 
 	{
-		unsigned imin = 0;
-		unsigned imax = (G_N_ELEMENTS (LIST) - 1);
-		unsigned imid = (G_N_ELEMENTS (LIST) - 1) / 2;
+		int imin = 0;
+		int imax = (G_N_ELEMENTS (LIST) - 1);
+		int imid = (G_N_ELEMENTS (LIST) - 1) / 2;
 
 		for (;;) {
 			const int cmp = strcmp (link_descs[LIST[imid]].rtnl_type, name);
@@ -737,14 +737,14 @@ _link_type_from_rtnl_type (const char *name) \
 				return LIST[imid];
 
 			if (cmp < 0)
-				imin = imid + 1u;
+				imin = imid + 1;
 			else
-				imax = imid - 1u;
+				imax = imid - 1;
 
 			if (G_UNLIKELY (imin > imax))
 				return NM_LINK_TYPE_NONE;
 
-			imid = (imin + imax) / 2u;
+			imid = (imin + imax) / 2;
 		}
 	}
 }
@@ -787,9 +787,9 @@ _link_type_from_devtype (const char *name) \
 	}
 
 	{
-		unsigned imin = 0;
-		unsigned imax = (G_N_ELEMENTS (LIST) - 1);
-		unsigned imid = (G_N_ELEMENTS (LIST) - 1) / 2;
+		int imin = 0;
+		int imax = (G_N_ELEMENTS (LIST) - 1);
+		int imid = (G_N_ELEMENTS (LIST) - 1) / 2;
 
 		for (;;) {
 			const int cmp = strcmp (link_descs[LIST[imid]].devtype, name);
@@ -798,14 +798,14 @@ _link_type_from_devtype (const char *name) \
 				return LIST[imid];
 
 			if (cmp < 0)
-				imin = imid + 1u;
+				imin = imid + 1;
 			else
-				imax = imid - 1u;
+				imax = imid - 1;
 
 			if (G_UNLIKELY (imin > imax))
 				return NM_LINK_TYPE_NONE;
 
-			imid = (imin + imax) / 2u;
+			imid = (imin + imax) / 2;
 		}
 	}
 }
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index 7edaaf58..7d10d909 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -1511,13 +1511,15 @@ nm_platform_link_ip6tnl_add (NMPlatform *self,
 static inline int
 nm_platform_link_ip6gre_add (NMPlatform *self,
                              const char *name,
+                             const void *address,
+                             size_t address_len,
                              const NMPlatformLnkIp6Tnl *props,
                              const NMPlatformLink **out_link)
 {
 	g_return_val_if_fail (props, -NME_BUG);
 	g_return_val_if_fail (props->is_gre, -NME_BUG);
 
-	return nm_platform_link_add (self, props->is_tap ? NM_LINK_TYPE_IP6GRETAP : NM_LINK_TYPE_IP6GRE, name, 0, NULL, 0, props, out_link);
+	return nm_platform_link_add (self, props->is_tap ? NM_LINK_TYPE_IP6GRETAP : NM_LINK_TYPE_IP6GRE, name, 0, address, address_len, props, out_link);
 }
 
 static inline int
diff --git a/src/platform/tests/test-common.c b/src/platform/tests/test-common.c
index f393ae93..f28dfa3a 100644
--- a/src/platform/tests/test-common.c
+++ b/src/platform/tests/test-common.c
@@ -1380,7 +1380,7 @@ nmtstp_link_ip6gre_add (NMPlatform *platform,
 			                                      100);
 		}
 	} else
-		success = NMTST_NM_ERR_SUCCESS (nm_platform_link_ip6gre_add (platform, name, lnk, &pllink));
+		success = NMTST_NM_ERR_SUCCESS (nm_platform_link_ip6gre_add (platform, name, NULL, 0, lnk, &pllink));
 
 	_assert_pllink (platform, success, pllink, name, lnk->is_tap ? NM_LINK_TYPE_IP6GRETAP : NM_LINK_TYPE_IP6GRE);
 
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 7adafb58..338c22ed 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
@@ -3682,11 +3682,25 @@ next:
 	timeout = svGetValueInt64 (ifcfg, "IEEE_8021X_AUTH_TIMEOUT", 10, 0, G_MAXINT32, 0);
 	g_object_set (s_8021x, NM_SETTING_802_1X_AUTH_TIMEOUT, (int) timeout, NULL);
 
+	nm_clear_g_free (&value);
+	v = svGetValueStr (ifcfg, "IEEE_8021X_CA_PATH", &value);
+	g_object_set (s_8021x, NM_SETTING_802_1X_CA_PATH, v, NULL);
+
+	nm_clear_g_free (&value);
+	v = svGetValueStr (ifcfg, "IEEE_8021X_PHASE2_CA_PATH", &value);
+	g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_CA_PATH, v, NULL);
+
 	g_object_set (s_8021x,
 	              NM_SETTING_802_1X_OPTIONAL,
 	              svGetValueBoolean (ifcfg, "IEEE_8021X_OPTIONAL", FALSE),
 	              NULL);
 
+	_secret_set_from_ifcfg (s_8021x,
+	                        ifcfg,
+	                        keys_ifcfg,
+	                        "IEEE_8021X_PIN",
+	                        NM_SETTING_802_1X_PIN);
+
 	return g_steal_pointer (&s_8021x);
 }
 
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.c
index d3243617..15a772bc 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.c
@@ -812,6 +812,7 @@ const NMSIfcfgKeyTypeInfo nms_ifcfg_well_known_keys[] = {
 	_KEY_TYPE ("IEEE_8021X_CA_CERT",                          NMS_IFCFG_KEY_TYPE_IS_PLAIN ),
 	_KEY_TYPE ("IEEE_8021X_CA_CERT_PASSWORD",                 NMS_IFCFG_KEY_TYPE_IS_PLAIN ),
 	_KEY_TYPE ("IEEE_8021X_CA_CERT_PASSWORD_FLAGS",           NMS_IFCFG_KEY_TYPE_IS_PLAIN ),
+	_KEY_TYPE ("IEEE_8021X_CA_PATH",                          NMS_IFCFG_KEY_TYPE_IS_PLAIN ),
 	_KEY_TYPE ("IEEE_8021X_CLIENT_CERT",                      NMS_IFCFG_KEY_TYPE_IS_PLAIN ),
 	_KEY_TYPE ("IEEE_8021X_CLIENT_CERT_PASSWORD",             NMS_IFCFG_KEY_TYPE_IS_PLAIN ),
 	_KEY_TYPE ("IEEE_8021X_CLIENT_CERT_PASSWORD_FLAGS",       NMS_IFCFG_KEY_TYPE_IS_PLAIN ),
@@ -840,9 +841,12 @@ const NMSIfcfgKeyTypeInfo nms_ifcfg_well_known_keys[] = {
 	_KEY_TYPE ("IEEE_8021X_PEAP_VERSION",                     NMS_IFCFG_KEY_TYPE_IS_PLAIN ),
 	_KEY_TYPE ("IEEE_8021X_PHASE1_AUTH_FLAGS",                NMS_IFCFG_KEY_TYPE_IS_PLAIN ),
 	_KEY_TYPE ("IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES",        NMS_IFCFG_KEY_TYPE_IS_PLAIN ),
+	_KEY_TYPE ("IEEE_8021X_PHASE2_CA_PATH",                   NMS_IFCFG_KEY_TYPE_IS_PLAIN ),
 	_KEY_TYPE ("IEEE_8021X_PHASE2_DOMAIN_MATCH",              NMS_IFCFG_KEY_TYPE_IS_PLAIN ),
 	_KEY_TYPE ("IEEE_8021X_PHASE2_DOMAIN_SUFFIX_MATCH",       NMS_IFCFG_KEY_TYPE_IS_PLAIN ),
 	_KEY_TYPE ("IEEE_8021X_PHASE2_SUBJECT_MATCH",             NMS_IFCFG_KEY_TYPE_IS_PLAIN ),
+	_KEY_TYPE ("IEEE_8021X_PIN",                              NMS_IFCFG_KEY_TYPE_IS_PLAIN ),
+	_KEY_TYPE ("IEEE_8021X_PIN_FLAGS",                        NMS_IFCFG_KEY_TYPE_IS_PLAIN ),
 	_KEY_TYPE ("IEEE_8021X_PRIVATE_KEY",                      NMS_IFCFG_KEY_TYPE_IS_PLAIN ),
 	_KEY_TYPE ("IEEE_8021X_PRIVATE_KEY_PASSWORD",             NMS_IFCFG_KEY_TYPE_IS_PLAIN ),
 	_KEY_TYPE ("IEEE_8021X_PRIVATE_KEY_PASSWORD_FLAGS",       NMS_IFCFG_KEY_TYPE_IS_PLAIN ),
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.h b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.h
index 056d03fa..6c31b269 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.h
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.h
@@ -33,7 +33,7 @@ typedef struct {
 	NMSIfcfgKeyTypeFlags key_flags;
 } NMSIfcfgKeyTypeInfo;
 
-extern const NMSIfcfgKeyTypeInfo nms_ifcfg_well_known_keys[232];
+extern const NMSIfcfgKeyTypeInfo nms_ifcfg_well_known_keys[236];
 
 const NMSIfcfgKeyTypeInfo *nms_ifcfg_well_known_key_find_info (const char *key, gssize *out_idx);
 
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 a0797fdc..e126c77f 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
@@ -515,6 +515,18 @@ write_8021x_setting (NMConnection *connection,
 	                             "IEEE_8021X_OPTIONAL",
 	                             nm_setting_802_1x_get_optional (s_8021x));
 
+	svSetValue (ifcfg, "IEEE_8021X_CA_PATH",
+	            nm_setting_802_1x_get_ca_path (s_8021x));
+	svSetValue (ifcfg, "IEEE_8021X_PHASE2_CA_PATH",
+	            nm_setting_802_1x_get_phase2_ca_path (s_8021x));
+
+	set_secret (ifcfg,
+	            secrets,
+	            "IEEE_8021X_PIN",
+	            nm_setting_802_1x_get_pin (s_8021x),
+	            "IEEE_8021X_PIN_FLAGS",
+	            nm_setting_802_1x_get_pin_flags (s_8021x));
+
 	if (!write_8021x_certs (s_8021x, secrets, blobs, FALSE, ifcfg, error))
 		return FALSE;
 
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-802-1x-password-raw b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-802-1x-password-raw
index 181ffbef..a5434434 100644
--- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-802-1x-password-raw
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-802-1x-password-raw
@@ -11,3 +11,5 @@ IEEE_8021X_IDENTITY="Bill Smith"
 IEEE_8021X_CA_CERT=test_ca_cert.pem
 IEEE_8021X_INNER_AUTH_METHODS=EAP-GTC
 IEEE_8021X_PASSWORD_RAW=0408151623420001
+#IEEE_8021X_PIN=hallo1
+IEEE_8021X_PIN_FLAGS=0
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wired-802-1x-password-raw b/src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wired-802-1x-password-raw
new file mode 100644
index 00000000..d29a4289
--- /dev/null
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wired-802-1x-password-raw
@@ -0,0 +1 @@
+IEEE_8021X_PIN=hallo2
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 efa9ea9b..ffedff01 100644
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
@@ -2037,6 +2037,9 @@ test_read_write_802_1x_password_raw (void)
 	                 ==,
 	                 NM_SETTING_SECRET_FLAG_NONE);
 
+	g_assert_cmpstr (nm_setting_802_1x_get_pin (s_8021x), ==, "hallo2");
+	g_assert_cmpint (nm_setting_802_1x_get_pin_flags (s_8021x), ==, NM_SETTING_SECRET_FLAG_NONE);
+
 	_writer_new_connection (connection,
 	                        TEST_SCRATCH_DIR,
 	                        &testfile);