xref: /dflybsd-src/sys/netproto/802_11/wlan_xauth/ieee80211_xauth.c (revision bff82488b6f45c2f067e4c552e649b1d3e07cd7c)
132176cfdSRui Paulo /*-
2841ab66cSSepherosa Ziehau  * Copyright (c) 2004 Video54 Technologies, Inc.
332176cfdSRui Paulo  * Copyright (c) 2004-2008 Sam Leffler, Errno Consulting
4841ab66cSSepherosa Ziehau  * All rights reserved.
5841ab66cSSepherosa Ziehau  *
6841ab66cSSepherosa Ziehau  * Redistribution and use in source and binary forms, with or without
7841ab66cSSepherosa Ziehau  * modification, are permitted provided that the following conditions
8841ab66cSSepherosa Ziehau  * are met:
9841ab66cSSepherosa Ziehau  * 1. Redistributions of source code must retain the above copyright
10841ab66cSSepherosa Ziehau  *    notice, this list of conditions and the following disclaimer.
11841ab66cSSepherosa Ziehau  * 2. Redistributions in binary form must reproduce the above copyright
12841ab66cSSepherosa Ziehau  *    notice, this list of conditions and the following disclaimer in the
13841ab66cSSepherosa Ziehau  *    documentation and/or other materials provided with the distribution.
14841ab66cSSepherosa Ziehau  *
15841ab66cSSepherosa Ziehau  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16841ab66cSSepherosa Ziehau  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17841ab66cSSepherosa Ziehau  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18841ab66cSSepherosa Ziehau  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19841ab66cSSepherosa Ziehau  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20841ab66cSSepherosa Ziehau  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21841ab66cSSepherosa Ziehau  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22841ab66cSSepherosa Ziehau  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23841ab66cSSepherosa Ziehau  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24841ab66cSSepherosa Ziehau  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25841ab66cSSepherosa Ziehau  */
26841ab66cSSepherosa Ziehau 
27085ff963SMatthew Dillon #include <sys/cdefs.h>
28085ff963SMatthew Dillon __FBSDID("$FreeBSD$");
29085ff963SMatthew Dillon 
30841ab66cSSepherosa Ziehau /*
31841ab66cSSepherosa Ziehau  * External authenticator placeholder module.
32841ab66cSSepherosa Ziehau  *
33841ab66cSSepherosa Ziehau  * This support is optional; it is only used when the 802.11 layer's
34841ab66cSSepherosa Ziehau  * authentication mode is set to use 802.1x or WPA is enabled separately
35841ab66cSSepherosa Ziehau  * (for WPA-PSK).  If compiled as a module this code does not need
36841ab66cSSepherosa Ziehau  * to be present unless 802.1x/WPA is in use.
37841ab66cSSepherosa Ziehau  *
38841ab66cSSepherosa Ziehau  * The authenticator hooks into the 802.11 layer.  At present we use none
39841ab66cSSepherosa Ziehau  * of the available callbacks--the user mode authenticator process works
40841ab66cSSepherosa Ziehau  * entirely from messages about stations joining and leaving.
41841ab66cSSepherosa Ziehau  */
4232176cfdSRui Paulo #include "opt_wlan.h"
4332176cfdSRui Paulo 
44841ab66cSSepherosa Ziehau #include <sys/param.h>
45841ab66cSSepherosa Ziehau #include <sys/kernel.h>
46841ab66cSSepherosa Ziehau #include <sys/systm.h>
474f655ef5SMatthew Dillon #include <sys/malloc.h>
48841ab66cSSepherosa Ziehau #include <sys/mbuf.h>
49841ab66cSSepherosa Ziehau #include <sys/module.h>
50841ab66cSSepherosa Ziehau 
51841ab66cSSepherosa Ziehau #include <sys/socket.h>
52841ab66cSSepherosa Ziehau 
53841ab66cSSepherosa Ziehau #include <net/if.h>
54841ab66cSSepherosa Ziehau #include <net/if_media.h>
55*bff82488SAaron LI #include <net/ifq_var.h>
56841ab66cSSepherosa Ziehau #include <net/ethernet.h>
57841ab66cSSepherosa Ziehau #include <net/route.h>
58841ab66cSSepherosa Ziehau 
59841ab66cSSepherosa Ziehau #include <netproto/802_11/ieee80211_var.h>
60841ab66cSSepherosa Ziehau 
6132176cfdSRui Paulo /* XXX number of references from net80211 layer; needed for module code */
6232176cfdSRui Paulo static	int nrefs = 0;
6332176cfdSRui Paulo 
64841ab66cSSepherosa Ziehau /*
65841ab66cSSepherosa Ziehau  * One module handles everything for now.  May want
66841ab66cSSepherosa Ziehau  * to split things up for embedded applications.
67841ab66cSSepherosa Ziehau  */
68841ab66cSSepherosa Ziehau static const struct ieee80211_authenticator xauth = {
69841ab66cSSepherosa Ziehau 	.ia_name	= "external",
70841ab66cSSepherosa Ziehau 	.ia_attach	= NULL,
71841ab66cSSepherosa Ziehau 	.ia_detach	= NULL,
72841ab66cSSepherosa Ziehau 	.ia_node_join	= NULL,
73841ab66cSSepherosa Ziehau 	.ia_node_leave	= NULL,
74841ab66cSSepherosa Ziehau };
75841ab66cSSepherosa Ziehau 
7632176cfdSRui Paulo IEEE80211_AUTH_MODULE(xauth, 1);
7732176cfdSRui Paulo IEEE80211_AUTH_ALG(x8021x, IEEE80211_AUTH_8021X, xauth);
7832176cfdSRui Paulo IEEE80211_AUTH_ALG(wpa, IEEE80211_AUTH_WPA, xauth);
79