ieee80211_20.c revision 1.1.2.1 1 1.1.2.1 pgoyette /* $NetBSD: ieee80211_20.c,v 1.1.2.1 2018/03/30 02:28:49 pgoyette Exp $ */
2 1.1.2.1 pgoyette /*-
3 1.1.2.1 pgoyette * Copyright (c) 2001 Atsushi Onoe
4 1.1.2.1 pgoyette * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
5 1.1.2.1 pgoyette * All rights reserved.
6 1.1.2.1 pgoyette *
7 1.1.2.1 pgoyette * Redistribution and use in source and binary forms, with or without
8 1.1.2.1 pgoyette * modification, are permitted provided that the following conditions
9 1.1.2.1 pgoyette * are met:
10 1.1.2.1 pgoyette * 1. Redistributions of source code must retain the above copyright
11 1.1.2.1 pgoyette * notice, this list of conditions and the following disclaimer.
12 1.1.2.1 pgoyette * 2. Redistributions in binary form must reproduce the above copyright
13 1.1.2.1 pgoyette * notice, this list of conditions and the following disclaimer in the
14 1.1.2.1 pgoyette * documentation and/or other materials provided with the distribution.
15 1.1.2.1 pgoyette * 3. The name of the author may not be used to endorse or promote products
16 1.1.2.1 pgoyette * derived from this software without specific prior written permission.
17 1.1.2.1 pgoyette *
18 1.1.2.1 pgoyette * Alternatively, this software may be distributed under the terms of the
19 1.1.2.1 pgoyette * GNU General Public License ("GPL") version 2 as published by the Free
20 1.1.2.1 pgoyette * Software Foundation.
21 1.1.2.1 pgoyette *
22 1.1.2.1 pgoyette * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 1.1.2.1 pgoyette * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 1.1.2.1 pgoyette * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 1.1.2.1 pgoyette * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 1.1.2.1 pgoyette * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 1.1.2.1 pgoyette * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 1.1.2.1 pgoyette * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 1.1.2.1 pgoyette * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 1.1.2.1 pgoyette * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 1.1.2.1 pgoyette * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 1.1.2.1 pgoyette */
33 1.1.2.1 pgoyette
34 1.1.2.1 pgoyette #include <sys/cdefs.h>
35 1.1.2.1 pgoyette #ifdef __FreeBSD__
36 1.1.2.1 pgoyette __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.35 2005/08/30 14:27:47 avatar Exp $");
37 1.1.2.1 pgoyette #endif
38 1.1.2.1 pgoyette #ifdef __NetBSD__
39 1.1.2.1 pgoyette __KERNEL_RCSID(0, "$NetBSD: ieee80211_20.c,v 1.1.2.1 2018/03/30 02:28:49 pgoyette Exp $");
40 1.1.2.1 pgoyette #endif
41 1.1.2.1 pgoyette
42 1.1.2.1 pgoyette /*
43 1.1.2.1 pgoyette * IEEE 802.11 ioctl support
44 1.1.2.1 pgoyette */
45 1.1.2.1 pgoyette
46 1.1.2.1 pgoyette #ifdef _KERNEL_OPT
47 1.1.2.1 pgoyette #include "opt_inet.h"
48 1.1.2.1 pgoyette #include "opt_compat_netbsd.h"
49 1.1.2.1 pgoyette #endif
50 1.1.2.1 pgoyette
51 1.1.2.1 pgoyette #include <sys/endian.h>
52 1.1.2.1 pgoyette #include <sys/param.h>
53 1.1.2.1 pgoyette #include <sys/kernel.h>
54 1.1.2.1 pgoyette #include <sys/socket.h>
55 1.1.2.1 pgoyette #include <sys/sockio.h>
56 1.1.2.1 pgoyette #include <sys/systm.h>
57 1.1.2.1 pgoyette #include <sys/proc.h>
58 1.1.2.1 pgoyette #include <sys/kauth.h>
59 1.1.2.1 pgoyette #include <sys/compat_stub.h>
60 1.1.2.1 pgoyette
61 1.1.2.1 pgoyette #include <net/if.h>
62 1.1.2.1 pgoyette #include <net/if_arp.h>
63 1.1.2.1 pgoyette #include <net/if_media.h>
64 1.1.2.1 pgoyette #include <net/if_ether.h>
65 1.1.2.1 pgoyette
66 1.1.2.1 pgoyette #include <net80211/ieee80211_var.h>
67 1.1.2.1 pgoyette #include <net80211/ieee80211_ioctl.h>
68 1.1.2.1 pgoyette
69 1.1.2.1 pgoyette #include <dev/ic/wi_ieee.h>
70 1.1.2.1 pgoyette
71 1.1.2.1 pgoyette #include <compat/common/compat_mod.h>
72 1.1.2.1 pgoyette
73 1.1.2.1 pgoyette #include <compat/sys/sockio.h>
74 1.1.2.1 pgoyette
75 1.1.2.1 pgoyette static int
76 1.1.2.1 pgoyette ieee80211_get_ostats(struct ieee80211_ostats *ostats,
77 1.1.2.1 pgoyette struct ieee80211_stats *stats)
78 1.1.2.1 pgoyette {
79 1.1.2.1 pgoyette #define COPYSTATS1(__ostats, __nstats, __dstmemb, __srcmemb, __lastmemb)\
80 1.1.2.1 pgoyette (void)memcpy(&(__ostats)->__dstmemb, &(__nstats)->__srcmemb, \
81 1.1.2.1 pgoyette offsetof(struct ieee80211_stats, __lastmemb) - \
82 1.1.2.1 pgoyette offsetof(struct ieee80211_stats, __srcmemb))
83 1.1.2.1 pgoyette #define COPYSTATS(__ostats, __nstats, __dstmemb, __lastmemb) \
84 1.1.2.1 pgoyette COPYSTATS1(__ostats, __nstats, __dstmemb, __dstmemb, __lastmemb)
85 1.1.2.1 pgoyette
86 1.1.2.1 pgoyette COPYSTATS(ostats, stats, is_rx_badversion, is_rx_unencrypted);
87 1.1.2.1 pgoyette COPYSTATS(ostats, stats, is_rx_wepfail, is_rx_beacon);
88 1.1.2.1 pgoyette COPYSTATS(ostats, stats, is_rx_rstoobig, is_rx_auth_countermeasures);
89 1.1.2.1 pgoyette COPYSTATS(ostats, stats, is_rx_assoc_bss, is_rx_assoc_badwpaie);
90 1.1.2.1 pgoyette COPYSTATS(ostats, stats, is_rx_deauth, is_rx_unauth);
91 1.1.2.1 pgoyette COPYSTATS1(ostats, stats, is_tx_nombuf, is_tx_nobuf, is_tx_badcipher);
92 1.1.2.1 pgoyette COPYSTATS(ostats, stats, is_scan_active, is_crypto_tkip);
93 1.1.2.1 pgoyette
94 1.1.2.1 pgoyette return 0;
95 1.1.2.1 pgoyette }
96 1.1.2.1 pgoyette
97 1.1.2.1 pgoyette void
98 1.1.2.1 pgoyette ieee80211_20_init(void)
99 1.1.2.1 pgoyette {
100 1.1.2.1 pgoyette
101 1.1.2.1 pgoyette ieee80211_get_ostats_20 = ieee80211_get_ostats;
102 1.1.2.1 pgoyette }
103 1.1.2.1 pgoyette void
104 1.1.2.1 pgoyette ieee80211_20_fini(void)
105 1.1.2.1 pgoyette {
106 1.1.2.1 pgoyette
107 1.1.2.1 pgoyette ieee80211_get_ostats_20 = (void *)enosys;
108 1.1.2.1 pgoyette }
109