From f7907fbdbbe21058694b1076028ea4c19b9045eb Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 1 Oct 2020 21:47:29 +0200 Subject: wireless: T2653: mangle RADIUS default values With commit 38ae3032 ("pppoe-server: T2936: move to get_config_dict()") there are now RADIUS default values present in the XML definitions - those must be proberly mangled for the WiFi interface. --- src/conf_mode/interfaces-wireless.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/conf_mode/interfaces-wireless.py b/src/conf_mode/interfaces-wireless.py index f8520aecf..ad8aee168 100755 --- a/src/conf_mode/interfaces-wireless.py +++ b/src/conf_mode/interfaces-wireless.py @@ -74,7 +74,18 @@ def get_config(config=None): else: conf = Config() base = ['interfaces', 'wireless'] + wifi = get_interface_dict(conf, base) + # defaults include RADIUS server specifics per TAG node which need to be + # added to individual RADIUS servers instead - so we can simply delete them + if vyos_dict_search('security.wpa.radius.server.port', wifi): + del wifi['security']['wpa']['radius']['server']['port'] + if not len(wifi['security']['wpa']['radius']['server']): + del wifi['security']['wpa']['radius'] + if not len(wifi['security']['wpa']): + del wifi['security']['wpa'] + if not len(wifi['security']): + del wifi['security'] if 'security' in wifi and 'wpa' in wifi['security']: wpa_cipher = wifi['security']['wpa'].get('cipher') @@ -99,6 +110,14 @@ def get_config(config=None): tmp = find_other_stations(conf, base, wifi['ifname']) if tmp: wifi['station_interfaces'] = tmp + # Add individual RADIUS server default values + if vyos_dict_search('security.wpa.radius.server', wifi): + default_values = defaults(base + ['security', 'wpa', 'radius', 'server']) + + for server in vyos_dict_search('security.wpa.radius.server', wifi): + wifi['security']['wpa']['radius']['server'][server] = dict_merge( + default_values, wifi['security']['wpa']['radius']['server'][server]) + return wifi def verify(wifi): -- cgit v1.2.3