summaryrefslogtreecommitdiffstats
path: root/etc/inc/openvpn.inc
diff options
context:
space:
mode:
authorMatthew Grooms <mgrooms@pfsense.org>2008-09-04 19:47:19 +0000
committerMatthew Grooms <mgrooms@pfsense.org>2008-09-04 19:47:19 +0000
commit095a95ae54a4df73e3e04845a485e78a43c8a92d (patch)
tree7d5782a5d031c6b6ab3db0c094d1af711c815ce1 /etc/inc/openvpn.inc
parent91224d9af0c277cce654048b03c47511abbe0b52 (diff)
downloadpfsense-095a95ae54a4df73e3e04845a485e78a43c8a92d.zip
pfsense-095a95ae54a4df73e3e04845a485e78a43c8a92d.tar.gz
Revert to the previous method of referencing OpenVPN device names in the
filter.inc file. We now specify the openvpn device name which is actually an os managed group. OpenVPN tap instances are added or removed from this group when OpenVPN configurations are created or destroyed. Portions of this patch were written by Ermal.
Diffstat (limited to 'etc/inc/openvpn.inc')
-rw-r--r--etc/inc/openvpn.inc22
1 files changed, 14 insertions, 8 deletions
diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc
index 7ee3d5d..4b067c0 100644
--- a/etc/inc/openvpn.inc
+++ b/etc/inc/openvpn.inc
@@ -176,9 +176,9 @@ function openvpn_add_dhcpopts(& $settings, & $conf) {
if ($settings['netbios_enable']) {
- if (!empty($settings['dhcp_nbttype']) && ($settings['dhcp_nbttype'] != 0))
- $conf .= "push \"dhcp-option NBT {$settings['dhcp_nbttype']}\"\n";
- if (!empty($settings['dhcp_nbtscope']))
+ if (!empty($settings['dhcp_nbttype']) && ($settings['dhcp_nbttype'] != 0))
+ $conf .= "push \"dhcp-option NBT {$settings['dhcp_nbttype']}\"\n";
+ if (!empty($settings['dhcp_nbtscope']))
$conf .= "push \"dhcp-option NBS {$settings['dhcp_nbtscope']}\"\n";
if (!empty($settings['wins_server1']))
@@ -251,6 +251,9 @@ function openvpn_reconfigure($mode,& $settings) {
/* rename the device */
mwexec("/sbin/ifconfig {$tunname} name {$devname}");
+
+ /* add the device to the openvpn group */
+ mwexec("/sbin/ifconfig {$devname} group openvpn");
}
$pfile = $g['varrun_path'] . "/openvpn_{$mode_id}.pid";
@@ -446,17 +449,20 @@ function openvpn_delete($mode, & $settings) {
$vpnid = $settings['vpnid'];
$mode_id = $mode.$vpnid;
- $tunname = "tun{$vpnid}";
- if ($mode == "server")
- $devname = "ovpns{$vpnid}";
- else
- $devname = "ovpnc{$vpnid}";
+ $tunname = "tun{$vpnid}";
+ if ($mode == "server")
+ $devname = "ovpns{$vpnid}";
+ else
+ $devname = "ovpnc{$vpnid}";
/* kill the process */
$pfile = "{$g['varrun_path']}/openvpn_{$mode_id}.pid";
killbypid($pfile);
unlink($pfile);
+ /* remove the device from the openvpn group */
+ mwexec("/sbin/ifconfig {$devname} -group openvpn");
+
/* restore the original adapter name */
mwexec("/sbin/ifconfig {$devname} name {$tunname}");
OpenPOWER on IntegriCloud