[PATCH] nl80211: Clear preq NL handle before setup AP or GO

Ouden Lin ouden.biz at gmail.com
Tue Dec 14 06:29:06 PST 2021

From: Ouden <Ouden.Biz at gmail.com>

When entering the P2P connection, the radio working "p2p-listen" will enable and disable the probe request report.
This will set and clear the pointer nl_preq.
In the state WAIT_PEER_CONNECT that initiates the negotiation, the disable probe request report will not be triggered.
At the start of GO (start AP), Unsbcsribe mgmt will delete all management reports, including Probe Requst,
However, nl_preq is still not deleted.
Finally, Go cannot enable probe request reporting until the trigger is disabled.

Logs for as:
P2P: Go to Listen state while waiting for the peer to become ready for GO Negotiation
P2P: Starting short listen state (state=WAIT_PEER_CONNECT)

nl80211: Enable Probe Request reporting nl_preq=0x562934543420
nl80211: Register frame type=0x40 (WLAN_FC_STYPE_PROBE_REQ) nl_handle=0x562934543420 match=

P2P: GO Negotiation with 00:AA:BB:0b:f0:3b
P2P: Skip stop_listen since we are on correct channel for response
P2P: State IDLE -> GO_NEG

nl80211: Setup AP operations for P2P group (GO)
nl80211: Unsubscribe mgmt frames handle 0x8888dea1bcc6c2c9 (start AP)
nl80211: Setup AP(wlan1) - device_ap_sme=1 use_monitor=0
nl80211: Subscribe to mgmt frames with AP handle 0x5629344e4a40 (device SME)
nl80211: Probe Request reporting already on! nl_preq=0x8888dea1bcdcbca9

When device_ap_sme=0, nl_preq will be cleared in nl80211_setup_ap().
Therefore, this patch will ignore device_ap_sme if it always needs to clear nl_preq first.

Change-Id: I318ead337928e0f757bfaddfe808d967b05069b0

Signed-off-by: Ouden <Ouden.Biz at gmail.com>
 src/drivers/driver_nl80211.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index aec179ac3..511877630 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -5574,8 +5574,11 @@ static int nl80211_setup_ap(struct i802_bss *bss)
 	 * devices that include the AP SME, in the other case (unless using
 	 * monitor iface) we'll get it through the nl_mgmt socket instead.
-	if (!drv->device_ap_sme)
-		wpa_driver_nl80211_probe_req_report(bss, 0);
+	if (bss->nl_preq) {
+		wpa_printf(MSG_DEBUG, "nl80211: Disable Probe Request "
+			   "reporting nl_preq=%p", bss->nl_preq);
+		nl80211_destroy_eloop_handle(&bss->nl_preq, 0);
+	}
 	if (!drv->device_ap_sme && !drv->use_monitor)
 		if (nl80211_mgmt_subscribe_ap(bss))

More information about the Hostap mailing list