diff options
author | Matthew Grooms <mgrooms@pfsense.org> | 2008-08-26 23:49:04 +0000 |
---|---|---|
committer | Matthew Grooms <mgrooms@pfsense.org> | 2008-08-26 23:49:04 +0000 |
commit | f432e364b2acdf561eaaef02d110c821ab4cb451 (patch) | |
tree | d2af0f174f0c1689b275fa5ee9149ba652d4ae6c /usr/local/www/vpn_openvpn_client.php | |
parent | c3d42a86c90be574a2b6aa4f629a7afa4a1fa7a1 (diff) | |
download | pfsense-f432e364b2acdf561eaaef02d110c821ab4cb451.zip pfsense-f432e364b2acdf561eaaef02d110c821ab4cb451.tar.gz |
Set some important default values for the new OpenVPN interface screens.
Add functions and interface code to handle local port conflict detection
and resolution.
Diffstat (limited to 'usr/local/www/vpn_openvpn_client.php')
-rw-r--r-- | usr/local/www/vpn_openvpn_client.php | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/usr/local/www/vpn_openvpn_client.php b/usr/local/www/vpn_openvpn_client.php index 4f42e40..107edf3 100644 --- a/usr/local/www/vpn_openvpn_client.php +++ b/usr/local/www/vpn_openvpn_client.php @@ -65,6 +65,11 @@ if ($_GET['act'] == "del") { $savemsg = gettext("Client successfully deleted")."<br/>"; } +if($_GET['act']=="new"){ + $pconfig['interface'] = "wan"; + $pconfig['server_port'] = 1194; +} + if($_GET['act']=="edit"){ if (isset($id) && $a_client[$id]) { @@ -101,7 +106,21 @@ if ($_POST) { unset($input_errors); $pconfig = $_POST; + if (isset($id) && $a_server[$id]) + $vpnid = $a_server[$id]['vpnid']; + else + $vpnid = 0; + /* input validation */ + if ($pconfig['local_port']) { + + if ($result = openvpn_validate_port($pconfig['local_port'], 'Local port')) + $input_errors[] = $result; + + if (openvpn_port_used($pconfig['protocol'], $pconfig['local_port']) != $vpnid) + $input_errors[] = "The specified 'Local port' is in use. Please select another value"; + } + if ($result = openvpn_validate_host($pconfig['server_addr'], 'Server host or address')) $input_errors[] = $result; @@ -142,8 +161,8 @@ if ($_POST) { $client = array(); - if (isset($id) && $a_client[$id]) - $client['vpnid'] = $a_client[$id]['vpnid']; + if ($vpnid) + $client['vpnid'] = $vpnid; else $client['vpnid'] = openvpn_vpnid_next(); |