]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
driver: Make setting up AP optional when creating AP interface
authorAvraham Stern <avraham.stern@intel.com>
Tue, 3 Nov 2015 14:30:09 +0000 (16:30 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 22 Nov 2015 15:42:59 +0000 (17:42 +0200)
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>
src/ap/ap_drv_ops.c
src/drivers/driver.h
src/drivers/driver_nl80211.c
wpa_supplicant/driver_i.h

index 656f0a722c6f7f5b5545a3d3becd14236202c036..b390450c6ad883a46a26beefa1bf59995adf79dd 100644 (file)
@@ -468,7 +468,7 @@ int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type,
                return -1;
        return hapd->driver->if_add(hapd->drv_priv, type, ifname, addr,
                                    bss_ctx, drv_priv, force_ifname, if_addr,
-                                   bridge, use_existing);
+                                   bridge, use_existing, 1);
 }
 
 
index 1ed232097d991ab8da36b1e7fd9a8ed3cac3e19b..d3f7057d10ab7d6e6191c13f55c59dea731465e3 100644 (file)
@@ -2407,12 +2407,13 @@ struct wpa_driver_ops {
         *      change interface address)
         * @bridge: Bridge interface to use or %NULL if no bridge configured
         * @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
         */
        int (*if_add)(void *priv, enum wpa_driver_if_type type,
                      const char *ifname, const u8 *addr, void *bss_ctx,
                      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
index e83a3dfbd45a3eea86b9a2bb92ea30fc654b3c94..43dd0b1657d051b3e29c27a15f61c9a1985b353f 100644 (file)
@@ -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,
                                     void *bss_ctx, void **drv_priv,
                                     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;
        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);
        }
 
-       if (type == WPA_IF_AP_BSS) {
+       if (type == WPA_IF_AP_BSS && setup_ap) {
                struct i802_bss *new_bss = os_zalloc(sizeof(*new_bss));
                if (new_bss == NULL) {
                        if (added)
index f32515433975e407d63041d743a5a8c6ff305e2a..3c2d80b425ad2b74603c297ec223759fe82029f6 100644 (file)
@@ -401,7 +401,7 @@ static inline int wpa_drv_if_add(struct wpa_supplicant *wpa_s,
        if (wpa_s->driver->if_add)
                return wpa_s->driver->if_add(wpa_s->drv_priv, type, ifname,
                                             addr, bss_ctx, NULL, force_ifname,
-                                            if_addr, bridge, 0);
+                                            if_addr, bridge, 0, 0);
        return -1;
 }