summary refs log tree commit diff
path: root/src/devices
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2019-09-30 13:49:20 +0200
committerMichael Biebl <biebl@debian.org>2019-09-30 13:49:20 +0200
commitd0425f68f7ee83a1dc5a6ad3688627c1b472a58b (patch)
tree978af126d9871da5f3bb07ad4180b30cefa5feb6 /src/devices
parent555dfa331e295a3a687a7cc6870e1349ffed8f26 (diff)
New upstream version 1.20.4 upstream/1.20.4
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/nm-device.c32
-rw-r--r--src/devices/wifi/nm-device-iwd.c1
-rw-r--r--src/devices/wifi/nm-device-olpc-mesh.c53
-rw-r--r--src/devices/wifi/nm-device-wifi-p2p.c1
-rw-r--r--src/devices/wifi/nm-device-wifi.c1
5 files changed, 64 insertions, 24 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 823cf48a..67e23b8f 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -3933,12 +3933,18 @@ device_link_changed (NMDevice *self)
 	if (priv->up && (!was_up || seen_down)) {
 		/* the link was down and just came up. That happens for example, while changing MTU.
 		 * We must restore IP configuration. */
-		if (!ip_config_merge_and_apply (self, AF_INET, TRUE))
-			_LOGW (LOGD_IP4, "failed applying IP4 config after link comes up again");
+		if (NM_IN_SET (priv->ip_state_4, NM_DEVICE_IP_STATE_CONF,
+		                                 NM_DEVICE_IP_STATE_DONE)) {
+			if (!ip_config_merge_and_apply (self, AF_INET, TRUE))
+				_LOGW (LOGD_IP4, "failed applying IP4 config after link comes up again");
+		}
 
 		priv->linklocal6_dad_counter = 0;
-		if (!ip_config_merge_and_apply (self, AF_INET6, TRUE))
-			_LOGW (LOGD_IP6, "failed applying IP6 config after link comes up again");
+		if (NM_IN_SET (priv->ip_state_6, NM_DEVICE_IP_STATE_CONF,
+		                                 NM_DEVICE_IP_STATE_DONE)) {
+			if (!ip_config_merge_and_apply (self, AF_INET6, TRUE))
+				_LOGW (LOGD_IP6, "failed applying IP6 config after link comes up again");
+		}
 	}
 
 	if (update_unmanaged_specs)
