summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-05-21 18:19:52 +0200
committerChristian Poessinger <christian@poessinger.com>2020-05-21 18:19:52 +0200
commite12390d75b5ea0423f19efc1dc5dd97ae5fe42dd (patch)
tree4ba301c80896404caacc98ac7d1d81cc695b593a /src/conf_mode
parentf8e2d8acd8a036a041cf4b51891d21a3c809afb0 (diff)
downloadvyos-1x-e12390d75b5ea0423f19efc1dc5dd97ae5fe42dd.tar.gz
vyos-1x-e12390d75b5ea0423f19efc1dc5dd97ae5fe42dd.zip
macsec: T2023: delete wpa_supplicant config when interface is removed
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/interfaces-macsec.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/conf_mode/interfaces-macsec.py b/src/conf_mode/interfaces-macsec.py
index d251f6408..6a3bb49fe 100755
--- a/src/conf_mode/interfaces-macsec.py
+++ b/src/conf_mode/interfaces-macsec.py
@@ -45,6 +45,9 @@ default_config_data = {
'vrf': ''
}
+# XXX: wpa_supplicant works on the source interface
+wpa_suppl_conf = '/run/wpa_supplicant/{source_interface}.conf'
+
def get_config():
macsec = deepcopy(default_config_data)
conf = Config()
@@ -158,12 +161,7 @@ def verify(macsec):
return None
def generate(macsec):
- # XXX: wpa_supplicant works on the source interface not the resulting
- # MACsec interface
- wpa_suppl_conf = '/run/wpa_supplicant/{source_interface}.conf'
- conf = wpa_suppl_conf.format(**macsec)
-
- render(conf, 'macsec/wpa_supplicant.conf.tmpl', macsec, permission=0o640)
+ render(wpa_suppl_conf.format(**macsec), 'macsec/wpa_supplicant.conf.tmpl', macsec, permission=0o640)
return None
def apply(macsec):
@@ -172,6 +170,10 @@ def apply(macsec):
call('systemctl stop wpa_supplicant-macsec@{source_interface}.service'.format(**macsec))
MACsecIf(macsec['intf']).remove()
+ # delete configuration on interface removal
+ if os.path.isfile(wpa_suppl_conf.format(**macsec)):
+ os.unlink(wpa_suppl_conf.format(**macsec))
+
else:
# MACsec interfaces require a configuration when they are added using
# iproute2. This static method will provide the configuration