driver: Make setting up AP optional when creating AP interface
When an AP interface it created, it is also setup and subscribes for management frames etc. However, when the interface is added by wpa_supplicant, setting up for AP operations is redundant because it will be done by wpa_supplicant on wpa_drv_init() when setting the interface mode to AP. In addition, it may cause wpa_supplicant to fail initializing the interface as it will try to subscribe for management frames on this interface but the interface is already registered. Change this, so when adding an AP interface, make setting up the AP optional, and use it only when the interface is added by hostapd but not when it is added by wpa_supplicant. Signed-off-by: Avraham Stern <avraham.stern@intel.com>
This commit is contained in:
parent
36e820605f
commit
d8a3b66d7f
4 changed files with 7 additions and 5 deletions
|
@ -468,7 +468,7 @@ int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type,
|
||||||
return -1;
|
return -1;
|
||||||
return hapd->driver->if_add(hapd->drv_priv, type, ifname, addr,
|
return hapd->driver->if_add(hapd->drv_priv, type, ifname, addr,
|
||||||
bss_ctx, drv_priv, force_ifname, if_addr,
|
bss_ctx, drv_priv, force_ifname, if_addr,
|
||||||
bridge, use_existing);
|
bridge, use_existing, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2407,12 +2407,13 @@ struct wpa_driver_ops {
|
||||||
* change interface address)
|
* change interface address)
|
||||||
* @bridge: Bridge interface to use or %NULL if no bridge configured
|
* @bridge: Bridge interface to use or %NULL if no bridge configured
|
||||||
* @use_existing: Whether to allow existing interface to be used
|
* @use_existing: Whether to allow existing interface to be used
|
||||||
|
* @setup_ap: Whether to setup AP for %WPA_IF_AP_BSS interfaces
|
||||||
* Returns: 0 on success, -1 on failure
|
* Returns: 0 on success, -1 on failure
|
||||||
*/
|
*/
|
||||||
int (*if_add)(void *priv, enum wpa_driver_if_type type,
|
int (*if_add)(void *priv, enum wpa_driver_if_type type,
|
||||||
const char *ifname, const u8 *addr, void *bss_ctx,
|
const char *ifname, const u8 *addr, void *bss_ctx,
|
||||||
void **drv_priv, char *force_ifname, u8 *if_addr,
|
void **drv_priv, char *force_ifname, u8 *if_addr,
|
||||||
const char *bridge, int use_existing);
|
const char *bridge, int use_existing, int setup_ap);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* if_remove - Remove a virtual interface
|
* if_remove - Remove a virtual interface
|
||||||
|
|
|
@ -5903,7 +5903,8 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
|
||||||
const char *ifname, const u8 *addr,
|
const char *ifname, const u8 *addr,
|
||||||
void *bss_ctx, void **drv_priv,
|
void *bss_ctx, void **drv_priv,
|
||||||
char *force_ifname, u8 *if_addr,
|
char *force_ifname, u8 *if_addr,
|
||||||
const char *bridge, int use_existing)
|
const char *bridge, int use_existing,
|
||||||
|
int setup_ap)
|
||||||
{
|
{
|
||||||
enum nl80211_iftype nlmode;
|
enum nl80211_iftype nlmode;
|
||||||
struct i802_bss *bss = priv;
|
struct i802_bss *bss = priv;
|
||||||
|
@ -5987,7 +5988,7 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
|
||||||
os_memcpy(if_addr, new_addr, ETH_ALEN);
|
os_memcpy(if_addr, new_addr, ETH_ALEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == WPA_IF_AP_BSS) {
|
if (type == WPA_IF_AP_BSS && setup_ap) {
|
||||||
struct i802_bss *new_bss = os_zalloc(sizeof(*new_bss));
|
struct i802_bss *new_bss = os_zalloc(sizeof(*new_bss));
|
||||||
if (new_bss == NULL) {
|
if (new_bss == NULL) {
|
||||||
if (added)
|
if (added)
|
||||||
|
|
|
@ -401,7 +401,7 @@ static inline int wpa_drv_if_add(struct wpa_supplicant *wpa_s,
|
||||||
if (wpa_s->driver->if_add)
|
if (wpa_s->driver->if_add)
|
||||||
return wpa_s->driver->if_add(wpa_s->drv_priv, type, ifname,
|
return wpa_s->driver->if_add(wpa_s->drv_priv, type, ifname,
|
||||||
addr, bss_ctx, NULL, force_ifname,
|
addr, bss_ctx, NULL, force_ifname,
|
||||||
if_addr, bridge, 0);
|
if_addr, bridge, 0, 0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue