]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Fix regression in returning to AP mode after scan
authorYun Park <yunp@qca.qualcomm.com>
Tue, 4 Feb 2014 21:11:14 +0000 (23:11 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 5 Feb 2014 20:53:59 +0000 (22:53 +0200)
Commit b1f625e0d81b76bb2380d0b47b95f5ad61123ba5 extended
ap_scan_as_station to be able to distinguish between AP and P2P GO
iftypes. However, it did this in a way that completely lost the original
mode because drv->nlmode had already been replaced with the station
mode. Fix this by storing the correct old mode.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

src/drivers/driver_nl80211.c

index 5323e99c08afb2b215eea7fa3d9e501e01ce587e..59785681af9f39fc980a19c5f255b29aa9eceabf 100644 (file)
@@ -4901,6 +4901,8 @@ static int wpa_driver_nl80211_scan(struct i802_bss *bss,
                wpa_printf(MSG_DEBUG, "nl80211: Scan trigger failed: ret=%d "
                           "(%s)", ret, strerror(-ret));
                if (drv->hostapd && is_ap_interface(drv->nlmode)) {
+                       enum nl80211_iftype old_mode = drv->nlmode;
+
                        /*
                         * mac80211 does not allow scan requests in AP mode, so
                         * try to do this in station mode.
@@ -4915,7 +4917,7 @@ static int wpa_driver_nl80211_scan(struct i802_bss *bss,
                        }
 
                        /* Restore AP mode when processing scan results */
-                       drv->ap_scan_as_station = drv->nlmode;
+                       drv->ap_scan_as_station = old_mode;
                        ret = 0;
                } else
                        goto nla_put_failure;