summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces_wireless.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-08-23 21:19:32 +0200
committerGitHub <noreply@github.com>2024-08-23 21:19:32 +0200
commit0e77effa7a752efd641751b541c5306a0e79b9e7 (patch)
treeca460a30decba87e7a9caa47b4fe54fed1bc8a49 /src/conf_mode/interfaces_wireless.py
parent92c261ecfe9aef9edddc8f92d3db8fa0ce4c2065 (diff)
parent549a16f5b1437d437ccc873ded500b8cecd03c28 (diff)
downloadvyos-1x-0e77effa7a752efd641751b541c5306a0e79b9e7.tar.gz
vyos-1x-0e77effa7a752efd641751b541c5306a0e79b9e7.zip
Merge pull request #4012 from vyos/mergify/bp/circinus/pr-3656
wireless: T6318: move country-code to a system wide configuration (backport #3656)
Diffstat (limited to 'src/conf_mode/interfaces_wireless.py')
-rwxr-xr-xsrc/conf_mode/interfaces_wireless.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/conf_mode/interfaces_wireless.py b/src/conf_mode/interfaces_wireless.py
index 9488f6797..aa65adc10 100755
--- a/src/conf_mode/interfaces_wireless.py
+++ b/src/conf_mode/interfaces_wireless.py
@@ -48,6 +48,8 @@ hostapd_conf = '/run/hostapd/{ifname}.conf'
hostapd_accept_station_conf = '/run/hostapd/{ifname}_station_accept.conf'
hostapd_deny_station_conf = '/run/hostapd/{ifname}_station_deny.conf'
+country_code_path = ['system', 'wireless', 'country-code']
+
def find_other_stations(conf, base, ifname):
"""
Only one wireless interface per phy can be in station mode -
@@ -82,7 +84,11 @@ def get_config(config=None):
conf = Config()
base = ['interfaces', 'wireless']
- ifname, wifi = get_interface_dict(conf, base)
+ _, wifi = get_interface_dict(conf, base)
+
+ # retrieve global Wireless regulatory domain setting
+ if conf.exists(country_code_path):
+ wifi['country_code'] = conf.return_value(country_code_path)
if 'deleted' not in wifi:
# then get_interface_dict provides default keys
@@ -149,7 +155,8 @@ def verify(wifi):
if wifi['type'] == 'access-point':
if 'country_code' not in wifi:
- raise ConfigError('Wireless country-code is mandatory')
+ raise ConfigError(f'Wireless country-code is mandatory, use: '\
+ f'"set {" ".join(country_code_path)}"!')
if 'channel' not in wifi:
raise ConfigError('Wireless channel must be configured!')