cfg80211: add wext handlers back to netdev for compat code
authorLuis R. Rodriguez <lrodriguez@atheros.com>
Tue, 6 Oct 2009 18:19:02 +0000 (14:19 -0400)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Tue, 6 Oct 2009 18:24:17 +0000 (14:24 -0400)
The patch "wext: refactor" by Johannes Berg refactored
wext code so that new kernels no longer get the wext
handlers through struct netdevice, instead they get
it through the struct wiphy which is cfg80211 specific.

For old kernels this means you get not wext handlers
anymore when backporting code, this adds the wext handler
back to the netdevice wireless_handlers to let compat
users use wext again.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
compat/patches/10-add-wext-handlers-to-netdev.patch [new file with mode: 0644]

diff --git a/compat/patches/10-add-wext-handlers-to-netdev.patch b/compat/patches/10-add-wext-handlers-to-netdev.patch
new file mode 100644 (file)
index 0000000..9172c20
--- /dev/null
@@ -0,0 +1,26 @@
+The patch "wext: refactor" by Johannes Berg refactored
+wext code so that new kernels no longer get the wext
+handlers through struct netdevice, instead they get
+it through the struct wiphy which is cfg80211 specific.
+
+For old kernels this means you get not wext handlers
+anymore when backporting code, this adds the wext handler
+back to the netdevice wireless_handlers to let compat
+users use wext again.
+
+We only do this for kernels <= 2.6.32 as 2.6.33 will use
+the struct wiphy wireless handler.
+
+--- a/net/wireless/core.c      2009-10-06 13:23:34.000000000 -0400
++++ b/net/wireless/core.c      2009-10-06 13:25:31.000000000 -0400
+@@ -671,6 +671,10 @@
+               wdev->sme_state = CFG80211_SME_IDLE;
+               mutex_unlock(&rdev->devlist_mtx);
+ #ifdef CONFIG_CFG80211_WEXT
++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32))
++              if (!dev->wireless_handlers)
++                      dev->wireless_handlers = &cfg80211_wext_handler;
++#endif
+               wdev->wext.default_key = -1;
+               wdev->wext.default_mgmt_key = -1;
+               wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;