ieee80211_xauth.c revision 1.5.158.3 1 /* $NetBSD: ieee80211_xauth.c,v 1.5.158.3 2018/07/16 20:11:12 phil Exp $ */
2
3 /*-
4 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
5 *
6 * Copyright (c) 2004 Video54 Technologies, Inc.
7 * Copyright (c) 2004-2008 Sam Leffler, Errno Consulting
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #include <sys/cdefs.h>
32 #ifdef __FreeBSD__
33 __FBSDID("$FreeBSD$");
34 #endif
35
36 /*
37 * External authenticator placeholder module.
38 *
39 * This support is optional; it is only used when the 802.11 layer's
40 * authentication mode is set to use 802.1x or WPA is enabled separately
41 * (for WPA-PSK). If compiled as a module this code does not need
42 * to be present unless 802.1x/WPA is in use.
43 *
44 * The authenticator hooks into the 802.11 layer. At present we use none
45 * of the available callbacks--the user mode authenticator process works
46 * entirely from messages about stations joining and leaving.
47 */
48 #include "opt_wlan.h"
49
50 #include <sys/param.h>
51 #include <sys/kernel.h>
52 #include <sys/systm.h>
53 #include <sys/malloc.h>
54 #include <sys/mbuf.h>
55 #include <sys/module.h>
56
57 #include <sys/socket.h>
58
59 #include <net/if.h>
60 #include <net/if_media.h>
61 #ifdef __FreeBSD__
62 #include <net/ethernet.h>
63 #endif
64 #include <net/route.h>
65
66 #include <net80211/ieee80211_var.h>
67
68 /* XXX number of references from net80211 layer; needed for module code */
69 static int nrefs __unused = 0;
70
71 /*
72 * One module handles everything for now. May want
73 * to split things up for embedded applications.
74 */
75 #if __FreeBSD__
76 static const struct ieee80211_authenticator xauth = {
77 #elif __NetBSD__
78 const struct ieee80211_authenticator auth_xauth = {
79 #endif
80 .ia_name = "external",
81 .ia_attach = NULL,
82 .ia_detach = NULL,
83 .ia_node_join = NULL,
84 .ia_node_leave = NULL,
85 };
86
87 #if __FreeBSD__
88 IEEE80211_AUTH_MODULE(xauth, 1);
89 IEEE80211_AUTH_ALG(x8021x, IEEE80211_AUTH_8021X, xauth);
90 IEEE80211_AUTH_ALG(wpa, IEEE80211_AUTH_WPA, xauth);
91 #endif
92