[PATCH 06/15] AP: Set the Mobility Domain bit in the own neighbor report

Andrei-Alexandru Bleortu me at andrei-z.com
Sun Oct 4 03:41:59 PDT 2026


The BSSID Information field of a Neighbor Report element has the Mobility
Domain bit set when the reported AP includes an MDE in its Beacon frames
whose contents are identical to the MDE of the reporting AP (IEEE Std
802.11-2024, 9.4.2.35). hostapd left a TODO for it in its own neighbor
report, so the report it hands to STAs, and copies of it that the other
APs of the mobility domain add with SET_NEIGHBOR, said that FT to the
reported AP is not possible.

Set it when FT is enabled.

Assisted-by: LLM
Signed-off-by: Andrei-Alexandru Bleortu <me at andrei-z.com>
---
 src/ap/neighbor_db.c    |  6 +++++-
 tests/hwsim/test_rrm.py | 24 ++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/src/ap/neighbor_db.c b/src/ap/neighbor_db.c
index fd4f881df..93203c5d2 100644
--- a/src/ap/neighbor_db.c
+++ b/src/ap/neighbor_db.c
@@ -274,7 +274,11 @@ void hostapd_neighbor_set_own_report(struct hostapd_data *hapd)
 		bssid_info |= NEI_REP_BSSID_INFO_HE;
 	if (eht)
 		bssid_info |= NEI_REP_BSSID_INFO_EHT;
-	/* TODO: Set NEI_REP_BSSID_INFO_MOBILITY_DOMAIN if MDE is set */
+#ifdef CONFIG_IEEE80211R_AP
+	/* The own MDE is identical to itself (IEEE Std 802.11-2024, 9.4.2.35) */
+	if (hapd->conf->wpa && wpa_key_mgmt_ft(hapd->conf->wpa_key_mgmt))
+		bssid_info |= NEI_REP_BSSID_INFO_MOBILITY_DOMAIN;
+#endif /* CONFIG_IEEE80211R_AP */
 
 	hostapd_get_oper_chan_info_of_bss(hapd, &oper_chwidth,
 					  &center_freq1_idx, &center_freq2_idx);
diff --git a/tests/hwsim/test_rrm.py b/tests/hwsim/test_rrm.py
index db8d43cc2..14a42d40c 100644
--- a/tests/hwsim/test_rrm.py
+++ b/tests/hwsim/test_rrm.py
@@ -61,6 +61,30 @@ def check_nr_results(dev, bssids=None, lci=False, civic=False):
         if not found:
             raise Exception("RRM report result for %s not indicated" % bssid)
 
+def own_nr_bssid_info(hapd):
+    res = hapd.request("SHOW_NEIGHBOR").split()
+    nr = bytes.fromhex([x for x in res if x.startswith("nr=")][0][3:])
+    return struct.unpack('<I', nr[6:10])[0]
+
+def test_rrm_own_nr_mobility_domain(dev, apdev):
+    """Own neighbor report and the Mobility Domain bit"""
+    params = hostapd.wpa2_params(ssid="test-ft", passphrase="12345678")
+    params["wpa_key_mgmt"] = "FT-PSK"
+    params["mobility_domain"] = "a1b2"
+    params["nas_identifier"] = "nas1.w1.fi"
+    params["r1_key_holder"] = "000102030405"
+    params["r0kh"] = "ff:ff:ff:ff:ff:ff * 100102030405060708090a0b0c0d0e0f100102030405060708090a0b0c0d0e0f"
+    params["r1kh"] = "00:00:00:00:00:00 00:00:00:00:00:00 100102030405060708090a0b0c0d0e0f100102030405060708090a0b0c0d0e0f"
+    params["rrm_neighbor_report"] = "1"
+    hapd = hostapd.add_ap(apdev[0], params)
+    if not own_nr_bssid_info(hapd) & (1 << 10):
+        raise Exception("Mobility Domain bit not set with FT")
+
+    params = {"ssid": "test", "rrm_neighbor_report": "1"}
+    hapd2 = hostapd.add_ap(apdev[1], params)
+    if own_nr_bssid_info(hapd2) & (1 << 10):
+        raise Exception("Mobility Domain bit set without FT")
+
 def test_rrm_neighbor_db(dev, apdev):
     """hostapd ctrl_iface SET_NEIGHBOR"""
     params = {"ssid": "test", "rrm_neighbor_report": "1"}
-- 
2.47.3





More information about the Hostap mailing list