summaryrefslogtreecommitdiffstats
path: root/usr/local/www/vpn_openvpn_server.php
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2012-12-04 13:12:24 -0500
committerjim-p <jimp@pfsense.org>2012-12-04 13:12:24 -0500
commit198bb44993ff5a8d639522e325cc96cec0df96a2 (patch)
tree90a528fa7111ba86fa1e709b06c47625941a9681 /usr/local/www/vpn_openvpn_server.php
parent6714bbdc6573489a25e2b93eeb9e94e2251475b6 (diff)
downloadpfsense-198bb44993ff5a8d639522e325cc96cec0df96a2.zip
pfsense-198bb44993ff5a8d639522e325cc96cec0df96a2.tar.gz
Add input validation to reject invalid combinations of IPv4/IPv6 openvpn protocols and interface/VIPs.
Diffstat (limited to 'usr/local/www/vpn_openvpn_server.php')
-rw-r--r--usr/local/www/vpn_openvpn_server.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/usr/local/www/vpn_openvpn_server.php b/usr/local/www/vpn_openvpn_server.php
index 004ce56..dafcabc 100644
--- a/usr/local/www/vpn_openvpn_server.php
+++ b/usr/local/www/vpn_openvpn_server.php
@@ -207,6 +207,17 @@ if ($_POST) {
else
$vpnid = 0;
+ list($iv_iface, $iv_ip) = explode ("|",$pconfig['interface']);
+ if (is_ipaddrv4($iv_ip) && (stristr($pconfig['protocol'], "6") !== false)) {
+ $input_errors[] = gettext("Protocol and IP address families do not match. You cannot select an IPv6 protocol and an IPv4 IP address.");
+ } elseif (is_ipaddrv6($iv_ip) && (stristr($pconfig['protocol'], "6") === false)) {
+ $input_errors[] = gettext("Protocol and IP address families do not match. You cannot select an IPv4 protocol and an IPv6 IP address.");
+ } elseif ((stristr($pconfig['protocol'], "6") === false) && !get_interface_ip($iv_iface)) {
+ $input_errors[] = gettext("An IPv4 protocol was selected, but the selected interface has no IPv4 address.");
+ } elseif ((stristr($pconfig['protocol'], "6") !== false) && !get_interface_ipv6($iv_iface)) {
+ $input_errors[] = gettext("An IPv6 protocol was selected, but the selected interface has no IPv6 address.");
+ }
+
if ($pconfig['mode'] != "p2p_shared_key")
$tls_mode = true;
else
OpenPOWER on IntegriCloud