From 49388ca2c6c4bdfd20a4df233528ad533ba45547 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Fri, 12 Apr 2019 15:05:07 +0200 Subject: [PATCH] Routing, gateways. ditch lookup_gateway_ip_by_name() usage from firewall_rules_edit.php, for https://github.com/opnsense/core/issues/2279 --- src/www/firewall_rules_edit.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/www/firewall_rules_edit.php b/src/www/firewall_rules_edit.php index 90af1fc69..40139e0ce 100644 --- a/src/www/firewall_rules_edit.php +++ b/src/www/firewall_rules_edit.php @@ -236,11 +236,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { } } } - if (!empty($pconfig['gateway']) && is_ipaddr(lookup_gateway_ip_by_name($pconfig['gateway']))) { - if ($pconfig['ipprotocol'] == "inet6" && !is_ipaddrv6(lookup_gateway_ip_by_name($pconfig['gateway']))) { + $gateways = new \OPNsense\Routing\Gateways(legacy_interfaces_details()); + if (!empty($pconfig['gateway']) && is_ipaddr($gateways->getAddress($pconfig['gateway']))) { + if ($pconfig['ipprotocol'] == "inet6" && !is_ipaddrv6($gateways->getAddress($pconfig['gateway']))) { $input_errors[] = gettext('You can not assign the IPv4 Gateway to an IPv6 filter rule.'); } - if ($pconfig['ipprotocol'] == "inet" && !is_ipaddrv4(lookup_gateway_ip_by_name($pconfig['gateway']))) { + if ($pconfig['ipprotocol'] == "inet" && !is_ipaddrv4($gateways->getAddress($pconfig['gateway']))) { $input_errors[] = gettext('You can not assign the IPv6 Gateway to an IPv4 filter rule.'); } }