Deprecate set_intra_bss() driver_ops
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 17 Oct 2011 15:58:46 +0000 (18:58 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 17 Oct 2011 15:58:46 +0000 (18:58 +0300)
The AP client isolation parameter is now available through set_ap().
driver_nl80211.c was the only driver wrapper using the set_intra_bss()
call in hostap.git, but some external trees may have used this. Once
those are cleared, the set_infra_bss() driver_ops can be removed
completely. The only remaining use case for it currently is in P2P
GO mode with wpa_supplicant.

src/ap/beacon.c
src/drivers/driver.h
src/drivers/driver_nl80211.c

index c0fa639..7b07e07 100644 (file)
@@ -436,14 +436,6 @@ void handle_probe_req(struct hostapd_data *hapd,
 }
 
 
-static int hostapd_set_ap_isolate(struct hostapd_data *hapd, int value)
-{
-       if (hapd->driver == NULL || hapd->driver->set_intra_bss == NULL)
-               return 0;
-       return hapd->driver->set_intra_bss(hapd->drv_priv, !value);
-}
-
-
 static int hostapd_set_bss_params(struct hostapd_data *hapd,
                                  int use_protection)
 {
@@ -494,13 +486,6 @@ static int hostapd_set_bss_params(struct hostapd_data *hapd,
                ret = -1;
        }
 
-       if (hostapd_set_ap_isolate(hapd, hapd->conf->isolate) &&
-           hapd->conf->isolate) {
-               wpa_printf(MSG_ERROR, "Could not enable AP isolation in "
-                          "kernel driver");
-               ret = -1;
-       }
-
        return ret;
 }
 
@@ -666,6 +651,7 @@ void ieee802_11_set_beacon(struct hostapd_data *hapd)
        params.beacon_ies = beacon;
        params.proberesp_ies = proberesp;
        params.assocresp_ies = assocresp;
+       params.isolate = hapd->conf->isolate;
        if (hostapd_drv_set_ap(hapd, &params))
                wpa_printf(MSG_ERROR, "Failed to set beacon parameters");
        hostapd_free_ap_extra_ies(hapd, beacon, proberesp, assocresp);
index 79c24f9..a690384 100644 (file)
@@ -619,6 +619,14 @@ struct wpa_driver_ap_params {
         * (Re)Association Request frames internally.
         */
        const struct wpabuf *assocresp_ies;
+
+       /**
+        * isolate - Whether to isolate frames between associated stations
+        *
+        * If this is non-zero, the AP is requested to disable forwarding of
+        * frames between association stations.
+        */
+       int isolate;
 };
 
 /**
@@ -2128,6 +2136,8 @@ struct wpa_driver_ops {
 
        /**
         * set_intra_bss - Enables/Disables intra BSS bridging
+        *
+        * DEPRECATED - use set_ap() parameter isolate instead
         */
        int (*set_intra_bss)(void *priv, int enabled);
 
index bb2b797..4e9c126 100644 (file)
@@ -4161,6 +4161,27 @@ static int wpa_driver_nl80211_send_mlme(void *priv, const u8 *data,
 }
 
 
+static int nl80211_set_ap_isolate(struct i802_bss *bss, int enabled)
+{
+       struct wpa_driver_nl80211_data *drv = bss->drv;
+       struct nl_msg *msg;
+
+       msg = nlmsg_alloc();
+       if (!msg)
+               return -ENOMEM;
+
+       genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0,
+                   NL80211_CMD_SET_BSS, 0);
+
+       NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(bss->ifname));
+       NLA_PUT_U8(msg, NL80211_ATTR_AP_ISOLATE, enabled);
+
+       return send_and_recv_msgs(drv, msg, NULL, NULL);
+ nla_put_failure:
+       return -ENOBUFS;
+}
+
+
 static int wpa_driver_nl80211_set_ap(void *priv,
                                     struct wpa_driver_ap_params *params)
 {
@@ -4293,6 +4314,13 @@ static int wpa_driver_nl80211_set_ap(void *priv,
                           ret, strerror(-ret));
        } else {
                bss->beacon_set = 1;
+               ret = nl80211_set_ap_isolate(bss, params->isolate);
+               if (!params->isolate && ret) {
+                       wpa_printf(MSG_DEBUG, "nl80211: Ignore AP isolation "
+                                  "configuration error since isolation is "
+                                  "not used");
+                       ret = 0;
+               }
        }
        return ret;
  nla_put_failure:
@@ -7190,28 +7218,6 @@ static int nl80211_send_frame(void *priv, const u8 *data, size_t data_len,
 }
 
 
-static int nl80211_set_intra_bss(void *priv, int enabled)
-{
-       struct i802_bss *bss = priv;
-       struct wpa_driver_nl80211_data *drv = bss->drv;
-       struct nl_msg *msg;
-
-       msg = nlmsg_alloc();
-       if (!msg)
-               return -ENOMEM;
-
-       genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0,
-                   NL80211_CMD_SET_BSS, 0);
-
-       NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(bss->ifname));
-       NLA_PUT_U8(msg, NL80211_ATTR_AP_ISOLATE, !enabled);
-
-       return send_and_recv_msgs(drv, msg, NULL, NULL);
- nla_put_failure:
-       return -ENOBUFS;
-}
-
-
 static int nl80211_set_param(void *priv, const char *param)
 {
        wpa_printf(MSG_DEBUG, "nl80211: driver param='%s'", param);
@@ -7420,7 +7426,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
        .signal_monitor = nl80211_signal_monitor,
        .signal_poll = nl80211_signal_poll,
        .send_frame = nl80211_send_frame,
-       .set_intra_bss = nl80211_set_intra_bss,
        .set_param = nl80211_set_param,
        .get_radio_name = nl80211_get_radio_name,
        .add_pmkid = nl80211_add_pmkid,