Merge ~alfonsosanchezbeato/snappy-hwe-snaps/+git/wifi-ap:add-country-code into ~snappy-hwe-team/snappy-hwe-snaps/+git/wifi-ap:master

Proposed by Alfonso Sanchez-Beato on 2017-06-23
Status: Merged
Approved by: Konrad Zapałowicz on 2017-06-26
Approved revision: ab0bfe4b3e19de468c8e3925fc24bbfb26398bf0
Merged at revision: cb233f4fb6e542bdaa24efb2a85cc3329f3cff18
Proposed branch: ~alfonsosanchezbeato/snappy-hwe-snaps/+git/wifi-ap:add-country-code
Merge into: ~snappy-hwe-team/snappy-hwe-snaps/+git/wifi-ap:master
Diff against target: 179 lines (+95/-4)
6 files modified
bin/ap.sh (+7/-0)
conf/default-config (+8/-3)
docs/reference/commands.md (+4/-0)
docs/reference/configuration.md (+68/-1)
docs/reference/rest-api/v1-configuration.md (+4/-0)
tests/main/default-configuration/tasks.yaml (+4/-0)
Reviewer Review Type Date Requested Status
Simon Fels Needs Fixing on 2017-06-26
Konrad Zapałowicz (community) code 2017-06-23 Approve on 2017-06-26
System Enablement Bot continuous-integration Approve on 2017-06-23
Roberto Mier Escandón  (community) Approve on 2017-06-23
Review via email: mp+326219@code.launchpad.net

Description of the change

Add country code configuration options so the beacon frames
contain that IE.

To post a comment you must log in.
Konrad Zapałowicz (kzapalowicz) wrote :

Minor comments, mostly wording related.

review: Needs Fixing (code)

@Konrad, thanks for the comments. Branch repushed after addressing them.

not tested, only changes review. lgtm

review: Approve
Konrad Zapałowicz (kzapalowicz) wrote :

ack

