Skip to contentSkip to conversation

station/wsc: remove beacon loss handling

PATCH In review James Prestwood 2 participants 4 messages Nov 3, 2020 – Nov 4, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 station/wsc: remove beacon loss handling

Modern kernels ~5.4+ have changed the way lost beacons are reported and effectively make the lost beacon event useless because it is immediately followed by a disconnect event. This does now allow IWD enough time to do much of anything before the disconnect comes in and we are forced to fully re-connect to a different AP.

---
 src/station.c | 26 --------------------------
 src/wsc.c     |  3 ---
 2 files changed, 29 deletions(-)
src/station.c +0 -26
index eb254bf6..db36b748 100644
@@ -2085,29 +2085,6 @@ static bool station_cannot_roam(struct station *station)
 					station->state == STATION_STATE_ROAMING;
 }
 
-static void station_lost_beacon(struct station *station)
-{
-	l_debug("%u", netdev_get_ifindex(station->netdev));
-
-	if (station->state != STATION_STATE_ROAMING &&
-			station->state != STATION_STATE_CONNECTED)
-		return;
-
-	/*
-	 * Tell the roam mechanism to not bother requesting Neighbor Reports,
-	 * preauthenticating or performing other over-the-DS type of
-	 * authentication to target AP, even while station->connected_bss is
-	 * still non-NULL.  The current connection is in a serious condition
-	 * and we might wasting our time with those mechanisms.
-	 */
-	station->roam_no_orig_ap = true;
-
-	if (station_cannot_roam(station))
-		return;
-
-	station_roam_trigger_cb(NULL, station);
-}
-
 #define WNM_REQUEST_MODE_PREFERRED_CANDIDATE_LIST	(1 << 0)
 #define WNM_REQUEST_MODE_TERMINATION_IMMINENT		(1 << 3)
 #define WNM_REQUEST_MODE_ESS_DISASSOCIATION_IMMINENT	(1 << 4)
