diff options
25 files changed, 156 insertions, 540 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index ee866fd6957d..65057348838b 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -5783,7 +5783,7 @@ static int airo_get_essid(struct net_device *dev, | |||
5783 | /* If none, we may want to get the one that was set */ | 5783 | /* If none, we may want to get the one that was set */ |
5784 | 5784 | ||
5785 | /* Push it out ! */ | 5785 | /* Push it out ! */ |
5786 | dwrq->length = status_rid.SSIDlen + 1; | 5786 | dwrq->length = status_rid.SSIDlen; |
5787 | dwrq->flags = 1; /* active */ | 5787 | dwrq->flags = 1; /* active */ |
5788 | 5788 | ||
5789 | return 0; | 5789 | return 0; |
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index f0ccfef66445..98a76f10a0f7 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -1718,11 +1718,11 @@ static int atmel_get_essid(struct net_device *dev, | |||
1718 | if (priv->new_SSID_size != 0) { | 1718 | if (priv->new_SSID_size != 0) { |
1719 | memcpy(extra, priv->new_SSID, priv->new_SSID_size); | 1719 | memcpy(extra, priv->new_SSID, priv->new_SSID_size); |
1720 | extra[priv->new_SSID_size] = '\0'; | 1720 | extra[priv->new_SSID_size] = '\0'; |
1721 | dwrq->length = priv->new_SSID_size + 1; | 1721 | dwrq->length = priv->new_SSID_size; |
1722 | } else { | 1722 | } else { |
1723 | memcpy(extra, priv->SSID, priv->SSID_size); | 1723 | memcpy(extra, priv->SSID, priv->SSID_size); |
1724 | extra[priv->SSID_size] = '\0'; | 1724 | extra[priv->SSID_size] = '\0'; |
1725 | dwrq->length = priv->SSID_size + 1; | 1725 | dwrq->length = priv->SSID_size; |
1726 | } | 1726 | } |
1727 | 1727 | ||
1728 | dwrq->flags = !priv->connect_to_any_BSS; /* active */ | 1728 | dwrq->flags = !priv->connect_to_any_BSS; /* active */ |
diff --git a/drivers/net/wireless/hostap/Kconfig b/drivers/net/wireless/hostap/Kconfig index 56f41c714d38..c8f6286dd35f 100644 --- a/drivers/net/wireless/hostap/Kconfig +++ b/drivers/net/wireless/hostap/Kconfig | |||
@@ -26,11 +26,25 @@ config HOSTAP_FIRMWARE | |||
26 | depends on HOSTAP | 26 | depends on HOSTAP |
27 | ---help--- | 27 | ---help--- |
28 | Configure Host AP driver to include support for firmware image | 28 | Configure Host AP driver to include support for firmware image |
29 | download. Current version supports only downloading to volatile, i.e., | 29 | download. This option by itself only enables downloading to the |
30 | RAM memory. Flash upgrade is not yet supported. | 30 | volatile memory, i.e. the card RAM. This option is required to |
31 | support cards that don't have firmware in flash, such as D-Link | ||
32 | DWL-520 rev E and D-Link DWL-650 rev P. | ||
31 | 33 | ||
32 | Firmware image downloading needs user space tool, prism2_srec. It is | 34 | Firmware image downloading needs a user space tool, prism2_srec. |
33 | available from http://hostap.epitest.fi/. | 35 | It is available from http://hostap.epitest.fi/. |
36 | |||
37 | config HOSTAP_FIRMWARE_NVRAM | ||
38 | bool "Support for non-volatile firmware download" | ||
39 | depends on HOSTAP_FIRMWARE | ||
40 | ---help--- | ||
41 | Allow Host AP driver to write firmware images to the non-volatile | ||
42 | card memory, i.e. flash memory that survives power cycling. | ||
43 | Enable this option if you want to be able to change card firmware | ||
44 | permanently. | ||
45 | |||
46 | Firmware image downloading needs a user space tool, prism2_srec. | ||
47 | It is available from http://hostap.epitest.fi/. | ||
34 | 48 | ||
35 | config HOSTAP_PLX | 49 | config HOSTAP_PLX |
36 | tristate "Host AP driver for Prism2/2.5/3 in PLX9052 PCI adaptors" | 50 | tristate "Host AP driver for Prism2/2.5/3 in PLX9052 PCI adaptors" |
diff --git a/drivers/net/wireless/hostap/Makefile b/drivers/net/wireless/hostap/Makefile index 353ccb93134b..b8e41a702c00 100644 --- a/drivers/net/wireless/hostap/Makefile +++ b/drivers/net/wireless/hostap/Makefile | |||
@@ -1,4 +1,5 @@ | |||
1 | hostap-y := hostap_main.o | 1 | hostap-y := hostap_80211_rx.o hostap_80211_tx.o hostap_ap.o hostap_info.o \ |
2 | hostap_ioctl.o hostap_main.o hostap_proc.o | ||
2 | obj-$(CONFIG_HOSTAP) += hostap.o | 3 | obj-$(CONFIG_HOSTAP) += hostap.o |
3 | 4 | ||
4 | obj-$(CONFIG_HOSTAP_CS) += hostap_cs.o | 5 | obj-$(CONFIG_HOSTAP_CS) += hostap_cs.o |
diff --git a/drivers/net/wireless/hostap/hostap.h b/drivers/net/wireless/hostap/hostap.h index 5fac89b8ce3a..5e63765219fe 100644 --- a/drivers/net/wireless/hostap/hostap.h +++ b/drivers/net/wireless/hostap/hostap.h | |||
@@ -1,6 +1,15 @@ | |||
1 | #ifndef HOSTAP_H | 1 | #ifndef HOSTAP_H |
2 | #define HOSTAP_H | 2 | #define HOSTAP_H |
3 | 3 | ||
4 | #include <linux/ethtool.h> | ||
5 | |||
6 | #include "hostap_wlan.h" | ||
7 | #include "hostap_ap.h" | ||
8 | |||
9 | static const long freq_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442, | ||
10 | 2447, 2452, 2457, 2462, 2467, 2472, 2484 }; | ||
11 | #define FREQ_COUNT (sizeof(freq_list) / sizeof(freq_list[0])) | ||
12 | |||
4 | /* hostap.c */ | 13 | /* hostap.c */ |
5 | 14 | ||
6 | extern struct proc_dir_entry *hostap_proc; | 15 | extern struct proc_dir_entry *hostap_proc; |
@@ -40,6 +49,26 @@ int prism2_update_comms_qual(struct net_device *dev); | |||
40 | int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype, | 49 | int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype, |
41 | u8 *body, size_t bodylen); | 50 | u8 *body, size_t bodylen); |
42 | int prism2_sta_deauth(local_info_t *local, u16 reason); | 51 | int prism2_sta_deauth(local_info_t *local, u16 reason); |
52 | int prism2_wds_add(local_info_t *local, u8 *remote_addr, | ||
53 | int rtnl_locked); | ||
54 | int prism2_wds_del(local_info_t *local, u8 *remote_addr, | ||
55 | int rtnl_locked, int do_not_remove); | ||
56 | |||
57 | |||
58 | /* hostap_ap.c */ | ||
59 | |||
60 | int ap_control_add_mac(struct mac_restrictions *mac_restrictions, u8 *mac); | ||
61 | int ap_control_del_mac(struct mac_restrictions *mac_restrictions, u8 *mac); | ||
62 | void ap_control_flush_macs(struct mac_restrictions *mac_restrictions); | ||
63 | int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, u8 *mac); | ||
64 | void ap_control_kickall(struct ap_data *ap); | ||
65 | void * ap_crypt_get_ptrs(struct ap_data *ap, u8 *addr, int permanent, | ||
66 | struct ieee80211_crypt_data ***crypt); | ||
67 | int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[], | ||
68 | struct iw_quality qual[], int buf_size, | ||
69 | int aplist); | ||
70 | int prism2_ap_translate_scan(struct net_device *dev, char *buffer); | ||
71 | int prism2_hostapd(struct ap_data *ap, struct prism2_hostapd_param *param); | ||
43 | 72 | ||
44 | 73 | ||
45 | /* hostap_proc.c */ | 74 | /* hostap_proc.c */ |
@@ -54,4 +83,12 @@ void hostap_info_init(local_info_t *local); | |||
54 | void hostap_info_process(local_info_t *local, struct sk_buff *skb); | 83 | void hostap_info_process(local_info_t *local, struct sk_buff *skb); |
55 | 84 | ||
56 | 85 | ||
86 | /* hostap_ioctl.c */ | ||
87 | |||
88 | extern const struct iw_handler_def hostap_iw_handler_def; | ||
89 | extern struct ethtool_ops prism2_ethtool_ops; | ||
90 | |||
91 | int hostap_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); | ||
92 | |||
93 | |||
57 | #endif /* HOSTAP_H */ | 94 | #endif /* HOSTAP_H */ |
diff --git a/drivers/net/wireless/hostap/hostap_80211.h b/drivers/net/wireless/hostap/hostap_80211.h index bf506f50d722..1fc72fe511e9 100644 --- a/drivers/net/wireless/hostap/hostap_80211.h +++ b/drivers/net/wireless/hostap/hostap_80211.h | |||
@@ -1,6 +1,9 @@ | |||
1 | #ifndef HOSTAP_80211_H | 1 | #ifndef HOSTAP_80211_H |
2 | #define HOSTAP_80211_H | 2 | #define HOSTAP_80211_H |
3 | 3 | ||
4 | #include <linux/types.h> | ||
5 | #include <net/ieee80211_crypt.h> | ||
6 | |||
4 | struct hostap_ieee80211_mgmt { | 7 | struct hostap_ieee80211_mgmt { |
5 | u16 frame_control; | 8 | u16 frame_control; |
6 | u16 duration; | 9 | u16 duration; |
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c index 4b13b76425c1..7e04dc94b3bc 100644 --- a/drivers/net/wireless/hostap/hostap_80211_rx.c +++ b/drivers/net/wireless/hostap/hostap_80211_rx.c | |||
@@ -1,7 +1,18 @@ | |||
1 | #include <linux/etherdevice.h> | 1 | #include <linux/etherdevice.h> |
2 | #include <net/ieee80211_crypt.h> | ||
2 | 3 | ||
3 | #include "hostap_80211.h" | 4 | #include "hostap_80211.h" |
4 | #include "hostap.h" | 5 | #include "hostap.h" |
6 | #include "hostap_ap.h" | ||
7 | |||
8 | /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ | ||
9 | /* Ethernet-II snap header (RFC1042 for most EtherTypes) */ | ||
10 | static unsigned char rfc1042_header[] = | ||
11 | { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; | ||
12 | /* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ | ||
13 | static unsigned char bridge_tunnel_header[] = | ||
14 | { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; | ||
15 | /* No encapsulation header if EtherType < 0x600 (=length) */ | ||
5 | 16 | ||
6 | void hostap_dump_rx_80211(const char *name, struct sk_buff *skb, | 17 | void hostap_dump_rx_80211(const char *name, struct sk_buff *skb, |
7 | struct hostap_80211_rx_status *rx_stats) | 18 | struct hostap_80211_rx_status *rx_stats) |
diff --git a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c index 9d24f8a38ac5..4a85e63906f1 100644 --- a/drivers/net/wireless/hostap/hostap_80211_tx.c +++ b/drivers/net/wireless/hostap/hostap_80211_tx.c | |||
@@ -1,3 +1,18 @@ | |||
1 | #include "hostap_80211.h" | ||
2 | #include "hostap_common.h" | ||
3 | #include "hostap_wlan.h" | ||
4 | #include "hostap.h" | ||
5 | #include "hostap_ap.h" | ||
6 | |||
7 | /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ | ||
8 | /* Ethernet-II snap header (RFC1042 for most EtherTypes) */ | ||
9 | static unsigned char rfc1042_header[] = | ||
10 | { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; | ||
11 | /* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ | ||
12 | static unsigned char bridge_tunnel_header[] = | ||
13 | { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; | ||
14 | /* No encapsulation header if EtherType < 0x600 (=length) */ | ||
15 | |||
1 | void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) | 16 | void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) |
2 | { | 17 | { |
3 | struct ieee80211_hdr_4addr *hdr; | 18 | struct ieee80211_hdr_4addr *hdr; |
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c index 9da94ab7f05f..753a1de6664b 100644 --- a/drivers/net/wireless/hostap/hostap_ap.c +++ b/drivers/net/wireless/hostap/hostap_ap.c | |||
@@ -16,6 +16,14 @@ | |||
16 | * (8802.11: 5.5) | 16 | * (8802.11: 5.5) |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/proc_fs.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <linux/random.h> | ||
22 | |||
23 | #include "hostap_wlan.h" | ||
24 | #include "hostap.h" | ||
25 | #include "hostap_ap.h" | ||
26 | |||
19 | static int other_ap_policy[MAX_PARM_DEVICES] = { AP_OTHER_AP_SKIP_ALL, | 27 | static int other_ap_policy[MAX_PARM_DEVICES] = { AP_OTHER_AP_SKIP_ALL, |
20 | DEF_INTS }; | 28 | DEF_INTS }; |
21 | module_param_array(other_ap_policy, int, NULL, 0444); | 29 | module_param_array(other_ap_policy, int, NULL, 0444); |
@@ -360,8 +368,7 @@ static int ap_control_proc_read(char *page, char **start, off_t off, | |||
360 | } | 368 | } |
361 | 369 | ||
362 | 370 | ||
363 | static int ap_control_add_mac(struct mac_restrictions *mac_restrictions, | 371 | int ap_control_add_mac(struct mac_restrictions *mac_restrictions, u8 *mac) |
364 | u8 *mac) | ||
365 | { | 372 | { |
366 | struct mac_entry *entry; | 373 | struct mac_entry *entry; |
367 | 374 | ||
@@ -380,8 +387,7 @@ static int ap_control_add_mac(struct mac_restrictions *mac_restrictions, | |||
380 | } | 387 | } |
381 | 388 | ||
382 | 389 | ||
383 | static int ap_control_del_mac(struct mac_restrictions *mac_restrictions, | 390 | int ap_control_del_mac(struct mac_restrictions *mac_restrictions, u8 *mac) |
384 | u8 *mac) | ||
385 | { | 391 | { |
386 | struct list_head *ptr; | 392 | struct list_head *ptr; |
387 | struct mac_entry *entry; | 393 | struct mac_entry *entry; |
@@ -433,7 +439,7 @@ static int ap_control_mac_deny(struct mac_restrictions *mac_restrictions, | |||
433 | } | 439 | } |
434 | 440 | ||
435 | 441 | ||
436 | static void ap_control_flush_macs(struct mac_restrictions *mac_restrictions) | 442 | void ap_control_flush_macs(struct mac_restrictions *mac_restrictions) |
437 | { | 443 | { |
438 | struct list_head *ptr, *n; | 444 | struct list_head *ptr, *n; |
439 | struct mac_entry *entry; | 445 | struct mac_entry *entry; |
@@ -454,8 +460,7 @@ static void ap_control_flush_macs(struct mac_restrictions *mac_restrictions) | |||
454 | } | 460 | } |
455 | 461 | ||
456 | 462 | ||
457 | static int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, | 463 | int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, u8 *mac) |
458 | u8 *mac) | ||
459 | { | 464 | { |
460 | struct sta_info *sta; | 465 | struct sta_info *sta; |
461 | u16 resp; | 466 | u16 resp; |
@@ -486,7 +491,7 @@ static int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, | |||
486 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ | 491 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ |
487 | 492 | ||
488 | 493 | ||
489 | static void ap_control_kickall(struct ap_data *ap) | 494 | void ap_control_kickall(struct ap_data *ap) |
490 | { | 495 | { |
491 | struct list_head *ptr, *n; | 496 | struct list_head *ptr, *n; |
492 | struct sta_info *sta; | 497 | struct sta_info *sta; |
@@ -2321,9 +2326,9 @@ static void schedule_packet_send(local_info_t *local, struct sta_info *sta) | |||
2321 | } | 2326 | } |
2322 | 2327 | ||
2323 | 2328 | ||
2324 | static int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[], | 2329 | int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[], |
2325 | struct iw_quality qual[], int buf_size, | 2330 | struct iw_quality qual[], int buf_size, |
2326 | int aplist) | 2331 | int aplist) |
2327 | { | 2332 | { |
2328 | struct ap_data *ap = local->ap; | 2333 | struct ap_data *ap = local->ap; |
2329 | struct list_head *ptr; | 2334 | struct list_head *ptr; |
@@ -2363,7 +2368,7 @@ static int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[], | |||
2363 | 2368 | ||
2364 | /* Translate our list of Access Points & Stations to a card independant | 2369 | /* Translate our list of Access Points & Stations to a card independant |
2365 | * format that the Wireless Tools will understand - Jean II */ | 2370 | * format that the Wireless Tools will understand - Jean II */ |
2366 | static int prism2_ap_translate_scan(struct net_device *dev, char *buffer) | 2371 | int prism2_ap_translate_scan(struct net_device *dev, char *buffer) |
2367 | { | 2372 | { |
2368 | struct hostap_interface *iface; | 2373 | struct hostap_interface *iface; |
2369 | local_info_t *local; | 2374 | local_info_t *local; |
@@ -2608,8 +2613,7 @@ static int prism2_hostapd_sta_clear_stats(struct ap_data *ap, | |||
2608 | } | 2613 | } |
2609 | 2614 | ||
2610 | 2615 | ||
2611 | static int prism2_hostapd(struct ap_data *ap, | 2616 | int prism2_hostapd(struct ap_data *ap, struct prism2_hostapd_param *param) |
2612 | struct prism2_hostapd_param *param) | ||
2613 | { | 2617 | { |
2614 | switch (param->cmd) { | 2618 | switch (param->cmd) { |
2615 | case PRISM2_HOSTAPD_FLUSH: | 2619 | case PRISM2_HOSTAPD_FLUSH: |
@@ -3207,8 +3211,8 @@ void hostap_update_rates(local_info_t *local) | |||
3207 | } | 3211 | } |
3208 | 3212 | ||
3209 | 3213 | ||
3210 | static void * ap_crypt_get_ptrs(struct ap_data *ap, u8 *addr, int permanent, | 3214 | void * ap_crypt_get_ptrs(struct ap_data *ap, u8 *addr, int permanent, |
3211 | struct ieee80211_crypt_data ***crypt) | 3215 | struct ieee80211_crypt_data ***crypt) |
3212 | { | 3216 | { |
3213 | struct sta_info *sta; | 3217 | struct sta_info *sta; |
3214 | 3218 | ||
diff --git a/drivers/net/wireless/hostap/hostap_ap.h b/drivers/net/wireless/hostap/hostap_ap.h index 6d00df69c2e3..2fa2452b6b07 100644 --- a/drivers/net/wireless/hostap/hostap_ap.h +++ b/drivers/net/wireless/hostap/hostap_ap.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef HOSTAP_AP_H | 1 | #ifndef HOSTAP_AP_H |
2 | #define HOSTAP_AP_H | 2 | #define HOSTAP_AP_H |
3 | 3 | ||
4 | #include "hostap_80211.h" | ||
5 | |||
4 | /* AP data structures for STAs */ | 6 | /* AP data structures for STAs */ |
5 | 7 | ||
6 | /* maximum number of frames to buffer per STA */ | 8 | /* maximum number of frames to buffer per STA */ |
diff --git a/drivers/net/wireless/hostap/hostap_common.h b/drivers/net/wireless/hostap/hostap_common.h index 6f4fa9dc308f..01624005d808 100644 --- a/drivers/net/wireless/hostap/hostap_common.h +++ b/drivers/net/wireless/hostap/hostap_common.h | |||
@@ -1,6 +1,9 @@ | |||
1 | #ifndef HOSTAP_COMMON_H | 1 | #ifndef HOSTAP_COMMON_H |
2 | #define HOSTAP_COMMON_H | 2 | #define HOSTAP_COMMON_H |
3 | 3 | ||
4 | #include <linux/types.h> | ||
5 | #include <linux/if_ether.h> | ||
6 | |||
4 | #define BIT(x) (1 << (x)) | 7 | #define BIT(x) (1 << (x)) |
5 | 8 | ||
6 | #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] | 9 | #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] |
diff --git a/drivers/net/wireless/hostap/hostap_config.h b/drivers/net/wireless/hostap/hostap_config.h index 7ed3425d08c1..c090a5aebb58 100644 --- a/drivers/net/wireless/hostap/hostap_config.h +++ b/drivers/net/wireless/hostap/hostap_config.h | |||
@@ -21,15 +21,10 @@ | |||
21 | #define PRISM2_DOWNLOAD_SUPPORT | 21 | #define PRISM2_DOWNLOAD_SUPPORT |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | #ifdef PRISM2_DOWNLOAD_SUPPORT | 24 | /* Allow kernel configuration to enable non-volatile download support. */ |
25 | /* Allow writing firmware images into flash, i.e., to non-volatile storage. | 25 | #ifdef CONFIG_HOSTAP_FIRMWARE_NVRAM |
26 | * Before you enable this option, you should make absolutely sure that you are | 26 | #define PRISM2_NON_VOLATILE_DOWNLOAD |
27 | * using prism2_srec utility that comes with THIS version of the driver! | 27 | #endif |
28 | * In addition, please note that it is possible to kill your card with | ||
29 | * non-volatile download if you are using incorrect image. This feature has not | ||
30 | * been fully tested, so please be careful with it. */ | ||
31 | /* #define PRISM2_NON_VOLATILE_DOWNLOAD */ | ||
32 | #endif /* PRISM2_DOWNLOAD_SUPPORT */ | ||
33 | 28 | ||
34 | /* Save low-level I/O for debugging. This should not be enabled in normal use. | 29 | /* Save low-level I/O for debugging. This should not be enabled in normal use. |
35 | */ | 30 | */ |
diff --git a/drivers/net/wireless/hostap/hostap_info.c b/drivers/net/wireless/hostap/hostap_info.c index 5aa998fdf1c4..50f72d831cf4 100644 --- a/drivers/net/wireless/hostap/hostap_info.c +++ b/drivers/net/wireless/hostap/hostap_info.c | |||
@@ -1,5 +1,8 @@ | |||
1 | /* Host AP driver Info Frame processing (part of hostap.o module) */ | 1 | /* Host AP driver Info Frame processing (part of hostap.o module) */ |
2 | 2 | ||
3 | #include "hostap_wlan.h" | ||
4 | #include "hostap.h" | ||
5 | #include "hostap_ap.h" | ||
3 | 6 | ||
4 | /* Called only as a tasklet (software IRQ) */ | 7 | /* Called only as a tasklet (software IRQ) */ |
5 | static void prism2_info_commtallies16(local_info_t *local, unsigned char *buf, | 8 | static void prism2_info_commtallies16(local_info_t *local, unsigned char *buf, |
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c index 2617d70bcda9..f3e0ce1ee037 100644 --- a/drivers/net/wireless/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/hostap/hostap_ioctl.c | |||
@@ -1,11 +1,13 @@ | |||
1 | /* ioctl() (mostly Linux Wireless Extensions) routines for Host AP driver */ | 1 | /* ioctl() (mostly Linux Wireless Extensions) routines for Host AP driver */ |
2 | 2 | ||
3 | #ifdef in_atomic | 3 | #include <linux/types.h> |
4 | /* Get kernel_locked() for in_atomic() */ | ||
5 | #include <linux/smp_lock.h> | 4 | #include <linux/smp_lock.h> |
6 | #endif | ||
7 | #include <linux/ethtool.h> | 5 | #include <linux/ethtool.h> |
6 | #include <net/ieee80211_crypt.h> | ||
8 | 7 | ||
8 | #include "hostap_wlan.h" | ||
9 | #include "hostap.h" | ||
10 | #include "hostap_ap.h" | ||
9 | 11 | ||
10 | static struct iw_statistics *hostap_get_wireless_stats(struct net_device *dev) | 12 | static struct iw_statistics *hostap_get_wireless_stats(struct net_device *dev) |
11 | { | 13 | { |
@@ -3910,7 +3912,7 @@ static void prism2_get_drvinfo(struct net_device *dev, | |||
3910 | local->sta_fw_ver & 0xff); | 3912 | local->sta_fw_ver & 0xff); |
3911 | } | 3913 | } |
3912 | 3914 | ||
3913 | static struct ethtool_ops prism2_ethtool_ops = { | 3915 | struct ethtool_ops prism2_ethtool_ops = { |
3914 | .get_drvinfo = prism2_get_drvinfo | 3916 | .get_drvinfo = prism2_get_drvinfo |
3915 | }; | 3917 | }; |
3916 | 3918 | ||
@@ -3985,7 +3987,7 @@ static const iw_handler prism2_private_handler[] = | |||
3985 | (iw_handler) prism2_ioctl_priv_readmif, /* 3 */ | 3987 | (iw_handler) prism2_ioctl_priv_readmif, /* 3 */ |
3986 | }; | 3988 | }; |
3987 | 3989 | ||
3988 | static const struct iw_handler_def hostap_iw_handler_def = | 3990 | const struct iw_handler_def hostap_iw_handler_def = |
3989 | { | 3991 | { |
3990 | .num_standard = sizeof(prism2_handler) / sizeof(iw_handler), | 3992 | .num_standard = sizeof(prism2_handler) / sizeof(iw_handler), |
3991 | .num_private = sizeof(prism2_private_handler) / sizeof(iw_handler), | 3993 | .num_private = sizeof(prism2_private_handler) / sizeof(iw_handler), |
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c index 3d2ea61033be..8dd4c4446a64 100644 --- a/drivers/net/wireless/hostap/hostap_main.c +++ b/drivers/net/wireless/hostap/hostap_main.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/kmod.h> | 24 | #include <linux/kmod.h> |
25 | #include <linux/rtnetlink.h> | 25 | #include <linux/rtnetlink.h> |
26 | #include <linux/wireless.h> | 26 | #include <linux/wireless.h> |
27 | #include <linux/etherdevice.h> | ||
27 | #include <net/iw_handler.h> | 28 | #include <net/iw_handler.h> |
28 | #include <net/ieee80211.h> | 29 | #include <net/ieee80211.h> |
29 | #include <net/ieee80211_crypt.h> | 30 | #include <net/ieee80211_crypt.h> |
@@ -47,57 +48,6 @@ MODULE_VERSION(PRISM2_VERSION); | |||
47 | #define PRISM2_MAX_MTU (PRISM2_MAX_FRAME_SIZE - (6 /* LLC */ + 8 /* WEP */)) | 48 | #define PRISM2_MAX_MTU (PRISM2_MAX_FRAME_SIZE - (6 /* LLC */ + 8 /* WEP */)) |
48 | 49 | ||
49 | 50 | ||
50 | /* hostap.c */ | ||
51 | static int prism2_wds_add(local_info_t *local, u8 *remote_addr, | ||
52 | int rtnl_locked); | ||
53 | static int prism2_wds_del(local_info_t *local, u8 *remote_addr, | ||
54 | int rtnl_locked, int do_not_remove); | ||
55 | |||
56 | /* hostap_ap.c */ | ||
57 | static int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[], | ||
58 | struct iw_quality qual[], int buf_size, | ||
59 | int aplist); | ||
60 | static int prism2_ap_translate_scan(struct net_device *dev, char *buffer); | ||
61 | static int prism2_hostapd(struct ap_data *ap, | ||
62 | struct prism2_hostapd_param *param); | ||
63 | static void * ap_crypt_get_ptrs(struct ap_data *ap, u8 *addr, int permanent, | ||
64 | struct ieee80211_crypt_data ***crypt); | ||
65 | static void ap_control_kickall(struct ap_data *ap); | ||
66 | #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT | ||
67 | static int ap_control_add_mac(struct mac_restrictions *mac_restrictions, | ||
68 | u8 *mac); | ||
69 | static int ap_control_del_mac(struct mac_restrictions *mac_restrictions, | ||
70 | u8 *mac); | ||
71 | static void ap_control_flush_macs(struct mac_restrictions *mac_restrictions); | ||
72 | static int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, | ||
73 | u8 *mac); | ||
74 | #endif /* !PRISM2_NO_KERNEL_IEEE80211_MGMT */ | ||
75 | |||
76 | |||
77 | static const long freq_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442, | ||
78 | 2447, 2452, 2457, 2462, 2467, 2472, 2484 }; | ||
79 | #define FREQ_COUNT (sizeof(freq_list) / sizeof(freq_list[0])) | ||
80 | |||
81 | |||
82 | /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ | ||
83 | /* Ethernet-II snap header (RFC1042 for most EtherTypes) */ | ||
84 | static unsigned char rfc1042_header[] = | ||
85 | { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; | ||
86 | /* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ | ||
87 | static unsigned char bridge_tunnel_header[] = | ||
88 | { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; | ||
89 | /* No encapsulation header if EtherType < 0x600 (=length) */ | ||
90 | |||
91 | |||
92 | /* FIX: these could be compiled separately and linked together to hostap.o */ | ||
93 | #include "hostap_ap.c" | ||
94 | #include "hostap_info.c" | ||
95 | #include "hostap_ioctl.c" | ||
96 | #include "hostap_proc.c" | ||
97 | #include "hostap_80211_rx.c" | ||
98 | #include "hostap_80211_tx.c" | ||
99 | |||
100 | |||
101 | struct net_device * hostap_add_interface(struct local_info *local, | 51 | struct net_device * hostap_add_interface(struct local_info *local, |
102 | int type, int rtnl_locked, | 52 | int type, int rtnl_locked, |
103 | const char *prefix, | 53 | const char *prefix, |
@@ -196,8 +146,8 @@ static inline int prism2_wds_special_addr(u8 *addr) | |||
196 | } | 146 | } |
197 | 147 | ||
198 | 148 | ||
199 | static int prism2_wds_add(local_info_t *local, u8 *remote_addr, | 149 | int prism2_wds_add(local_info_t *local, u8 *remote_addr, |
200 | int rtnl_locked) | 150 | int rtnl_locked) |
201 | { | 151 | { |
202 | struct net_device *dev; | 152 | struct net_device *dev; |
203 | struct list_head *ptr; | 153 | struct list_head *ptr; |
@@ -258,8 +208,8 @@ static int prism2_wds_add(local_info_t *local, u8 *remote_addr, | |||
258 | } | 208 | } |
259 | 209 | ||
260 | 210 | ||
261 | static int prism2_wds_del(local_info_t *local, u8 *remote_addr, | 211 | int prism2_wds_del(local_info_t *local, u8 *remote_addr, |
262 | int rtnl_locked, int do_not_remove) | 212 | int rtnl_locked, int do_not_remove) |
263 | { | 213 | { |
264 | unsigned long flags; | 214 | unsigned long flags; |
265 | struct list_head *ptr; | 215 | struct list_head *ptr; |
diff --git a/drivers/net/wireless/hostap/hostap_proc.c b/drivers/net/wireless/hostap/hostap_proc.c index a0a4cbd4937a..d1d8ce022e63 100644 --- a/drivers/net/wireless/hostap/hostap_proc.c +++ b/drivers/net/wireless/hostap/hostap_proc.c | |||
@@ -1,5 +1,12 @@ | |||
1 | /* /proc routines for Host AP driver */ | 1 | /* /proc routines for Host AP driver */ |
2 | 2 | ||
3 | #include <linux/types.h> | ||
4 | #include <linux/proc_fs.h> | ||
5 | #include <net/ieee80211_crypt.h> | ||
6 | |||
7 | #include "hostap_wlan.h" | ||
8 | #include "hostap.h" | ||
9 | |||
3 | #define PROC_LIMIT (PAGE_SIZE - 80) | 10 | #define PROC_LIMIT (PAGE_SIZE - 80) |
4 | 11 | ||
5 | 12 | ||
diff --git a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h index cfd801559492..87a54aa6f4dd 100644 --- a/drivers/net/wireless/hostap/hostap_wlan.h +++ b/drivers/net/wireless/hostap/hostap_wlan.h | |||
@@ -1,6 +1,10 @@ | |||
1 | #ifndef HOSTAP_WLAN_H | 1 | #ifndef HOSTAP_WLAN_H |
2 | #define HOSTAP_WLAN_H | 2 | #define HOSTAP_WLAN_H |
3 | 3 | ||
4 | #include <linux/wireless.h> | ||
5 | #include <linux/netdevice.h> | ||
6 | #include <net/iw_handler.h> | ||
7 | |||
4 | #include "hostap_config.h" | 8 | #include "hostap_config.h" |
5 | #include "hostap_common.h" | 9 | #include "hostap_common.h" |
6 | 10 | ||
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index 7518384f34d9..8bf02763b5c7 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
@@ -5735,70 +5735,6 @@ static struct net_device_stats *ipw2100_stats(struct net_device *dev) | |||
5735 | return &priv->ieee->stats; | 5735 | return &priv->ieee->stats; |
5736 | } | 5736 | } |
5737 | 5737 | ||
5738 | #if WIRELESS_EXT < 18 | ||
5739 | /* Support for wpa_supplicant before WE-18, deprecated. */ | ||
5740 | |||
5741 | /* following definitions must match definitions in driver_ipw.c */ | ||
5742 | |||
5743 | #define IPW2100_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30 | ||
5744 | |||
5745 | #define IPW2100_CMD_SET_WPA_PARAM 1 | ||
5746 | #define IPW2100_CMD_SET_WPA_IE 2 | ||
5747 | #define IPW2100_CMD_SET_ENCRYPTION 3 | ||
5748 | #define IPW2100_CMD_MLME 4 | ||
5749 | |||
5750 | #define IPW2100_PARAM_WPA_ENABLED 1 | ||
5751 | #define IPW2100_PARAM_TKIP_COUNTERMEASURES 2 | ||
5752 | #define IPW2100_PARAM_DROP_UNENCRYPTED 3 | ||
5753 | #define IPW2100_PARAM_PRIVACY_INVOKED 4 | ||
5754 | #define IPW2100_PARAM_AUTH_ALGS 5 | ||
5755 | #define IPW2100_PARAM_IEEE_802_1X 6 | ||
5756 | |||
5757 | #define IPW2100_MLME_STA_DEAUTH 1 | ||
5758 | #define IPW2100_MLME_STA_DISASSOC 2 | ||
5759 | |||
5760 | #define IPW2100_CRYPT_ERR_UNKNOWN_ALG 2 | ||
5761 | #define IPW2100_CRYPT_ERR_UNKNOWN_ADDR 3 | ||
5762 | #define IPW2100_CRYPT_ERR_CRYPT_INIT_FAILED 4 | ||
5763 | #define IPW2100_CRYPT_ERR_KEY_SET_FAILED 5 | ||
5764 | #define IPW2100_CRYPT_ERR_TX_KEY_SET_FAILED 6 | ||
5765 | #define IPW2100_CRYPT_ERR_CARD_CONF_FAILED 7 | ||
5766 | |||
5767 | #define IPW2100_CRYPT_ALG_NAME_LEN 16 | ||
5768 | |||
5769 | struct ipw2100_param { | ||
5770 | u32 cmd; | ||
5771 | u8 sta_addr[ETH_ALEN]; | ||
5772 | union { | ||
5773 | struct { | ||
5774 | u8 name; | ||
5775 | u32 value; | ||
5776 | } wpa_param; | ||
5777 | struct { | ||
5778 | u32 len; | ||
5779 | u8 reserved[32]; | ||
5780 | u8 data[0]; | ||
5781 | } wpa_ie; | ||
5782 | struct { | ||
5783 | u32 command; | ||
5784 | u32 reason_code; | ||
5785 | } mlme; | ||
5786 | struct { | ||
5787 | u8 alg[IPW2100_CRYPT_ALG_NAME_LEN]; | ||
5788 | u8 set_tx; | ||
5789 | u32 err; | ||
5790 | u8 idx; | ||
5791 | u8 seq[8]; /* sequence counter (set: RX, get: TX) */ | ||
5792 | u16 key_len; | ||
5793 | u8 key[0]; | ||
5794 | } crypt; | ||
5795 | |||
5796 | } u; | ||
5797 | }; | ||
5798 | |||
5799 | /* end of driver_ipw.c code */ | ||
5800 | #endif /* WIRELESS_EXT < 18 */ | ||
5801 | |||
5802 | static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value) | 5738 | static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value) |
5803 | { | 5739 | { |
5804 | /* This is called when wpa_supplicant loads and closes the driver | 5740 | /* This is called when wpa_supplicant loads and closes the driver |
@@ -5807,11 +5743,6 @@ static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value) | |||
5807 | return 0; | 5743 | return 0; |
5808 | } | 5744 | } |
5809 | 5745 | ||
5810 | #if WIRELESS_EXT < 18 | ||
5811 | #define IW_AUTH_ALG_OPEN_SYSTEM 0x1 | ||
5812 | #define IW_AUTH_ALG_SHARED_KEY 0x2 | ||
5813 | #endif | ||
5814 | |||
5815 | static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value) | 5746 | static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value) |
5816 | { | 5747 | { |
5817 | 5748 | ||
@@ -5855,360 +5786,6 @@ void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv, | |||
5855 | ipw2100_set_wpa_ie(priv, &frame, 0); | 5786 | ipw2100_set_wpa_ie(priv, &frame, 0); |
5856 | } | 5787 | } |
5857 | 5788 | ||
5858 | #if WIRELESS_EXT < 18 | ||
5859 | static int ipw2100_wpa_set_param(struct net_device *dev, u8 name, u32 value) | ||
5860 | { | ||
5861 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
5862 | struct ieee80211_crypt_data *crypt; | ||
5863 | unsigned long flags; | ||
5864 | int ret = 0; | ||
5865 | |||
5866 | switch (name) { | ||
5867 | case IPW2100_PARAM_WPA_ENABLED: | ||
5868 | ret = ipw2100_wpa_enable(priv, value); | ||
5869 | break; | ||
5870 | |||
5871 | case IPW2100_PARAM_TKIP_COUNTERMEASURES: | ||
5872 | crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; | ||
5873 | if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) | ||
5874 | break; | ||
5875 | |||
5876 | flags = crypt->ops->get_flags(crypt->priv); | ||
5877 | |||
5878 | if (value) | ||
5879 | flags |= IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; | ||
5880 | else | ||
5881 | flags &= ~IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; | ||
5882 | |||
5883 | crypt->ops->set_flags(flags, crypt->priv); | ||
5884 | |||
5885 | break; | ||
5886 | |||
5887 | case IPW2100_PARAM_DROP_UNENCRYPTED:{ | ||
5888 | /* See IW_AUTH_DROP_UNENCRYPTED handling for details */ | ||
5889 | struct ieee80211_security sec = { | ||
5890 | .flags = SEC_ENABLED, | ||
5891 | .enabled = value, | ||
5892 | }; | ||
5893 | priv->ieee->drop_unencrypted = value; | ||
5894 | /* We only change SEC_LEVEL for open mode. Others | ||
5895 | * are set by ipw_wpa_set_encryption. | ||
5896 | */ | ||
5897 | if (!value) { | ||
5898 | sec.flags |= SEC_LEVEL; | ||
5899 | sec.level = SEC_LEVEL_0; | ||
5900 | } else { | ||
5901 | sec.flags |= SEC_LEVEL; | ||
5902 | sec.level = SEC_LEVEL_1; | ||
5903 | } | ||
5904 | if (priv->ieee->set_security) | ||
5905 | priv->ieee->set_security(priv->ieee->dev, &sec); | ||
5906 | break; | ||
5907 | } | ||
5908 | |||
5909 | case IPW2100_PARAM_PRIVACY_INVOKED: | ||
5910 | priv->ieee->privacy_invoked = value; | ||
5911 | break; | ||
5912 | |||
5913 | case IPW2100_PARAM_AUTH_ALGS: | ||
5914 | ret = ipw2100_wpa_set_auth_algs(priv, value); | ||
5915 | break; | ||
5916 | |||
5917 | case IPW2100_PARAM_IEEE_802_1X: | ||
5918 | priv->ieee->ieee802_1x = value; | ||
5919 | break; | ||
5920 | |||
5921 | default: | ||
5922 | printk(KERN_ERR DRV_NAME ": %s: Unknown WPA param: %d\n", | ||
5923 | dev->name, name); | ||
5924 | ret = -EOPNOTSUPP; | ||
5925 | } | ||
5926 | |||
5927 | return ret; | ||
5928 | } | ||
5929 | |||
5930 | static int ipw2100_wpa_mlme(struct net_device *dev, int command, int reason) | ||
5931 | { | ||
5932 | |||
5933 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
5934 | int ret = 0; | ||
5935 | |||
5936 | switch (command) { | ||
5937 | case IPW2100_MLME_STA_DEAUTH: | ||
5938 | // silently ignore | ||
5939 | break; | ||
5940 | |||
5941 | case IPW2100_MLME_STA_DISASSOC: | ||
5942 | ipw2100_disassociate_bssid(priv); | ||
5943 | break; | ||
5944 | |||
5945 | default: | ||
5946 | printk(KERN_ERR DRV_NAME ": %s: Unknown MLME request: %d\n", | ||
5947 | dev->name, command); | ||
5948 | ret = -EOPNOTSUPP; | ||
5949 | } | ||
5950 | |||
5951 | return ret; | ||
5952 | } | ||
5953 | |||
5954 | static int ipw2100_wpa_set_wpa_ie(struct net_device *dev, | ||
5955 | struct ipw2100_param *param, int plen) | ||
5956 | { | ||
5957 | |||
5958 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
5959 | struct ieee80211_device *ieee = priv->ieee; | ||
5960 | u8 *buf; | ||
5961 | |||
5962 | if (!ieee->wpa_enabled) | ||
5963 | return -EOPNOTSUPP; | ||
5964 | |||
5965 | if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || | ||
5966 | (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL)) | ||
5967 | return -EINVAL; | ||
5968 | |||
5969 | if (param->u.wpa_ie.len) { | ||
5970 | buf = kmalloc(param->u.wpa_ie.len, GFP_KERNEL); | ||
5971 | if (buf == NULL) | ||
5972 | return -ENOMEM; | ||
5973 | |||
5974 | memcpy(buf, param->u.wpa_ie.data, param->u.wpa_ie.len); | ||
5975 | |||
5976 | kfree(ieee->wpa_ie); | ||
5977 | ieee->wpa_ie = buf; | ||
5978 | ieee->wpa_ie_len = param->u.wpa_ie.len; | ||
5979 | |||
5980 | } else { | ||
5981 | kfree(ieee->wpa_ie); | ||
5982 | ieee->wpa_ie = NULL; | ||
5983 | ieee->wpa_ie_len = 0; | ||
5984 | } | ||
5985 | |||
5986 | ipw2100_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); | ||
5987 | |||
5988 | return 0; | ||
5989 | } | ||
5990 | |||
5991 | /* implementation borrowed from hostap driver */ | ||
5992 | |||
5993 | static int ipw2100_wpa_set_encryption(struct net_device *dev, | ||
5994 | struct ipw2100_param *param, | ||
5995 | int param_len) | ||
5996 | { | ||
5997 | int ret = 0; | ||
5998 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
5999 | struct ieee80211_device *ieee = priv->ieee; | ||
6000 | struct ieee80211_crypto_ops *ops; | ||
6001 | struct ieee80211_crypt_data **crypt; | ||
6002 | |||
6003 | struct ieee80211_security sec = { | ||
6004 | .flags = 0, | ||
6005 | }; | ||
6006 | |||
6007 | param->u.crypt.err = 0; | ||
6008 | param->u.crypt.alg[IPW2100_CRYPT_ALG_NAME_LEN - 1] = '\0'; | ||
6009 | |||
6010 | if (param_len != | ||
6011 | (int)((char *)param->u.crypt.key - (char *)param) + | ||
6012 | param->u.crypt.key_len) { | ||
6013 | IPW_DEBUG_INFO("Len mismatch %d, %d\n", param_len, | ||
6014 | param->u.crypt.key_len); | ||
6015 | return -EINVAL; | ||
6016 | } | ||
6017 | if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && | ||
6018 | param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && | ||
6019 | param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { | ||
6020 | if (param->u.crypt.idx >= WEP_KEYS) | ||
6021 | return -EINVAL; | ||
6022 | crypt = &ieee->crypt[param->u.crypt.idx]; | ||
6023 | } else { | ||
6024 | return -EINVAL; | ||
6025 | } | ||
6026 | |||
6027 | sec.flags |= SEC_ENABLED | SEC_ENCRYPT; | ||
6028 | if (strcmp(param->u.crypt.alg, "none") == 0) { | ||
6029 | if (crypt) { | ||
6030 | sec.enabled = 0; | ||
6031 | sec.encrypt = 0; | ||
6032 | sec.level = SEC_LEVEL_0; | ||
6033 | sec.flags |= SEC_LEVEL; | ||
6034 | ieee80211_crypt_delayed_deinit(ieee, crypt); | ||
6035 | } | ||
6036 | goto done; | ||
6037 | } | ||
6038 | sec.enabled = 1; | ||
6039 | sec.encrypt = 1; | ||
6040 | |||
6041 | ops = ieee80211_get_crypto_ops(param->u.crypt.alg); | ||
6042 | if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { | ||
6043 | request_module("ieee80211_crypt_wep"); | ||
6044 | ops = ieee80211_get_crypto_ops(param->u.crypt.alg); | ||
6045 | } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) { | ||
6046 | request_module("ieee80211_crypt_tkip"); | ||
6047 | ops = ieee80211_get_crypto_ops(param->u.crypt.alg); | ||
6048 | } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) { | ||
6049 | request_module("ieee80211_crypt_ccmp"); | ||
6050 | ops = ieee80211_get_crypto_ops(param->u.crypt.alg); | ||
6051 | } | ||
6052 | if (ops == NULL) { | ||
6053 | IPW_DEBUG_INFO("%s: unknown crypto alg '%s'\n", | ||
6054 | dev->name, param->u.crypt.alg); | ||
6055 | param->u.crypt.err = IPW2100_CRYPT_ERR_UNKNOWN_ALG; | ||
6056 | ret = -EINVAL; | ||
6057 | goto done; | ||
6058 | } | ||
6059 | |||
6060 | if (*crypt == NULL || (*crypt)->ops != ops) { | ||
6061 | struct ieee80211_crypt_data *new_crypt; | ||
6062 | |||
6063 | ieee80211_crypt_delayed_deinit(ieee, crypt); | ||
6064 | |||
6065 | new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL); | ||
6066 | if (new_crypt == NULL) { | ||
6067 | ret = -ENOMEM; | ||
6068 | goto done; | ||
6069 | } | ||
6070 | new_crypt->ops = ops; | ||
6071 | if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) | ||
6072 | new_crypt->priv = | ||
6073 | new_crypt->ops->init(param->u.crypt.idx); | ||
6074 | |||
6075 | if (new_crypt->priv == NULL) { | ||
6076 | kfree(new_crypt); | ||
6077 | param->u.crypt.err = | ||
6078 | IPW2100_CRYPT_ERR_CRYPT_INIT_FAILED; | ||
6079 | ret = -EINVAL; | ||
6080 | goto done; | ||
6081 | } | ||
6082 | |||
6083 | *crypt = new_crypt; | ||
6084 | } | ||
6085 | |||
6086 | if (param->u.crypt.key_len > 0 && (*crypt)->ops->set_key && | ||
6087 | (*crypt)->ops->set_key(param->u.crypt.key, | ||
6088 | param->u.crypt.key_len, param->u.crypt.seq, | ||
6089 | (*crypt)->priv) < 0) { | ||
6090 | IPW_DEBUG_INFO("%s: key setting failed\n", dev->name); | ||
6091 | param->u.crypt.err = IPW2100_CRYPT_ERR_KEY_SET_FAILED; | ||
6092 | ret = -EINVAL; | ||
6093 | goto done; | ||
6094 | } | ||
6095 | |||
6096 | if (param->u.crypt.set_tx) { | ||
6097 | ieee->tx_keyidx = param->u.crypt.idx; | ||
6098 | sec.active_key = param->u.crypt.idx; | ||
6099 | sec.flags |= SEC_ACTIVE_KEY; | ||
6100 | } | ||
6101 | |||
6102 | if (ops->name != NULL) { | ||
6103 | |||
6104 | if (strcmp(ops->name, "WEP") == 0) { | ||
6105 | memcpy(sec.keys[param->u.crypt.idx], | ||
6106 | param->u.crypt.key, param->u.crypt.key_len); | ||
6107 | sec.key_sizes[param->u.crypt.idx] = | ||
6108 | param->u.crypt.key_len; | ||
6109 | sec.flags |= (1 << param->u.crypt.idx); | ||
6110 | sec.flags |= SEC_LEVEL; | ||
6111 | sec.level = SEC_LEVEL_1; | ||
6112 | } else if (strcmp(ops->name, "TKIP") == 0) { | ||
6113 | sec.flags |= SEC_LEVEL; | ||
6114 | sec.level = SEC_LEVEL_2; | ||
6115 | } else if (strcmp(ops->name, "CCMP") == 0) { | ||
6116 | sec.flags |= SEC_LEVEL; | ||
6117 | sec.level = SEC_LEVEL_3; | ||
6118 | } | ||
6119 | } | ||
6120 | done: | ||
6121 | if (ieee->set_security) | ||
6122 | ieee->set_security(ieee->dev, &sec); | ||
6123 | |||
6124 | /* Do not reset port if card is in Managed mode since resetting will | ||
6125 | * generate new IEEE 802.11 authentication which may end up in looping | ||
6126 | * with IEEE 802.1X. If your hardware requires a reset after WEP | ||
6127 | * configuration (for example... Prism2), implement the reset_port in | ||
6128 | * the callbacks structures used to initialize the 802.11 stack. */ | ||
6129 | if (ieee->reset_on_keychange && | ||
6130 | ieee->iw_mode != IW_MODE_INFRA && | ||
6131 | ieee->reset_port && ieee->reset_port(dev)) { | ||
6132 | IPW_DEBUG_INFO("%s: reset_port failed\n", dev->name); | ||
6133 | param->u.crypt.err = IPW2100_CRYPT_ERR_CARD_CONF_FAILED; | ||
6134 | return -EINVAL; | ||
6135 | } | ||
6136 | |||
6137 | return ret; | ||
6138 | } | ||
6139 | |||
6140 | static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p) | ||
6141 | { | ||
6142 | |||
6143 | struct ipw2100_param *param; | ||
6144 | int ret = 0; | ||
6145 | |||
6146 | IPW_DEBUG_IOCTL("wpa_supplicant: len=%d\n", p->length); | ||
6147 | |||
6148 | if (p->length < sizeof(struct ipw2100_param) || !p->pointer) | ||
6149 | return -EINVAL; | ||
6150 | |||
6151 | param = (struct ipw2100_param *)kmalloc(p->length, GFP_KERNEL); | ||
6152 | if (param == NULL) | ||
6153 | return -ENOMEM; | ||
6154 | |||
6155 | if (copy_from_user(param, p->pointer, p->length)) { | ||
6156 | kfree(param); | ||
6157 | return -EFAULT; | ||
6158 | } | ||
6159 | |||
6160 | switch (param->cmd) { | ||
6161 | |||
6162 | case IPW2100_CMD_SET_WPA_PARAM: | ||
6163 | ret = ipw2100_wpa_set_param(dev, param->u.wpa_param.name, | ||
6164 | param->u.wpa_param.value); | ||
6165 | break; | ||
6166 | |||
6167 | case IPW2100_CMD_SET_WPA_IE: | ||
6168 | ret = ipw2100_wpa_set_wpa_ie(dev, param, p->length); | ||
6169 | break; | ||
6170 | |||
6171 | case IPW2100_CMD_SET_ENCRYPTION: | ||
6172 | ret = ipw2100_wpa_set_encryption(dev, param, p->length); | ||
6173 | break; | ||
6174 | |||
6175 | case IPW2100_CMD_MLME: | ||
6176 | ret = ipw2100_wpa_mlme(dev, param->u.mlme.command, | ||
6177 | param->u.mlme.reason_code); | ||
6178 | break; | ||
6179 | |||
6180 | default: | ||
6181 | printk(KERN_ERR DRV_NAME | ||
6182 | ": %s: Unknown WPA supplicant request: %d\n", dev->name, | ||
6183 | param->cmd); | ||
6184 | ret = -EOPNOTSUPP; | ||
6185 | |||
6186 | } | ||
6187 | |||
6188 | if (ret == 0 && copy_to_user(p->pointer, param, p->length)) | ||
6189 | ret = -EFAULT; | ||
6190 | |||
6191 | kfree(param); | ||
6192 | return ret; | ||
6193 | } | ||
6194 | |||
6195 | static int ipw2100_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | ||
6196 | { | ||
6197 | struct iwreq *wrq = (struct iwreq *)rq; | ||
6198 | int ret = -1; | ||
6199 | switch (cmd) { | ||
6200 | case IPW2100_IOCTL_WPA_SUPPLICANT: | ||
6201 | ret = ipw2100_wpa_supplicant(dev, &wrq->u.data); | ||
6202 | return ret; | ||
6203 | |||
6204 | default: | ||
6205 | return -EOPNOTSUPP; | ||
6206 | } | ||
6207 | |||
6208 | return -EOPNOTSUPP; | ||
6209 | } | ||
6210 | #endif /* WIRELESS_EXT < 18 */ | ||
6211 | |||
6212 | static void ipw_ethtool_get_drvinfo(struct net_device *dev, | 5789 | static void ipw_ethtool_get_drvinfo(struct net_device *dev, |
6213 | struct ethtool_drvinfo *info) | 5790 | struct ethtool_drvinfo *info) |
6214 | { | 5791 | { |
@@ -6337,9 +5914,6 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev, | |||
6337 | dev->open = ipw2100_open; | 5914 | dev->open = ipw2100_open; |
6338 | dev->stop = ipw2100_close; | 5915 | dev->stop = ipw2100_close; |
6339 | dev->init = ipw2100_net_init; | 5916 | dev->init = ipw2100_net_init; |
6340 | #if WIRELESS_EXT < 18 | ||
6341 | dev->do_ioctl = ipw2100_ioctl; | ||
6342 | #endif | ||
6343 | dev->get_stats = ipw2100_stats; | 5917 | dev->get_stats = ipw2100_stats; |
6344 | dev->ethtool_ops = &ipw2100_ethtool_ops; | 5918 | dev->ethtool_ops = &ipw2100_ethtool_ops; |
6345 | dev->tx_timeout = ipw2100_tx_timeout; | 5919 | dev->tx_timeout = ipw2100_tx_timeout; |
@@ -7855,7 +7429,6 @@ static int ipw2100_wx_get_power(struct net_device *dev, | |||
7855 | return 0; | 7429 | return 0; |
7856 | } | 7430 | } |
7857 | 7431 | ||
7858 | #if WIRELESS_EXT > 17 | ||
7859 | /* | 7432 | /* |
7860 | * WE-18 WPA support | 7433 | * WE-18 WPA support |
7861 | */ | 7434 | */ |
@@ -8117,7 +7690,6 @@ static int ipw2100_wx_set_mlme(struct net_device *dev, | |||
8117 | } | 7690 | } |
8118 | return 0; | 7691 | return 0; |
8119 | } | 7692 | } |
8120 | #endif /* WIRELESS_EXT > 17 */ | ||
8121 | 7693 | ||
8122 | /* | 7694 | /* |
8123 | * | 7695 | * |
@@ -8350,11 +7922,7 @@ static iw_handler ipw2100_wx_handlers[] = { | |||
8350 | NULL, /* SIOCWIWTHRSPY */ | 7922 | NULL, /* SIOCWIWTHRSPY */ |
8351 | ipw2100_wx_set_wap, /* SIOCSIWAP */ | 7923 | ipw2100_wx_set_wap, /* SIOCSIWAP */ |
8352 | ipw2100_wx_get_wap, /* SIOCGIWAP */ | 7924 | ipw2100_wx_get_wap, /* SIOCGIWAP */ |
8353 | #if WIRELESS_EXT > 17 | ||
8354 | ipw2100_wx_set_mlme, /* SIOCSIWMLME */ | 7925 | ipw2100_wx_set_mlme, /* SIOCSIWMLME */ |
8355 | #else | ||
8356 | NULL, /* -- hole -- */ | ||
8357 | #endif | ||
8358 | NULL, /* SIOCGIWAPLIST -- deprecated */ | 7926 | NULL, /* SIOCGIWAPLIST -- deprecated */ |
8359 | ipw2100_wx_set_scan, /* SIOCSIWSCAN */ | 7927 | ipw2100_wx_set_scan, /* SIOCSIWSCAN */ |
8360 | ipw2100_wx_get_scan, /* SIOCGIWSCAN */ | 7928 | ipw2100_wx_get_scan, /* SIOCGIWSCAN */ |
@@ -8378,7 +7946,6 @@ static iw_handler ipw2100_wx_handlers[] = { | |||
8378 | ipw2100_wx_get_encode, /* SIOCGIWENCODE */ | 7946 | ipw2100_wx_get_encode, /* SIOCGIWENCODE */ |
8379 | ipw2100_wx_set_power, /* SIOCSIWPOWER */ | 7947 | ipw2100_wx_set_power, /* SIOCSIWPOWER */ |
8380 | ipw2100_wx_get_power, /* SIOCGIWPOWER */ | 7948 | ipw2100_wx_get_power, /* SIOCGIWPOWER */ |
8381 | #if WIRELESS_EXT > 17 | ||
8382 | NULL, /* -- hole -- */ | 7949 | NULL, /* -- hole -- */ |
8383 | NULL, /* -- hole -- */ | 7950 | NULL, /* -- hole -- */ |
8384 | ipw2100_wx_set_genie, /* SIOCSIWGENIE */ | 7951 | ipw2100_wx_set_genie, /* SIOCSIWGENIE */ |
@@ -8388,7 +7955,6 @@ static iw_handler ipw2100_wx_handlers[] = { | |||
8388 | ipw2100_wx_set_encodeext, /* SIOCSIWENCODEEXT */ | 7955 | ipw2100_wx_set_encodeext, /* SIOCSIWENCODEEXT */ |
8389 | ipw2100_wx_get_encodeext, /* SIOCGIWENCODEEXT */ | 7956 | ipw2100_wx_get_encodeext, /* SIOCGIWENCODEEXT */ |
8390 | NULL, /* SIOCSIWPMKSA */ | 7957 | NULL, /* SIOCSIWPMKSA */ |
8391 | #endif | ||
8392 | }; | 7958 | }; |
8393 | 7959 | ||
8394 | #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV | 7960 | #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV |
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 819be2b6b7df..4c28e332ecc3 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -8936,14 +8936,12 @@ static int ipw_request_direct_scan(struct ipw_priv *priv, char *essid, | |||
8936 | IPW_DEBUG_HC("starting request direct scan!\n"); | 8936 | IPW_DEBUG_HC("starting request direct scan!\n"); |
8937 | 8937 | ||
8938 | if (priv->status & (STATUS_SCANNING | STATUS_SCAN_ABORTING)) { | 8938 | if (priv->status & (STATUS_SCANNING | STATUS_SCAN_ABORTING)) { |
8939 | err = wait_event_interruptible(priv->wait_state, | 8939 | /* We should not sleep here; otherwise we will block most |
8940 | !(priv-> | 8940 | * of the system (for instance, we hold rtnl_lock when we |
8941 | status & (STATUS_SCANNING | | 8941 | * get here). |
8942 | STATUS_SCAN_ABORTING))); | 8942 | */ |
8943 | if (err) { | 8943 | err = -EAGAIN; |
8944 | IPW_DEBUG_HC("aborting direct scan"); | 8944 | goto done; |
8945 | goto done; | ||
8946 | } | ||
8947 | } | 8945 | } |
8948 | memset(&scan, 0, sizeof(scan)); | 8946 | memset(&scan, 0, sizeof(scan)); |
8949 | 8947 | ||
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c index 135a156db25d..c5cd61c7f927 100644 --- a/drivers/net/wireless/prism54/isl_ioctl.c +++ b/drivers/net/wireless/prism54/isl_ioctl.c | |||
@@ -748,7 +748,7 @@ prism54_get_essid(struct net_device *ndev, struct iw_request_info *info, | |||
748 | if (essid->length) { | 748 | if (essid->length) { |
749 | dwrq->flags = 1; /* set ESSID to ON for Wireless Extensions */ | 749 | dwrq->flags = 1; /* set ESSID to ON for Wireless Extensions */ |
750 | /* if it is to big, trunk it */ | 750 | /* if it is to big, trunk it */ |
751 | dwrq->length = min(IW_ESSID_MAX_SIZE, essid->length + 1); | 751 | dwrq->length = min(IW_ESSID_MAX_SIZE, essid->length); |
752 | } else { | 752 | } else { |
753 | dwrq->flags = 0; | 753 | dwrq->flags = 0; |
754 | dwrq->length = 0; | 754 | dwrq->length = 0; |
diff --git a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c index 33d64d2ee53f..a8261d8454dd 100644 --- a/drivers/net/wireless/prism54/islpci_eth.c +++ b/drivers/net/wireless/prism54/islpci_eth.c | |||
@@ -177,7 +177,7 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev) | |||
177 | #endif | 177 | #endif |
178 | 178 | ||
179 | newskb->dev = skb->dev; | 179 | newskb->dev = skb->dev; |
180 | dev_kfree_skb(skb); | 180 | dev_kfree_skb_irq(skb); |
181 | skb = newskb; | 181 | skb = newskb; |
182 | } | 182 | } |
183 | } | 183 | } |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 319180ca7e71..7880d8c31aad 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -1256,7 +1256,7 @@ static int ray_get_essid(struct net_device *dev, | |||
1256 | extra[IW_ESSID_MAX_SIZE] = '\0'; | 1256 | extra[IW_ESSID_MAX_SIZE] = '\0'; |
1257 | 1257 | ||
1258 | /* Push it out ! */ | 1258 | /* Push it out ! */ |
1259 | dwrq->length = strlen(extra) + 1; | 1259 | dwrq->length = strlen(extra); |
1260 | dwrq->flags = 1; /* active */ | 1260 | dwrq->flags = 1; /* active */ |
1261 | 1261 | ||
1262 | return 0; | 1262 | return 0; |
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 7e2039f52c49..cf373625fc70 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -2280,7 +2280,7 @@ static int wavelan_get_essid(struct net_device *dev, | |||
2280 | extra[IW_ESSID_MAX_SIZE] = '\0'; | 2280 | extra[IW_ESSID_MAX_SIZE] = '\0'; |
2281 | 2281 | ||
2282 | /* Set the length */ | 2282 | /* Set the length */ |
2283 | wrqu->data.length = strlen(extra) + 1; | 2283 | wrqu->data.length = strlen(extra); |
2284 | 2284 | ||
2285 | return 0; | 2285 | return 0; |
2286 | } | 2286 | } |
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h index 03b766afdc39..cd82c3e998e4 100644 --- a/include/net/ieee80211_crypt.h +++ b/include/net/ieee80211_crypt.h | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | #include <linux/types.h> | 26 | #include <linux/types.h> |
27 | #include <linux/list.h> | 27 | #include <linux/list.h> |
28 | #include <net/ieee80211.h> | ||
28 | #include <asm/atomic.h> | 29 | #include <asm/atomic.h> |
29 | 30 | ||
30 | enum { | 31 | enum { |
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h index d67c8393a343..a2c5e0b88422 100644 --- a/include/net/iw_handler.h +++ b/include/net/iw_handler.h | |||
@@ -327,7 +327,7 @@ struct iw_handler_def | |||
327 | __u16 num_private_args; | 327 | __u16 num_private_args; |
328 | 328 | ||
329 | /* Array of handlers for standard ioctls | 329 | /* Array of handlers for standard ioctls |
330 | * We will call dev->wireless_handlers->standard[ioctl - SIOCSIWNAME] | 330 | * We will call dev->wireless_handlers->standard[ioctl - SIOCSIWCOMMIT] |
331 | */ | 331 | */ |
332 | const iw_handler * standard; | 332 | const iw_handler * standard; |
333 | 333 | ||