@@ -7733,8 +7739,8 @@ dhcp4_dad_cb (NMDevice *self, NMIP4Config **configs, gboolean success)
 	NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
 
 	if (success) {
-		nm_dhcp_client_accept (priv->dhcp4.client, NULL);
-		nm_device_activate_schedule_ip_config_result (self, AF_INET, NM_IP_CONFIG_CAST (configs[1]));
+		nm_device_activate_schedule_ip_config_result (self, AF_INET,
+		                                              NM_IP_CONFIG_CAST (configs[1]));
 	} else {
 		nm_dhcp_client_decline (priv->dhcp4.client, "Address conflict detected", NULL);
 		nm_device_ip_method_failed (self, AF_INET,
@@ -9365,7 +9371,7 @@ _commit_mtu (NMDevice *self, const NMIP4Config *config)
 		s_ip6 = nm_device_get_applied_setting (self, NM_TYPE_SETTING_IP6_CONFIG);
 		if (   s_ip6
 		    && !NM_IN_STRSET (nm_setting_ip_config_get_method (s_ip6),
-		                      NM_SETTING_IP6_CONFIG_METHOD_IGNORE
+		                      NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
 		                      NM_SETTING_IP6_CONFIG_METHOD_DISABLED)) {
 			/* the interface has IPv6 enabled. The MTU with IPv6 cannot be smaller
 			 * then 1280.
@@ -10722,6 +10728,18 @@ activate_stage5_ip_config_result_4 (NMDevice *self)
 		}
 	}
 
+	if (priv->dhcp4.client) {
+		gs_free_error GError *error = NULL;
+
+		if (!nm_dhcp_client_accept (priv->dhcp4.client, &error)) {
+			_LOGW (LOGD_DHCP4,
+			       "Activation: Stage 5 of 5 (IPv4 Commit) error accepting lease: %s",
+			       error->message);
+			nm_device_ip_method_failed (self, AF_INET, NM_DEVICE_STATE_REASON_DHCP_ERROR);
+			return;
+		}
+	}
+
 	/* If IPv4 wasn't the first to complete, and DHCP was used, then ensure
 	 * dispatcher scripts get the DHCP lease information.
 	 */
diff --git a/src/devices/wifi/nm-device-iwd.c b/src/devices/wifi/nm-device-iwd.c
index 9cfe5f70..6ef9ef94 100644
--- a/src/devices/wifi/nm-device-iwd.c
+++ b/src/devices/wifi/nm-device-iwd.c
@@ -2061,6 +2061,7 @@ can_reapply_change (NMDevice *device,
 		return nm_device_hash_check_invalid_keys (diffs,
 		                                          NM_SETTING_WIRELESS_SETTING_NAME,
 		                                          error,
+		                                          NM_SETTING_WIRELESS_SEEN_BSSIDS, /* ignored */
 		                                          NM_SETTING_WIRELESS_MTU); /* reapplied with IP config */
 	}
 
diff --git a/src/devices/wifi/nm-device-olpc-mesh.c b/src/devices/wifi/nm-device-olpc-mesh.c
index 3c865c55..aa50c420 100644
--- a/src/devices/wifi/nm-device-olpc-mesh.c
+++ b/src/devices/wifi/nm-device-olpc-mesh.c
@@ -82,9 +82,9 @@ get_autoconnect_allowed (NMDevice *device)
 	NMDeviceOlpcMesh *self = NM_DEVICE_OLPC_MESH (device);
 	NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (self);
 
-	/* We shall always have a companion if we're >= DISCONENCTED, and this
-	 * ought not be called until then. */
-	g_return_val_if_fail (priv->companion, FALSE);
+	/* We can't even connect if we don't have a companion yet. */
+	if (!priv->companion)
+		return FALSE;
 
 	/* We must not attempt to autoconnect when the companion is connected or
 	 * connecting, * because we'd tear down its connection. */
@@ -174,17 +174,28 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
 	return NM_ACT_STAGE_RETURN_SUCCESS;
 }
 
-static void
+static gboolean
 _mesh_set_channel (NMDeviceOlpcMesh *self, guint32 channel)
 {
 	NMPlatform *platform;
 	int ifindex = nm_device_get_ifindex (NM_DEVICE (self));
+	guint32 old_channel;
 
 	platform = nm_device_get_platform (NM_DEVICE (self));
-	if (nm_platform_mesh_get_channel (platform, ifindex) != channel) {
-		if (nm_platform_mesh_set_channel (platform, ifindex, channel))
-			_notify (self, PROP_ACTIVE_CHANNEL);
-	}
+	old_channel = nm_platform_mesh_get_channel (platform, ifindex);
+
+	if (channel == 0)
+		channel = old_channel;
+
+	/* We want to call this even if the channel number is the same,
+	 * because that actually starts the mesh with the configured mesh ID. */
+	if (!nm_platform_mesh_set_channel (platform, ifindex, channel))
+		return FALSE;
+
+	if (old_channel != channel)
+		_notify (self, PROP_ACTIVE_CHANNEL);
+
+	return TRUE;
 }
 
 static NMActStageReturn
@@ -192,27 +203,35 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
 {
 	NMDeviceOlpcMesh *self = NM_DEVICE_OLPC_MESH (device);
 	NMSettingOlpcMesh *s_mesh;
-	guint32 channel;
 	GBytes *ssid;
 	const char *anycast_addr;
+	gboolean success;
 
 	s_mesh = nm_device_get_applied_setting (device, NM_TYPE_SETTING_OLPC_MESH);
 
 	g_return_val_if_fail (s_mesh, NM_ACT_STAGE_RETURN_FAILURE);
 
-	channel = nm_setting_olpc_mesh_get_channel (s_mesh);
-	if (channel != 0)
-		_mesh_set_channel (self, channel);
-
 	ssid = nm_setting_olpc_mesh_get_ssid (s_mesh);
-	nm_platform_mesh_set_ssid (nm_device_get_platform (device),
-	                           nm_device_get_ifindex (device),
-	                           g_bytes_get_data (ssid, NULL),
-	                           g_bytes_get_size (ssid));
+	nm_device_take_down (NM_DEVICE (self), TRUE);
+	success = nm_platform_mesh_set_ssid (nm_device_get_platform (device),
+	                                     nm_device_get_ifindex (device),
+	                                     g_bytes_get_data (ssid, NULL),
+	                                     g_bytes_get_size (ssid));
+	nm_device_bring_up (NM_DEVICE (self), TRUE, NULL);
+	if (!success) {
+		_LOGW (LOGD_WIFI, "Unable to set the mesh ID");
+		return NM_ACT_STAGE_RETURN_FAILURE;
+	}
 
 	anycast_addr = nm_setting_olpc_mesh_get_dhcp_anycast_address (s_mesh);
 	nm_device_set_dhcp_anycast_address (device, anycast_addr);
 
+	if (!_mesh_set_channel (self, nm_setting_olpc_mesh_get_channel (s_mesh))) {
+		_LOGW (LOGD_WIFI, "Unable to set the mesh channel");
+		return NM_ACT_STAGE_RETURN_FAILURE;
+	}
+
+
 	return NM_ACT_STAGE_RETURN_SUCCESS;
 }
 
diff --git a/src/devices/wifi/nm-device-wifi-p2p.c b/src/devices/wifi/nm-device-wifi-p2p.c
index c5826e24..c9e6189b 100644
--- a/src/devices/wifi/nm-device-wifi-p2p.c
+++ b/src/devices/wifi/nm-device-wifi-p2p.c
@@ -828,6 +828,7 @@ supplicant_group_iface_state_cb (NMSupplicantInterface *iface,
 
 static void
 supplicant_group_iface_group_finished_cb (NMSupplicantInterface *iface,
+                                          const char *iface_path,
                                           void *user_data)
 {
 	NMDeviceWifiP2P *self = NM_DEVICE_WIFI_P2P (user_data);
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
index 2ffba47a..8c80b0aa 100644
--- a/src/devices/wifi/nm-device-wifi.c
+++ b/src/devices/wifi/nm-device-wifi.c
@@ -3254,6 +3254,7 @@ can_reapply_change (NMDevice *device,
 		return nm_device_hash_check_invalid_keys (diffs,
 		                                          NM_SETTING_WIRELESS_SETTING_NAME,
 		                                          error,
+		                                          NM_SETTING_WIRELESS_SEEN_BSSIDS, /* ignored */
 		                                          NM_SETTING_WIRELESS_MTU, /* reapplied with IP config */
 		                                          NM_SETTING_WIRELESS_WAKE_ON_WLAN);
 	}