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.'); } }