summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstilez <stilez@users.noreply.github.com>2016-09-11 03:13:20 +0100
committerGitHub <noreply@github.com>2016-09-11 03:13:20 +0100
commite23a417300bd01e86e30e8db6e7b29a18a766047 (patch)
treed182f87d262d820d682f7ef7c3a7554be153f3d5
parenta8b0fc78ece9b43534b604140c878c460e8afd95 (diff)
downloadpfsense-e23a417300bd01e86e30e8db6e7b29a18a766047.zip
pfsense-e23a417300bd01e86e30e8db6e7b29a18a766047.tar.gz
simplify code a bit more
-rw-r--r--src/usr/local/www/firewall_rules_edit.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/usr/local/www/firewall_rules_edit.php b/src/usr/local/www/firewall_rules_edit.php
index 73f815a..963f578 100644
--- a/src/usr/local/www/firewall_rules_edit.php
+++ b/src/usr/local/www/firewall_rules_edit.php
@@ -322,14 +322,15 @@ if ($_POST) {
}
}
}
- if (is_ipaddr(lookup_gateway_ip_by_name($_POST['gateway']))) {
- if (($_POST['ipprotocol'] == "inet46") && ($_POST['gateway'] <> "")) {
+ if ($iptype = is_ipaddr(lookup_gateway_ip_by_name($_POST['gateway']))) {
+ // this also implies that $_POST['gateway'] was set and not empty
+ if ($_POST['ipprotocol'] == "inet46") {
$input_errors[] = gettext("Gateways can not be assigned in a rule that applies to both IPv4 and IPv6.");
}
- if (($_POST['ipprotocol'] == "inet6") && (!is_ipaddrv6(lookup_gateway_ip_by_name($_POST['gateway'])))) {
+ if (($_POST['ipprotocol'] == "inet6") && ($iptype != 6)) {
$input_errors[] = gettext("An IPv4 gateway can not be assigned in IPv6 rules.");
}
- if (($_POST['ipprotocol'] == "inet") && (!is_ipaddrv4(lookup_gateway_ip_by_name($_POST['gateway'])))) {
+ if (($_POST['ipprotocol'] == "inet") && ($iptype != 4)) {
$input_errors[] = gettext("An IPv6 gateway can not be assigned in IPv4 rules.");
}
}
OpenPOWER on IntegriCloud