Skip to contentSkip to conversation

netdev: only set in_reassoc if using an auth-proto

PATCH New James Prestwood 1 participant 2 messages Nov 23, 2021

lore
Share & tools
lore

James Prestwood

author
#0 lore raw

PATCH 1/2 netdev: only set in_reassoc if using an auth-proto

The kernel strangely sends a disconnect event when using auth/assoc commands, but does not for CMD_CONNECT (only deauth). This wasn't observed and IWD assumed a disconnect event comes unconditionally. Because of this in_reassoc is checked in netdev_disconnect_event and the event is ignored if set.

When CMD_CONNECT is used to reassociate this would cause disconnect events to be ignored when they should not be, preventing IWD from going into a disconnected state post-roam.

Now, in_reassoc is only set if an auth-proto is used.

---
 src/netdev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
src/netdev.c +3 -2
index 96e473a9..34ace286 100644
@@ -4144,13 +4144,14 @@ int netdev_reassociate(struct netdev *netdev, struct scan_bss *target_bss,
 	netdev->associated = false;
 	netdev->operational = false;
 	netdev->connected = false;
-	netdev->in_reassoc = true;
 
 	netdev_connect_common(netdev, target_bss, orig_bss, hs, NULL, 0,
 					event_filter, cb, user_data);
 
-	if (netdev->ap)
+	if (netdev->ap) {
+		netdev->in_reassoc = true;
 		memcpy(netdev->ap->prev_bssid, orig_bss->addr, ETH_ALEN);
+	}
 
 	netdev_rssi_polling_update(netdev);
 
Signature · 1 line
2.31.1
author
#1 lore raw

PATCH 2/2 auto-t: testPSK-roam deauthenticate IWD after roam

After roaming deauth IWD and check the connection state.

---
 autotests/testPSK-roam/connection_test.py | 4 ++++
 1 file changed, 4 insertions(+)
autotests/testPSK-roam/connection_test.py +4 -0
index 437e52fc..8d9b22ad 100644
@@ -100,6 +100,10 @@ class Test(unittest.TestCase):
         self.assertRaises(Exception, testutil.test_ifaces_connected,
                           (self.bss_hostapd[1].ifname, device.name, True, True))
 
+        self.bss_hostapd[0].deauthenticate(device.address)
+        condition = 'obj.state == DeviceState.disconnected'
+        wd.wait_for_object_condition(device, condition)
+
     def test_ft_psk(self):
         wd = IWD(True)
 
Signature · 1 line
2.31.1