From 9123a03824f083035f130477bb7b030e559cc9ec Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Wed, 8 Apr 2020 22:27:37 +0200 Subject: wireguard: T2244: re-use interface removal code from WireGuardIf class --- src/conf_mode/interfaces-wireguard.py | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'src/conf_mode/interfaces-wireguard.py') diff --git a/src/conf_mode/interfaces-wireguard.py b/src/conf_mode/interfaces-wireguard.py index 8a44fe5e7..e9d9ad459 100755 --- a/src/conf_mode/interfaces-wireguard.py +++ b/src/conf_mode/interfaces-wireguard.py @@ -222,20 +222,6 @@ def verify(wg): def apply(wg): - # no wg configs left, remove all interface from system - # maybe move it into ifconfig.py - if wg['deleted']: - net_devs = os.listdir('/sys/class/net/') - for dev in net_devs: - 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)) - # XXX: we are ignoring any errors here - run(f'ip link del dev {wg_intf} >/dev/null') - return None - # init wg class w = WireGuardIf(wg['intf']) -- cgit v1.2.3