ieee80211_xauth.c revision 138568
10Sstevel@tonic-gate/*- 211038SRao.Shoaib@Sun.COM * Copyright (c) 2004 Video54 Technologies, Inc. 30Sstevel@tonic-gate * All rights reserved. 40Sstevel@tonic-gate * 50Sstevel@tonic-gate * Redistribution and use in source and binary forms, with or without 60Sstevel@tonic-gate * modification, are permitted provided that the following conditions 70Sstevel@tonic-gate * are met: 80Sstevel@tonic-gate * 1. Redistributions of source code must retain the above copyright 911038SRao.Shoaib@Sun.COM * notice, this list of conditions and the following disclaimer. 1011038SRao.Shoaib@Sun.COM * 2. Redistributions in binary form must reproduce the above copyright 1111038SRao.Shoaib@Sun.COM * notice, this list of conditions and the following disclaimer in the 1211038SRao.Shoaib@Sun.COM * documentation and/or other materials provided with the distribution. 1311038SRao.Shoaib@Sun.COM * 3. The name of the author may not be used to endorse or promote products 1411038SRao.Shoaib@Sun.COM * derived from this software without specific prior written permission. 1511038SRao.Shoaib@Sun.COM * 160Sstevel@tonic-gate * Alternatively, this software may be distributed under the terms of the 170Sstevel@tonic-gate * GNU General Public License ("GPL") version 2 as published by the Free 180Sstevel@tonic-gate * Software Foundation. 1911038SRao.Shoaib@Sun.COM * 200Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 210Sstevel@tonic-gate * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 220Sstevel@tonic-gate * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 230Sstevel@tonic-gate * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 240Sstevel@tonic-gate * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 250Sstevel@tonic-gate * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 260Sstevel@tonic-gate * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 270Sstevel@tonic-gate * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 280Sstevel@tonic-gate * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 290Sstevel@tonic-gate * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 300Sstevel@tonic-gate */ 310Sstevel@tonic-gate 320Sstevel@tonic-gate#include <sys/cdefs.h> 330Sstevel@tonic-gate__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_xauth.c 138568 2004-12-08 17:26:47Z sam $"); 340Sstevel@tonic-gate 350Sstevel@tonic-gate/* 360Sstevel@tonic-gate * External authenticator placeholder module. 370Sstevel@tonic-gate * 380Sstevel@tonic-gate * This support is optional; it is only used when the 802.11 layer's 390Sstevel@tonic-gate * authentication mode is set to use 802.1x or WPA is enabled separately 400Sstevel@tonic-gate * (for WPA-PSK). If compiled as a module this code does not need 410Sstevel@tonic-gate * to be present unless 802.1x/WPA is in use. 420Sstevel@tonic-gate * 430Sstevel@tonic-gate * The authenticator hooks into the 802.11 layer. At present we use none 440Sstevel@tonic-gate * of the available callbacks--the user mode authenticator process works 450Sstevel@tonic-gate * entirely from messages about stations joining and leaving. 460Sstevel@tonic-gate */ 470Sstevel@tonic-gate#include <sys/param.h> 480Sstevel@tonic-gate#include <sys/kernel.h> 490Sstevel@tonic-gate#include <sys/systm.h> 500Sstevel@tonic-gate#include <sys/mbuf.h> 510Sstevel@tonic-gate#include <sys/module.h> 520Sstevel@tonic-gate 530Sstevel@tonic-gate#include <sys/socket.h> 540Sstevel@tonic-gate 550Sstevel@tonic-gate#include <net/if.h> 560Sstevel@tonic-gate#include <net/if_media.h> 570Sstevel@tonic-gate#include <net/ethernet.h> 580Sstevel@tonic-gate#include <net/route.h> 590Sstevel@tonic-gate 600Sstevel@tonic-gate#include <net80211/ieee80211_var.h> 610Sstevel@tonic-gate 620Sstevel@tonic-gate/* 630Sstevel@tonic-gate * One module handles everything for now. May want 640Sstevel@tonic-gate * to split things up for embedded applications. 650Sstevel@tonic-gate */ 660Sstevel@tonic-gatestatic const struct ieee80211_authenticator xauth = { 670Sstevel@tonic-gate .ia_name = "external", 680Sstevel@tonic-gate .ia_attach = NULL, 690Sstevel@tonic-gate .ia_detach = NULL, 700Sstevel@tonic-gate .ia_node_join = NULL, 710Sstevel@tonic-gate .ia_node_leave = NULL, 720Sstevel@tonic-gate}; 730Sstevel@tonic-gate 740Sstevel@tonic-gate/* 750Sstevel@tonic-gate * Module glue. 760Sstevel@tonic-gate */ 770Sstevel@tonic-gatestatic int 780Sstevel@tonic-gatewlan_xauth_modevent(module_t mod, int type, void *unused) 790Sstevel@tonic-gate{ 800Sstevel@tonic-gate switch (type) { 810Sstevel@tonic-gate case MOD_LOAD: 820Sstevel@tonic-gate ieee80211_authenticator_register(IEEE80211_AUTH_8021X, &xauth); 830Sstevel@tonic-gate ieee80211_authenticator_register(IEEE80211_AUTH_WPA, &xauth); 840Sstevel@tonic-gate return 0; 850Sstevel@tonic-gate case MOD_UNLOAD: 860Sstevel@tonic-gate ieee80211_authenticator_unregister(IEEE80211_AUTH_8021X); 870Sstevel@tonic-gate ieee80211_authenticator_unregister(IEEE80211_AUTH_WPA); 880Sstevel@tonic-gate return 0; 890Sstevel@tonic-gate } 900Sstevel@tonic-gate return EINVAL; 910Sstevel@tonic-gate} 920Sstevel@tonic-gate 930Sstevel@tonic-gatestatic moduledata_t wlan_xauth_mod = { 940Sstevel@tonic-gate "wlan_xauth", 950Sstevel@tonic-gate wlan_xauth_modevent, 960Sstevel@tonic-gate 0 970Sstevel@tonic-gate}; 980Sstevel@tonic-gateDECLARE_MODULE(wlan_xauth, wlan_xauth_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); 990Sstevel@tonic-gateMODULE_VERSION(wlan_xauth, 1); 1000Sstevel@tonic-gateMODULE_DEPEND(wlan_xauth, wlan, 1, 1, 1); 1010Sstevel@tonic-gate