mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 17:44:41 +00:00
Firwall/Nat, when using "Reflection for port forwards" we should only add nat rules for interfaces with configured addresses.
Although this looks a bit duplicate at first, when the nat interface itself (e.g. openvpn) is missing a network, we should add a rdr, but skip the nat rule. closes https://github.com/opnsense/core/issues/3023
This commit is contained in:
parent
6b848aba4a
commit
d8f23d5210
@ -156,8 +156,13 @@ class ForwardRule extends Rule
|
||||
$rule = $tmp;
|
||||
// automatically generate nat rule when enablenatreflectionhelper is set
|
||||
if (!$rule['disabled'] && empty($rule['nordr']) && !empty($rule['enablenatreflectionhelper'])) {
|
||||
$rule['rule_types'][] = "rdr_nat";
|
||||
$rule['staticnatport'] = !empty($rule['staticnatport']);
|
||||
if (!empty($this->interfaceMapping[$rule['interface']]) && (
|
||||
!empty($this->interfaceMapping[$rule['interface']]['ifconfig']['ipv4']) ||
|
||||
!empty($this->interfaceMapping[$rule['interface']]['ifconfig']['ipv6'])
|
||||
)) {
|
||||
$rule['rule_types'][] = "rdr_nat";
|
||||
$rule['staticnatport'] = !empty($rule['staticnatport']);
|
||||
}
|
||||
}
|
||||
$rule['interface'] = $interf;
|
||||
yield $rule;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user