summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces_wireless.py
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2024-06-17 17:31:40 +0200
committerGitHub <noreply@github.com>2024-06-17 17:31:40 +0200
commit444728ba6256fa7d39bedf9c4be83c098a9cc1ae (patch)
treef7e3168df466976acfdea9467711899b39c6907d /src/conf_mode/interfaces_wireless.py
parent2224890a5be141daf9dd5613de0ebb81bb706db0 (diff)
parent9e22ab6b2aee48029d3455f65880e45c558cf1da (diff)
downloadvyos-1x-444728ba6256fa7d39bedf9c4be83c098a9cc1ae.tar.gz
vyos-1x-444728ba6256fa7d39bedf9c4be83c098a9cc1ae.zip
Merge pull request #3656 from c-po/wireless-regdomain
wireless: T6318: move country-code to a system wide configuration
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 c0a17c0bc..998ff9dba 100755
--- a/src/conf_mode/interfaces_wireless.py
+++ b/src/conf_mode/interfaces_wireless.py
@@ -44,6 +44,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 -
@@ -78,7 +80,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
@@ -131,7 +137,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!')