]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Add option for disabling intra BSS distribution
authorSudhakar Swaminathan <Sudhakar.Swaminathan@Atheros.com>
Wed, 8 Sep 2010 18:18:10 +0000 (21:18 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 10 Sep 2010 17:30:26 +0000 (10:30 -0700)
p2p_intra_bss configuration parameter can now be used to
disable/enable intra BSS distribution (bridging of frames between
the clients in a group).

12 files changed:
src/drivers/driver.h
src/drivers/driver_ndis.c
src/p2p/p2p.c
src/p2p/p2p.h
src/p2p/p2p_go_neg.c
src/p2p/p2p_group.c
wpa_supplicant/ap.c
wpa_supplicant/config.c
wpa_supplicant/config.h
wpa_supplicant/config_file.c
wpa_supplicant/driver_i.h
wpa_supplicant/p2p_supplicant.c

index 5352ef5eafa6a10bbc19c5deaa1581c09ca1581d..6274639b8a75e91d754ef6e35f37913056487e19 100644 (file)
@@ -1893,6 +1893,11 @@ struct wpa_driver_ops {
         * Returns: 0 on success or -1 on failure
         */
        int (*ampdu)(void *priv, int ampdu);
+
+       /**
+        * set_intra_bss - Enables/Disables intra BSS bridging
+        */
+       int (*set_intra_bss)(void *priv, int enabled);
 };
 
 
index ed00e984100d5516cf765acd49c01501bade10b9..5bfd613690773f21cfa8be7027d3f5989f3594e6 100644 (file)
@@ -3308,5 +3308,6 @@ const struct wpa_driver_ops wpa_driver_ndis_ops = {
        NULL /* get_noa */,
        NULL /* set_noa */,
        NULL /* set_p2p_powersave */,
-       NULL /* ampdu */
+       NULL /* ampdu */,
+       NULL /* set_intra_bss */
 };
index e4d967ff02683a82c2e777b76493f01354662bb1..ff4d02780dbcd04a042606806402afcbb3abd1a9 100644 (file)
@@ -3031,3 +3031,11 @@ int p2p_get_oper_freq(struct p2p_data *p2p, const u8 *iface_addr)
                return -1;
        return dev->oper_freq;
 }
