From 9dd26e81ab2d5afb4d831f6101e869fa40133c06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 10 Nov 2010 21:28:07 +0000 Subject: [PATCH] * Added xauth authentication module needed for WPA. * Forwarded a few more ioctls to the driver. * Enabled debugging mode for now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39387 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/libs/compat/freebsd_wlan/net80211/Jamfile | 6 +-- .../freebsd_wlan/net80211/ieee80211_haiku.cpp | 47 ++++++++++++++----- .../freebsd_wlan/net80211/ieee80211_haiku.h | 17 +++++++ 3 files changed, 55 insertions(+), 15 deletions(-) diff --git a/src/libs/compat/freebsd_wlan/net80211/Jamfile b/src/libs/compat/freebsd_wlan/net80211/Jamfile index 50f0aeae8c..e9a6faef6c 100644 --- a/src/libs/compat/freebsd_wlan/net80211/Jamfile +++ b/src/libs/compat/freebsd_wlan/net80211/Jamfile @@ -11,9 +11,9 @@ UsePrivateKernelHeaders ; Includes [ FGristFiles kernel_c++_structs.h ] : kernel_c++_struct_sizes.h ; -SubDirCcFlags [ FDefines _KERNEL=1 FBSD_DRIVER=1 ] +SubDirCcFlags [ FDefines _KERNEL=1 FBSD_DRIVER=1 IEEE80211_DEBUG=1 ] -Wno-format -Wno-unused -Wno-uninitialized ; -SubDirC++Flags [ FDefines _KERNEL=1 FBSD_DRIVER=1 ] +SubDirC++Flags [ FDefines _KERNEL=1 FBSD_DRIVER=1 IEEE80211_DEBUG=1 ] -Wno-format -Wno-unused -Wno-uninitialized ; SEARCH_SOURCE += [ FDirName $(SUBDIR) .. crypto rijndael ] ; @@ -59,5 +59,5 @@ KernelStaticLibrary libfreebsd_wlan.a : # NOT SUPPORTED YET ieee80211_rssadapt.c # NOT SUPPORTED YET ieee80211_superg.c # NOT SUPPORTED YET ieee80211_tdma.c - # NOT SUPPORTED YET ieee80211_xauth.c + ieee80211_xauth.c ; diff --git a/src/libs/compat/freebsd_wlan/net80211/ieee80211_haiku.cpp b/src/libs/compat/freebsd_wlan/net80211/ieee80211_haiku.cpp index abd6bde364..342049d98f 100644 --- a/src/libs/compat/freebsd_wlan/net80211/ieee80211_haiku.cpp +++ b/src/libs/compat/freebsd_wlan/net80211/ieee80211_haiku.cpp @@ -38,17 +38,17 @@ #include "ieee80211_haiku.h" extern "C" { -#include -#include -#include -#include +# include +# include +# include +# include -#include -#include -#include -#include +# include +# include +# include +# include -#include "ieee80211_var.h" +# include "ieee80211_var.h" }; #include @@ -62,6 +62,14 @@ extern "C" { #include +#define TRACE_WLAN +#ifdef TRACE_WLAN +# define TRACE(x, ...) dprintf(x, __VA_ARGS__); +#else +# define TRACE(x, ...) ; +#endif + + #define MC_ALIGN(m, len) \ do { \ (m)->m_data += (MCLBYTES - (len)) &~ (sizeof(long) - 1);\ @@ -336,6 +344,7 @@ wlan_control(void* cookie, uint32 op, void* arg, size_t length) if (user_memcpy(&request, arg, sizeof(struct ieee80211req)) != B_OK) return B_BAD_ADDRESS; + TRACE("wlan_control: %ld, %d\n", op, request.i_type); status_t status = ifp->if_ioctl(ifp, op, (caddr_t)&request); if (status != B_OK) return status; @@ -345,6 +354,13 @@ wlan_control(void* cookie, uint32 op, void* arg, size_t length) return B_BAD_ADDRESS; return B_OK; } + + case SIOCSIFFLAGS: + case SIOCSIFMEDIA: + case SIOCGIFMEDIA: + case SIOCSIFMTU: + // Requests that make it here always come from the kernel + return ifp->if_ioctl(ifp, op, (caddr_t)arg); } return B_BAD_VALUE; @@ -530,8 +546,7 @@ ieee80211_sysctl_vattach(struct ieee80211vap* vap) | IEEE80211_MSG_DOTH | IEEE80211_MSG_INACT | IEEE80211_MSG_ROAM - | IEEE80211_MSG_RATECTL - ; + | IEEE80211_MSG_RATECTL; } @@ -555,7 +570,7 @@ ieee80211_vap_destroy(struct ieee80211vap* vap) void ieee80211_load_module(const char* modname) { - dprintf("%s not implemented, yet.\n", __func__); + dprintf("%s not implemented, yet: modname %s\n", __func__, modname); } @@ -568,6 +583,8 @@ ieee80211_notify_node_join(struct ieee80211_node* ni, int newassoc) if (ni == vap->iv_bss) if_link_state_change(ifp, LINK_STATE_UP); + TRACE("%s\n", __FUNCTION__); + if (sNotificationModule != NULL) { char messageBuffer[512]; KMessage message; @@ -590,6 +607,8 @@ ieee80211_notify_node_leave(struct ieee80211_node* ni) if (ni == vap->iv_bss) if_link_state_change(ifp, LINK_STATE_DOWN); + TRACE("%s\n", __FUNCTION__); + if (sNotificationModule != NULL) { char messageBuffer[512]; KMessage message; @@ -609,6 +628,8 @@ ieee80211_notify_scan_done(struct ieee80211vap* vap) release_sem_etc(vap->iv_ifp->scan_done_sem, 1, B_DO_NOT_RESCHEDULE | B_RELEASE_ALL); + TRACE("%s\n", __FUNCTION__); + if (sNotificationModule != NULL) { char messageBuffer[512]; KMessage message; @@ -701,10 +722,12 @@ ieee80211_notify_radio(struct ieee80211com* ic, int state) void ieee80211_sysctl_attach(struct ieee80211com* ic) { + dprintf("%s not implemented, yet.\n", __func__); } void ieee80211_sysctl_detach(struct ieee80211com* ic) { + dprintf("%s not implemented, yet.\n", __func__); } diff --git a/src/libs/compat/freebsd_wlan/net80211/ieee80211_haiku.h b/src/libs/compat/freebsd_wlan/net80211/ieee80211_haiku.h index 8cd15eed4c..32d4fb9245 100644 --- a/src/libs/compat/freebsd_wlan/net80211/ieee80211_haiku.h +++ b/src/libs/compat/freebsd_wlan/net80211/ieee80211_haiku.h @@ -283,6 +283,23 @@ void ieee80211_load_module(const char *); typedef void (*policy##_setup)(int); \ SET_DECLARE(policy##_set, policy##_setup); +/* + * Authenticator modules handle 802.1x/WPA authentication. + */ +#define IEEE80211_AUTH_MODULE(name, version) \ + _IEEE80211_POLICY_MODULE(auth, name, version) + +#define IEEE80211_AUTH_ALG(name, alg, v) \ +static void \ +name##_modevent(int type) \ +{ \ + if (type == MOD_LOAD) \ + ieee80211_authenticator_register(alg, &v); \ + else \ + ieee80211_authenticator_unregister(alg); \ +} \ +TEXT_SET(auth_set, name##_modevent) + /* * Scanner modules provide scanning policy. */