mac80211: improve wifi interface cleanup
[openwrt/staging/chunkeey.git] / package / wpa_supplicant / patches / 150-Remove-PS3-gelic-legacy-wpa-support.patch
1 From 67441c596f016f69c230eaa31ecb2272c6cbf4bf Mon Sep 17 00:00:00 2001
2 From: Hamish Guthrie <hamish.guthrie@sonycom.com>
3 Date: Wed, 6 Jan 2010 10:00:22 +0100
4 Subject: [PATCH] Remove PS3 gelic legacy wpa support
5
6 The ps3 wireless driver now supports wireless extensions. There is dedicated support code in wpa_supplicant for the old gelic wireless driver. The current gelic driver retains the old API with CONFIG_GELIC_WIRELESS_OLD_PSK_INTERFACE, which is being removed from the driver.
7
8 Signed-off-by: Hamish Guthrie <hamish.guthrie@sonycom.com>
9 ---
10 src/drivers/driver_ps3.c | 186 ----------------------------------------------
11 src/drivers/drivers.c | 6 --
12 wpa_supplicant/Makefile | 6 --
13 3 files changed, 0 insertions(+), 198 deletions(-)
14 delete mode 100644 src/drivers/driver_ps3.c
15
16 diff --git a/src/drivers/driver_ps3.c b/src/drivers/driver_ps3.c
17 deleted file mode 100644
18 index fde3425..0000000
19 --- a/src/drivers/driver_ps3.c
20 +++ /dev/null
21 @@ -1,186 +0,0 @@
22 -/*
23 - * WPA Supplicant - PS3 Linux wireless extension driver interface
24 - * Copyright 2007, 2008 Sony Corporation
25 - *
26 - * This program is free software; you can redistribute it and/or modify
27 - * it under the terms of the GNU General Public License version 2 as
28 - * published by the Free Software Foundation.
29 - *
30 - * Alternatively, this software may be distributed under the terms of BSD
31 - * license.
32 - *
33 - * See README and COPYING for more details.
34 - */
35 -
36 -#include "includes.h"
37 -#include <sys/ioctl.h>
38 -#include "wireless_copy.h"
39 -#include "common.h"
40 -#include "wpa_common.h"
41 -#include "driver.h"
42 -#include "eloop.h"
43 -#include "driver_wext.h"
44 -#include "ieee802_11_defs.h"
45 -
46 -static int wpa_driver_ps3_set_wpa_key(struct wpa_driver_wext_data *drv,
47 - struct wpa_driver_associate_params *params)
48 -{
49 - int ret, i;
50 - struct iwreq iwr;
51 - char *buf, *str;
52 -
53 - if (!params->psk && !params->passphrase) {
54 - wpa_printf(MSG_INFO, "%s:no PSK error", __func__);
55 - return -EINVAL;
56 - }
57 -
58 - os_memset(&iwr, 0, sizeof(iwr));
59 - if (params->psk) {
60 - /* includes null */
61 - iwr.u.data.length = PMK_LEN * 2 + 1;
62 - buf = os_malloc(iwr.u.data.length);
63 - if (!buf)
64 - return -ENOMEM;
65 - str = buf;
66 - for (i = 0; i < PMK_LEN; i++) {
67 - str += snprintf(str, iwr.u.data.length - (str - buf),
68 - "%02x", params->psk[i]);
69 - }
70 - } else if (params->passphrase) {
71 - /* including quotations and null */
72 - iwr.u.data.length = strlen(params->passphrase) + 3;
73 - buf = os_malloc(iwr.u.data.length);
74 - if (!buf)
75 - return -ENOMEM;
76 - buf[0] = '"';
77 - os_memcpy(buf + 1, params->passphrase, iwr.u.data.length - 3);
78 - buf[iwr.u.data.length - 2] = '"';
79 - buf[iwr.u.data.length - 1] = '\0';
80 - } else
81 - return -EINVAL;
82 - iwr.u.data.pointer = (caddr_t) buf;
83 - os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
84 - ret = ioctl(drv->ioctl_sock, SIOCIWFIRSTPRIV, &iwr);
85 - os_free(buf);
86 -
87 - return ret;
88 -}
89 -
90 -static int wpa_driver_ps3_set_wep_keys(struct wpa_driver_wext_data *drv,
91 - struct wpa_driver_associate_params *params)
92 -{
93 - int ret, i;
94 - struct iwreq iwr;
95 -
96 - for (i = 0; i < 4; i++) {
97 - os_memset(&iwr, 0, sizeof(iwr));
98 - os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
99 - iwr.u.encoding.flags = i + 1;
100 - if (params->wep_key_len[i]) {
101 - iwr.u.encoding.pointer = (caddr_t) params->wep_key[i];
102 - iwr.u.encoding.length = params->wep_key_len[i];
103 - } else
104 - iwr.u.encoding.flags = IW_ENCODE_NOKEY |
105 - IW_ENCODE_DISABLED;
106 -
107 - if (ioctl(drv->ioctl_sock, SIOCSIWENCODE, &iwr) < 0) {
108 - perror("ioctl[SIOCSIWENCODE]");
109 - ret = -1;
110 - }
111 - }
112 - return ret;
113 -}
114 -
115 -static int wpa_driver_ps3_associate(void *priv,
116 - struct wpa_driver_associate_params *params)
117 -{
118 - struct wpa_driver_wext_data *drv = priv;
119 - int ret, value;
120 -
121 - wpa_printf(MSG_DEBUG, "%s: <-", __func__);
122 -
123 - /* clear BSSID */
124 - if (!params->bssid &&
125 - wpa_driver_wext_set_bssid(drv, NULL) < 0)
126 - ret = -1;
127 -
128 - if (wpa_driver_wext_set_mode(drv, params->mode) < 0)
129 - ret = -1;
130 -
131 - if (params->wpa_ie == NULL || params->wpa_ie_len == 0)
132 - value = IW_AUTH_WPA_VERSION_DISABLED;
133 - else if (params->wpa_ie[0] == WLAN_EID_RSN)
134 - value = IW_AUTH_WPA_VERSION_WPA2;
135 - else
136 - value = IW_AUTH_WPA_VERSION_WPA;
137 - if (wpa_driver_wext_set_auth_param(drv,
138 - IW_AUTH_WPA_VERSION, value) < 0)
139 - ret = -1;
140 - value = wpa_driver_wext_cipher2wext(params->pairwise_suite);
141 - if (wpa_driver_wext_set_auth_param(drv,
142 - IW_AUTH_CIPHER_PAIRWISE, value) < 0)
143 - ret = -1;
144 - value = wpa_driver_wext_cipher2wext(params->group_suite);
145 - if (wpa_driver_wext_set_auth_param(drv,
146 - IW_AUTH_CIPHER_GROUP, value) < 0)
147 - ret = -1;
148 - value = wpa_driver_wext_keymgmt2wext(params->key_mgmt_suite);
149 - if (wpa_driver_wext_set_auth_param(drv, IW_AUTH_KEY_MGMT, value) < 0)
150 - ret = -1;
151 -
152 - /* set selected BSSID */
153 - if (params->bssid &&
154 - wpa_driver_wext_set_bssid(drv, params->bssid) < 0)
155 - ret = -1;
156 -
157 - switch (params->group_suite) {
158 - case CIPHER_NONE:
159 - ret = 0;
160 - break;
161 - case CIPHER_WEP40:
162 - case CIPHER_WEP104:
163 - ret = wpa_driver_ps3_set_wep_keys(drv, params);
164 - break;
165 - case CIPHER_TKIP:
166 - case CIPHER_CCMP:
167 - ret = wpa_driver_ps3_set_wpa_key(drv, params);
168 - break;
169 - }
170 -
171 - /* start to associate */
172 - ret = wpa_driver_wext_set_ssid(drv, params->ssid, params->ssid_len);
173 -
174 - wpa_printf(MSG_DEBUG, "%s: ->", __func__);
175 -
176 - return ret;
177 -}
178 -
179 -static int wpa_driver_ps3_get_capa(void *priv, struct wpa_driver_capa *capa)
180 -{
181 - int ret;
182 - wpa_printf(MSG_DEBUG, "%s:<-", __func__);
183 -
184 - ret = wpa_driver_wext_get_capa(priv, capa);
185 - if (ret) {
186 - wpa_printf(MSG_INFO, "%s: base wext returns error %d",
187 - __func__, ret);
188 - return ret;
189 - }
190 - /* PS3 hypervisor does association and 4way handshake by itself */
191 - capa->flags |= WPA_DRIVER_FLAGS_4WAY_HANDSHAKE;
192 - wpa_printf(MSG_DEBUG, "%s:->", __func__);
193 - return 0;
194 -}
195 -
196 -const struct wpa_driver_ops wpa_driver_ps3_ops = {
197 - .name = "ps3",
198 - .desc = "PLAYSTATION3 Linux wireless extension driver",
199 - .get_bssid = wpa_driver_wext_get_bssid,
200 - .get_ssid = wpa_driver_wext_get_ssid,
201 - .scan = wpa_driver_wext_scan,
202 - .get_scan_results2 = wpa_driver_wext_get_scan_results,
203 - .associate = wpa_driver_ps3_associate, /* PS3 */
204 - .init = wpa_driver_wext_init,
205 - .deinit = wpa_driver_wext_deinit,
206 - .get_capa = wpa_driver_ps3_get_capa, /* PS3 */
207 -};
208 diff --git a/src/drivers/drivers.c b/src/drivers/drivers.c
209 index d278797..7e7d720 100644
210 --- a/src/drivers/drivers.c
211 +++ b/src/drivers/drivers.c
212 @@ -64,9 +64,6 @@ extern struct wpa_driver_ops wpa_driver_ralink_ops; /* driver_ralink.c */
213 #ifdef CONFIG_DRIVER_OSX
214 extern struct wpa_driver_ops wpa_driver_osx_ops; /* driver_osx.m */
215 #endif /* CONFIG_DRIVER_OSX */
216 -#ifdef CONFIG_DRIVER_PS3
217 -extern struct wpa_driver_ops wpa_driver_ps3_ops; /* driver_ps3.c */
218 -#endif /* CONFIG_DRIVER_PS3 */
219 #ifdef CONFIG_DRIVER_IPHONE
220 extern struct wpa_driver_ops wpa_driver_iphone_ops; /* driver_iphone.m */
221 #endif /* CONFIG_DRIVER_IPHONE */
222 @@ -126,9 +123,6 @@ struct wpa_driver_ops *wpa_supplicant_drivers[] =
223 #ifdef CONFIG_DRIVER_OSX
224 &wpa_driver_osx_ops,
225 #endif /* CONFIG_DRIVER_OSX */
226 -#ifdef CONFIG_DRIVER_PS3
227 - &wpa_driver_ps3_ops,
228 -#endif /* CONFIG_DRIVER_PS3 */
229 #ifdef CONFIG_DRIVER_IPHONE
230 &wpa_driver_iphone_ops,
231 #endif /* CONFIG_DRIVER_IPHONE */
232 diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
233 index 45d6ada..f131e92 100644
234 --- a/wpa_supplicant/Makefile
235 +++ b/wpa_supplicant/Makefile
236 @@ -226,12 +226,6 @@ LDFLAGS += -framework CoreFoundation
237 LDFLAGS += -F/System/Library/PrivateFrameworks -framework Apple80211
238 endif
239
240 -ifdef CONFIG_DRIVER_PS3
241 -CFLAGS += -DCONFIG_DRIVER_PS3 -m64
242 -OBJS_d += ../src/drivers/driver_ps3.o
243 -LDFLAGS += -m64
244 -endif
245 -
246 ifdef CONFIG_DRIVER_IPHONE
247 CFLAGS += -DCONFIG_DRIVER_IPHONE
248 OBJS_d += ../src/drivers/driver_iphone.o
249 --
250 1.6.2.4
251