diff options
author | hagbard <vyosdev@derith.de> | 2019-01-30 14:57:51 -0800 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2019-02-28 15:01:16 +0100 |
commit | 7794b835e246214493b91f120a18a02248dca076 (patch) | |
tree | 8d4c6ef99129926fe4c113a4f8a37200acf1f955 /src | |
parent | bd654e86b6567045d337606b63f276d14b59b224 (diff) | |
download | vyos-1x-7794b835e246214493b91f120a18a02248dca076.tar.gz vyos-1x-7794b835e246214493b91f120a18a02248dca076.zip |
Fix: T1217 - cant delete wireguard wg0 interface
Diffstat (limited to 'src')
-rwxr-xr-x | src/conf_mode/wireguard.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/conf_mode/wireguard.py b/src/conf_mode/wireguard.py index 57baaee1c..e893dba47 100755 --- a/src/conf_mode/wireguard.py +++ b/src/conf_mode/wireguard.py @@ -150,11 +150,12 @@ def apply(c): if not c: net_devs = os.listdir('/sys/class/net/') for dev in net_devs: - buf = open('/sys/class/net/' + dev + '/uevent', 'r').read() - if re.search("DEVTYPE=wireguard", buf, re.I|re.M): - wg_intf = re.sub("INTERFACE=", "", re.search("INTERFACE=.*", buf, re.I|re.M).group(0)) - sl.syslog(sl.LOG_NOTICE, "removing interface " + wg_intf) - subprocess.call(['ip l d dev ' + wg_intf + ' >/dev/null'], shell=True) + if os.path.isdir('/sys/class/net/' + dev): + buf = open('/sys/class/net/' + dev + '/uevent', 'r').read() + if re.search("DEVTYPE=wireguard", buf, re.I|re.M): + wg_intf = re.sub("INTERFACE=", "", re.search("INTERFACE=.*", buf, re.I|re.M).group(0)) + sl.syslog(sl.LOG_NOTICE, "removing interface " + wg_intf) + subprocess.call(['ip l d dev ' + wg_intf + ' >/dev/null'], shell=True) return None ### |