review: Approve (code)
Simon Fels (morphis) :
review: Needs Fixing
Simon Fels (morphis) :
Simon Fels (morphis) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/ap.sh b/bin/ap.sh
2index 19841de..5db1c56 100755
3--- a/bin/ap.sh
4+++ b/bin/ap.sh
5@@ -190,6 +190,13 @@ hw_mode=$WIFI_OPERATION_MODE
6 dtim_period=3
7
8
9+# Regulatory domain options
10+country_code=$WIFI_COUNTRY_CODE
11+ieee80211d=$WIFI_IEEE80211D
12+ieee80211h=$WIFI_IEEE80211H
13+local_pwr_constraint=$WIFI_LOCAL_PWR_CONSTRAINT
14+
15+
16 # The wmm_* options are needed to enable AMPDU
17 # and get decent 802.11n throughput
18 # UAPSD is for stations powersave
19diff --git a/conf/default-config b/conf/default-config
20index 6152c7c..2573a48 100644
21--- a/conf/default-config
22+++ b/conf/default-config
23@@ -12,9 +12,9 @@
24 # You should have received a copy of the GNU General Public License
25 # along with this program. If not, see <http://www.gnu.org/licenses/>.
26
27-# WARNING This file is sourced as shell script by the ap.sh script
28-# it's also readed by the configuration service as whitelist of valid tokens.
29-# Tokens NOT present in this default file won't accepted by the service
30+# WARNING This file is sourced as a shell script by the ap.sh script.
31+# It is also read by the configuration service as a whitelist of valid tokens.
32+# Tokens NOT present in this default file won't accepted by the service.
33
34 DISABLED="true"
35
36@@ -50,6 +50,11 @@ WIFI_CHANNEL=6
37 # g = IEEE 802.11g (2.4 GHz), ad = IEEE 802.11ad (60 GHz);
38 WIFI_OPERATION_MODE="g"
39
40+WIFI_COUNTRY_CODE=XX
41+WIFI_IEEE80211D=1
42+WIFI_IEEE80211H=1
43+WIFI_LOCAL_PWR_CONSTRAINT=3
44+
45 # Wether connection sharing is disabled or not
46 SHARE_DISABLED="false"
47 # Network interface which connection will be shared with connected
48diff --git a/docs/reference/commands.md b/docs/reference/commands.md
49index 9845f5a..89d81cd 100644
50--- a/docs/reference/commands.md
51+++ b/docs/reference/commands.md
52@@ -27,9 +27,13 @@ share.disabled: false
53 share.network-interface: wlan0
54 wifi.address: 10.0.60.1
55 wifi.channel: 6
56+wifi.country-code: ES
57 wifi.hostapd-driver: nl80211
58+wifi.ieee80211d: 1
59+wifi.ieee80211h: 1
60 wifi.interface: wlan0
61 wifi.interface-mode: direct
62+wifi.local-pwr-constraint: 3
63 wifi.netmask: 255.255.255.0
64 wifi.operation-mode: g
65 wifi.security: open
66diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md
67index 49999db..2428f48 100644
68--- a/docs/reference/configuration.md
69+++ b/docs/reference/configuration.md
70@@ -229,7 +229,6 @@ Example:
71 $ wifi-ap.config set dhcp.range-start=192.168.7.10
72 ```
73
74-
75 ## dhcp.range-stop
76
77 End of the IP address range being used to assign IP addresses to DHCP clients
78@@ -253,3 +252,71 @@ Example:
79 ```
80 $ wifi-ap.config set dhcp.lease-time=24h
81 ```
82+
83+## wifi.country-code
84+
85+Country code as specified by ISO/IEC 3166-1, used to set regulatory domain. Set
86+as needed to indicate country in which device is operating. This can limit
87+available channels and transmit power.
88+
89+Possible values: see [this list](http://geotags.com/iso3166/countries.html).
90+
91+Default value: *XX*
92+
93+Example:
94+
95+```
96+$ wifi-ap.config set wifi.country-code=US
97+```
98+
99+## wifi.ieee80211d
100+
101+Enable IEEE 802.11d. This advertises the country code and the set of allowed
102+channels and transmit power levels based on the regulatory limits.
103+
104+Possible values:
105+
106+ * *0*: Disabled
107+ * *1*: Enabled
108+
109+Default value: *1*
110+
111+Example:
112+
113+```
114+$ wifi-ap.config set wifi.ieee80211d=1
115+```
116+
117+## wifi.ieee80211h
118+
119+Enable IEEE 802.11h. This enables radar detection and DFS support if
120+available. DFS support is required on outdoor 5 GHz channels in most countries
121+of the world. This can be used only with ieee80211d=1.
122+
123+Possible values:
124+
125+ * *0*: Disabled
126+ * *1*: Enabled
127+
128+Default value: *1*
129+
130+Example:
131+
132+```
133+$ wifi-ap.config set wifi.ieee80211h=1
134+```
135+
136+## wifi.local-pwr-constraint
137+
138+Add Power Constraint element to Beacon and Probe Response frames, when
139+applicable. The Country element must be set for this to happen. Power Constraint
140+element is required by Transmit Power Control. This can be used only with
141+ieee80211d=1. Valid values are 0..255 (dB below maximum allowed transmit power).
142+
143+Default value: *3*
144+
145+Example:
146+
147+```
148+$ wifi-ap.config set wifi.local-pwr-constraint=3
149+```
150diff --git a/docs/reference/rest-api/v1-configuration.md b/docs/reference/rest-api/v1-configuration.md
151index 158e245..241ed2c 100644
152--- a/docs/reference/rest-api/v1-configuration.md
153+++ b/docs/reference/rest-api/v1-configuration.md
154@@ -52,6 +52,10 @@ $ sudo wifi-ap-client /v1/configuration
155 "wifi.security": "wpa2",
156 "wifi.security-passphrase": "12345678",
157 "wifi.channel": 6,
158+"wifi.country-code": "XX",
159+"wifi.ieee80211d": 1,
160+"wifi.ieee80211h": 1,
161+"wifi.local-pwr-constraint": 3,
162 "wifi.operation-mode": "virtual",
163 "share.disabled": false,
164 "share.network-interface": "eth0",
165diff --git a/tests/main/default-configuration/tasks.yaml b/tests/main/default-configuration/tasks.yaml
166index d6c1cba..c83f35b 100644
167--- a/tests/main/default-configuration/tasks.yaml
168+++ b/tests/main/default-configuration/tasks.yaml
169@@ -17,6 +17,10 @@ execute: |
170 test "`/snap/bin/wifi-ap.config get wifi.operation-mode`" = "g"
171 test "`/snap/bin/wifi-ap.config get wifi.security`" = "open"
172 test "`/snap/bin/wifi-ap.config get wifi.ssid`" = "Ubuntu"
173+ test "`/snap/bin/wifi-ap.config get wifi.country-code`" = "XX"
174+ test "`/snap/bin/wifi-ap.config get wifi.ieee80211d`" = "1"
175+ test "`/snap/bin/wifi-ap.config get wifi.ieee80211h`" = "1"
176+ test "`/snap/bin/wifi-ap.config get wifi.local-pwr-constraint`" = "3"
177 # FIXME: Once wifi-ap.config get returns correct error codes when an
178 # item does not exist we can drop the grep check here.
179 /snap/bin/wifi-ap.config get wifi.security-passphrase | grep 'does not exist'

Subscribers

People subscribed via source and target branches