@@ -2235,9 +2212,6 @@ static void station_netdev_event(struct netdev *netdev, enum netdev_event event,
 	case NETDEV_EVENT_ASSOCIATING:
 		l_debug("Associating");
 		break;
-	case NETDEV_EVENT_LOST_BEACON:
-		station_lost_beacon(station);
-		break;
 	case NETDEV_EVENT_DISCONNECT_BY_AP:
 	case NETDEV_EVENT_DISCONNECT_BY_SME:
 		station_disconnect_event(station, event_data);
src/wsc.c +0 -3
index 66ddb8bf..aec9900c 100644
@@ -247,9 +247,6 @@ static void wsc_enrollee_netdev_event(struct netdev *netdev,
 	case NETDEV_EVENT_AUTHENTICATING:
 	case NETDEV_EVENT_ASSOCIATING:
 		break;
-	case NETDEV_EVENT_LOST_BEACON:
-		l_debug("Lost beacon");
-		break;
 	case NETDEV_EVENT_DISCONNECT_BY_AP:
 		l_debug("Disconnect by AP");
 		wsc_enrollee_connect_cb(wsce->netdev,
Signature · 1 line
2.26.2
#1 lore raw

PATCH 2/3 netdev: remove handling of beacon loss event

---
 src/netdev.c | 14 --------------
 src/netdev.h |  2 --
 2 files changed, 16 deletions(-)
src/netdev.c +0 -14
index 5d3aa862..3f78afbf 100644
@@ -671,16 +671,6 @@ struct netdev *netdev_find(int ifindex)
 	return l_queue_find(netdev_list, netdev_match, L_UINT_TO_PTR(ifindex));
 }
 
-static void netdev_lost_beacon(struct netdev *netdev)
-{
-	if (!netdev->connected)
-		return;
-
-	if (netdev->event_filter)
-		netdev->event_filter(netdev, NETDEV_EVENT_LOST_BEACON, NULL,
-							netdev->user_data);
-}
-
 /* Threshold RSSI for roaming to trigger, configurable in main.conf */
 static int LOW_SIGNAL_THRESHOLD;
 
@@ -771,10 +761,6 @@ static void netdev_cqm_event(struct l_genl_msg *msg, struct netdev *netdev)
 
 			while (l_genl_attr_next(&nested, &type, &len, &data)) {
 				switch (type) {
-				case NL80211_ATTR_CQM_BEACON_LOSS_EVENT:
-					netdev_lost_beacon(netdev);
-					break;
-
 				case NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT:
 					if (len != 4)
 						continue;
src/netdev.h +0 -2
index 58b63fbd..65fdbaaf 100644
@@ -40,7 +40,6 @@ enum netdev_result {
 enum netdev_event {
 	NETDEV_EVENT_AUTHENTICATING,
 	NETDEV_EVENT_ASSOCIATING,
-	NETDEV_EVENT_LOST_BEACON,
 	NETDEV_EVENT_DISCONNECT_BY_AP,
 	NETDEV_EVENT_DISCONNECT_BY_SME,
 	NETDEV_EVENT_RSSI_THRESHOLD_LOW,
@@ -89,7 +88,6 @@ typedef void (*netdev_connect_cb_t)(struct netdev *netdev,
  *
  * NETDEV_EVENT_AUTHENTICATING - unused
  * NETDEV_EVENT_ASSOCIATING - unused
- * NETDEV_EVENT_LOST_BEACON - unused
  * NETDEV_EVENT_DISCONNECT_BY_AP - MMPDU_REASON_CODE
  * NETDEV_EVENT_DISCONNECT_BY_SME - MMPDU_REASON_CODE
  * NETDEV_EVENT_RSSI_THRESHOLD_LOW - unused
Signature · 1 line
2.26.2
#2 lore raw

PATCH 3/3 auto-t: remove beacon loss tests

In reply to James Prestwood
---
 .../testFT-8021x-roam/connection_test.py      | 76 -----------------
 autotests/testFT-PSK-roam/connection_test.py  | 83 -------------------
 2 files changed, 159 deletions(-)
autotests/testFT-8021x-roam/connection_test.py +0 -76
index 2dfe9ce5..6e905f0d 100644
@@ -92,82 +92,6 @@ class Test(unittest.TestCase):
         self.assertRaises(Exception, testutil.test_ifaces_connected,
                           (self.bss_hostapd[0].ifname, device.name))
 
-    def test_roam_on_beacon_loss(self):
-        hwsim = Hwsim()
-
-        rule0 = hwsim.rules.create()
-        rule0.source = self.bss_radio[0].addresses[0]
-        rule0.bidirectional = True
-
-        rule1 = hwsim.rules.create()
-        rule1.source = self.bss_radio[1].addresses[0]
-        rule1.bidirectional = True
-
-        wd = IWD()
-
-        device = wd.list_devices(1)[0]
-
-        # Check that iwd selects BSS 0 first
-        rule0.signal = -2000
-        rule1.signal = -2500
-
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        device.scan()
-
-        condition = 'obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        ordered_network = device.get_ordered_network("TestFT")
-        self.assertEqual(ordered_network.type, NetworkType.eap)
-        self.assertEqual(ordered_network.signal_strength, -2000)
-
-        condition = 'not obj.connected'
-        wd.wait_for_object_condition(ordered_network.network_object, condition)
-
-        self.assertFalse(self.bss_hostapd[0].list_sta())
-        self.assertFalse(self.bss_hostapd[1].list_sta())
-
-        ordered_network.network_object.connect()
-
-        condition = 'obj.state == DeviceState.connected'
-        wd.wait_for_object_condition(device, condition)
-
-        self.assertTrue(self.bss_hostapd[0].list_sta())
-        self.assertFalse(self.bss_hostapd[1].list_sta())
-
-        testutil.test_iface_operstate(device.name)
-        testutil.test_ifaces_connected(self.bss_hostapd[0].ifname, device.name)
-        self.assertRaises(Exception, testutil.test_ifaces_connected,
-                          (self.bss_hostapd[1].ifname, device.name))
-
-        # Check that iwd starts transition to BSS 1 in less than 20 seconds
-        # from a beacon loss event
-        rule0.drop = True
-        rule0.signal = -3000
-        wd.wait(2)
-        rule0.drop = False
-
-        condition = 'obj.state == DeviceState.roaming'
-        wd.wait_for_object_condition(device, condition)
-
-        # Check that iwd is on BSS 1 once out of roaming state and doesn't
-        # go through 'disconnected', 'autoconnect', 'connecting' in between
-        condition = 'obj.state != DeviceState.roaming'
-        wd.wait_for_object_condition(device, condition)
-
-        self.assertEqual(device.state, iwd.DeviceState.connected)
-        self.assertTrue(self.bss_hostapd[1].list_sta())
-
-        testutil.test_iface_operstate(device.name)
-        testutil.test_ifaces_connected(self.bss_hostapd[1].ifname, device.name)
-        self.assertRaises(Exception, testutil.test_ifaces_connected,
-                          (self.bss_hostapd[0].ifname, device.name))
-
     def tearDown(self):
         os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down')
         os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" down')
autotests/testFT-PSK-roam/connection_test.py +0 -83

89 lines not on this page · raw message

Signature · 1 line
2.26.2
#3 lore raw
In reply to James Prestwood

Hi James,

Quoted 11 lines · James Prestwood

Modern kernels ~5.4+ have changed the way lost beacons are reported and effectively make the lost beacon event useless because it is immediately followed by a disconnect event. This does now allow IWD enough time to do much of anything before the disconnect comes in and we are forced to fully re-connect to a different AP.

---
  src/station.c | 26 --------------------------
  src/wsc.c     |  3 ---
  2 files changed, 29 deletions(-)

All applied, thanks.

Regards,
-Denis