xref: /freebsd/sys/net80211/ieee80211_xauth.c (revision 685dc743dc3b5645e34836464128e1c0558b404b)
18a1b9b6aSSam Leffler /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3fe267a55SPedro F. Giffuni  *
48a1b9b6aSSam Leffler  * Copyright (c) 2004 Video54 Technologies, Inc.
5b032f27cSSam Leffler  * Copyright (c) 2004-2008 Sam Leffler, Errno Consulting
68a1b9b6aSSam Leffler  * All rights reserved.
78a1b9b6aSSam Leffler  *
88a1b9b6aSSam Leffler  * Redistribution and use in source and binary forms, with or without
98a1b9b6aSSam Leffler  * modification, are permitted provided that the following conditions
108a1b9b6aSSam Leffler  * are met:
118a1b9b6aSSam Leffler  * 1. Redistributions of source code must retain the above copyright
128a1b9b6aSSam Leffler  *    notice, this list of conditions and the following disclaimer.
138a1b9b6aSSam Leffler  * 2. Redistributions in binary form must reproduce the above copyright
148a1b9b6aSSam Leffler  *    notice, this list of conditions and the following disclaimer in the
158a1b9b6aSSam Leffler  *    documentation and/or other materials provided with the distribution.
168a1b9b6aSSam Leffler  *
178a1b9b6aSSam Leffler  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
188a1b9b6aSSam Leffler  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
198a1b9b6aSSam Leffler  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
208a1b9b6aSSam Leffler  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
218a1b9b6aSSam Leffler  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
228a1b9b6aSSam Leffler  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
238a1b9b6aSSam Leffler  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
248a1b9b6aSSam Leffler  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
258a1b9b6aSSam Leffler  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
268a1b9b6aSSam Leffler  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
278a1b9b6aSSam Leffler  */
288a1b9b6aSSam Leffler 
298a1b9b6aSSam Leffler #include <sys/cdefs.h>
308a1b9b6aSSam Leffler /*
318a1b9b6aSSam Leffler  * External authenticator placeholder module.
328a1b9b6aSSam Leffler  *
338a1b9b6aSSam Leffler  * This support is optional; it is only used when the 802.11 layer's
348a1b9b6aSSam Leffler  * authentication mode is set to use 802.1x or WPA is enabled separately
358a1b9b6aSSam Leffler  * (for WPA-PSK).  If compiled as a module this code does not need
368a1b9b6aSSam Leffler  * to be present unless 802.1x/WPA is in use.
378a1b9b6aSSam Leffler  *
388a1b9b6aSSam Leffler  * The authenticator hooks into the 802.11 layer.  At present we use none
398a1b9b6aSSam Leffler  * of the available callbacks--the user mode authenticator process works
408a1b9b6aSSam Leffler  * entirely from messages about stations joining and leaving.
418a1b9b6aSSam Leffler  */
42b032f27cSSam Leffler #include "opt_wlan.h"
43b032f27cSSam Leffler 
448a1b9b6aSSam Leffler #include <sys/param.h>
458a1b9b6aSSam Leffler #include <sys/kernel.h>
468a1b9b6aSSam Leffler #include <sys/systm.h>
478ec07310SGleb Smirnoff #include <sys/malloc.h>
488a1b9b6aSSam Leffler #include <sys/mbuf.h>
498a1b9b6aSSam Leffler #include <sys/module.h>
508a1b9b6aSSam Leffler 
518a1b9b6aSSam Leffler #include <sys/socket.h>
528a1b9b6aSSam Leffler 
538a1b9b6aSSam Leffler #include <net/if.h>
548a1b9b6aSSam Leffler #include <net/if_media.h>
558a1b9b6aSSam Leffler #include <net/ethernet.h>
568a1b9b6aSSam Leffler #include <net/route.h>
578a1b9b6aSSam Leffler 
588a1b9b6aSSam Leffler #include <net80211/ieee80211_var.h>
598a1b9b6aSSam Leffler 
60b032f27cSSam Leffler /* XXX number of references from net80211 layer; needed for module code */
61b032f27cSSam Leffler static	int nrefs = 0;
62b032f27cSSam Leffler 
638a1b9b6aSSam Leffler /*
648a1b9b6aSSam Leffler  * One module handles everything for now.  May want
658a1b9b6aSSam Leffler  * to split things up for embedded applications.
668a1b9b6aSSam Leffler  */
678a1b9b6aSSam Leffler static const struct ieee80211_authenticator xauth = {
688a1b9b6aSSam Leffler 	.ia_name	= "external",
698a1b9b6aSSam Leffler 	.ia_attach	= NULL,
708a1b9b6aSSam Leffler 	.ia_detach	= NULL,
718a1b9b6aSSam Leffler 	.ia_node_join	= NULL,
728a1b9b6aSSam Leffler 	.ia_node_leave	= NULL,
738a1b9b6aSSam Leffler };
748a1b9b6aSSam Leffler 
75b032f27cSSam Leffler IEEE80211_AUTH_MODULE(xauth, 1);
76b032f27cSSam Leffler IEEE80211_AUTH_ALG(x8021x, IEEE80211_AUTH_8021X, xauth);
77b032f27cSSam Leffler IEEE80211_AUTH_ALG(wpa, IEEE80211_AUTH_WPA, xauth);
78