aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee80211/softmac/ieee80211softmac_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ieee80211/softmac/ieee80211softmac_io.c')
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_io.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/net/ieee80211/softmac/ieee80211softmac_io.c b/net/ieee80211/softmac/ieee80211softmac_io.c
index b96931001b43..26c35253be33 100644
--- a/net/ieee80211/softmac/ieee80211softmac_io.c
+++ b/net/ieee80211/softmac/ieee80211softmac_io.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Some parts based on code from net80211 2 * Some parts based on code from net80211
3 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2001 Atsushi Onoe
4 * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting 4 * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -29,14 +29,14 @@
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * 32 *
33 */ 33 */
34 34
35#include "ieee80211softmac_priv.h" 35#include "ieee80211softmac_priv.h"
36 36
37/* Helper functions for inserting data into the frames */ 37/* Helper functions for inserting data into the frames */
38 38
39/* 39/*
40 * Adds an ESSID element to the frame 40 * Adds an ESSID element to the frame
41 * 41 *
42 */ 42 */
@@ -53,7 +53,7 @@ ieee80211softmac_add_essid(u8 *dst, struct ieee80211softmac_essid *essid)
53 *dst++ = 0; 53 *dst++ = 0;
54 return dst; 54 return dst;
55 } 55 }
56} 56}
57 57
58/* Adds Supported Rates and if required Extended Rates Information Element 58/* Adds Supported Rates and if required Extended Rates Information Element
59 * to the frame, ASSUMES WE HAVE A SORTED LIST OF RATES */ 59 * 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
81 memcpy(dst, r->rates + cck_len, ofdm_len); 81 memcpy(dst, r->rates + cck_len, ofdm_len);
82 dst += ofdm_len; 82 dst += ofdm_len;
83 } 83 }
84 } 84 }
85 return dst; 85 return dst;
86} 86}
87 87
88/* Allocate a management frame */ 88/* Allocate a management frame */
89static u8 * 89static u8 *
90ieee80211softmac_alloc_mgt(u32 size) 90ieee80211softmac_alloc_mgt(u32 size)
91{ 91{
92 u8 * data; 92 u8 * data;
93 93
94 /* Add the header and FCS to the size */ 94 /* Add the header and FCS to the size */
95 size = size + IEEE80211_3ADDR_LEN; 95 size = size + IEEE80211_3ADDR_LEN;
96 if(size > IEEE80211_DATA_LEN) 96 if(size > IEEE80211_DATA_LEN)
97 return NULL; 97 return NULL;
98 /* Allocate the frame */ 98 /* Allocate the frame */
@@ -103,13 +103,13 @@ ieee80211softmac_alloc_mgt(u32 size)
103/* 103/*
104 * Add a 2 Address Header 104 * Add a 2 Address Header
105 */ 105 */
106static void 106static void
107ieee80211softmac_hdr_2addr(struct ieee80211softmac_device *mac, 107ieee80211softmac_hdr_2addr(struct ieee80211softmac_device *mac,
108 struct ieee80211_hdr_2addr *header, u32 type, u8 *dest) 108 struct ieee80211_hdr_2addr *header, u32 type, u8 *dest)
109{ 109{
110 /* Fill in the frame control flags */ 110 /* Fill in the frame control flags */
111 header->frame_ctl = cpu_to_le16(type); 111 header->frame_ctl = cpu_to_le16(type);
112 /* Control packets always have WEP turned off */ 112 /* Control packets always have WEP turned off */
113 if(type > IEEE80211_STYPE_CFENDACK && type < IEEE80211_STYPE_PSPOLL) 113 if(type > IEEE80211_STYPE_CFENDACK && type < IEEE80211_STYPE_PSPOLL)
114 header->frame_ctl |= mac->ieee->sec.level ? cpu_to_le16(IEEE80211_FCTL_PROTECTED) : 0; 114 header->frame_ctl |= mac->ieee->sec.level ? cpu_to_le16(IEEE80211_FCTL_PROTECTED) : 0;
115 115
@@ -130,13 +130,13 @@ ieee80211softmac_hdr_2addr(struct ieee80211softmac_device *mac,
130 130
131 131
132/* Add a 3 Address Header */ 132/* Add a 3 Address Header */
133static void 133static void
134ieee80211softmac_hdr_3addr(struct ieee80211softmac_device *mac, 134ieee80211softmac_hdr_3addr(struct ieee80211softmac_device *mac,
135 struct ieee80211_hdr_3addr *header, u32 type, u8 *dest, u8 *bssid) 135 struct ieee80211_hdr_3addr *header, u32 type, u8 *dest, u8 *bssid)
136{ 136{
137 /* This is common with 2addr, so use that instead */ 137 /* This is common with 2addr, so use that instead */
138 ieee80211softmac_hdr_2addr(mac, (struct ieee80211_hdr_2addr *)header, type, dest); 138 ieee80211softmac_hdr_2addr(mac, (struct ieee80211_hdr_2addr *)header, type, dest);
139 139
140 /* Fill in the BSS ID */ 140 /* Fill in the BSS ID */
141 if(bssid == NULL) 141 if(bssid == NULL)
142 memset(header->addr3, 0xFF, ETH_ALEN); 142 memset(header->addr3, 0xFF, ETH_ALEN);
@@ -201,11 +201,11 @@ ieee80211softmac_capabilities(struct ieee80211softmac_device *mac,
201 201
202/***************************************************************************** 202/*****************************************************************************
203 * Create Management packets 203 * Create Management packets
204 *****************************************************************************/ 204 *****************************************************************************/
205 205
206/* Creates an association request packet */ 206/* Creates an association request packet */
207static u32 207static u32
208ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt, 208ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt,
209 struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net) 209 struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net)
210{ 210{
211 u8 *data; 211 u8 *data;
@@ -233,7 +233,7 @@ ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt,
233 233
234 /* Fill in Listen Interval (?) */ 234 /* Fill in Listen Interval (?) */
235 (*pkt)->listen_interval = cpu_to_le16(10); 235 (*pkt)->listen_interval = cpu_to_le16(10);
236 236
237 data = (u8 *)(*pkt)->info_element; 237 data = (u8 *)(*pkt)->info_element;
238 /* Add SSID */ 238 /* Add SSID */
239 data = ieee80211softmac_add_essid(data, &net->essid); 239 data = ieee80211softmac_add_essid(data, &net->essid);
@@ -250,7 +250,7 @@ ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt,
250 250
251/* Create a reassociation request packet */ 251/* Create a reassociation request packet */
252static u32 252static u32
253ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt, 253ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt,
254 struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net) 254 struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net)
255{ 255{
256 u8 *data; 256 u8 *data;
@@ -263,9 +263,9 @@ ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt,
263 /* Rates IE */ 263 /* Rates IE */
264 1 + 1 + IEEE80211SOFTMAC_MAX_RATES_LEN + 264 1 + 1 + IEEE80211SOFTMAC_MAX_RATES_LEN +
265 /* Extended Rates IE */ 265 /* Extended Rates IE */
266 1 + 1 + IEEE80211SOFTMAC_MAX_EX_RATES_LEN 266 1 + 1 + IEEE80211SOFTMAC_MAX_EX_RATES_LEN
267 /* Other IE's? */ 267 /* Other IE's? */
268 ); 268 );
269 if (unlikely((*pkt) == NULL)) 269 if (unlikely((*pkt) == NULL))
270 return 0; 270 return 0;
271 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_REASSOC_REQ, net->bssid, net->bssid); 271 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,
277 (*pkt)->listen_interval = cpu_to_le16(10); 277 (*pkt)->listen_interval = cpu_to_le16(10);
278 /* Fill in the current AP MAC */ 278 /* Fill in the current AP MAC */
279 memcpy((*pkt)->current_ap, mac->ieee->bssid, ETH_ALEN); 279 memcpy((*pkt)->current_ap, mac->ieee->bssid, ETH_ALEN);
280 280
281 data = (u8 *)(*pkt)->info_element; 281 data = (u8 *)(*pkt)->info_element;
282 /* Add SSID */ 282 /* Add SSID */
283 data = ieee80211softmac_add_essid(data, &net->essid); 283 data = ieee80211softmac_add_essid(data, &net->essid);
284 /* Add Rates */ 284 /* Add Rates */
285 data = ieee80211softmac_frame_add_rates(data, &mac->ratesinfo); 285 data = ieee80211softmac_frame_add_rates(data, &mac->ratesinfo);
286 /* Return packet size */ 286 /* Return packet size */
@@ -289,7 +289,7 @@ ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt,
289 289
290/* Create an authentication packet */ 290/* Create an authentication packet */
291static u32 291static u32
292ieee80211softmac_auth(struct ieee80211_auth **pkt, 292ieee80211softmac_auth(struct ieee80211_auth **pkt,
293 struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net, 293 struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net,
294 u16 transaction, u16 status, int *encrypt_mpdu) 294 u16 transaction, u16 status, int *encrypt_mpdu)
295{ 295{
@@ -309,20 +309,20 @@ ieee80211softmac_auth(struct ieee80211_auth **pkt,
309 if (unlikely((*pkt) == NULL)) 309 if (unlikely((*pkt) == NULL))
310 return 0; 310 return 0;
311 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_AUTH, net->bssid, net->bssid); 311 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_AUTH, net->bssid, net->bssid);
312 312
313 /* Algorithm */ 313 /* Algorithm */
314 (*pkt)->algorithm = cpu_to_le16(auth_mode); 314 (*pkt)->algorithm = cpu_to_le16(auth_mode);
315 /* Transaction */ 315 /* Transaction */
316 (*pkt)->transaction = cpu_to_le16(transaction); 316 (*pkt)->transaction = cpu_to_le16(transaction);
317 /* Status */ 317 /* Status */
318 (*pkt)->status = cpu_to_le16(status); 318 (*pkt)->status = cpu_to_le16(status);
319 319
320 data = (u8 *)(*pkt)->info_element; 320 data = (u8 *)(*pkt)->info_element;
321 /* Challenge Text */ 321 /* Challenge Text */
322 if (is_shared_response) { 322 if (is_shared_response) {
323 *data = MFIE_TYPE_CHALLENGE; 323 *data = MFIE_TYPE_CHALLENGE;
324 data++; 324 data++;
325 325
326 /* Copy the challenge in */ 326 /* Copy the challenge in */
327 *data = net->challenge_len; 327 *data = net->challenge_len;
328 data++; 328 data++;
@@ -360,7 +360,7 @@ static u32
360ieee80211softmac_probe_req(struct ieee80211_probe_request **pkt, 360ieee80211softmac_probe_req(struct ieee80211_probe_request **pkt,
361 struct ieee80211softmac_device *mac, struct ieee80211softmac_essid *essid) 361 struct ieee80211softmac_device *mac, struct ieee80211softmac_essid *essid)
362{ 362{
363 u8 *data; 363 u8 *data;
364 /* Allocate Packet */ 364 /* Allocate Packet */
365 (*pkt) = (struct ieee80211_probe_request *)ieee80211softmac_alloc_mgt( 365 (*pkt) = (struct ieee80211_probe_request *)ieee80211softmac_alloc_mgt(
366 /* SSID of requested network */ 366 /* SSID of requested network */
@@ -368,12 +368,12 @@ ieee80211softmac_probe_req(struct ieee80211_probe_request **pkt,
368 /* Rates IE */ 368 /* Rates IE */
369 1 + 1 + IEEE80211SOFTMAC_MAX_RATES_LEN + 369 1 + 1 + IEEE80211SOFTMAC_MAX_RATES_LEN +
370 /* Extended Rates IE */ 370 /* Extended Rates IE */
371 1 + 1 + IEEE80211SOFTMAC_MAX_EX_RATES_LEN 371 1 + 1 + IEEE80211SOFTMAC_MAX_EX_RATES_LEN
372 ); 372 );
373 if (unlikely((*pkt) == NULL)) 373 if (unlikely((*pkt) == NULL))
374 return 0; 374 return 0;
375 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_PROBE_REQ, NULL, NULL); 375 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_PROBE_REQ, NULL, NULL);
376 376
377 data = (u8 *)(*pkt)->info_element; 377 data = (u8 *)(*pkt)->info_element;
378 /* Add ESSID (can be NULL) */ 378 /* Add ESSID (can be NULL) */
379 data = ieee80211softmac_add_essid(data, essid); 379 data = ieee80211softmac_add_essid(data, essid);
@@ -401,7 +401,7 @@ ieee80211softmac_probe_resp(struct ieee80211_probe_response **pkt,
401 2 + /* DS Parameter Set */ 401 2 + /* DS Parameter Set */
402 8 + /* CF Parameter Set */ 402 8 + /* CF Parameter Set */
403 4 /* IBSS Parameter Set */ 403 4 /* IBSS Parameter Set */
404 ); 404 );
405 if (unlikely((*pkt) == NULL)) 405 if (unlikely((*pkt) == NULL))
406 return 0; 406 return 0;
407 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_PROBE_RESP, net->bssid, net->bssid); 407 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,
445 pkt_size = ieee80211softmac_probe_resp((struct ieee80211_probe_response **)(&pkt), mac, (struct ieee80211softmac_network *)ptrarg); 445 pkt_size = ieee80211softmac_probe_resp((struct ieee80211_probe_response **)(&pkt), mac, (struct ieee80211softmac_network *)ptrarg);
446 break; 446 break;
447 default: 447 default:
448 printkl(KERN_DEBUG PFX "Unsupported Management Frame type: %i\n", type); 448 printkl(KERN_DEBUG PFX "Unsupported Management Frame type: %i\n", type);
449 return -EINVAL; 449 return -EINVAL;
450 }; 450 };
451 451
452 if(pkt_size == 0 || pkt == NULL) { 452 if(pkt_size == 0 || pkt == NULL) {
453 printkl(KERN_DEBUG PFX "Error, packet is nonexistant or 0 length\n"); 453 printkl(KERN_DEBUG PFX "Error, packet is nonexistant or 0 length\n");
454 return -ENOMEM; 454 return -ENOMEM;
455 } 455 }
456 456
457 /* Send the packet to the ieee80211 layer for tx */ 457 /* Send the packet to the ieee80211 layer for tx */
458 /* we defined softmac->mgmt_xmit for this. Should we keep it 458 /* we defined softmac->mgmt_xmit for this. Should we keep it
459 * as it is (that means we'd need to wrap this into a txb), 459 * as it is (that means we'd need to wrap this into a txb),