mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 08:34:39 +00:00
openvpn: why not delete the interface? #2450
This commit is contained in:
parent
2896c69d0d
commit
4e1cddf3bb
@ -1009,12 +1009,6 @@ function openvpn_delete($mode, &$settings)
|
||||
$vpnid = $settings['vpnid'];
|
||||
$mode_id = $mode.$vpnid;
|
||||
|
||||
if (isset($settings['dev_mode'])) {
|
||||
$tunname = "{$settings['dev_mode']}{$vpnid}";
|
||||
} else { /* defaults to tun */
|
||||
$tunname = "tun{$vpnid}";
|
||||
}
|
||||
|
||||
if ($mode == "server") {
|
||||
$devname = "ovpns{$vpnid}";
|
||||
} else {
|
||||
@ -1022,13 +1016,10 @@ function openvpn_delete($mode, &$settings)
|
||||
}
|
||||
|
||||
/* kill the process if running */
|
||||
killbypid("/var/run/openvpn_{$mode_id}.pid");
|
||||
killbypid("/var/run/openvpn_{$mode_id}.pid", 'TERM', true);
|
||||
|
||||
/* remove the device from the openvpn group */
|
||||
mwexec("/sbin/ifconfig " . escapeshellarg($devname) . " -group openvpn");
|
||||
|
||||
/* restore the original adapter name */
|
||||
mwexec("/sbin/ifconfig " . escapeshellarg($devname) . " name " . escapeshellarg($tunname));
|
||||
/* remove the device */
|
||||
mwexec("/sbin/ifconfig " . escapeshellarg($devname) . " destroy");
|
||||
|
||||
/* remove the configuration files */
|
||||
@array_map('unlink', glob("/var/etc/openvpn/{$mode_id}.*"));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user