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
Status: Merged
Approved by: Konrad Zapałowicz
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
Konrad Zapałowicz (community) code Approve
System Enablement Bot continuous-integration Approve
Roberto Mier Escandon (community) Approve
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.
Revision history for this message
Konrad Zapałowicz (kzapalowicz) wrote :

Minor comments, mostly wording related.

review: Needs Fixing (code)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

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

Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Roberto Mier Escandon (rmescandon) wrote :

not tested, only changes review. lgtm

review: Approve
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Konrad Zapałowicz (kzapalowicz) wrote :

ack

review: Approve (code)
Revision history for this message
Simon Fels (morphis) :
review: Needs Fixing
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) :
Revision history for this message
Simon Fels (morphis) :
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) :
Revision history for this message
Simon Fels (morphis) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/bin/ap.sh b/bin/ap.sh
index 19841de..5db1c56 100755
--- a/bin/ap.sh
+++ b/bin/ap.sh
@@ -190,6 +190,13 @@ hw_mode=$WIFI_OPERATION_MODE
190dtim_period=3190dtim_period=3
191191
192192
193# Regulatory domain options
194country_code=$WIFI_COUNTRY_CODE
195ieee80211d=$WIFI_IEEE80211D
196ieee80211h=$WIFI_IEEE80211H
197local_pwr_constraint=$WIFI_LOCAL_PWR_CONSTRAINT
198
199
193# The wmm_* options are needed to enable AMPDU200# The wmm_* options are needed to enable AMPDU
194# and get decent 802.11n throughput201# and get decent 802.11n throughput
195# UAPSD is for stations powersave202# UAPSD is for stations powersave
diff --git a/conf/default-config b/conf/default-config
index 6152c7c..2573a48 100644
--- a/conf/default-config
+++ b/conf/default-config
@@ -12,9 +12,9 @@
12# You should have received a copy of the GNU General Public License12# You should have received a copy of the GNU General Public License
13# along with this program. If not, see <http://www.gnu.org/licenses/>.13# along with this program. If not, see <http://www.gnu.org/licenses/>.
1414
15# WARNING This file is sourced as shell script by the ap.sh script15# WARNING This file is sourced as a shell script by the ap.sh script.
16# it's also readed by the configuration service as whitelist of valid tokens.16# It is also read by the configuration service as a whitelist of valid tokens.
17# Tokens NOT present in this default file won't accepted by the service17# Tokens NOT present in this default file won't accepted by the service.
1818
19DISABLED="true"19DISABLED="true"
2020
@@ -50,6 +50,11 @@ WIFI_CHANNEL=6
50# g = IEEE 802.11g (2.4 GHz), ad = IEEE 802.11ad (60 GHz);50# g = IEEE 802.11g (2.4 GHz), ad = IEEE 802.11ad (60 GHz);
51WIFI_OPERATION_MODE="g"51WIFI_OPERATION_MODE="g"
5252
53WIFI_COUNTRY_CODE=XX
54WIFI_IEEE80211D=1
55WIFI_IEEE80211H=1
56WIFI_LOCAL_PWR_CONSTRAINT=3
57
53# Wether connection sharing is disabled or not58# Wether connection sharing is disabled or not
54SHARE_DISABLED="false"59SHARE_DISABLED="false"
55# Network interface which connection will be shared with connected60# Network interface which connection will be shared with connected
diff --git a/docs/reference/commands.md b/docs/reference/commands.md
index 9845f5a..89d81cd 100644
--- a/docs/reference/commands.md
+++ b/docs/reference/commands.md
@@ -27,9 +27,13 @@ share.disabled: false
27share.network-interface: wlan027share.network-interface: wlan0
28wifi.address: 10.0.60.128wifi.address: 10.0.60.1
29wifi.channel: 629wifi.channel: 6
30wifi.country-code: ES
30wifi.hostapd-driver: nl8021131wifi.hostapd-driver: nl80211
32wifi.ieee80211d: 1
33wifi.ieee80211h: 1
31wifi.interface: wlan034wifi.interface: wlan0
32wifi.interface-mode: direct35wifi.interface-mode: direct
36wifi.local-pwr-constraint: 3
33wifi.netmask: 255.255.255.037wifi.netmask: 255.255.255.0
34wifi.operation-mode: g38wifi.operation-mode: g
35wifi.security: open39wifi.security: open
diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md
index 49999db..2428f48 100644
--- a/docs/reference/configuration.md
+++ b/docs/reference/configuration.md
@@ -229,7 +229,6 @@ Example:
229$ wifi-ap.config set dhcp.range-start=192.168.7.10229$ wifi-ap.config set dhcp.range-start=192.168.7.10
230```230```
231231
232
233## dhcp.range-stop232## dhcp.range-stop
234233
235End of the IP address range being used to assign IP addresses to DHCP clients234End of the IP address range being used to assign IP addresses to DHCP clients
@@ -253,3 +252,71 @@ Example:
253```252```
254$ wifi-ap.config set dhcp.lease-time=24h253$ wifi-ap.config set dhcp.lease-time=24h
255```254```
255
256## wifi.country-code
257
258Country code as specified by ISO/IEC 3166-1, used to set regulatory domain. Set
259as needed to indicate country in which device is operating. This can limit
260available channels and transmit power.
261
262Possible values: see [this list](http://geotags.com/iso3166/countries.html).
263
264Default value: *XX*
265
266Example:
267
268```
269$ wifi-ap.config set wifi.country-code=US
270```
271
272## wifi.ieee80211d
273
274Enable IEEE 802.11d. This advertises the country code and the set of allowed
275channels and transmit power levels based on the regulatory limits.
276
277Possible values:
278
279 * *0*: Disabled
280 * *1*: Enabled
281
282Default value: *1*
283
284Example:
285
286```
287$ wifi-ap.config set wifi.ieee80211d=1
288```
289
290## wifi.ieee80211h
291
292Enable IEEE 802.11h. This enables radar detection and DFS support if
293available. DFS support is required on outdoor 5 GHz channels in most countries
294of the world. This can be used only with ieee80211d=1.
295
296Possible values:
297
298 * *0*: Disabled
299 * *1*: Enabled
300
301Default value: *1*
302
303Example:
304
305```
306$ wifi-ap.config set wifi.ieee80211h=1
307```
308
309## wifi.local-pwr-constraint
310
311Add Power Constraint element to Beacon and Probe Response frames, when
312applicable. The Country element must be set for this to happen. Power Constraint
313element is required by Transmit Power Control. This can be used only with
314ieee80211d=1. Valid values are 0..255 (dB below maximum allowed transmit power).
315
316Default value: *3*
317
318Example:
319
320```
321$ wifi-ap.config set wifi.local-pwr-constraint=3
322```
diff --git a/docs/reference/rest-api/v1-configuration.md b/docs/reference/rest-api/v1-configuration.md
index 158e245..241ed2c 100644
--- a/docs/reference/rest-api/v1-configuration.md
+++ b/docs/reference/rest-api/v1-configuration.md
@@ -52,6 +52,10 @@ $ sudo wifi-ap-client /v1/configuration
52"wifi.security": "wpa2",52"wifi.security": "wpa2",
53"wifi.security-passphrase": "12345678",53"wifi.security-passphrase": "12345678",
54"wifi.channel": 6,54"wifi.channel": 6,
55"wifi.country-code": "XX",
56"wifi.ieee80211d": 1,
57"wifi.ieee80211h": 1,
58"wifi.local-pwr-constraint": 3,
55"wifi.operation-mode": "virtual",59"wifi.operation-mode": "virtual",
56"share.disabled": false,60"share.disabled": false,
57"share.network-interface": "eth0",61"share.network-interface": "eth0",
diff --git a/tests/main/default-configuration/tasks.yaml b/tests/main/default-configuration/tasks.yaml
index d6c1cba..c83f35b 100644
--- a/tests/main/default-configuration/tasks.yaml
+++ b/tests/main/default-configuration/tasks.yaml
@@ -17,6 +17,10 @@ execute: |
17 test "`/snap/bin/wifi-ap.config get wifi.operation-mode`" = "g"17 test "`/snap/bin/wifi-ap.config get wifi.operation-mode`" = "g"
18 test "`/snap/bin/wifi-ap.config get wifi.security`" = "open"18 test "`/snap/bin/wifi-ap.config get wifi.security`" = "open"
19 test "`/snap/bin/wifi-ap.config get wifi.ssid`" = "Ubuntu"19 test "`/snap/bin/wifi-ap.config get wifi.ssid`" = "Ubuntu"
20 test "`/snap/bin/wifi-ap.config get wifi.country-code`" = "XX"
21 test "`/snap/bin/wifi-ap.config get wifi.ieee80211d`" = "1"
22 test "`/snap/bin/wifi-ap.config get wifi.ieee80211h`" = "1"
23 test "`/snap/bin/wifi-ap.config get wifi.local-pwr-constraint`" = "3"
20 # FIXME: Once wifi-ap.config get returns correct error codes when an24 # FIXME: Once wifi-ap.config get returns correct error codes when an
21 # item does not exist we can drop the grep check here.25 # item does not exist we can drop the grep check here.
22 /snap/bin/wifi-ap.config get wifi.security-passphrase | grep 'does not exist'26 /snap/bin/wifi-ap.config get wifi.security-passphrase | grep 'does not exist'

Subscribers

People subscribed via source and target branches