Commit af8cdcd8 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

mac80211: convert to cfg80211 IBSS API

This converts mac80211 to the new cfg80211 IBSS API, the
wext handling functions are called where appropriate.
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 04a773ad
...@@ -1283,6 +1283,21 @@ static int ieee80211_disassoc(struct wiphy *wiphy, struct net_device *dev, ...@@ -1283,6 +1283,21 @@ static int ieee80211_disassoc(struct wiphy *wiphy, struct net_device *dev,
return ieee80211_sta_disassociate(sdata, req->reason_code); return ieee80211_sta_disassociate(sdata, req->reason_code);
} }
static int ieee80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_ibss_params *params)
{
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
return ieee80211_ibss_join(sdata, params);
}
static int ieee80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
{
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
return ieee80211_ibss_leave(sdata);
}
struct cfg80211_ops mac80211_config_ops = { struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface, .add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface, .del_virtual_intf = ieee80211_del_iface,
...@@ -1319,4 +1334,6 @@ struct cfg80211_ops mac80211_config_ops = { ...@@ -1319,4 +1334,6 @@ struct cfg80211_ops mac80211_config_ops = {
.assoc = ieee80211_assoc, .assoc = ieee80211_assoc,
.deauth = ieee80211_deauth, .deauth = ieee80211_deauth,
.disassoc = ieee80211_disassoc, .disassoc = ieee80211_disassoc,
.join_ibss = ieee80211_join_ibss,
.leave_ibss = ieee80211_leave_ibss,
}; };
This diff is collapsed.
...@@ -323,14 +323,6 @@ struct ieee80211_if_managed { ...@@ -323,14 +323,6 @@ struct ieee80211_if_managed {
size_t sme_auth_ie_len; size_t sme_auth_ie_len;
}; };
enum ieee80211_ibss_flags {
IEEE80211_IBSS_AUTO_CHANNEL_SEL = BIT(0),
IEEE80211_IBSS_AUTO_BSSID_SEL = BIT(1),
IEEE80211_IBSS_BSSID_SET = BIT(2),
IEEE80211_IBSS_PREV_BSSID_SET = BIT(3),
IEEE80211_IBSS_SSID_SET = BIT(4),
};
enum ieee80211_ibss_request { enum ieee80211_ibss_request {
IEEE80211_IBSS_REQ_RUN = 0, IEEE80211_IBSS_REQ_RUN = 0,
}; };
...@@ -341,17 +333,20 @@ struct ieee80211_if_ibss { ...@@ -341,17 +333,20 @@ struct ieee80211_if_ibss {
struct sk_buff_head skb_queue; struct sk_buff_head skb_queue;
u8 ssid[IEEE80211_MAX_SSID_LEN]; unsigned long request;
u8 ssid_len; unsigned long last_scan_completed;
bool fixed_bssid;
u32 flags; bool fixed_channel;
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
u8 ssid[IEEE80211_MAX_SSID_LEN];
unsigned long request; u8 ssid_len, ie_len;
u8 *ie;
struct ieee80211_channel *channel;
unsigned long ibss_join_req; unsigned long ibss_join_req;
struct sk_buff *probe_resp; /* ProbeResp template for IBSS */ /* probe response/beacon for IBSS */
struct sk_buff *presp, *skb;
enum { enum {
IEEE80211_IBSS_MLME_SEARCH, IEEE80211_IBSS_MLME_SEARCH,
...@@ -630,8 +625,6 @@ struct ieee80211_local { ...@@ -630,8 +625,6 @@ struct ieee80211_local {
spinlock_t sta_lock; spinlock_t sta_lock;
unsigned long num_sta; unsigned long num_sta;
struct list_head sta_list; struct list_head sta_list;
struct list_head sta_flush_list;
struct work_struct sta_flush_work;
struct sta_info *sta_hash[STA_HASH_SIZE]; struct sta_info *sta_hash[STA_HASH_SIZE];
struct timer_list sta_cleanup; struct timer_list sta_cleanup;
...@@ -681,7 +674,6 @@ struct ieee80211_local { ...@@ -681,7 +674,6 @@ struct ieee80211_local {
int scan_ies_len; int scan_ies_len;
enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state; enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
unsigned long last_scan_completed;
struct delayed_work scan_work; struct delayed_work scan_work;
struct ieee80211_sub_if_data *scan_sdata; struct ieee80211_sub_if_data *scan_sdata;
enum nl80211_channel_type oper_channel_type; enum nl80211_channel_type oper_channel_type;
...@@ -946,10 +938,6 @@ int ieee80211_max_network_latency(struct notifier_block *nb, ...@@ -946,10 +938,6 @@ int ieee80211_max_network_latency(struct notifier_block *nb,
unsigned long data, void *dummy); unsigned long data, void *dummy);
/* IBSS code */ /* IBSS code */
int ieee80211_ibss_commit(struct ieee80211_sub_if_data *sdata);
int ieee80211_ibss_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len);
int ieee80211_ibss_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len);
int ieee80211_ibss_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid);
void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local);
void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata); void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata);
ieee80211_rx_result ieee80211_rx_result
...@@ -957,6 +945,9 @@ ieee80211_ibss_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, ...@@ -957,6 +945,9 @@ ieee80211_ibss_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
struct ieee80211_rx_status *rx_status); struct ieee80211_rx_status *rx_status);
struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
u8 *bssid, u8 *addr, u32 supp_rates); u8 *bssid, u8 *addr, u32 supp_rates);
int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
struct cfg80211_ibss_params *params);
int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata);
/* scan/BSS handling */ /* scan/BSS handling */
void ieee80211_scan_work(struct work_struct *work); void ieee80211_scan_work(struct work_struct *work);
......
...@@ -235,11 +235,7 @@ static int ieee80211_open(struct net_device *dev) ...@@ -235,11 +235,7 @@ static int ieee80211_open(struct net_device *dev)
netif_addr_unlock_bh(local->mdev); netif_addr_unlock_bh(local->mdev);
break; break;
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
case NL80211_IFTYPE_ADHOC:
if (sdata->vif.type == NL80211_IFTYPE_STATION)
sdata->u.mgd.flags &= ~IEEE80211_STA_PREV_BSSID_SET; sdata->u.mgd.flags &= ~IEEE80211_STA_PREV_BSSID_SET;
else
sdata->u.ibss.flags &= ~IEEE80211_IBSS_PREV_BSSID_SET;
/* fall through */ /* fall through */
default: default:
conf.vif = &sdata->vif; conf.vif = &sdata->vif;
...@@ -327,8 +323,6 @@ static int ieee80211_open(struct net_device *dev) ...@@ -327,8 +323,6 @@ static int ieee80211_open(struct net_device *dev)
*/ */
if (sdata->vif.type == NL80211_IFTYPE_STATION) if (sdata->vif.type == NL80211_IFTYPE_STATION)
queue_work(local->hw.workqueue, &sdata->u.mgd.work); queue_work(local->hw.workqueue, &sdata->u.mgd.work);
else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
queue_work(local->hw.workqueue, &sdata->u.ibss.work);
netif_tx_start_all_queues(dev); netif_tx_start_all_queues(dev);
...@@ -499,7 +493,6 @@ static int ieee80211_stop(struct net_device *dev) ...@@ -499,7 +493,6 @@ static int ieee80211_stop(struct net_device *dev)
/* fall through */ /* fall through */
case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_ADHOC:
if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
memset(sdata->u.ibss.bssid, 0, ETH_ALEN);
del_timer_sync(&sdata->u.ibss.timer); del_timer_sync(&sdata->u.ibss.timer);
cancel_work_sync(&sdata->u.ibss.work); cancel_work_sync(&sdata->u.ibss.work);
synchronize_rcu(); synchronize_rcu();
...@@ -653,7 +646,8 @@ static void ieee80211_teardown_sdata(struct net_device *dev) ...@@ -653,7 +646,8 @@ static void ieee80211_teardown_sdata(struct net_device *dev)
mesh_rmc_free(sdata); mesh_rmc_free(sdata);
break; break;
case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_ADHOC:
kfree_skb(sdata->u.ibss.probe_resp); if (WARN_ON(sdata->u.ibss.presp))
kfree_skb(sdata->u.ibss.presp);
break; break;
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
kfree(sdata->u.mgd.extra_ie); kfree(sdata->u.mgd.extra_ie);
......
...@@ -209,7 +209,7 @@ int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed) ...@@ -209,7 +209,7 @@ int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed)
!!rcu_dereference(sdata->u.ap.beacon); !!rcu_dereference(sdata->u.ap.beacon);
break; break;
case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_ADHOC:
conf.enable_beacon = !!sdata->u.ibss.probe_resp; conf.enable_beacon = !!sdata->u.ibss.presp;
break; break;
case NL80211_IFTYPE_MESH_POINT: case NL80211_IFTYPE_MESH_POINT:
conf.enable_beacon = true; conf.enable_beacon = true;
......
...@@ -295,8 +295,6 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) ...@@ -295,8 +295,6 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
cfg80211_scan_done(local->scan_req, aborted); cfg80211_scan_done(local->scan_req, aborted);
local->scan_req = NULL; local->scan_req = NULL;
local->last_scan_completed = jiffies;
if (local->hw_scanning) { if (local->hw_scanning) {
local->hw_scanning = false; local->hw_scanning = false;
/* /*
......
...@@ -686,41 +686,10 @@ static void sta_info_debugfs_add_work(struct work_struct *work) ...@@ -686,41 +686,10 @@ static void sta_info_debugfs_add_work(struct work_struct *work)
} }
#endif #endif
static void __ieee80211_run_pending_flush(struct ieee80211_local *local)
{
struct sta_info *sta;
unsigned long flags;
ASSERT_RTNL();
spin_lock_irqsave(&local->sta_lock, flags);
while (!list_empty(&local->sta_flush_list)) {
sta = list_first_entry(&local->sta_flush_list,
struct sta_info, list);
list_del(&sta->list);
spin_unlock_irqrestore(&local->sta_lock, flags);
sta_info_destroy(sta);
spin_lock_irqsave(&local->sta_lock, flags);
}
spin_unlock_irqrestore(&local->sta_lock, flags);
}
static void ieee80211_sta_flush_work(struct work_struct *work)
{
struct ieee80211_local *local =
container_of(work, struct ieee80211_local, sta_flush_work);
rtnl_lock();
__ieee80211_run_pending_flush(local);
rtnl_unlock();
}
void sta_info_init(struct ieee80211_local *local) void sta_info_init(struct ieee80211_local *local)
{ {
spin_lock_init(&local->sta_lock); spin_lock_init(&local->sta_lock);
INIT_LIST_HEAD(&local->sta_list); INIT_LIST_HEAD(&local->sta_list);
INIT_LIST_HEAD(&local->sta_flush_list);
INIT_WORK(&local->sta_flush_work, ieee80211_sta_flush_work);
setup_timer(&local->sta_cleanup, sta_info_cleanup, setup_timer(&local->sta_cleanup, sta_info_cleanup,
(unsigned long)local); (unsigned long)local);
...@@ -741,7 +710,6 @@ int sta_info_start(struct ieee80211_local *local) ...@@ -741,7 +710,6 @@ int sta_info_start(struct ieee80211_local *local)
void sta_info_stop(struct ieee80211_local *local) void sta_info_stop(struct ieee80211_local *local)
{ {
del_timer(&local->sta_cleanup); del_timer(&local->sta_cleanup);
cancel_work_sync(&local->sta_flush_work);
#ifdef CONFIG_MAC80211_DEBUGFS #ifdef CONFIG_MAC80211_DEBUGFS
/* /*
* Make sure the debugfs adding work isn't pending after this * Make sure the debugfs adding work isn't pending after this
...@@ -752,10 +720,7 @@ void sta_info_stop(struct ieee80211_local *local) ...@@ -752,10 +720,7 @@ void sta_info_stop(struct ieee80211_local *local)
cancel_work_sync(&local->sta_debugfs_add); cancel_work_sync(&local->sta_debugfs_add);
#endif #endif
rtnl_lock();
sta_info_flush(local, NULL); sta_info_flush(local, NULL);
__ieee80211_run_pending_flush(local);
rtnl_unlock();
} }
/** /**
...@@ -775,7 +740,6 @@ int sta_info_flush(struct ieee80211_local *local, ...@@ -775,7 +740,6 @@ int sta_info_flush(struct ieee80211_local *local,
unsigned long flags; unsigned long flags;
might_sleep(); might_sleep();
ASSERT_RTNL();
spin_lock_irqsave(&local->sta_lock, flags); spin_lock_irqsave(&local->sta_lock, flags);
list_for_each_entry_safe(sta, tmp, &local->sta_list, list) { list_for_each_entry_safe(sta, tmp, &local->sta_list, list) {
...@@ -795,39 +759,6 @@ int sta_info_flush(struct ieee80211_local *local, ...@@ -795,39 +759,6 @@ int sta_info_flush(struct ieee80211_local *local,
return ret; return ret;
} }
/**
* sta_info_flush_delayed - flush matching STA entries from the STA table
*
* This function unlinks all stations for a given interface and queues
* them for freeing. Note that the workqueue function scheduled here has
* to run before any new keys can be added to the system to avoid set_key()
* callback ordering issues.
*
* @sdata: the interface
*/
void sta_info_flush_delayed(struct ieee80211_sub_if_data *sdata)
{
struct ieee80211_local *local = sdata->local;
struct sta_info *sta, *tmp;
unsigned long flags;
bool work = false;
spin_lock_irqsave(&local->sta_lock, flags);
list_for_each_entry_safe(sta, tmp, &local->sta_list, list) {
if (sdata == sta->sdata) {
__sta_info_unlink(&sta);
if (sta) {
list_add_tail(&sta->list,
&local->sta_flush_list);
work = true;
}
}
}
if (work)
schedule_work(&local->sta_flush_work);
spin_unlock_irqrestore(&local->sta_lock, flags);
}
void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
unsigned long exp_time) unsigned long exp_time)
{ {
......
...@@ -443,7 +443,6 @@ int sta_info_start(struct ieee80211_local *local); ...@@ -443,7 +443,6 @@ int sta_info_start(struct ieee80211_local *local);
void sta_info_stop(struct ieee80211_local *local); void sta_info_stop(struct ieee80211_local *local);
int sta_info_flush(struct ieee80211_local *local, int sta_info_flush(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata); struct ieee80211_sub_if_data *sdata);
void sta_info_flush_delayed(struct ieee80211_sub_if_data *sdata);
void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
unsigned long exp_time); unsigned long exp_time);
......
...@@ -2102,18 +2102,18 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, ...@@ -2102,18 +2102,18 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
} else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
struct sk_buff *presp = rcu_dereference(ifibss->presp);
if (!ifibss->probe_resp) if (!presp)
goto out; goto out;
skb = skb_copy(ifibss->probe_resp, GFP_ATOMIC); skb = skb_copy(presp, GFP_ATOMIC);
if (!skb) if (!skb)
goto out; goto out;
hdr = (struct ieee80211_hdr *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
IEEE80211_STYPE_BEACON); IEEE80211_STYPE_BEACON);
} else if (ieee80211_vif_is_mesh(&sdata->vif)) { } else if (ieee80211_vif_is_mesh(&sdata->vif)) {
struct ieee80211_mgmt *mgmt; struct ieee80211_mgmt *mgmt;
u8 *pos; u8 *pos;
......
...@@ -149,17 +149,14 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev, ...@@ -149,17 +149,14 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev,
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
if (sdata->vif.type == NL80211_IFTYPE_ADHOC) if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
sdata->u.ibss.flags &= ~IEEE80211_IBSS_AUTO_CHANNEL_SEL; return cfg80211_ibss_wext_siwfreq(dev, info, freq, extra);
else if (sdata->vif.type == NL80211_IFTYPE_STATION) else if (sdata->vif.type == NL80211_IFTYPE_STATION)
sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL; sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL;
/* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */ /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */
if (freq->e == 0) { if (freq->e == 0) {
if (freq->m < 0) { if (freq->m < 0) {
if (sdata->vif.type == NL80211_IFTYPE_ADHOC) if (sdata->vif.type == NL80211_IFTYPE_STATION)
sdata->u.ibss.flags |=
IEEE80211_IBSS_AUTO_CHANNEL_SEL;
else if (sdata->vif.type == NL80211_IFTYPE_STATION)
sdata->u.mgd.flags |= sdata->u.mgd.flags |=
IEEE80211_STA_AUTO_CHANNEL_SEL; IEEE80211_STA_AUTO_CHANNEL_SEL;
return 0; return 0;
...@@ -183,6 +180,10 @@ static int ieee80211_ioctl_giwfreq(struct net_device *dev, ...@@ -183,6 +180,10 @@ static int ieee80211_ioctl_giwfreq(struct net_device *dev,
struct iw_freq *freq, char *extra) struct iw_freq *freq, char *extra)
{ {
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra);
freq->m = local->hw.conf.channel->center_freq; freq->m = local->hw.conf.channel->center_freq;
freq->e = 6; freq->e = 6;
...@@ -195,15 +196,17 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev, ...@@ -195,15 +196,17 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
struct iw_point *data, char *ssid) struct iw_point *data, char *ssid)
{ {
struct ieee80211_sub_if_data *sdata; struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
size_t len = data->length; size_t len = data->length;
int ret; int ret;
if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
return cfg80211_ibss_wext_siwessid(dev, info, data, ssid);
/* iwconfig uses nul termination in SSID.. */ /* iwconfig uses nul termination in SSID.. */
if (len > 0 && ssid[len - 1] == '\0') if (len > 0 && ssid[len - 1] == '\0')
len--; len--;
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
if (sdata->vif.type == NL80211_IFTYPE_STATION) { if (sdata->vif.type == NL80211_IFTYPE_STATION) {
if (data->flags) if (data->flags)
sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_SSID_SEL; sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_SSID_SEL;
...@@ -217,8 +220,7 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev, ...@@ -217,8 +220,7 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev,
sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME; sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME;
ieee80211_sta_req_auth(sdata); ieee80211_sta_req_auth(sdata);
return 0; return 0;
} else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) }
return ieee80211_ibss_set_ssid(sdata, ssid, len);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -229,9 +231,13 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev, ...@@ -229,9 +231,13 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev,
struct iw_point *data, char *ssid) struct iw_point *data, char *ssid)
{ {
size_t len; size_t len;
struct ieee80211_sub_if_data *sdata; struct ieee80211_sub_if_data *sdata;
sdata = IEEE80211_DEV_TO_SUB_IF(dev); sdata = IEEE80211_DEV_TO_SUB_IF(dev);
if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
return cfg80211_ibss_wext_giwessid(dev, info, data, ssid);
if (sdata->vif.type == NL80211_IFTYPE_STATION) { if (sdata->vif.type == NL80211_IFTYPE_STATION) {
int res = ieee80211_sta_get_ssid(sdata, ssid, &len); int res = ieee80211_sta_get_ssid(sdata, ssid, &len);
if (res == 0) { if (res == 0) {
...@@ -240,14 +246,6 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev, ...@@ -240,14 +246,6 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev,
} else } else
data->flags = 0; data->flags = 0;
return res; return res;
} else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
int res = ieee80211_ibss_get_ssid(sdata, ssid, &len);
if (res == 0) {
data->length = len;
data->flags = 1;
} else
data->flags = 0;
return res;
} }
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -258,9 +256,11 @@ static int ieee80211_ioctl_siwap(struct net_device *dev, ...@@ -258,9 +256,11 @@ static int ieee80211_ioctl_siwap(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
struct sockaddr *ap_addr, char *extra) struct sockaddr *ap_addr, char *extra)
{ {
struct ieee80211_sub_if_data *sdata; struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
return cfg80211_ibss_wext_siwap(dev, info, ap_addr, extra);
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
if (sdata->vif.type == NL80211_IFTYPE_STATION) { if (sdata->vif.type == NL80211_IFTYPE_STATION) {
int ret; int ret;
...@@ -277,16 +277,6 @@ static int ieee80211_ioctl_siwap(struct net_device *dev, ...@@ -277,16 +277,6 @@ static int ieee80211_ioctl_siwap(struct net_device *dev,
sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME; sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME;
ieee80211_sta_req_auth(sdata); ieee80211_sta_req_auth(sdata);
return 0; return 0;
} else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
if (is_zero_ether_addr((u8 *) &ap_addr->sa_data))
sdata->u.ibss.flags |= IEEE80211_IBSS_AUTO_BSSID_SEL |
IEEE80211_IBSS_AUTO_CHANNEL_SEL;
else if (is_broadcast_ether_addr((u8 *) &ap_addr->sa_data))
sdata->u.ibss.flags |= IEEE80211_IBSS_AUTO_BSSID_SEL;
else
sdata->u.ibss.flags &= ~IEEE80211_IBSS_AUTO_BSSID_SEL;
return ieee80211_ibss_set_bssid(sdata, (u8 *) &ap_addr->sa_data);
} else if (sdata->vif.type == NL80211_IFTYPE_WDS) { } else if (sdata->vif.type == NL80211_IFTYPE_WDS) {
/* /*
* If it is necessary to update the WDS peer address * If it is necessary to update the WDS peer address
...@@ -312,9 +302,11 @@ static int ieee80211_ioctl_giwap(struct net_device *dev, ...@@ -312,9 +302,11 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
struct sockaddr *ap_addr, char *extra) struct sockaddr *ap_addr, char *extra)
{ {
struct ieee80211_sub_if_data *sdata; struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
return cfg80211_ibss_wext_giwap(dev, info, ap_addr, extra);
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
if (sdata->vif.type == NL80211_IFTYPE_STATION) { if (sdata->vif.type == NL80211_IFTYPE_STATION) {
if (sdata->u.mgd.state == IEEE80211_STA_MLME_ASSOCIATED) { if (sdata->u.mgd.state == IEEE80211_STA_MLME_ASSOCIATED) {
ap_addr->sa_family = ARPHRD_ETHER; ap_addr->sa_family = ARPHRD_ETHER;
...@@ -322,13 +314,6 @@ static int ieee80211_ioctl_giwap(struct net_device *dev, ...@@ -322,13 +314,6 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
} else } else
memset(&ap_addr->sa_data, 0, ETH_ALEN); memset(&ap_addr->sa_data, 0, ETH_ALEN);
return 0; return 0;
} else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
if (sdata->u.ibss.state == IEEE80211_IBSS_MLME_JOINED) {
ap_addr->sa_family = ARPHRD_ETHER;
memcpy(&ap_addr->sa_data, sdata->u.ibss.bssid, ETH_ALEN);
} else
memset(&ap_addr->sa_data, 0, ETH_ALEN);
return 0;
} else if (sdata->vif.type == NL80211_IFTYPE_WDS) { } else if (sdata->vif.type == NL80211_IFTYPE_WDS) {
ap_addr->sa_family = ARPHRD_ETHER; ap_addr->sa_family = ARPHRD_ETHER;
memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment