struct prism2_wep_data *wep = priv;
u32 klen, len;
u8 *pos;
-
+
if (skb_headroom(skb) < 4 || skb->len < hdr_len)
return -1;
/* other checks are in prism2_wep_build_iv */
if (skb_tailroom(skb) < 4)
return -1;
-
+
/* add the IV to the frame */
if (prism2_wep_build_iv(skb, hdr_len, NULL, 0, priv))
return -1;
-
+
/* Copy the IV into the first 3 bytes of the key */
memcpy(key, skb->data + hdr_len, 3);
/* Copy rest of the WEP key (the secret part) */
memcpy(key + 3, wep->key, wep->key_len);
-
+
len = skb->len - hdr_len - 4;
pos = skb->data + hdr_len + 4;
klen = 3 + wep->key_len;
* any security data (IV, ICV, etc) that was left behind */
if (!can_be_decrypted && (fc & IEEE80211_FCTL_PROTECTED) &&
ieee->host_strip_iv_icv) {
- int trimlen = 0;
+ int trimlen = 0;
/* Top two-bits of byte 3 are the key index */
if (skb->len >= hdrlen + 3)
if ((fc & IEEE80211_FCTL_VERS) != 0)
goto drop_free;
-
+
switch (fc & IEEE80211_FCTL_FTYPE) {
case IEEE80211_FTYPE_MGMT:
if (skb->len < sizeof(struct ieee80211_hdr_3addr))
/* We only update the statistics if they were created by receiving
* the network information on the actual channel the network is on.
- *
+ *
* This keeps beacons received on neighbor channels from bringing
* down the signal level of an AP. */
if (dst->channel == src->stats.received_channel)
| | tion | (BSSID) | | | ence | data | |
`--------------------------------------------------| |------'
Total: 28 non-data bytes `----.----'
- |
+ |
.- 'Frame data' expands, if WEP enabled, to <----------'
|
V
Desc. | IV | Encrypted | ICV |
| | Packet | |
`-----| |-----'
- `-----.-----'
- |
+ `-----.-----'
+ |
.- 'Encrypted Packet' expands to
|
V
int err = 0;
spin_lock_irqsave(&ieee->lock, flags);
-
+
switch (wrqu->param.flags & IW_AUTH_INDEX) {
case IW_AUTH_WPA_VERSION:
case IW_AUTH_CIPHER_PAIRWISE:
int err = 0;
spin_lock_irqsave(&ieee->lock, flags);
-
+
switch (wrqu->param.flags & IW_AUTH_INDEX) {
case IW_AUTH_WPA_VERSION:
case IW_AUTH_CIPHER_PAIRWISE:
* Overview
*
* Before you can associate, you have to authenticate.
- *
+ *
*/
/* Sends out an association request to the desired AP */
/* Switch to correct channel for this network */
mac->set_channel(mac->dev, net->channel);
-
+
/* Send association request */
ieee80211softmac_send_mgt_frame(mac, net, IEEE80211_STYPE_ASSOC_REQ, 0);
-
+
dprintk(KERN_INFO PFX "sent association request!\n");
spin_lock_irqsave(&mac->lock, flags);
}
/* if 'ANY' network requested, take any that doesn't have privacy enabled */
- if (mac->associnfo.req_essid.len == 0
+ if (mac->associnfo.req_essid.len == 0
&& !(net->capability & WLAN_CAPABILITY_PRIVACY))
return 1;
if (net->ssid_len != mac->associnfo.req_essid.len)
/* try to find the requested network in our list, if we found one already */
if (bssvalid || mac->associnfo.bssfixed)
- found = ieee80211softmac_get_network_by_bssid(mac, mac->associnfo.bssid);
-
+ found = ieee80211softmac_get_network_by_bssid(mac, mac->associnfo.bssid);
+
/* Search the ieee80211 networks for this network if we didn't find it by bssid,
* but only if we've scanned at least once (to get a better list of networks to
* select from). If we have not scanned before, the !found logic below will be
if (mac->associnfo.scan_retry > 0) {
mac->associnfo.scan_retry--;
- /* We know of no such network. Let's scan.
+ /* We know of no such network. Let's scan.
* NB: this also happens if we had no memory to copy the network info...
* Maybe we can hope to have more memory after scanning finishes ;)
*/
mac->set_bssid_filter(mac->dev, net->bssid);
memcpy(mac->ieee->bssid, net->bssid, ETH_ALEN);
netif_carrier_on(mac->dev);
-
+
mac->association_id = le16_to_cpup(&resp->aid);
}
if (unlikely(!mac->running))
return -ENODEV;
-
+
spin_lock_irqsave(&mac->lock, flags);
if (!mac->associnfo.associating) {
mac->associnfo.associated = 0;
ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_FAILED, network);
}
-
+
spin_unlock_irqrestore(&mac->lock, flags);
return 0;
}
/* Queues an auth request to the desired AP */
int
-ieee80211softmac_auth_req(struct ieee80211softmac_device *mac,
+ieee80211softmac_auth_req(struct ieee80211softmac_device *mac,
struct ieee80211softmac_network *net)
{
struct ieee80211softmac_auth_queue_item *auth;
unsigned long flags;
-
+
if (net->authenticating || net->authenticated)
return 0;
net->authenticating = 1;
auth->retry = IEEE80211SOFTMAC_AUTH_RETRY_LIMIT;
auth->state = IEEE80211SOFTMAC_AUTH_OPEN_REQUEST;
INIT_DELAYED_WORK(&auth->work, ieee80211softmac_auth_queue);
-
+
/* Lock (for list) */
spin_lock_irqsave(&mac->lock, flags);
list_add_tail(&auth->list, &mac->auth_queue);
schedule_delayed_work(&auth->work, 0);
spin_unlock_irqrestore(&mac->lock, flags);
-
+
return 0;
}
if(auth->retry > 0) {
/* Switch to correct channel for this network */
mac->set_channel(mac->dev, net->channel);
-
+
/* Lock and set flags */
spin_lock_irqsave(&mac->lock, flags);
if (unlikely(!mac->running)) {
}
/* Handle the auth response from the AP
- * This should be registered with ieee80211 as handle_auth
+ * This should be registered with ieee80211 as handle_auth
*/
-int
+int
ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
-{
+{
struct list_head *list_ptr;
struct ieee80211softmac_device *mac = ieee80211_priv(dev);
struct ieee80211softmac_network *net = NULL;
unsigned long flags;
u8 * data;
-
+
if (unlikely(!mac->running))
return -ENODEV;
aq = NULL;
}
spin_unlock_irqrestore(&mac->lock, flags);
-
+
/* Make sure that we've got an auth queue item for this request */
if(aq == NULL)
{
dprintkl(KERN_DEBUG PFX "Authentication response received from "MAC_FMT" but no queue item exists.\n", MAC_ARG(auth->header.addr2));
/* Error #? */
return -1;
- }
-
+ }
+
/* Check for out of order authentication */
if(!net->authenticating)
{
case WLAN_STATUS_SUCCESS:
/* Update the status to Authenticated */
spin_lock_irqsave(&mac->lock, flags);
- net->authenticating = 0;
+ net->authenticating = 0;
net->authenticated = 1;
spin_unlock_irqrestore(&mac->lock, flags);
-
+
/* Send event */
printkl(KERN_NOTICE PFX "Open Authentication completed with "MAC_FMT"\n", MAC_ARG(net->bssid));
ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_AUTHENTICATED, net);
net->authenticated = 0;
net->authenticating = 0;
spin_unlock_irqrestore(&mac->lock, flags);
-
- printkl(KERN_NOTICE PFX "Open Authentication with "MAC_FMT" failed, error code: %i\n",
+
+ printkl(KERN_NOTICE PFX "Open Authentication with "MAC_FMT" failed, error code: %i\n",
MAC_ARG(net->bssid), le16_to_cpup(&auth->status));
/* Count the error? */
break;
data = (u8 *)auth->info_element;
if (*data++ != MFIE_TYPE_CHALLENGE) {
printkl(KERN_NOTICE PFX "Shared Key Authentication failed due to a missing challenge.\n");
- break;
+ break;
}
/* Save the challenge */
spin_lock_irqsave(&mac->lock, flags);
- net->challenge_len = *data++;
+ net->challenge_len = *data++;
if (net->challenge_len > WLAN_AUTH_CHALLENGE_LEN)
net->challenge_len = WLAN_AUTH_CHALLENGE_LEN;
kfree(net->challenge);
spin_unlock_irqrestore(&mac->lock, flags);
break;
}
- aq->state = IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE;
+ aq->state = IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE;
/* We reuse the work struct from the auth request here.
* It is safe to do so as each one is per-request, and
/* Check the status code of the response */
switch(auth->status) {
case WLAN_STATUS_SUCCESS:
- /* Update the status to Authenticated */
+ /* Update the status to Authenticated */
spin_lock_irqsave(&mac->lock, flags);
net->authenticating = 0;
net->authenticated = 1;
spin_unlock_irqrestore(&mac->lock, flags);
- printkl(KERN_NOTICE PFX "Shared Key Authentication completed with "MAC_FMT"\n",
+ printkl(KERN_NOTICE PFX "Shared Key Authentication completed with "MAC_FMT"\n",
MAC_ARG(net->bssid));
ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_AUTHENTICATED, net);
break;
default:
- printkl(KERN_NOTICE PFX "Shared Key Authentication with "MAC_FMT" failed, error code: %i\n",
+ printkl(KERN_NOTICE PFX "Shared Key Authentication with "MAC_FMT" failed, error code: %i\n",
MAC_ARG(net->bssid), le16_to_cpup(&auth->status));
/* Lock and reset flags */
spin_lock_irqsave(&mac->lock, flags);
- net->authenticating = 0;
- net->authenticated = 0;
+ net->authenticating = 0;
+ net->authenticated = 0;
spin_unlock_irqrestore(&mac->lock, flags);
/* Count the error? */
break;
goto free_aq;
break;
default:
- /* ERROR */
+ /* ERROR */
goto free_aq;
break;
}
spin_lock_irqsave(&mac->lock, flags);
net->authenticating = 0;
net->authenticated = 0;
-
+
/* Find correct auth queue item, if it exists */
list_for_each(list_ptr, &mac->auth_queue) {
aq = list_entry(list_ptr, struct ieee80211softmac_auth_queue_item, list);
else
aq = NULL;
}
-
+
/* Cancel pending work */
if(aq != NULL)
/* Not entirely safe? What about running work? */
if(net->challenge != NULL)
kfree(net->challenge);
kfree(net);
-
+
/* can't transmit data right now... */
netif_carrier_off(mac->dev);
spin_unlock_irqrestore(&mac->lock, flags);
ieee80211softmac_try_reassoc(mac);
}
-/*
+/*
* Sends a deauth request to the desired AP
*/
-int
-ieee80211softmac_deauth_req(struct ieee80211softmac_device *mac,
+int
+ieee80211softmac_deauth_req(struct ieee80211softmac_device *mac,
struct ieee80211softmac_network *net, int reason)
{
int ret;
-
+
/* Make sure the network is authenticated */
if (!net->authenticated)
{
/* Error okay? */
return -EPERM;
}
-
+
/* Send the de-auth packet */
if((ret = ieee80211softmac_send_mgt_frame(mac, net, IEEE80211_STYPE_DEAUTH, reason)))
return ret;
-
+
ieee80211softmac_deauth_from_net(mac, net);
return 0;
}
-
+
/*
* This should be registered with ieee80211 as handle_deauth
*/
-int
+int
ieee80211softmac_deauth_resp(struct net_device *dev, struct ieee80211_deauth *deauth)
{
-
+
struct ieee80211softmac_network *net = NULL;
struct ieee80211softmac_device *mac = ieee80211_priv(dev);
-
+
if (unlikely(!mac->running))
return -ENODEV;
}
net = ieee80211softmac_get_network_by_bssid(mac, deauth->header.addr2);
-
+
if (net == NULL) {
dprintkl(KERN_DEBUG PFX "Received deauthentication packet from "MAC_FMT", but that network is unknown.\n",
MAC_ARG(deauth->header.addr2));
container_of(work, struct ieee80211softmac_event, work.work);
struct ieee80211softmac_event event = *pevent;
kfree(pevent);
-
+
event.fun(event.mac->dev, event.event_type, event.context);
}
if (event < -1 || event > IEEE80211SOFTMAC_EVENT_LAST)
return -ENOSYS;
-
+
if (!fun)
return -EINVAL;
-
+
eventptr = kmalloc(sizeof(struct ieee80211softmac_event), gfp_mask);
if (!eventptr)
return -ENOMEM;
-
+
eventptr->event_type = event;
INIT_DELAYED_WORK(&eventptr->work, ieee80211softmac_notify_callback);
eventptr->fun = fun;
if (event < 0 || event > IEEE80211SOFTMAC_EVENT_LAST)
return -ENOSYS;
-
+
return ieee80211softmac_notify_internal(mac, event, NULL, fun, context, gfp_mask);
}
EXPORT_SYMBOL_GPL(ieee80211softmac_notify_gfp);
{
struct ieee80211softmac_event *eventptr, *tmp;
struct ieee80211softmac_network *network;
-
+
if (event >= 0) {
union iwreq_data wrqu;
int we_event;
-/*
+/*
* Some parts based on code from net80211
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*/
#include "ieee80211softmac_priv.h"
/* Helper functions for inserting data into the frames */
-/*
+/*
* Adds an ESSID element to the frame
*
*/
*dst++ = 0;
return dst;
}
-}
+}
/* Adds Supported Rates and if required Extended Rates Information Element
* to the frame, ASSUMES WE HAVE A SORTED LIST OF RATES */
memcpy(dst, r->rates + cck_len, ofdm_len);
dst += ofdm_len;
}
- }
+ }
return dst;
}
/* Allocate a management frame */
-static u8 *
+static u8 *
ieee80211softmac_alloc_mgt(u32 size)
{
u8 * data;
-
+
/* Add the header and FCS to the size */
- size = size + IEEE80211_3ADDR_LEN;
+ size = size + IEEE80211_3ADDR_LEN;
if(size > IEEE80211_DATA_LEN)
return NULL;
/* Allocate the frame */
/*
* Add a 2 Address Header
*/
-static void
+static void
ieee80211softmac_hdr_2addr(struct ieee80211softmac_device *mac,
struct ieee80211_hdr_2addr *header, u32 type, u8 *dest)
{
/* Fill in the frame control flags */
header->frame_ctl = cpu_to_le16(type);
- /* Control packets always have WEP turned off */
+ /* Control packets always have WEP turned off */
if(type > IEEE80211_STYPE_CFENDACK && type < IEEE80211_STYPE_PSPOLL)
header->frame_ctl |= mac->ieee->sec.level ? cpu_to_le16(IEEE80211_FCTL_PROTECTED) : 0;
/* Add a 3 Address Header */
-static void
+static void
ieee80211softmac_hdr_3addr(struct ieee80211softmac_device *mac,
struct ieee80211_hdr_3addr *header, u32 type, u8 *dest, u8 *bssid)
{
/* This is common with 2addr, so use that instead */
- ieee80211softmac_hdr_2addr(mac, (struct ieee80211_hdr_2addr *)header, type, dest);
-
+ ieee80211softmac_hdr_2addr(mac, (struct ieee80211_hdr_2addr *)header, type, dest);
+
/* Fill in the BSS ID */
if(bssid == NULL)
memset(header->addr3, 0xFF, ETH_ALEN);
/*****************************************************************************
* Create Management packets
- *****************************************************************************/
+ *****************************************************************************/
/* Creates an association request packet */
static u32
-ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt,
+ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt,
struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net)
{
u8 *data;
/* Fill in Listen Interval (?) */
(*pkt)->listen_interval = cpu_to_le16(10);
-
+
data = (u8 *)(*pkt)->info_element;
/* Add SSID */
data = ieee80211softmac_add_essid(data, &net->essid);
/* Create a reassociation request packet */
static u32
-ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt,
+ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt,
struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net)
{
u8 *data;
/* Rates IE */
1 + 1 + IEEE80211SOFTMAC_MAX_RATES_LEN +
/* Extended Rates IE */
- 1 + 1 + IEEE80211SOFTMAC_MAX_EX_RATES_LEN
+ 1 + 1 + IEEE80211SOFTMAC_MAX_EX_RATES_LEN
/* Other IE's? */
- );
+ );
if (unlikely((*pkt) == NULL))
return 0;
ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_REASSOC_REQ, net->bssid, net->bssid);
(*pkt)->listen_interval = cpu_to_le16(10);
/* Fill in the current AP MAC */
memcpy((*pkt)->current_ap, mac->ieee->bssid, ETH_ALEN);
-
+
data = (u8 *)(*pkt)->info_element;
/* Add SSID */
- data = ieee80211softmac_add_essid(data, &net->essid);
+ data = ieee80211softmac_add_essid(data, &net->essid);
/* Add Rates */
data = ieee80211softmac_frame_add_rates(data, &mac->ratesinfo);
/* Return packet size */
/* Create an authentication packet */
static u32
-ieee80211softmac_auth(struct ieee80211_auth **pkt,
+ieee80211softmac_auth(struct ieee80211_auth **pkt,
struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net,
u16 transaction, u16 status, int *encrypt_mpdu)
{
if (unlikely((*pkt) == NULL))
return 0;
ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_AUTH, net->bssid, net->bssid);
-
+
/* Algorithm */
(*pkt)->algorithm = cpu_to_le16(auth_mode);
/* Transaction */
(*pkt)->transaction = cpu_to_le16(transaction);
/* Status */
(*pkt)->status = cpu_to_le16(status);
-
+
data = (u8 *)(*pkt)->info_element;
/* Challenge Text */
if (is_shared_response) {
*data = MFIE_TYPE_CHALLENGE;
data++;
-
+
/* Copy the challenge in */
*data = net->challenge_len;
data++;
ieee80211softmac_probe_req(struct ieee80211_probe_request **pkt,
struct ieee80211softmac_device *mac, struct ieee80211softmac_essid *essid)
{
- u8 *data;
+ u8 *data;
/* Allocate Packet */
(*pkt) = (struct ieee80211_probe_request *)ieee80211softmac_alloc_mgt(
/* SSID of requested network */
/* Rates IE */
1 + 1 + IEEE80211SOFTMAC_MAX_RATES_LEN +
/* Extended Rates IE */
- 1 + 1 + IEEE80211SOFTMAC_MAX_EX_RATES_LEN
+ 1 + 1 + IEEE80211SOFTMAC_MAX_EX_RATES_LEN
);
if (unlikely((*pkt) == NULL))
return 0;
ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_PROBE_REQ, NULL, NULL);
-
+
data = (u8 *)(*pkt)->info_element;
/* Add ESSID (can be NULL) */
data = ieee80211softmac_add_essid(data, essid);
2 + /* DS Parameter Set */
8 + /* CF Parameter Set */
4 /* IBSS Parameter Set */
- );
+ );
if (unlikely((*pkt) == NULL))
return 0;
ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_PROBE_RESP, net->bssid, net->bssid);
pkt_size = ieee80211softmac_probe_resp((struct ieee80211_probe_response **)(&pkt), mac, (struct ieee80211softmac_network *)ptrarg);
break;
default:
- printkl(KERN_DEBUG PFX "Unsupported Management Frame type: %i\n", type);
- return -EINVAL;
+ printkl(KERN_DEBUG PFX "Unsupported Management Frame type: %i\n", type);
+ return -EINVAL;
};
if(pkt_size == 0 || pkt == NULL) {
printkl(KERN_DEBUG PFX "Error, packet is nonexistant or 0 length\n");
return -ENOMEM;
}
-
+
/* Send the packet to the ieee80211 layer for tx */
/* we defined softmac->mgmt_xmit for this. Should we keep it
* as it is (that means we'd need to wrap this into a txb),
{
struct ieee80211softmac_device *softmac;
struct net_device *dev;
-
+
dev = alloc_ieee80211(sizeof(struct ieee80211softmac_device) + sizeof_priv);
softmac = ieee80211_priv(dev);
softmac->dev = dev;
softmac->ieee = netdev_priv(dev);
spin_lock_init(&softmac->lock);
-
+
softmac->ieee->handle_auth = ieee80211softmac_auth_resp;
softmac->ieee->handle_deauth = ieee80211softmac_deauth_resp;
softmac->ieee->handle_assoc_response = ieee80211softmac_handle_assoc_response;
softmac->ieee->handle_reassoc_request = ieee80211softmac_handle_reassoc_req;
softmac->ieee->handle_disassoc = ieee80211softmac_handle_disassoc;
- softmac->ieee->handle_beacon = ieee80211softmac_handle_beacon;
+ softmac->ieee->handle_beacon = ieee80211softmac_handle_beacon;
softmac->scaninfo = NULL;
softmac->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT;
/* to start with, we can't send anything ... */
netif_carrier_off(dev);
-
+
return dev;
}
EXPORT_SYMBOL_GPL(alloc_ieee80211softmac);
/* Clears the pending work queue items, stops all scans, etc. */
-void
+void
ieee80211softmac_clear_pending_work(struct ieee80211softmac_device *sm)
{
unsigned long flags;
struct ieee80211softmac_event *eventptr, *eventtmp;
struct ieee80211softmac_auth_queue_item *authptr, *authtmp;
struct ieee80211softmac_network *netptr, *nettmp;
-
+
ieee80211softmac_stop_scan(sm);
ieee80211softmac_wait_for_scan(sm);
-
+
spin_lock_irqsave(&sm->lock, flags);
sm->running = 0;
/* Free all pending assoc work items */
cancel_delayed_work(&sm->associnfo.work);
-
+
/* Free all pending scan work items */
if(sm->scaninfo != NULL)
- cancel_delayed_work(&sm->scaninfo->softmac_scan);
-
+ cancel_delayed_work(&sm->scaninfo->softmac_scan);
+
/* Free all pending auth work items */
list_for_each_entry(authptr, &sm->auth_queue, list)
cancel_delayed_work(&authptr->work);
-
+
/* delete all pending event calls and work items */
list_for_each_entry_safe(eventptr, eventtmp, &sm->events, list)
cancel_delayed_work(&eventptr->work);
list_del(&authptr->list);
kfree(authptr);
}
-
+
/* delete all pending event calls and work items */
list_for_each_entry_safe(eventptr, eventtmp, &sm->events, list) {
list_del(&eventptr->list);
kfree(eventptr);
}
-
+
/* Free all networks */
list_for_each_entry_safe(netptr, nettmp, &sm->network_list, list) {
ieee80211softmac_del_network_locked(sm, netptr);
void free_ieee80211softmac(struct net_device *dev)
{
struct ieee80211softmac_device *sm = ieee80211_priv(dev);
- ieee80211softmac_clear_pending_work(sm);
+ ieee80211softmac_clear_pending_work(sm);
kfree(sm->scaninfo);
kfree(sm->wpa.IE);
free_ieee80211(dev);
void ieee80211softmac_process_erp(struct ieee80211softmac_device *mac,
u8 erp_value)
{
- int use_protection;
+ int use_protection;
int short_preamble;
- u32 changes = 0;
+ u32 changes = 0;
/* Barker preamble mode */
short_preamble = ((erp_value & WLAN_ERP_BARKER_PREAMBLE) == 0
rates, so 801.11g devices start off at 11M for now. People
can manually change it if they really need to, but 11M is
more reliable. Note similar logic in
- ieee80211softmac_wx_set_rate() */
+ ieee80211softmac_wx_set_rate() */
if (ieee->modulation & IEEE80211_CCK_MODULATION) {
txrates->user_rate = IEEE80211_CCK_RATE_11MB;
} else if (ieee->modulation & IEEE80211_OFDM_MODULATION) {
{
struct ieee80211softmac_device *mac = ieee80211_priv(dev);
unsigned long flags;
-
+
spin_lock_irqsave(&mac->lock, flags);
memcpy(mac->ratesinfo.rates, rates, count);
mac->ratesinfo.count = count;
{
int i;
struct ieee80211softmac_ratesinfo *ri = &mac->ratesinfo;
-
+
for (i=0; i<ri->count-1; i++) {
if (ri->rates[i] == rate)
return ri->rates[i+1];
{
int i;
struct ieee80211softmac_ratesinfo *ri = &mac->ratesinfo;
-
+
for (i=delta; i<ri->count; i++) {
if (ri->rates[i] == rate)
return ri->rates[i-delta];
softnet->channel = net->channel;
softnet->essid.len = net->ssid_len;
memcpy(softnet->essid.data, net->ssid, softnet->essid.len);
-
+
/* copy rates over */
softnet->supported_rates.count = net->rates_len;
memcpy(&softnet->supported_rates.rates[0], net->rates, net->rates_len);
{
unsigned long flags;
struct ieee80211softmac_network *softmac_net;
-
+
spin_lock_irqsave(&mac->lock, flags);
softmac_net = ieee80211softmac_get_network_by_bssid_locked(mac, bssid);
spin_unlock_irqrestore(&mac->lock, flags);
/* Get a network from the list by ESSID with locking */
struct ieee80211softmac_network *
ieee80211softmac_get_network_by_essid(struct ieee80211softmac_device *mac,
- struct ieee80211softmac_essid *essid)
+ struct ieee80211softmac_essid *essid)
{
unsigned long flags;
struct ieee80211softmac_network *softmac_net = NULL;
spin_lock_irqsave(&mac->lock, flags);
- softmac_net = ieee80211softmac_get_network_by_essid_locked(mac, essid);
+ softmac_net = ieee80211softmac_get_network_by_essid_locked(mac, essid);
spin_unlock_irqrestore(&mac->lock, flags);
return softmac_net;
}
{
return ieee80211softmac_lower_rate_delta(mac, rate, 2);
}
-
+
/*** prototypes from _io.c */
int ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac,
int ieee80211softmac_handle_disassoc(struct net_device * dev,
struct ieee80211_disassoc * disassoc);
int ieee80211softmac_handle_reassoc_req(struct net_device * dev,
- struct ieee80211_reassoc_request * reassoc);
+ struct ieee80211_reassoc_request * reassoc);
void ieee80211softmac_assoc_timeout(struct work_struct *work);
void ieee80211softmac_send_disassoc_req(struct ieee80211softmac_device *mac, u16 reason);
void ieee80211softmac_disassoc(struct ieee80211softmac_device *mac);
/* some helper functions */
static inline int ieee80211softmac_scan_handlers_check_self(struct ieee80211softmac_device *sm)
{
- return (sm->start_scan == ieee80211softmac_start_scan_implementation) &&
- (sm->stop_scan == ieee80211softmac_stop_scan_implementation) &&
+ return (sm->start_scan == ieee80211softmac_start_scan_implementation) &&
+ (sm->stop_scan == ieee80211softmac_stop_scan_implementation) &&
(sm->wait_for_scan == ieee80211softmac_wait_for_scan_implementation);
}
static inline int ieee80211softmac_scan_sanity_check(struct ieee80211softmac_device *sm)
{
- return ((sm->start_scan != ieee80211softmac_start_scan_implementation) &&
- (sm->stop_scan != ieee80211softmac_stop_scan_implementation) &&
+ return ((sm->start_scan != ieee80211softmac_start_scan_implementation) &&
+ (sm->stop_scan != ieee80211softmac_stop_scan_implementation) &&
(sm->wait_for_scan != ieee80211softmac_wait_for_scan_implementation)
) || ieee80211softmac_scan_handlers_check_self(sm);
}
unsigned long flags;
spin_lock_irqsave(&sm->lock, flags);
-
+
if (!sm->scanning) {
spin_unlock_irqrestore(&sm->lock, flags);
return;
}
-
+
spin_unlock_irqrestore(&sm->lock, flags);
sm->stop_scan(sm->dev);
}
unsigned long flags;
spin_lock_irqsave(&sm->lock, flags);
-
+
if (!sm->scanning) {
spin_unlock_irqrestore(&sm->lock, flags);
return;
}
-
+
spin_unlock_irqrestore(&sm->lock, flags);
sm->wait_for_scan(sm->dev);
}
{
struct ieee80211softmac_device *sm = ieee80211_priv(dev);
unsigned long flags;
-
+
if (!(dev->flags & IFF_UP))
return -ENODEV;
assert(ieee80211softmac_scan_handlers_check_self(sm));
if (!ieee80211softmac_scan_handlers_check_self(sm))
return -EINVAL;
-
+
spin_lock_irqsave(&sm->lock, flags);
/* it looks like we need to hold the lock here
* to make sure we don't allocate two of these... */
spin_lock_irqsave(&sm->lock, flags);
sm->scanning = 0;
spin_unlock_irqrestore(&sm->lock, flags);
-
+
if (sm->associnfo.bssvalid) {
struct ieee80211softmac_network *net;
/* If all fails, return ANY (empty) */
data->essid.length = 0;
data->essid.flags = 0; /* active */
-
+
/* If we have a statically configured ESSID then return it */
if (sm->associnfo.static_essid) {
data->essid.length = sm->associnfo.req_essid.len;
data->essid.flags = 1; /* active */
memcpy(extra, sm->associnfo.req_essid.data, sm->associnfo.req_essid.len);
}
-
+
/* If we're associating/associated, return that */
if (sm->associnfo.associated || sm->associnfo.associating) {
data->essid.length = sm->associnfo.associate_essid.len;
rates, so 801.11g devices start off at 11M for now. People
can manually change it if they really need to, but 11M is
more reliable. Note similar logic in
- ieee80211softmac_wx_set_rate() */
+ ieee80211softmac_wx_set_rate() */
if (ieee->modulation & IEEE80211_CCK_MODULATION)
in_rate = 11000000;
else
ieee80211softmac_recalc_txrates(mac);
err = 0;
-out_unlock:
+out_unlock:
spin_unlock_irqrestore(&mac->lock, flags);
out:
return err;
} else if (is_zero_ether_addr(data->ap_addr.sa_data)) {
/* the bssid we have is no longer fixed */
mac->associnfo.bssfixed = 0;
- } else {
+ } else {
if (!memcmp(mac->associnfo.bssid, data->ap_addr.sa_data, ETH_ALEN)) {
if (mac->associnfo.associating || mac->associnfo.associated) {
/* bssid unchanged and associated or associating - just return */
mac->associnfo.bssfixed = 1;
/* queue associate if new bssid or (old one again and not associated) */
schedule_delayed_work(&mac->associnfo.work, 0);
- }
+ }
out:
mutex_unlock(&mac->associnfo.mutex);
mac->wpa.IEbuflen = 0;
}
- out:
+ out:
spin_unlock_irqrestore(&mac->lock, flags);
mutex_unlock(&mac->associnfo.mutex);
mutex_lock(&mac->associnfo.mutex);
spin_lock_irqsave(&mac->lock, flags);
-
+
wrqu->data.length = 0;
-
+
if (mac->wpa.IE && mac->wpa.IElen) {
wrqu->data.length = mac->wpa.IElen;
if (mac->wpa.IElen <= space)