+
+
+void p2p_set_intra_bss_dist(struct p2p_data *p2p, int enabled)
+{
+       wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Intra BSS distribution %s",
+               enabled ? "enabled" : "disabled");
+       p2p->cfg->p2p_intra_bss = enabled;
+}
index 8d7985b2e382b7396c606219ab4d75d2d8cf9fec..a540bfd482daed2583dfb125ec05470f1148d703 100644 (file)
@@ -222,6 +222,11 @@ struct p2p_config {
         */
        size_t max_peers;
 
+       /**
+        * p2p_intra_bss - Intra BSS communication is supported
+        */
+       int p2p_intra_bss;
+
        /**
         * ssid_postfix - Postfix data to add to the SSID
         *
@@ -1243,4 +1248,11 @@ int p2p_get_oper_freq(struct p2p_data *p2p, const u8 *iface_addr);
 int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq, int level,
                   const u8 *ies, size_t ies_len);
 
+/**
+ * p2p_set_intra_bss_dist - Set intra BSS distribution
+ * @p2p: P2P module context from p2p_init()
+ * @enabled: Whether intra BSS distribution will be enabled
+ */
+void p2p_set_intra_bss_dist(struct p2p_data *p2p, int enabled);
+
 #endif /* P2P_H */
index 0a3d0c451c0fe224c8b4d85f3db141de9687b84a..434d2094f84ca754764caf40957d564fa79b9b09 100644 (file)
@@ -160,6 +160,8 @@ static struct wpabuf * p2p_build_go_neg_req(struct p2p_data *p2p,
                group_capab |= P2P_GROUP_CAPAB_PERSISTENT_GROUP;
        if (p2p->cross_connect)
                group_capab |= P2P_GROUP_CAPAB_CROSS_CONN;
+       if (p2p->cfg->p2p_intra_bss)
+               group_capab |= P2P_GROUP_CAPAB_INTRA_BSS_DIST;
        p2p_buf_add_capability(buf, p2p->dev_capab, group_capab);
        p2p_buf_add_go_intent(buf, (p2p->go_intent << 1) |
                              p2p->next_tie_breaker);
@@ -249,6 +251,8 @@ static struct wpabuf * p2p_build_go_neg_resp(struct p2p_data *p2p,
                        group_capab |= P2P_GROUP_CAPAB_PERSISTENT_GROUP;
                if (p2p->cross_connect)
                        group_capab |= P2P_GROUP_CAPAB_CROSS_CONN;
+               if (p2p->cfg->p2p_intra_bss)
+                       group_capab |= P2P_GROUP_CAPAB_INTRA_BSS_DIST;
        }
        p2p_buf_add_capability(buf, p2p->dev_capab, group_capab);
        p2p_buf_add_go_intent(buf, (p2p->go_intent << 1) | tie_breaker);
@@ -650,6 +654,8 @@ static struct wpabuf * p2p_build_go_neg_conf(struct p2p_data *p2p,
                        group_capab |= P2P_GROUP_CAPAB_PERSISTENT_GROUP;
                if (p2p->cross_connect)
                        group_capab |= P2P_GROUP_CAPAB_CROSS_CONN;
+               if (p2p->cfg->p2p_intra_bss)
+                       group_capab |= P2P_GROUP_CAPAB_INTRA_BSS_DIST;
        }
        p2p_buf_add_capability(buf, p2p->dev_capab, group_capab);
        if (go || resp_chan == NULL)
index 338d1f2b5d7b3bb7fef87ab3f0a89c10b58759e9..4ee84cdedf051ae375801bb632fc36f4057ba43f 100644 (file)
@@ -144,7 +144,8 @@ static void p2p_group_add_common_ies(struct p2p_group *group,
        group_capab |= P2P_GROUP_CAPAB_GROUP_OWNER;
        if (group->cfg->persistent_group)
                group_capab |= P2P_GROUP_CAPAB_PERSISTENT_GROUP;
-       group_capab |= P2P_GROUP_CAPAB_INTRA_BSS_DIST;
+       if (group->p2p->cfg->p2p_intra_bss)
+               group_capab |= P2P_GROUP_CAPAB_INTRA_BSS_DIST;
        if (group->group_formation)
                group_capab |= P2P_GROUP_CAPAB_GROUP_FORMATION;
        if (group->p2p->cross_connect)
index 5d9edfaeddc30ef2802ec8cb99a987e135706031..26a1d11fb84dc3beea5f72ab245d9625d016a26d 100644 (file)
@@ -302,6 +302,7 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
        if (ssid->mode == WPAS_MODE_P2P_GO ||
            ssid->mode == WPAS_MODE_P2P_GROUP_FORMATION)
                params.p2p = 1;
+       wpa_drv_set_intra_bss(wpa_s, wpa_s->conf->p2p_intra_bss);
 #endif /* CONFIG_P2P */
 
        if (wpa_s->parent->set_ap_uapsd)
index 4b748807c9af98d9b6702196c29c09e88a3fd0b7..6e03760a96ed6cb7779d61d49d9a1dd18ccc477e 100644 (file)
@@ -2144,6 +2144,7 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
        config->ap_scan = DEFAULT_AP_SCAN;
        config->fast_reauth = DEFAULT_FAST_REAUTH;
        config->p2p_go_intent = DEFAULT_P2P_GO_INTENT;
+       config->p2p_intra_bss = DEFAULT_P2P_INTRA_BSS;
        config->bss_max_count = DEFAULT_BSS_MAX_COUNT;
 
        if (ctrl_interface)
@@ -2400,6 +2401,7 @@ static const struct global_parse_data global_fields[] = {
        { INT_RANGE(p2p_go_intent, 0, 15), 0 },
        { STR(p2p_ssid_postfix), CFG_CHANGED_P2P_SSID_POSTFIX },
        { INT_RANGE(persistent_reconnect, 0, 1), 0 },
+       { INT_RANGE(p2p_intra_bss, 0, 1), CFG_CHANGED_P2P_INTRA_BSS },
 #endif /* CONFIG_P2P */
        { FUNC(country), CFG_CHANGED_COUNTRY },
        { INT(bss_max_count), 0 },
index d3291cd058cba84f881a3506adc245a13c7bf24a..246c65fc3e59e1405eddfc7ed0f034fd41139ab8 100644 (file)
@@ -23,6 +23,7 @@
 #endif /* CONFIG_NO_SCAN_PROCESSING */
 #define DEFAULT_FAST_REAUTH 1
 #define DEFAULT_P2P_GO_INTENT 7
+#define DEFAULT_P2P_INTRA_BSS 1
 #define DEFAULT_BSS_MAX_COUNT 200
 
 #include "config_ssid.h"
@@ -37,6 +38,7 @@
 #define CFG_CHANGED_SEC_DEVICE_TYPE BIT(6)
 #define CFG_CHANGED_P2P_SSID_POSTFIX BIT(7)
 #define CFG_CHANGED_WPS_STRING BIT(8)
+#define CFG_CHANGED_P2P_INTRA_BSS BIT(9)
 
 /**
  * struct wpa_config - wpa_supplicant configuration data
@@ -361,6 +363,7 @@ struct wpa_config {
        int p2p_go_intent;
        char *p2p_ssid_postfix;
        int persistent_reconnect;
+       int p2p_intra_bss;
 
        /**
         * bss_max_count - Maximum number of BSS entries to keep in memory
index 1b9cc6016c87f6aa2322460ac10f02cf00f2568a..0f343fd04cb22994582610fd723de31066c7f759 100644 (file)
@@ -673,6 +673,9 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
        if (config->persistent_reconnect)
                fprintf(f, "persistent_reconnect=%u\n",
                        config->persistent_reconnect);
+       if (config->p2p_intra_bss != DEFAULT_P2P_INTRA_BSS)
+               fprintf(f, "p2p_intra_bss=%u\n", config->p2p_intra_bss);
+
 #endif /* CONFIG_P2P */
        if (config->country[0] && config->country[1]) {
                fprintf(f, "country=%c%c\n",
index bfc5b749f7a1e28e7773e559e75fb7649d82cc38..b5c9fc853abe02d8805a23d44329df52893d71cb 100644 (file)
@@ -424,6 +424,14 @@ static inline int wpa_drv_if_remove(struct wpa_supplicant *wpa_s,
        return -1;
 }
 
+static inline int wpa_drv_set_intra_bss(struct wpa_supplicant *wpa_s,
+                                       int enabled)
+{
+       if (wpa_s->driver->set_intra_bss)
+               return wpa_s->driver->set_intra_bss(wpa_s->drv_priv, enabled);
+       return -1;
+}
+
 static inline int wpa_drv_remain_on_channel(struct wpa_supplicant *wpa_s,
                                            unsigned int freq,
                                            unsigned int duration)
index 39d665471a555eff363c675b80a70d6ff5afc763..056d6f1638414843644ff6b7e0b8837b6a9ed5ca 100644 (file)
@@ -2201,6 +2201,8 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
                          p2p.ssid_postfix_len);
        }
 
+       p2p.p2p_intra_bss = wpa_s->conf->p2p_intra_bss;
+
        global->p2p = p2p_init(&p2p);
        if (global->p2p == NULL)
                return -1;
@@ -3395,6 +3397,9 @@ void wpas_p2p_update_config(struct wpa_supplicant *wpa_s)
                                     os_strlen(wpa_s->conf->p2p_ssid_postfix) :
                                     0);
        }
+
+       if (wpa_s->conf->changed_parameters & CFG_CHANGED_P2P_INTRA_BSS)
+               p2p_set_intra_bss_dist(p2p, wpa_s->conf->p2p_intra_bss);
 }