Routing, gateways. ditch lookup_gateway_ip_by_name() usage from firewall_rules_edit.php, for https://github.com/opnsense/core/issues/2279

This commit is contained in:
Ad Schellevis 2019-04-12 15:05:07 +02:00
parent bb1f0151d6
commit 49388ca2c6

View File

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