xref: /freebsd/share/man/man9/ieee80211_regdomain.9 (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1.\"
2.\" Copyright (c) 2009 Sam Leffler, Errno Consulting
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.\" $FreeBSD$
27.\"
28.Dd August 4, 2009
29.Dt IEEE80211_REGDOMAIN 9
30.Os
31.Sh NAME
32.Nm ieee80211_regdomain
33.Nd 802.11 regulatory support
34.Sh SYNOPSIS
35.In net80211/ieee80211_var.h
36.In net80211/ieee80211_regdomain.h
37.Pp
38.Ft int
39.Fo ieee80211_init_channels
40.Fa "struct ieee80211com *"
41.Fa "const struct ieee80211_regdomain *"
42.Fa "const uint8_t bands[]"
43.Fc
44.\"
45.Ft void
46.Fo ieee80211_sort_channels
47.Fa "struct ieee80211_channel *"
48.Fa "int nchans"
49.Fc
50.\"
51.Ft "struct ieee80211_appie *"
52.Fn ieee80211_alloc_countryie "struct ieee80211com *"
53.Sh DESCRIPTION
54The
55.Nm net80211
56software layer provides a support framework for drivers that includes
57comprehensive regulatory support.
58.Nm net80211
59provides mechanisms that enforce
60.Em "regulatory policy"
61by privileged user applications.
62.Pp
63Drivers define a device's capabilities and can
64intercept and control regulatory changes requested through
65.Nm net80211 .
66The initial regulatory state, including the channel list, must be
67filled in by the driver before calling
68.Fn ieee80211_ifattach .
69The channel list should reflect the set of channels the device is
70.Em calibrated
71for use on.
72This list may also be requested later through the
73.Vt ic_getradiocaps
74method in the
75.Vt ieee80211com
76structure.
77The
78.Fn ieee80211_init_channels
79function is provided as a rudimentary fallback for drivers that do not
80(or cannot) fill in a proper channel list.
81Default regulatory state is supplied such as the regulatory SKU,
82ISO country code, location (e.g. indoor, outdoor), and a set of
83frequency bands the device is capable of operating on.
84.Nm net80211
85populates the channel table in
86.Vt ic_channels
87with a default set of channels and capabilities.
88Note this mechanism should be used with care as any mismatch between
89the channel list created and the device's capabilities can result
90in runtime errors (e.g. a request to operate on a channel the device
91does not support).
92The SKU and country information are used for generating 802.11h protocol
93elements and related operation such as for 802.11d; mis-setup by a
94driver is not fatal, only potentially confusing.
95.Pp
96Devices that do not have a fixed/default regulatory state can set
97the regulatory SKU to
98.Dv SKU_DEBUG
99and country code to
100.Dv CTRY_DEFAULT
101and leave proper setup to user applications.
102If default settings are known they can be installed and/or an event
103can be dispatched to user space using
104.Fn ieee80211_notify_country
105so that
106.Xr devd 8
107will do the appropriate setup work at system boot (or device insertion).
108.Pp
109The channel table is sorted to optimize lookups using the
110.Fn ieee80211_sort_channels
111routine.
112This should be done whenever the channel table contents are modified.
113.Pp
114The
115.Fn ieee80211_alloc_countryie
116function allocates an information element as specified by 802.11h.
117Because this is expensive to generate it is cached in
118.Vt ic_countryie
119and generated only when regulatory state changes.
120Drivers that call
121.Fn ieee80211_alloc_countryie
122directly should not help with this caching; doing so may confuse the
123.Nm net80211
124layer.
125.Sh DRIVER REGULATORY CONTROL
126Drivers can control regulatory change requests by overriding the
127.Vt ic_setregdomain
128method that checks change requests.
129While drivers can reject any request that does not meet its requirements
130it is recommended that one be lenient in what is accepted and, whenever
131possible, instead of rejecting a request, alter it to be correct.
132For example, if the transmit power cap for a channel is too high the
133driver can either reject the request or (better) reduce the cap to be
134compliant.
135Requests that include unacceptable channels should cause the request
136to be rejected as otherwise a mismatch may be created between application
137state and the state managed by
138.Nm net80211 .
139The exact rules by which to operate are still being codified.
140.Sh SEE ALSO
141.Xr regdomain 5 ,
142.Xr ifconfig 8 ,
143.Xr ieee80211 9
144