summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/interfaces-wireless.py27
-rw-r--r--src/etc/systemd/system/wpa_supplicant@.service.d/override.conf4
2 files changed, 11 insertions, 20 deletions
diff --git a/src/conf_mode/interfaces-wireless.py b/src/conf_mode/interfaces-wireless.py
index f13408fa2..0fa20c5f4 100755
--- a/src/conf_mode/interfaces-wireless.py
+++ b/src/conf_mode/interfaces-wireless.py
@@ -95,16 +95,9 @@ default_config_data = {
'vif_s_remove': []
}
-def get_conf_file(conf_type, intf):
- cfg_dir = '/run/' + conf_type
-
- # create directory on demand
- if not os.path.exists(cfg_dir):
- os.makedirs(cfg_dir, 0o755)
- chown(cfg_dir, 'root', 'vyattacfg')
-
- cfg_file = cfg_dir + r'/{}.conf'.format(intf)
- return cfg_file
+# XXX: wpa_supplicant works on the source interface
+wpa_suppl_conf = '/run/wpa_supplicant/{intf}.conf'
+hostapd_conf = '/run/hostapd/{intf}.conf'
def get_config():
# determine tagNode instance
@@ -518,11 +511,11 @@ def generate(wifi):
# Delete config files if interface is removed
if wifi['deleted']:
- if os.path.isfile(get_conf_file('hostapd', interface)):
- os.unlink(get_conf_file('hostapd', interface))
+ if os.path.isfile(hostapd_conf.format(**wifi)):
+ os.unlink(hostapd_conf.format(**wifi))
- if os.path.isfile(get_conf_file('wpa_supplicant', interface)):
- os.unlink(get_conf_file('wpa_supplicant', interface))
+ if os.path.isfile(wpa_suppl_conf.format(**wifi)):
+ os.unlink(wpa_suppl_conf.format(**wifi))
return None
@@ -550,12 +543,10 @@ def generate(wifi):
# render appropriate new config files depending on access-point or station mode
if wifi['op_mode'] == 'ap':
- conf = get_conf_file('hostapd', interface)
- render(conf, 'wifi/hostapd.conf.tmpl', wifi)
+ render(hostapd_conf.format(**wifi), 'wifi/hostapd.conf.tmpl', wifi)
elif wifi['op_mode'] == 'station':
- conf = get_conf_file('wpa_supplicant', interface)
- render(conf, 'wifi/wpa_supplicant.conf.tmpl', wifi)
+ render(wpa_suppl_conf.format(**wifi), 'wifi/wpa_supplicant.conf.tmpl', wifi)
return None
diff --git a/src/etc/systemd/system/wpa_supplicant@.service.d/override.conf b/src/etc/systemd/system/wpa_supplicant@.service.d/override.conf
index 20b25b726..a895e675f 100644
--- a/src/etc/systemd/system/wpa_supplicant@.service.d/override.conf
+++ b/src/etc/systemd/system/wpa_supplicant@.service.d/override.conf
@@ -5,6 +5,6 @@ After=vyos-router.service
[Service]
WorkingDirectory=
WorkingDirectory=/run/wpa_supplicant
-EnvironmentFile=
+PIDFile=/run/wpa_supplicant/%I.pid
ExecStart=
-ExecStart=/sbin/wpa_supplicant -c%I.conf -Dnl80211,wext -i%I
+ExecStart=/sbin/wpa_supplicant -c/run/wpa_supplicant/%I.conf -Dnl80211,wext -i%I