ieee80211_xauth.c revision 1.5.158.4 1 /* $NetBSD: ieee80211_xauth.c,v 1.5.158.4 2019/06/10 22:09:46 christos 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 __NetBSD__
33 __KERNEL_RCSID(0, "$NetBSD: ieee80211_xauth.c,v 1.5.158.4 2019/06/10 22:09:46 christos Exp $");
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 #ifdef _KERNEL_OPT
49 #include "opt_wlan.h"
50 #endif
51
52 #include <sys/param.h>
53 #include <sys/kernel.h>
54 #include <sys/systm.h>
55 #include <sys/malloc.h>
56 #include <sys/mbuf.h>
57 #include <sys/module.h>
58
59 #include <sys/socket.h>
60
61 #include <net/if.h>
62 #include <net/if_media.h>
63 #ifdef __FreeBSD__
64 #include <net/ethernet.h>
65 #endif
66 #include <net/route.h>
67
68 #include <net80211/ieee80211_var.h>
69
70 /* XXX number of references from net80211 layer; needed for module code */
71 static int nrefs __unused = 0;
72
73 /*
74 * One module handles everything for now. May want
75 * to split things up for embedded applications.
76 */
77 #if __FreeBSD__
78 static const struct ieee80211_authenticator xauth = {
79 #elif __NetBSD__
80 const struct ieee80211_authenticator auth_xauth = {
81 #endif
82 .ia_name = "external",
83 .ia_attach = NULL,
84 .ia_detach = NULL,
85 .ia_node_join = NULL,
86 .ia_node_leave = NULL,
87 };
88
89 #if __FreeBSD__
90 IEEE80211_AUTH_MODULE(xauth, 1);
91 IEEE80211_AUTH_ALG(x8021x, IEEE80211_AUTH_8021X, xauth);
92 IEEE80211_AUTH_ALG(wpa, IEEE80211_AUTH_WPA, xauth);
93 #endif
94