diff options
author | jim-p <jimp@pfsense.org> | 2013-01-24 13:50:37 -0500 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2013-01-24 13:54:29 -0500 |
commit | a28d40cb7ea26bcfb28b1be3ad533058286b8e7f (patch) | |
tree | 8dcd27dd40a96dedbadf392f162e6b228ec58f1c /usr/local/www | |
parent | f657f5e1e407a4687983b6e9907f0dc489945157 (diff) | |
download | pfsense-a28d40cb7ea26bcfb28b1be3ad533058286b8e7f.zip pfsense-a28d40cb7ea26bcfb28b1be3ad533058286b8e7f.tar.gz |
Allow specifying multiple local/remote networks for OpenVPN separated by commas. While I'm here, fix up the IPv6 tunnel/remote/local network input validation. Simplify some code using functions.
Diffstat (limited to 'usr/local/www')
-rw-r--r-- | usr/local/www/vpn_openvpn_client.php | 11 | ||||
-rw-r--r-- | usr/local/www/vpn_openvpn_server.php | 15 |
2 files changed, 21 insertions, 5 deletions
diff --git a/usr/local/www/vpn_openvpn_client.php b/usr/local/www/vpn_openvpn_client.php index 2e2a3f9..4a1cd5d 100644 --- a/usr/local/www/vpn_openvpn_client.php +++ b/usr/local/www/vpn_openvpn_client.php @@ -203,10 +203,17 @@ if ($_POST) { } if($pconfig['tunnel_network']) - if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'Tunnel network')) + if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'IPv4 Tunnel Network', false, "ipv4")) $input_errors[] = $result; - if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'Remote network')) + if($pconfig['tunnel_networkv6']) + if ($result = openvpn_validate_cidr($pconfig['tunnel_networkv6'], 'IPv6 Tunnel Network', false, "ipv6")) + $input_errors[] = $result; + + if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'IPv4 Remote Network', true, "ipv4")) + $input_errors[] = $result; + + if ($result = openvpn_validate_cidr($pconfig['remote_networkv6'], 'IPv6 Remote Network', true, "ipv6")) $input_errors[] = $result; if (!empty($pconfig['use_shaper']) && (!is_numeric($pconfig['use_shaper']) || ($pconfig['use_shaper'] <= 0))) diff --git a/usr/local/www/vpn_openvpn_server.php b/usr/local/www/vpn_openvpn_server.php index 4e06d05..b9e3efd 100644 --- a/usr/local/www/vpn_openvpn_server.php +++ b/usr/local/www/vpn_openvpn_server.php @@ -231,13 +231,22 @@ if ($_POST) { if ($result = openvpn_validate_port($pconfig['local_port'], 'Local port')) $input_errors[] = $result; - if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'Tunnel network')) + if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'IPv4 Tunnel Network', false, "ipv4")) $input_errors[] = $result; - if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'Remote network')) + if ($result = openvpn_validate_cidr($pconfig['tunnel_networkv6'], 'IPv6 Tunnel Network', false, "ipv6")) $input_errors[] = $result; - if ($result = openvpn_validate_cidr($pconfig['local_network'], 'Local network')) + if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'IPv4 Remote Network', true, "ipv4")) + $input_errors[] = $result; + + if ($result = openvpn_validate_cidr($pconfig['remote_networkv6'], 'IPv6 Remote Network', true, "ipv6")) + $input_errors[] = $result; + + if ($result = openvpn_validate_cidr($pconfig['local_network'], 'IPv4 Local Network', true, "ipv4")) + $input_errors[] = $result; + + if ($result = openvpn_validate_cidr($pconfig['local_networkv6'], 'IPv6 Local Network', true, "ipv6")) $input_errors[] = $result; $portused = openvpn_port_used($pconfig['protocol'], $pconfig['local_port']); |