From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless@vger.kernel.org
Subject: [PATCH 5/8 v3] cfg80211: implement IWAP for WDS
Date: Tue, 30 Jun 2009 13:52:50 +0200 [thread overview]
Message-ID: <20090630115302.465073283@sipsolutions.net> (raw)
In-Reply-To: 20090630115245.675553951@sipsolutions.net
This implements siocsiwap/giwap for WDS mode.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
include/net/cfg80211.h | 10 +++++++++
net/mac80211/cfg.c | 11 ++++++++++
net/mac80211/wext.c | 26 +++----------------------
net/wireless/wext-compat.c | 46 +++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 71 insertions(+), 22 deletions(-)
--- wireless-testing.orig/include/net/cfg80211.h 2009-06-30 12:43:43.000000000 +0200
+++ wireless-testing/include/net/cfg80211.h 2009-06-30 12:43:47.000000000 +0200
@@ -1018,6 +1018,9 @@ struct cfg80211_ops {
enum tx_power_setting type, int dbm);
int (*get_tx_power)(struct wiphy *wiphy, int *dbm);
+ int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
+ u8 *addr);
+
void (*rfkill_poll)(struct wiphy *wiphy);
#ifdef CONFIG_NL80211_TESTMODE
@@ -1631,6 +1634,13 @@ int cfg80211_wext_giwpower(struct net_de
struct iw_request_info *info,
struct iw_param *wrq, char *extra);
+int cfg80211_wds_wext_siwap(struct net_device *dev,
+ struct iw_request_info *info,
+ struct sockaddr *addr, char *extra);
+int cfg80211_wds_wext_giwap(struct net_device *dev,
+ struct iw_request_info *info,
+ struct sockaddr *addr, char *extra);
+
/*
* callbacks for asynchronous cfg80211 methods, notification
* functions and BSS handling helpers
--- wireless-testing.orig/net/mac80211/wext.c 2009-06-30 12:43:43.000000000 +0200
+++ wireless-testing/net/mac80211/wext.c 2009-06-30 12:43:47.000000000 +0200
@@ -140,23 +140,8 @@ static int ieee80211_ioctl_siwap(struct
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
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;
}
--- wireless-testing.orig/net/wireless/wext-compat.c 2009-06-30 12:43:43.000000000 +0200
+++ wireless-testing/net/wireless/wext-compat.c 2009-06-30 12:43:47.000000000 +0200
@@ -1048,3 +1048,49 @@ int cfg80211_wext_giwpower(struct net_de
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);
--- wireless-testing.orig/net/mac80211/cfg.c 2009-06-30 12:43:43.000000000 +0200
+++ wireless-testing/net/mac80211/cfg.c 2009-06-30 12:43:47.000000000 +0200
@@ -1369,6 +1369,16 @@ static int ieee80211_get_tx_power(struct
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,
--
next prev parent reply other threads:[~2009-06-30 11:54 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-30 11:52 [PATCH 0/8 v3] connect API, wext conversion Johannes Berg
2009-06-30 11:52 ` [PATCH 1/8 v3] cfg80211: connect/disconnect API Johannes Berg
2009-06-30 15:35 ` [PATCH] cfg80211: set conn.state properly in the connect() case Samuel Ortiz
2009-07-01 10:58 ` Johannes Berg
2009-06-30 15:45 ` [PATCH RFC] iwmc3200wifi: connect API port Samuel Ortiz
2009-06-30 11:52 ` [PATCH 2/8 v3] cfg80211: emulate connect with auth/assoc Johannes Berg
2009-06-30 11:52 ` [PATCH 3/8 v3] cfg80211: managed mode wext compatibility Johannes Berg
2009-06-30 11:52 ` [PATCH 4/8 v3] cfg80211: implement iwpower Johannes Berg
2009-06-30 11:52 ` Johannes Berg [this message]
2009-06-30 11:52 ` [PATCH 6/8 v3] cfg80211: implement IWRATE Johannes Berg
2009-06-30 11:52 ` [PATCH 7/8 v3] cfg80211: implement get_wireless_stats Johannes Berg
2009-06-30 11:52 ` [PATCH 8/8 v3] mac80211: re-add HT disabling Johannes Berg
2009-06-30 13:25 ` Vasanthakumar Thiagarajan
2009-06-30 13:37 ` Johannes Berg
2009-06-30 13:52 ` Vasanthakumar Thiagarajan
2009-06-30 14:00 ` Johannes Berg
2009-07-01 7:39 ` [PATCH 8/8 v3.1] " Johannes Berg
2009-07-01 10:13 ` Vasanthakumar Thiagarajan
2009-07-01 10:42 ` Johannes Berg
2009-07-02 9:51 ` Jouni Malinen
2009-07-02 9:53 ` Johannes Berg
2009-07-02 11:43 ` Jouni Malinen
2009-07-02 11:56 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090630115302.465073283@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).