File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
src/opnsense/mvc/app/library/OPNsense/Firewall Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -72,10 +72,18 @@ private function parseNatRules()
72
72
} elseif (empty ($ rule ['target ' ])) {
73
73
$ interf = $ rule ['interface ' ];
74
74
if (!empty ($ this ->interfaceMapping [$ interf ])) {
75
- if (($ this ->isIpV4 ($ rule ) && !empty ($ this ->interfaceMapping [$ interf ]['ifconfig ' ]['ipv4 ' ])) ||
76
- (!$ this ->isIpV4 ($ rule ) && !empty ($ this ->interfaceMapping [$ interf ]['ifconfig ' ]['ipv6 ' ]))
75
+ $ interf_settings = $ this ->interfaceMapping [$ interf ];
76
+ if ((($ this ->isIpV4 ($ rule ) && !empty ($ interf_settings ['ifconfig ' ]['ipv4 ' ])) ||
77
+ (!$ this ->isIpV4 ($ rule ) && !empty ($ interf_settings ['ifconfig ' ]['ipv6 ' ])))
78
+ && (!empty ($ rule ['poolopts ' ]) || $ rule ['poolopts ' ] != 'round-robin ' )
77
79
) {
78
- $ rule ['target ' ] = $ this ->interfaceMapping [$ interf ]['if ' ];
80
+ // When pool options are set, we may not specify our interface as a list
81
+ // (which doesn't require the same network validations as single items do).
82
+ $ rule ['target ' ] = "{$ interf_settings ['if ' ]}" ;
83
+ } elseif (!empty ($ interf_settings ['if ' ])) {
84
+ // Define target as list, to prevent "no IP address found for *Interface*" when pf can't
85
+ // find an address on the interface for the same protocol family.
86
+ $ rule ['target ' ] = "( {$ interf_settings ['if ' ]}) " ;
79
87
}
80
88
}
81
89
if (empty ($ rule ['target ' ])) {
You can’t perform that action at this time.
0 commit comments