~ubuntu-branches/ubuntu/natty/linux-backports-modules-2.6.38/natty-updates

« back to all changes in this revision

Viewing changes to updates/compat-wireless-2.6.37/patches/10-add-wext-handlers-to-netdev.patch

  • Committer: Bazaar Package Importer
  • Author(s): Tim Gardner, Tim Gardner
  • Date: 2011-06-08 10:44:09 UTC
  • Revision ID: james.westby@ubuntu.com-20110608104409-fnl8carkdo15bwsz
Tags: 2.6.38-10.6
[ Tim Gardner ]

Shorten compat-wireless package name to cw to accomodate
CDROM file name length restrictions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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.
5
 
 
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
9
 
users use wext again.
10
 
 
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.
18
 
 
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);
24
 
 
25
 
-#ifdef CONFIG_CFG80211_WEXT
26
 
-       rdev->wiphy.wext = &cfg80211_wext_handler;
27
 
-#endif
28
 
-
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;
39
 
+#else
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 "
43
 
+                           "not work.\n");
44
 
+#endif
45
 
                wdev->wext.default_key = -1;
46
 
                wdev->wext.default_mgmt_key = -1;
47
 
                wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;