Commit
00c2c20d74ee ("hostapd: Maintain single wpa_driver_nl80211_data
(drv) object across interfaces") adds 2nd AP MLD interface as a new
interface. However, in cases where the interface is already created and
are supposed to be reused, due to the new interface request, addition of
a new AP MLD fails.
Leverage the reuse parameter and handle the additional error code during
interface add for such cases and update the interface mode to
NL80211_IFTYPE_AP.
Fixes: 00c2c20d74ee ("hostapd: Maintain single wpa_driver_nl80211_data (drv) object across interfaces")
Signed-off-by: Purushottam Kushwaha <quic_pkushwah@quicinc.com>
Signed-off-by: Chenming Huang <quic_chenhuan@quicinc.com>
&hapd->drv_priv, force_ifname, if_addr,
params.num_bridge && params.bridge[0] ?
params.bridge[0] : NULL,
- 0)) {
+ 1)) {
wpa_printf(MSG_ERROR, "Failed to add BSS (BSSID="
MACSTR ")", MAC2STR(hapd->own_addr));
os_free(params.bridge);
arg);
/* if error occurred and interface exists already */
- if (ret == -ENFILE && if_nametoindex(ifname)) {
+ if (ret < 0 && if_nametoindex(ifname)) {
if (use_existing) {
wpa_printf(MSG_DEBUG, "nl80211: Continue using existing interface %s",
ifname);
*drv_priv = new_bss;
nl80211_init_bss(new_bss);
+ /* Set interface mode to NL80211_IFTYPE_AP */
+ if (nl80211_set_mode(drv, ifidx, nlmode))
+ return -1;
+
/* Subscribe management frames for this WPA_IF_AP_BSS */
if (nl80211_setup_ap(new_bss))
return -1;