1
The patch "wext: refactor" by Johannes Berg refactored
2
wext code so that new kernels no longer get the wext
3
handlers through struct netdevice, instead they get
4
it through the struct wiphy which is cfg80211 specific.
6
For old kernels this means you get not wext handlers
7
anymore when backporting code, this adds the wext handler
8
back to the netdevice wireless_handlers to let compat
11
We do this for every kernel version because the struct wiphy
12
is changing from kernel version to version. At least the
13
struct from kernel 2.6.33 and 2.6.34 are incompatible and
14
the kernel would dereference some wrong type in the struct
15
and oops. The old interface is not affected by this. This
16
will cause that CONFIG_CFG80211_WEXT still depends on
17
CONFIG_WIRELESS_EXT in compat-wireless.
19
--- a/net/wireless/core.c
20
+++ b/net/wireless/core.c
21
@@ -366,10 +366,6 @@ struct wiphy *wiphy_new(const struct cfg
22
INIT_LIST_HEAD(&rdev->bss_list);
23
INIT_WORK(&rdev->scan_done_wk, __cfg80211_scan_done);
25
-#ifdef CONFIG_CFG80211_WEXT
26
- rdev->wiphy.wext = &cfg80211_wext_handler;
29
device_initialize(&rdev->wiphy.dev);
30
rdev->wiphy.dev.class = &ieee80211_class;
31
rdev->wiphy.dev.platform_data = rdev;
32
@@ -712,6 +708,15 @@ static int cfg80211_netdev_notifier_call
33
wdev->sme_state = CFG80211_SME_IDLE;
34
mutex_unlock(&rdev->devlist_mtx);
35
#ifdef CONFIG_CFG80211_WEXT
36
+#ifdef CONFIG_WIRELESS_EXT
37
+ if (!dev->wireless_handlers)
38
+ dev->wireless_handlers = &cfg80211_wext_handler;
40
+ printk_once(KERN_WARNING "cfg80211: wext will not work because "
41
+ "kernel was compiled with CONFIG_WIRELESS_EXT=n. "
42
+ "Tools using wext interface, like iwconfig will "
45
wdev->wext.default_key = -1;
46
wdev->wext.default_mgmt_key = -1;
47
wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;