mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Resolve alias value for rules
This commit is contained in:
parent
8336a68a2c
commit
27ff8a3ced
@ -526,13 +526,13 @@ function filter_nat_rules_generate() {
|
||||
|
||||
/* if item is an alias, expand */
|
||||
if(alias_expand($rule['external-port']))
|
||||
$extport[0] = alias_expand($rule['external-port']);
|
||||
else
|
||||
$extport[0] = alias_expand_value($rule['external-port']);
|
||||
else
|
||||
$extport = explode("-", $rule['external-port']);
|
||||
|
||||
/* if item is an alias, expand */
|
||||
if(alias_expand($rule['local-port']))
|
||||
$localport = alias_expand($rule['local-port']);
|
||||
$localport = alias_expand_value($rule['local-port']);
|
||||
else
|
||||
$localport = $rule['local-port'];
|
||||
|
||||
@ -560,24 +560,15 @@ function filter_nat_rules_generate() {
|
||||
|
||||
$lanif = $lancfg['if'];
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Expand aliases
|
||||
* XXX: may want to integrate this into pf macros
|
||||
*/
|
||||
if(alias_expand($extport[0]))
|
||||
$extport[0] = alias_expand($extport[0]);
|
||||
if(alias_expand($extport[1]))
|
||||
$extport[1] = alias_expand($extport[1]);
|
||||
if(alias_expand($target))
|
||||
$target = alias_expand($target);
|
||||
if(alias_expand($localport))
|
||||
$localport = alias_expand($localport);
|
||||
if(alias_expand($extaddr))
|
||||
$extaddr = alias_expand($extaddr);
|
||||
|
||||
|
||||
if ((!$extport[1]) || ($extport[0] == $extport[1])) {
|
||||
if($rule['protocol'] == "tcp/udp")
|
||||
$natrules .=
|
||||
|
||||
@ -347,6 +347,17 @@ function is_alias($name) {
|
||||
global $aliastable;
|
||||
|
||||
return isset($aliastable[$name]);
|
||||
}
|
||||
|
||||
function alias_expand_value($name) {
|
||||
|
||||
global $aliastable, $config;
|
||||
|
||||
foreach($config['aliases']['alias'] as $alias) {
|
||||
if($alias['name'] == $name)
|
||||
return $alias['address'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* expand a host or network alias, if necessary */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user