Skip to contentSkip to conversation

vendor_quirks: initial skeleton

PATCH In review James Prestwood 2 participants 12 messages Aug 27, 2025 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/11 vendor_quirks: initial skeleton

This module will provide a database for known issues or quirks with wireless vendors.

The vendor_quirks_append_for_oui() API is intended to be called from scan.c when parsing vendor attributes. This will lookup any quirks associated with the OUI provided and combine them into an existing vendor_quirk structure. This can be repeated against all the vendor OUI's seen in the scan then referenced later to alter IWD behavior.

In the future more critera could be added such as MAC address prefix or more generalized IE matches e.g.

vendor_quirks_append_for_mac()
vendor_quirks_append_for_ie()
etc.

---
 Makefile.am         |  2 ++
 src/vendor_quirks.c | 67 +++++++++++++++++++++++++++++++++++++++++++++
 src/vendor_quirks.h | 39 ++++++++++++++++++++++++++
 3 files changed, 108 insertions(+)
 create mode 100644 src/vendor_quirks.c
 create mode 100644 src/vendor_quirks.h

v2:
* Use a bitfield structure rather than enums/masks
* Rename API to be specific to OUI matches. Potentially to extend in the future to match MAC/IE's

Makefile.am +2 -0
index 92adfa6e..c01cd4c4 100644
@@ -274,6 +274,8 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h \
 					src/dpp.c \
 					src/udev.c \
 					src/pmksa.h src/pmksa.c \
+					src/vendor_quirks.h \
+					src/vendor_quirks.c \
 					$(eap_sources) \
 					$(builtin_sources)
 
src/vendor_quirks.c new file +67 -0

67 lines not on this page · raw message

src/vendor_quirks.h new file +39 -0
new file mode 100644
index 00000000..b5d726ca
@@ -0,0 +1,39 @@
+/*
+ *
+ *  Wireless daemon for Linux
+ *
+ *  Copyright (C) 2025  Locus Robotics Corporation. All rights reserved.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library 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
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifndef __IWD_VENDOR_QUIRKS_H
+#define __IWD_VENDOR_QUIRKS_H
+
+
+#include <stdint.h>
+
+struct vendor_quirk {
+	bool ignore_bss_tm_candidates : 1;
+	bool replay_counter_mismatch : 1;
+};
+
+void vendor_quirks_append_for_oui(const uint8_t *oui,
+					struct vendor_quirk *quirks);
+
+const char *vendor_quirks_to_string(struct vendor_quirk quirks);
+
+#endif /* __IWD_VENDOR_QUIRKS_H */
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 2/11 vendor_quirks: implement two vendor quirks

ignore_bss_tm_candidates:
When a BSS requests a station roam it can optionally include a list of BSS's that can be roamed to. IWD uses this list and only scans on those frequencies. In some cases though the AP's list contains very poor options and it would be better for IWD to request a full neighbor report.

replay_counter_mismatch:
On some Aruba APs there is a mismatch in the replay counters between what is seen in scans versus authentications/associations. This difference is not allowed in the spec, therefore IWD will not connect. This quirk is intended to relax that check.

---
 src/vendor_quirks.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
src/vendor_quirks.c +18 -1
index 18a9ba7a..4fba0c33 100644
@@ -25,6 +25,7 @@
 #endif
 
 #include <string.h>
+#include <stdio.h>
 
 #include <ell/ell.h>
 
