diff options
-rw-r--r-- | debian/changelog | 6 | ||||
-rwxr-xr-x | src/conf_mode/wireguard.py | 11 |
2 files changed, 12 insertions, 5 deletions
diff --git a/debian/changelog b/debian/changelog index 415cee0ff..477ce8a56 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vyos-1x (1.2.0-11) unstable; urgency=low + + * Fix: T1217 - cant delete wireguard wg0 interface + + -- hagbard <vyosdev@derith.de> Wed, 30 Jan 2019 14:54:45 -0800 + vyos-1x (1.2.0-10) unstable; urgency=low * T1178: Scheduled script breaks ability to modify configuration 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 ### |