ieee80211_xauth.c revision 138568
1138568Ssam/*- 2138568Ssam * Copyright (c) 2004 Video54 Technologies, Inc. 3138568Ssam * All rights reserved. 4138568Ssam * 5138568Ssam * Redistribution and use in source and binary forms, with or without 6138568Ssam * modification, are permitted provided that the following conditions 7138568Ssam * are met: 8138568Ssam * 1. Redistributions of source code must retain the above copyright 9138568Ssam * notice, this list of conditions and the following disclaimer. 10138568Ssam * 2. Redistributions in binary form must reproduce the above copyright 11138568Ssam * notice, this list of conditions and the following disclaimer in the 12138568Ssam * documentation and/or other materials provided with the distribution. 13138568Ssam * 3. The name of the author may not be used to endorse or promote products 14138568Ssam * derived from this software without specific prior written permission. 15138568Ssam * 16138568Ssam * Alternatively, this software may be distributed under the terms of the 17138568Ssam * GNU General Public License ("GPL") version 2 as published by the Free 18138568Ssam * Software Foundation. 19138568Ssam * 20138568Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21138568Ssam * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22138568Ssam * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23138568Ssam * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24138568Ssam * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25138568Ssam * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26138568Ssam * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27138568Ssam * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28138568Ssam * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29138568Ssam * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30138568Ssam */ 31138568Ssam 32138568Ssam#include <sys/cdefs.h> 33138568Ssam__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_xauth.c 138568 2004-12-08 17:26:47Z sam $"); 34138568Ssam 35138568Ssam/* 36138568Ssam * External authenticator placeholder module. 37138568Ssam * 38138568Ssam * This support is optional; it is only used when the 802.11 layer's 39138568Ssam * authentication mode is set to use 802.1x or WPA is enabled separately 40138568Ssam * (for WPA-PSK). If compiled as a module this code does not need 41138568Ssam * to be present unless 802.1x/WPA is in use. 42138568Ssam * 43138568Ssam * The authenticator hooks into the 802.11 layer. At present we use none 44138568Ssam * of the available callbacks--the user mode authenticator process works 45138568Ssam * entirely from messages about stations joining and leaving. 46138568Ssam */ 47138568Ssam#include <sys/param.h> 48138568Ssam#include <sys/kernel.h> 49138568Ssam#include <sys/systm.h> 50138568Ssam#include <sys/mbuf.h> 51138568Ssam#include <sys/module.h> 52138568Ssam 53138568Ssam#include <sys/socket.h> 54138568Ssam 55138568Ssam#include <net/if.h> 56138568Ssam#include <net/if_media.h> 57138568Ssam#include <net/ethernet.h> 58138568Ssam#include <net/route.h> 59138568Ssam 60138568Ssam#include <net80211/ieee80211_var.h> 61138568Ssam 62138568Ssam/* 63138568Ssam * One module handles everything for now. May want 64138568Ssam * to split things up for embedded applications. 65138568Ssam */ 66138568Ssamstatic const struct ieee80211_authenticator xauth = { 67138568Ssam .ia_name = "external", 68138568Ssam .ia_attach = NULL, 69138568Ssam .ia_detach = NULL, 70138568Ssam .ia_node_join = NULL, 71138568Ssam .ia_node_leave = NULL, 72138568Ssam}; 73138568Ssam 74138568Ssam/* 75138568Ssam * Module glue. 76138568Ssam */ 77138568Ssamstatic int 78138568Ssamwlan_xauth_modevent(module_t mod, int type, void *unused) 79138568Ssam{ 80138568Ssam switch (type) { 81138568Ssam case MOD_LOAD: 82138568Ssam ieee80211_authenticator_register(IEEE80211_AUTH_8021X, &xauth); 83138568Ssam ieee80211_authenticator_register(IEEE80211_AUTH_WPA, &xauth); 84138568Ssam return 0; 85138568Ssam case MOD_UNLOAD: 86138568Ssam ieee80211_authenticator_unregister(IEEE80211_AUTH_8021X); 87138568Ssam ieee80211_authenticator_unregister(IEEE80211_AUTH_WPA); 88138568Ssam return 0; 89138568Ssam } 90138568Ssam return EINVAL; 91138568Ssam} 92138568Ssam 93138568Ssamstatic moduledata_t wlan_xauth_mod = { 94138568Ssam "wlan_xauth", 95138568Ssam wlan_xauth_modevent, 96138568Ssam 0 97138568Ssam}; 98138568SsamDECLARE_MODULE(wlan_xauth, wlan_xauth_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); 99138568SsamMODULE_VERSION(wlan_xauth, 1); 100138568SsamMODULE_DEPEND(wlan_xauth, wlan, 1, 1, 1); 101