@@ -34,7 +35,16 @@ static const struct {
 	uint8_t oui[3];
 	struct vendor_quirk quirks;
 } oui_quirk_db[] = {
-	{ }
+	{
+		/* Cisco Meraki */
+		{ 0x00, 0x18, 0x0a },
+		{ .ignore_bss_tm_candidates = true },
+	},
+	{
+		/* Hewlett Packard, owns Aruba */
+		{ 0x00, 0x0b, 0x86 },
+		{ .replay_counter_mismatch = true },
+	},
 };
 
 void vendor_quirks_append_for_oui(const uint8_t *oui,
@@ -58,8 +68,15 @@ void vendor_quirks_append_for_oui(const uint8_t *oui,
 const char *vendor_quirks_to_string(struct vendor_quirk quirks)
 {
 	static char out[1024];
+	char *pos = out;
 	size_t s = 0;
 
+	if (quirks.ignore_bss_tm_candidates)
+		s += snprintf(pos, sizeof(out) - s, "IgnoreBssTmCandidateList");
+
+	if (quirks.replay_counter_mismatch)
+		s += snprintf(pos, sizeof(out) - s, "ReplayCounterMismatch");
+
 	if (!s)
 		return NULL;
 
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 3/11 handshake: pass object to handshake_util_ap_ie_matches

In reply to James Prestwood

This is to prepare for supporting a vendor quirk, where we'll need the handshake to lookup if the quirk to disable a specific check.

---
 src/eapol.c     |  2 +-
 src/ft.c        | 10 ++++++----
 src/handshake.c |  3 ++-
 src/handshake.h |  3 ++-
 4 files changed, 11 insertions(+), 7 deletions(-)
src/eapol.c +1 -1
index 6e37a54a..ab77746f 100644
@@ -1810,7 +1810,7 @@ static void eapol_handle_ptk_3_of_4(struct eapol_sm *sm,
 
 	if ((rsne[1] != hs->authenticator_ie[1] ||
 			memcmp(rsne + 2, hs->authenticator_ie + 2, rsne[1])) &&
-			!handshake_util_ap_ie_matches(&rsn_info,
+			!handshake_util_ap_ie_matches(hs, &rsn_info,
 							hs->authenticator_ie,
 							hs->wpa_ie))
 		goto error_ie_different;
src/ft.c +6 -4
index d8bee74c..0d6be4d4 100644
@@ -223,7 +223,8 @@ static bool ft_parse_associate_resp_frame(const uint8_t *frame, size_t frame_len
 	return true;
 }
 
-static bool ft_verify_rsne(const uint8_t *rsne, const uint8_t *pmk_r0_name,
+static bool ft_verify_rsne(struct handshake_state *hs,
+				const uint8_t *rsne, const uint8_t *pmk_r0_name,
 				const uint8_t *authenticator_ie)
 {
 	/*
@@ -253,7 +254,7 @@ static bool ft_verify_rsne(const uint8_t *rsne, const uint8_t *pmk_r0_name,
 				memcmp(msg2_rsne.pmkids, pmk_r0_name, 16))
 		return false;
 
-	if (!handshake_util_ap_ie_matches(&msg2_rsne, authenticator_ie, false))
+	if (!handshake_util_ap_ie_matches(hs, &msg2_rsne, authenticator_ie, false))
 		return false;
 
 	return true;
@@ -301,7 +302,8 @@ static int parse_ies(struct handshake_state *hs,
 	is_rsn = hs->supplicant_ie != NULL;
 
 	if (is_rsn) {
-		if (!ft_verify_rsne(rsne, hs->pmk_r0_name, authenticator_ie))
+		if (!ft_verify_rsne(hs, rsne, hs->pmk_r0_name,
+					authenticator_ie))
 			goto ft_error;
 	} else if (rsne)
 		goto ft_error;
@@ -480,7 +482,7 @@ int __ft_rx_associate(uint32_t ifindex, const uint8_t *frame, size_t frame_len)
 				memcmp(msg4_rsne.pmkids, hs->pmk_r1_name, 16))
 			return -EBADMSG;
 
-		if (!handshake_util_ap_ie_matches(&msg4_rsne,
+		if (!handshake_util_ap_ie_matches(hs, &msg4_rsne,
 							hs->authenticator_ie,
 							false))
 			return -EBADMSG;
src/handshake.c +2 -1
index c469e6fa..92edac30 100644
@@ -877,7 +877,8 @@ void handshake_state_set_igtk(struct handshake_state *s, const uint8_t *key,
  * results vs the RSN/WPA IE obtained as part of the 4-way handshake.  If they
  * don't match, the EAPoL packet must be silently discarded.
  */
-bool handshake_util_ap_ie_matches(const struct ie_rsn_info *msg_info,
+bool handshake_util_ap_ie_matches(struct handshake_state *s,
+					const struct ie_rsn_info *msg_info,
 					const uint8_t *scan_ie, bool is_wpa)
 {
 	struct ie_rsn_info scan_info;
src/handshake.h +2 -1
index c6e3c10b..b8891490 100644
@@ -312,7 +312,8 @@ bool handshake_state_set_pmksa(struct handshake_state *s, struct pmksa *pmksa);
 void handshake_state_cache_pmksa(struct handshake_state *s);
 bool handshake_state_remove_pmksa(struct handshake_state *s);
 
-bool handshake_util_ap_ie_matches(const struct ie_rsn_info *msg_info,
+bool handshake_util_ap_ie_matches(struct handshake_state *s,
+					const struct ie_rsn_info *msg_info,
 					const uint8_t *scan_ie, bool is_wpa);
 
 const uint8_t *handshake_util_find_kde(enum handshake_kde selector,
Signature · 1 line
2.34.1
#3 lore raw

PATCH v2 4/11 handshake: add vendor quirks into handshake object

In reply to James Prestwood
---
 src/handshake.c | 6 ++++++
 src/handshake.h | 6 ++++++
 2 files changed, 12 insertions(+)
src/handshake.c +6 -0
index 92edac30..02dfe2d8 100644
@@ -368,6 +368,12 @@ void handshake_state_set_vendor_ies(struct handshake_state *s,
 	}
 }
 
+void handshake_state_set_vendor_quirks(struct handshake_state *s,
+					struct vendor_quirk quirks)
+{
+	s->vendor_quirks = quirks;
+}
+
 void handshake_state_set_kh_ids(struct handshake_state *s,
 				const uint8_t *r0khid, size_t r0khid_len,
 				const uint8_t *r1khid)
src/handshake.h +6 -0
index b8891490..9ddeecd6 100644
@@ -26,6 +26,8 @@
 #include <linux/types.h>
 #include <ell/cleanup.h>
 
+#include "src/vendor_quirks.h"
+
 struct handshake_state;
 enum crypto_cipher;
 struct eapol_frame;
@@ -107,6 +109,7 @@ struct handshake_state {
 	uint8_t *authenticator_fte;
 	uint8_t *supplicant_fte;
 	uint8_t *vendor_ies;
+	struct vendor_quirk vendor_quirks;
 	size_t vendor_ies_len;
 	enum ie_rsn_cipher_suite pairwise_cipher;
 	enum ie_rsn_cipher_suite group_cipher;
@@ -237,6 +240,9 @@ void handshake_state_set_vendor_ies(struct handshake_state *s,
 					const struct iovec *iov,
 					size_t n_iovs);
 
+void handshake_state_set_vendor_quirks(struct handshake_state *s,
+					struct vendor_quirk quirks);
+
 void handshake_state_set_kh_ids(struct handshake_state *s,
 				const uint8_t *r0khid, size_t r0khid_len,
 				const uint8_t *r1khid);
Signature · 1 line
2.34.1
#4 lore raw

PATCH v2 5/11 scan: store vendor quirks in scan_bss

In reply to James Prestwood

As each vendor IE is parsed lookup if there are any quirks associated with it, and store these in a bit mask.

---
 src/scan.c | 6 ++++++
 src/scan.h | 2 ++
 2 files changed, 8 insertions(+)
src/scan.c +6 -0
index d9f27c83..46ea79ef 100644
@@ -51,6 +51,7 @@
 #include "src/mpdu.h"
 #include "src/band.h"
 #include "src/scan.h"
+#include "src/vendor_quirks.h"
 
 /* User configurable options */
 static double RANK_2G_FACTOR;
@@ -1221,6 +1222,11 @@ static void scan_parse_vendor_specific(struct scan_bss *bss, const void *data,
 	uint16_t cost_flags;
 	bool dgaf_disable;
 
+	if (L_WARN_ON(len < 3))
+		return;
+
+	vendor_quirks_append_for_oui(data, &bss->vendor_quirks);
+
 	if (!bss->wpa && is_ie_wpa_ie(data, len)) {
 		bss->wpa = l_memdup(data - 2, len + 2);
 		return;
src/scan.h +2 -0
index 4c1ebc21..ae6a3a79 100644
@@ -21,6 +21,7 @@
  */
 
 #include "src/defs.h"
+#include "src/vendor_quirks.h"
 
 struct scan_freq_set;
 struct ie_rsn_info;
@@ -79,6 +80,7 @@ struct scan_bss {
 	uint8_t *wfd;		/* Concatenated WFD IEs */
 	ssize_t wfd_size;	/* Size of Concatenated WFD IEs */
 	int8_t snr;
+	struct vendor_quirk vendor_quirks;
 	bool mde_present : 1;
 	bool cc_present : 1;
 	bool cap_rm_neighbor_report : 1;
Signature · 1 line
2.34.1
#5 lore raw

PATCH v2 6/11 station: set vendor quirks into handshake object

In reply to James Prestwood
---
 src/station.c | 2 ++
 1 file changed, 2 insertions(+)
src/station.c +2 -0
index e2273153..66395a5b 100644
@@ -1446,6 +1446,8 @@ static struct handshake_state *station_handshake_setup(struct station *station,
 	vendor_ies = network_info_get_extra_ies(info, bss, &iov_elems);
 	handshake_state_set_vendor_ies(hs, vendor_ies, iov_elems);
 
+	handshake_state_set_vendor_quirks(hs, bss->vendor_quirks);
+
 	/*
 	 * It can't hurt to try the FILS IP Address Assignment independent of
 	 * which auth-proto is actually used.
Signature · 1 line
2.34.1
#6 lore raw

PATCH v2 7/11 handshake: use vendor quirk to disable check of replay counters

In reply to James Prestwood

This has been a long standing issue on Aruba APs where the scan IEs differ from the IEs received during FT. For compatibility we have been carrying a patch to disable the replay counter check but this isn't something that was ever acceptable for upstream. Now with the addition of vendor quirks this check can be disabled only for the OUI of Aruba APs.

---
 src/handshake.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
src/handshake.c +8 -4
index 02dfe2d8..ef1a8220 100644
@@ -914,11 +914,15 @@ bool handshake_util_ap_ie_matches(struct handshake_state *s,
 	if (msg_info->no_pairwise != scan_info.no_pairwise)
 		return false;
 
-	if (msg_info->ptksa_replay_counter != scan_info.ptksa_replay_counter)
-		return false;
+	if (!(s->vendor_quirks.replay_counter_mismatch)) {
+		if (msg_info->ptksa_replay_counter !=
+					scan_info.ptksa_replay_counter)
+			return false;
 
-	if (msg_info->gtksa_replay_counter != scan_info.gtksa_replay_counter)
-		return false;
+		if (msg_info->gtksa_replay_counter !=
+					scan_info.gtksa_replay_counter)
+			return false;
+	}
 
 	if (msg_info->mfpr != scan_info.mfpr)
 		return false;
Signature · 1 line
2.34.1
#7 lore raw

PATCH v2 8/11 station: get neighbor report on BSS TM request

In reply to James Prestwood

If a BSS is requesting IWD roam elsewhere but does not include a preferred candidate list try getting a neighbor report before doing a full scan.

If the limited scan based on the candidate list comes up empty this would previously result in IWD giving up on the AP roam entirely. This patch also improves that behavior slightly by doing a full scan afterwards as a last ditch effort. If no BSS's are found after that, IWD will give up on the AP roam.

---
 src/station.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
src/station.c +20 -2
index 66395a5b..3d8eb36b 100644
@@ -2440,8 +2440,16 @@ static void station_roam_failed(struct station *station)
 	 * We were told by the AP to roam, but failed.  Try ourselves or
 	 * wait for the AP to tell us to roam again
 	 */
-	if (station->ap_directed_roaming)
+	if (station->ap_directed_roaming) {
+		/*
+		 * The candidate list from the AP (or neighbor report) found
+		 * no BSS's. Force a full scan
+		 */
+		if (!station->roam_scan_full)
+			goto full_scan;
+
 		goto delayed_retry;
+	}
 
 	/*
 	 * If we tried a limited scan, failed and the signal is still low,
@@ -2453,6 +2461,7 @@ static void station_roam_failed(struct station *station)
 		 * the scan here, so that the destroy callback is not called
 		 * after the return of this function
 		 */
+full_scan:
 		scan_cancel(netdev_get_wdev_id(station->netdev),
 						station->roam_scan_id);
 
@@ -3045,6 +3054,7 @@ static int station_roam_scan(struct station *station,
 	if (!freq_set) {
 		station->roam_scan_full = true;
 		params.freqs = allowed;
+		station_debug_event(station, "full-roam-scan");
 	} else
 		scan_freq_set_constrain(freq_set, allowed);
 
@@ -3378,7 +3388,15 @@ static void station_ap_directed_roam(struct station *station,
 		station_neighbor_report_cb(station->netdev, 0, body + pos,
 				body_len - pos, station);
 	} else {
-		l_debug("roam: AP did not include a preferred candidate list");
+		if (station->connected_bss->cap_rm_neighbor_report) {
+			if (!netdev_neighbor_report_req(station->netdev,
+					station_neighbor_report_cb))
+				return;
+
+			l_warn("failed to request neighbor report!");
+		}
+
+		l_debug("full scan after BSS transition request");
 		if (station_roam_scan(station, NULL) < 0)
 			station_roam_failed(station);
 	}
Signature · 1 line
2.34.1
#8 lore raw

PATCH v2 9/11 station: check vendor quirk for BSS TM request candidate list

In reply to James Prestwood

If the AP vendor has known issues with the preferred candidate list ignore it and jump directly to requesting a neighbor report.

---
 src/station.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

v2:
* Reworked to use variable for better readability

src/station.c +5 -1
index 3d8eb36b..4a29c9c1 100644
@@ -64,6 +64,7 @@
 #include "src/eap-tls-common.h"
 #include "src/storage.h"
 #include "src/pmksa.h"
+#include "src/vendor_quirks.h"
 
 #define STATION_RECENT_NETWORK_LIMIT	5
 #define STATION_RECENT_FREQS_LIMIT	5
@@ -3266,6 +3267,8 @@ static void station_ap_directed_roam(struct station *station,
 	uint16_t dtimer;
 	uint8_t valid_interval;
 	bool can_roam = !station_cannot_roam(station);
+	bool ignore_candidates =
+		station->connected_bss->vendor_quirks.ignore_bss_tm_candidates;
 
 	l_debug("ifindex: %u", netdev_get_ifindex(station->netdev));
 
@@ -3383,7 +3386,8 @@ static void station_ap_directed_roam(struct station *station,
 	l_timeout_remove(station->roam_trigger_timeout);
 	station->roam_trigger_timeout = NULL;
 
-	if (req_mode & WNM_REQUEST_MODE_PREFERRED_CANDIDATE_LIST) {
+	if ((req_mode & WNM_REQUEST_MODE_PREFERRED_CANDIDATE_LIST) &&
+				!ignore_candidates) {
 		l_debug("roam: AP sent a preferred candidate list");
 		station_neighbor_report_cb(station->netdev, 0, body + pos,
 				body_len - pos, station);
Signature · 1 line
2.34.1
#9 lore raw

PATCH v2 10/11 auto-t: add AP roam test for bad neighbor reports/candidate lists

In reply to James Prestwood
---
 .../testAPRoam/bad_neighbor_report_test.py    | 156 ++++++++++++++++++
 1 file changed, 156 insertions(+)
 create mode 100644 autotests/testAPRoam/bad_neighbor_report_test.py

v2:
* Added test that uses ignore BSS TM vendor quirk

autotests/testAPRoam/bad_neighbor_report_test.py new file +156 -0
new file mode 100644
index 00000000..c1ec7e26
@@ -0,0 +1,156 @@
+#!/usr/bin/python3
+
+import unittest
+import sys
+
+sys.path.append('../util')
+import iwd
+from iwd import IWD
+from iwd import NetworkType
+
+from hostapd import HostapdCLI
+
+class Test(unittest.TestCase):
+    def initial_connection(self):
+        ordered_network = self.device.get_ordered_network('TestAPRoam')
+
+        self.assertEqual(ordered_network.type, NetworkType.psk)
+
+        condition = 'not obj.connected'
+        self.wd.wait_for_object_condition(ordered_network.network_object, condition)
+
+        self.device.connect_bssid(self.bss_hostapd[0].bssid)
+
+        condition = 'obj.state == DeviceState.connected'
+        self.wd.wait_for_object_condition(self.device, condition)
+
+        self.bss_hostapd[0].wait_for_event('AP-STA-CONNECTED')
+
+        self.assertFalse(self.bss_hostapd[1].list_sta())
+
+    def test_full_scan(self):
+        """
+            Tests that IWD first tries a limited scan, then a full scan after
+            an AP directed roam. After the full scan yields no results IWD
+            should stop trying to roam.
+        """
+        self.initial_connection()
+
+        # Disable other APs, so the scans come up empty
+        self.bss_hostapd[1].disable()
+        self.bss_hostapd[2].disable()
+
+        # Send a bad candidate list with the BSS TM request which contains a
+        # channel with no AP operating on it.
+        self.bss_hostapd[0].send_bss_transition(
+            self.device.address,
+            [(self.bss_hostapd[1].bssid, "8f0000005105060603000000")]
+        )
+        self.device.wait_for_event("roam-scan-triggered")
+        self.device.wait_for_event("no-roam-candidates")
+        # IWD should then trigger a full scan
+        self.device.wait_for_event("full-roam-scan")
+        self.device.wait_for_event("no-roam-candidates", timeout=30)
+
+        # IWD should not trigger a roam again after the above 2 failures.
+        with self.assertRaises(TimeoutError):
+            self.device.wait_for_event("roam-scan-triggered", timeout=60)
+
+    def test_bad_candidate_list(self):
+        """
+            Tests behavior when the AP sends a candidate list but the scan
+            finds no BSS's. IWD should fall back to a full scan after.
+        """
+        self.initial_connection()
+
+        # Send a bad candidate list with the BSS TM request which contains a
+        # channel with no AP operating on it.
+        self.bss_hostapd[0].send_bss_transition(
+            self.device.address,
+            [(self.bss_hostapd[1].bssid, "8f0000005105060603000000")]
+        )
+        self.device.wait_for_event("roam-scan-triggered")
+        self.device.wait_for_event("no-roam-candidates")
+        # IWD should then trigger a full scan
+        self.device.wait_for_event("full-roam-scan")
+        self.device.wait_for_event("roaming", timeout=30)
+        self.device.wait_for_event("connected")
+
+    def test_bad_neighbor_report(self):
+        """
+            Tests behavior when the AP sends no candidate list. IWD should
+            request a neighbor report. If the limited scan yields no BSS's IWD
+            should fall back to a full scan.
+        """
+
+        # Set a bad neighbor (channel that no AP is on) to force the limited
+        # roam scan to fail
+        self.bss_hostapd[0].set_neighbor(
+            self.bss_hostapd[1].bssid,
+            "TestAPRoam",
+            '%s8f000000%s%s060603000000' % (self.bss_hostapd[1].bssid.replace(':', ''), "51", "0b")
+        )
+
+        self.initial_connection()
+
+        self.bss_hostapd[0].send_bss_transition(self.device.address, [])
+        self.device.wait_for_event("roam-scan-triggered")
+        # The AP will have sent a neighbor report with a single BSS but on
+        # channel 11 which no AP is on. This should result in a limited scan
+        # picking up no candidates.
+        self.device.wait_for_event("no-roam-candidates", timeout=30)
+        # IWD should then trigger a full scan
+        self.device.wait_for_event("full-roam-scan")
+        self.device.wait_for_event("roaming", timeout=30)
+        self.device.wait_for_event("connected")
+
+    def test_ignore_candidate_list_quirk(self):
+        """
+            Tests that IWD ignores the candidate list sent by the AP since its
+            OUI indicates it should be ignored.
+        """
+
+        # Set the OUI so the candidate list should be ignored
+        for hapd in self.bss_hostapd:
+            hapd.set_value('vendor_elements', 'dd0400180a01')
+
+        self.initial_connection()
+
+        # Send with a candidate list (should be ignored)
+        self.bss_hostapd[0].send_bss_transition(
+            self.device.address,
+            [(self.bss_hostapd[1].bssid, "8f0000005105060603000000")]
+        )
+        # IWD should ignore the list and trigger a full scan since we have not
+        # set any neighbors
+        self.device.wait_for_event("full-roam-scan")
+        self.device.wait_for_event("roaming", timeout=30)
+        self.device.wait_for_event("connected")
+
+    def setUp(self):
+        self.wd = IWD(True)
+
+        devices = self.wd.list_devices(1)
+        self.device = devices[0]
+
+    def tearDown(self):
+        self.wd = None
+        self.device = None
+
+        for hapd in self.bss_hostapd:
+            hapd.reload()
+
+    @classmethod
+    def setUpClass(cls):
+        IWD.copy_to_storage('TestAPRoam.psk')
+
+        cls.bss_hostapd = [ HostapdCLI(config='ssid1.conf'),
+                            HostapdCLI(config='ssid2.conf'),
+                            HostapdCLI(config='ssid3.conf') ]
+
+    @classmethod
+    def tearDownClass(cls):
+        IWD.clear_storage()
+
+if __name__ == '__main__':
+    unittest.main(exit=True)
Signature · 1 line
2.34.1
#10 lore raw

PATCH v2 11/11 station: print vendor quirks (if any) when connecting/roaming

In reply to James Prestwood

This makes it clear the BSS being selected for a connection/roam has any quirks associated with its OUI(s) and that IWD may behave differently based on these.

---
 src/station.c | 9 +++++++++
 1 file changed, 9 insertions(+)
src/station.c +9 -0
index 4a29c9c1..f8069d89 100644
@@ -2750,11 +2750,15 @@ static bool station_try_next_transition(struct station *station,
 	enum security security = network_get_security(connected);
 	struct handshake_state *new_hs;
 	struct ie_rsn_info cur_rsne, target_rsne;
+	const char *vendor_quirks = vendor_quirks_to_string(bss->vendor_quirks);
 
 	iwd_notice(IWD_NOTICE_ROAM_INFO, "bss: "MAC", signal: %d, load: %d/255",
 					MAC_STR(bss->addr),
 					bss->signal_strength / 100,
 					bss->utilization);
+	if (vendor_quirks)
+		l_debug("vendor quirks for "MAC": %s",
+				MAC_STR(bss->addr), vendor_quirks);
 
 	/* Reset AP roam flag, at this point the roaming behaves the same */
 	station->ap_directed_roaming = false;
@@ -3913,6 +3917,7 @@ int __station_connect_network(struct station *station, struct network *network,
 {
 	struct handshake_state *hs;
 	int r;
+	const char *vendor_quirks = vendor_quirks_to_string(bss->vendor_quirks);
 
 	/*
 	 * If we already have a handshake_state ref this is due to a retry,
@@ -3947,6 +3952,10 @@ int __station_connect_network(struct station *station, struct network *network,
 					bss->signal_strength / 100,
 					bss->utilization);
 
+	if (vendor_quirks)
+		l_debug("vendor quirks for "MAC": %s",
+				MAC_STR(bss->addr), vendor_quirks);
+
 	station->connected_bss = bss;
 	station->connected_network = network;
 	station->hs = handshake_state_ref(hs);
Signature · 1 line
2.34.1
#11 lore raw
In reply to James Prestwood

Hi James,

Quoted 20 lines · James Prestwood

This module will provide a database for known issues or quirks with wireless vendors.

The vendor_quirks_append_for_oui() API is intended to be called from scan.c when parsing vendor attributes. This will lookup any quirks associated with the OUI provided and combine them into an existing vendor_quirk structure. This can be repeated against all the vendor OUI's seen in the scan then referenced later to alter IWD behavior.

In the future more critera could be added such as MAC address prefix or more generalized IE matches e.g.

vendor_quirks_append_for_mac()
vendor_quirks_append_for_ie()
etc.

---
  Makefile.am         |  2 ++
  src/vendor_quirks.c | 67 +++++++++++++++++++++++++++++++++++++++++++++
  src/vendor_quirks.h | 39 ++++++++++++++++++++++++++
  3 files changed, 108 insertions(+)
Quoted 8 lines

create mode 100644 src/vendor_quirks.c
create mode 100644 src/vendor_quirks.h

v2:
* Use a bitfield structure rather than enums/masks
* Rename API to be specific to OUI matches. Potentially to extend in the future to match MAC/IE's

All applied, thanks.

Regards,
-Denis