summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-01 21:26:58 +0200
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 15:01:52 -0400
commitab737a4f7dbe57b12b73f482a7b973bf00b41942 (patch)
tree33f3c44073921b9fa4c96ea5501dbfcad59567ac /net
parentbc92afd92088ab41223383cc6863ab4792533c54 (diff)
cfg80211: implement IWAP for WDS
This implements siocsiwap/giwap for WDS mode. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/cfg.c11
-rw-r--r--net/mac80211/wext.c26
-rw-r--r--net/wireless/wext-compat.c46
3 files changed, 61 insertions, 22 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 8c7b2cdbeed..2cf5bf6378e 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1369,6 +1369,16 @@ static int ieee80211_get_tx_power(struct wiphy *wiphy, int *dbm)
return 0;
}
+static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
+ u8 *addr)
+{
+ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
+ memcpy(&sdata->u.wds.remote_addr, addr, ETH_ALEN);
+
+ return 0;
+}
+
static void ieee80211_rfkill_poll(struct wiphy *wiphy)
{
struct ieee80211_local *local = wiphy_priv(wiphy);
@@ -1454,6 +1464,7 @@ struct cfg80211_ops mac80211_config_ops = {
.set_wiphy_params = ieee80211_set_wiphy_params,
.set_tx_power = ieee80211_set_tx_power,
.get_tx_power = ieee80211_get_tx_power,
+ .set_wds_peer = ieee80211_set_wds_peer,
.rfkill_poll = ieee80211_rfkill_poll,
CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
.set_power_mgmt = ieee80211_set_power_mgmt,
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index f77929802c7..4053d766af2 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -140,23 +140,8 @@ static int ieee80211_ioctl_siwap(struct net_device *dev,
if (sdata->vif.type == NL80211_IFTYPE_STATION)
return cfg80211_mgd_wext_siwap(dev, info, ap_addr, extra);
- if (sdata->vif.type == NL80211_IFTYPE_WDS) {
- /*
- * If it is necessary to update the WDS peer address
- * while the interface is running, then we need to do
- * more work here, namely if it is running we need to
- * add a new and remove the old STA entry, this is
- * normally handled by _open() and _stop().
- */
- if (netif_running(dev))
- return -EBUSY;
-
- memcpy(&sdata->u.wds.remote_addr, (u8 *) &ap_addr->sa_data,
- ETH_ALEN);
-
- return 0;
- }
-
+ if (sdata->vif.type == NL80211_IFTYPE_WDS)
+ return cfg80211_wds_wext_siwap(dev, info, ap_addr, extra);
return -EOPNOTSUPP;
}
@@ -173,11 +158,8 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
if (sdata->vif.type == NL80211_IFTYPE_STATION)
return cfg80211_mgd_wext_giwap(dev, info, ap_addr, extra);
- if (sdata->vif.type == NL80211_IFTYPE_WDS) {
- ap_addr->sa_family = ARPHRD_ETHER;
- memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN);
- return 0;
- }
+ if (sdata->vif.type == NL80211_IFTYPE_WDS)
+ return cfg80211_wds_wext_giwap(dev, info, ap_addr, extra);
return -EOPNOTSUPP;
}
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 2e1ab78fb0d..2f72dae2634 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -1047,3 +1047,49 @@ int cfg80211_wext_giwpower(struct net_device *dev,
return 0;
}
EXPORT_SYMBOL_GPL(cfg80211_wext_giwpower);
+
+int cfg80211_wds_wext_siwap(struct net_device *dev,
+ struct iw_request_info *info,
+ struct sockaddr *addr, char *extra)
+{
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
+ int err;
+
+ if (WARN_ON(wdev->iftype != NL80211_IFTYPE_WDS))
+ return -EINVAL;
+
+ if (addr->sa_family != ARPHRD_ETHER)
+ return -EINVAL;
+
+ if (netif_running(dev))
+ return -EBUSY;
+
+ if (!rdev->ops->set_wds_peer)
+ return -EOPNOTSUPP;
+
+ err = rdev->ops->set_wds_peer(wdev->wiphy, dev, (u8 *) &addr->sa_data);
+ if (err)
+ return err;
+
+ memcpy(&wdev->wext.bssid, (u8 *) &addr->sa_data, ETH_ALEN);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(cfg80211_wds_wext_siwap);
+
+int cfg80211_wds_wext_giwap(struct net_device *dev,
+ struct iw_request_info *info,
+ struct sockaddr *addr, char *extra)
+{
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+
+ if (WARN_ON(wdev->iftype != NL80211_IFTYPE_WDS))
+ return -EINVAL;
+
+ addr->sa_family = ARPHRD_ETHER;
+ memcpy(&addr->sa_data, wdev->wext.bssid, ETH_ALEN);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(cfg80211_wds_wext_giwap);