1
0
Fork 0

[NET] IEEE80211: Fix whitespace errors.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
hifive-unleashed-5.1
YOSHIFUJI Hideaki 2007-02-09 23:24:46 +09:00 committed by David S. Miller
parent 03d52d7cfc
commit 642656518b
12 changed files with 145 additions and 145 deletions

View File

@ -97,7 +97,7 @@ static int prism2_wep_build_iv(struct sk_buff *skb, int hdr_len,
struct prism2_wep_data *wep = priv;
u32 klen, len;
u8 *pos;
if (skb_headroom(skb) < 4 || skb->len < hdr_len)
return -1;
@ -146,17 +146,17 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
/* 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;

View File

@ -663,7 +663,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
* 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)
@ -852,7 +852,7 @@ void ieee80211_rx_any(struct ieee80211_device *ieee,
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))
@ -1489,7 +1489,7 @@ static void update_network(struct ieee80211_network *dst,
/* 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)

View File

@ -54,7 +54,7 @@ Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs |
| | tion | (BSSID) | | | ence | data | |
`--------------------------------------------------| |------'
Total: 28 non-data bytes `----.----'
|
|
.- 'Frame data' expands, if WEP enabled, to <----------'
|
V
@ -64,8 +64,8 @@ Bytes | 4 | 0-2296 | 4 |
Desc. | IV | Encrypted | ICV |
| | Packet | |
`-----| |-----'
`-----.-----'
|
`-----.-----'
|
.- 'Encrypted Packet' expands to
|
V

View File

@ -754,7 +754,7 @@ int ieee80211_wx_set_auth(struct net_device *dev,
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:
@ -799,7 +799,7 @@ int ieee80211_wx_get_auth(struct net_device *dev,
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:

View File

@ -30,7 +30,7 @@
* Overview
*
* Before you can associate, you have to authenticate.
*
*
*/
/* Sends out an association request to the desired AP */
@ -41,10 +41,10 @@ ieee80211softmac_assoc(struct ieee80211softmac_device *mac, struct ieee80211soft
/* 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);
@ -153,7 +153,7 @@ network_matches_request(struct ieee80211softmac_device *mac, struct ieee80211_ne
}
/* 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)
@ -212,8 +212,8 @@ ieee80211softmac_assoc_work(struct work_struct *work)
/* 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
@ -265,7 +265,7 @@ ieee80211softmac_assoc_work(struct work_struct *work)
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 ;)
*/
@ -353,7 +353,7 @@ ieee80211softmac_associated(struct ieee80211softmac_device *mac,
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);
}
@ -374,7 +374,7 @@ ieee80211softmac_handle_assoc_response(struct net_device * dev,
if (unlikely(!mac->running))
return -ENODEV;
spin_lock_irqsave(&mac->lock, flags);
if (!mac->associnfo.associating) {
@ -426,7 +426,7 @@ ieee80211softmac_handle_assoc_response(struct net_device * dev,
mac->associnfo.associated = 0;
ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_FAILED, network);
}
spin_unlock_irqrestore(&mac->lock, flags);
return 0;
}

View File

@ -30,12 +30,12 @@ static void ieee80211softmac_auth_queue(struct work_struct *work);
/* 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;
@ -55,7 +55,7 @@ ieee80211softmac_auth_req(struct ieee80211softmac_device *mac,
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);
@ -63,7 +63,7 @@ ieee80211softmac_auth_req(struct ieee80211softmac_device *mac,
list_add_tail(&auth->list, &mac->auth_queue);
schedule_delayed_work(&auth->work, 0);
spin_unlock_irqrestore(&mac->lock, flags);
return 0;
}
@ -85,7 +85,7 @@ ieee80211softmac_auth_queue(struct work_struct *work)
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)) {
@ -130,11 +130,11 @@ ieee80211softmac_auth_challenge_response(struct work_struct *work)
}
/* 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);
@ -142,7 +142,7 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
struct ieee80211softmac_network *net = NULL;
unsigned long flags;
u8 * data;
if (unlikely(!mac->running))
return -ENODEV;
@ -157,15 +157,15 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
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)
{
@ -182,10 +182,10 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
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);
@ -196,8 +196,8 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
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;
@ -212,11 +212,11 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
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);
@ -229,7 +229,7 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
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
@ -248,22 +248,22 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
/* 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;
@ -277,7 +277,7 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
goto free_aq;
break;
default:
/* ERROR */
/* ERROR */
goto free_aq;
break;
}
@ -313,7 +313,7 @@ ieee80211softmac_deauth_from_net(struct ieee80211softmac_device *mac,
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);
@ -322,7 +322,7 @@ ieee80211softmac_deauth_from_net(struct ieee80211softmac_device *mac,
else
aq = NULL;
}
/* Cancel pending work */
if(aq != NULL)
/* Not entirely safe? What about running work? */
@ -333,7 +333,7 @@ ieee80211softmac_deauth_from_net(struct ieee80211softmac_device *mac,
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);
@ -341,15 +341,15 @@ ieee80211softmac_deauth_from_net(struct ieee80211softmac_device *mac,
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)
{
@ -357,25 +357,25 @@ ieee80211softmac_deauth_req(struct ieee80211softmac_device *mac,
/* 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;
@ -385,7 +385,7 @@ ieee80211softmac_deauth_resp(struct net_device *dev, struct ieee80211_deauth *de
}
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));

View File

@ -79,7 +79,7 @@ ieee80211softmac_notify_callback(struct work_struct *work)
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);
}
@ -92,14 +92,14 @@ ieee80211softmac_notify_internal(struct ieee80211softmac_device *mac,
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;
@ -122,7 +122,7 @@ ieee80211softmac_notify_gfp(struct net_device *dev,
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);
@ -133,7 +133,7 @@ ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int eve
{
struct ieee80211softmac_event *eventptr, *tmp;
struct ieee80211softmac_network *network;
if (event >= 0) {
union iwreq_data wrqu;
int we_event;

View File

@ -1,4 +1,4 @@
/*
/*
* Some parts based on code from net80211
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@ -29,14 +29,14 @@
* 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
*
*/
@ -53,7 +53,7 @@ ieee80211softmac_add_essid(u8 *dst, struct ieee80211softmac_essid *essid)
*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 */
@ -81,18 +81,18 @@ ieee80211softmac_frame_add_rates(u8 *dst, const struct ieee80211softmac_ratesinf
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 */
@ -103,13 +103,13 @@ ieee80211softmac_alloc_mgt(u32 size)
/*
* 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;
@ -130,13 +130,13 @@ ieee80211softmac_hdr_2addr(struct ieee80211softmac_device *mac,
/* 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);
@ -201,11 +201,11 @@ ieee80211softmac_capabilities(struct ieee80211softmac_device *mac,
/*****************************************************************************
* 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;
@ -233,7 +233,7 @@ ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt,
/* 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);
@ -250,7 +250,7 @@ ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt,
/* 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;
@ -263,9 +263,9 @@ ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt,
/* 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);
@ -277,10 +277,10 @@ ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt,
(*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 */
@ -289,7 +289,7 @@ ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt,
/* 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)
{
@ -309,20 +309,20 @@ ieee80211softmac_auth(struct ieee80211_auth **pkt,
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++;
@ -360,7 +360,7 @@ static u32
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 */
@ -368,12 +368,12 @@ ieee80211softmac_probe_req(struct ieee80211_probe_request **pkt,
/* 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);
@ -401,7 +401,7 @@ ieee80211softmac_probe_resp(struct ieee80211_probe_response **pkt,
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);
@ -445,15 +445,15 @@ ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac,
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),

View File

@ -32,19 +32,19 @@ struct net_device *alloc_ieee80211softmac(int sizeof_priv)
{
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;
@ -66,37 +66,37 @@ struct net_device *alloc_ieee80211softmac(int sizeof_priv)
/* 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);
@ -111,13 +111,13 @@ ieee80211softmac_clear_pending_work(struct ieee80211softmac_device *sm)
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);
@ -133,7 +133,7 @@ EXPORT_SYMBOL_GPL(ieee80211softmac_clear_pending_work);
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);
@ -208,9 +208,9 @@ EXPORT_SYMBOL_GPL(ieee80211softmac_highest_supported_rate);
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
@ -269,7 +269,7 @@ void ieee80211softmac_init_bss(struct ieee80211softmac_device *mac)
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) {
@ -332,7 +332,7 @@ void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates)
{
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;
@ -344,7 +344,7 @@ static u8 raise_rate(struct ieee80211softmac_device *mac, u8 rate)
{
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];
@ -357,7 +357,7 @@ u8 ieee80211softmac_lower_rate_delta(struct ieee80211softmac_device *mac, u8 rat
{
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];
@ -438,7 +438,7 @@ ieee80211softmac_create_network(struct ieee80211softmac_device *mac,
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);
@ -529,7 +529,7 @@ ieee80211softmac_get_network_by_bssid(struct ieee80211softmac_device *mac,
{
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);
@ -556,13 +556,13 @@ ieee80211softmac_get_network_by_essid_locked(struct ieee80211softmac_device *mac
/* 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;
}

View File

@ -130,7 +130,7 @@ static inline u8 get_fallback_rate(struct ieee80211softmac_device *mac, u8 rate)
{
return ieee80211softmac_lower_rate_delta(mac, rate, 2);
}
/*** prototypes from _io.c */
int ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac,
@ -156,7 +156,7 @@ int ieee80211softmac_handle_assoc_response(struct net_device * dev,
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);
@ -164,15 +164,15 @@ 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);
}

View File

@ -62,12 +62,12 @@ ieee80211softmac_stop_scan(struct ieee80211softmac_device *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);
}
@ -78,12 +78,12 @@ ieee80211softmac_wait_for_scan(struct ieee80211softmac_device *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->wait_for_scan(sm->dev);
}
@ -158,14 +158,14 @@ int ieee80211softmac_start_scan_implementation(struct net_device *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... */
@ -241,7 +241,7 @@ void ieee80211softmac_scan_finished(struct ieee80211softmac_device *sm)
spin_lock_irqsave(&sm->lock, flags);
sm->scanning = 0;
spin_unlock_irqrestore(&sm->lock, flags);
if (sm->associnfo.bssvalid) {
struct ieee80211softmac_network *net;

View File

@ -142,14 +142,14 @@ ieee80211softmac_wx_get_essid(struct net_device *net_dev,
/* 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;
@ -181,7 +181,7 @@ ieee80211softmac_wx_set_rate(struct net_device *net_dev,
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
@ -247,7 +247,7 @@ ieee80211softmac_wx_set_rate(struct net_device *net_dev,
ieee80211softmac_recalc_txrates(mac);
err = 0;
out_unlock:
out_unlock:
spin_unlock_irqrestore(&mac->lock, flags);
out:
return err;
@ -366,7 +366,7 @@ ieee80211softmac_wx_set_wap(struct net_device *net_dev,
} 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 */
@ -380,7 +380,7 @@ ieee80211softmac_wx_set_wap(struct net_device *net_dev,
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);
@ -437,7 +437,7 @@ ieee80211softmac_wx_set_genie(struct net_device *dev,
mac->wpa.IEbuflen = 0;
}
out:
out:
spin_unlock_irqrestore(&mac->lock, flags);
mutex_unlock(&mac->associnfo.mutex);
@ -458,9 +458,9 @@ ieee80211softmac_wx_get_genie(struct net_device *dev,
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)