[PATCH] AP: Allow using existing interfaces as a fallback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some drivers (e.g. brcmfmac) may not support deleting virtual
interfaces. In such cases we can start AP interfaces once only. On next
tries be should try to use existing interfaces as a fallback.

Signed-off-by: Rafał Miłecki <zajec5@xxxxxxxxx>
---
 src/ap/hostapd.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 42c1aaa..4e0de0c 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -936,16 +936,24 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
 			} while (mac_in_conf(hapd->iconf, hapd->own_addr));
 		}
 
-		hapd->interface_added = 1;
 		if (hostapd_if_add(hapd->iface->bss[0], WPA_IF_AP_BSS,
 				   conf->iface, addr, hapd,
 				   &hapd->drv_priv, force_ifname, if_addr,
 				   conf->bridge[0] ? conf->bridge : NULL,
 				   first == -1)) {
-			wpa_printf(MSG_ERROR, "Failed to add BSS (BSSID="
-				   MACSTR ")", MAC2STR(hapd->own_addr));
-			hapd->interface_added = 0;
-			return -1;
+			/* Try to use existing interface */
+			if (hostapd_if_add(hapd->iface->bss[0], WPA_IF_AP_BSS,
+					   conf->iface, hapd->own_addr, hapd,
+					   &hapd->drv_priv, force_ifname,
+					   if_addr,
+					   conf->bridge[0] ? conf->bridge : NULL,
+					   1)) {
+				wpa_printf(MSG_ERROR, "Failed to add BSS (BSSID="
+					   MACSTR ")", MAC2STR(hapd->own_addr));
+				return -1;
+			}
+		} else {
+			hapd->interface_added = 1;
 		}
 
 		if (!addr)
-- 
1.8.4.5


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux