diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2016-05-12 11:40:33 -0400 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2016-05-12 11:41:49 -0400 |
commit | 60ebb4736c38669464c48497914baf8cbdb8849e (patch) | |
tree | 1cf2d07c8a462cbc587b2a4822a629f7075c691f /src | |
parent | eb29a44aab5f163c97d41e5b4ecb5d89a083742d (diff) | |
download | pfsense-60ebb4736c38669464c48497914baf8cbdb8849e.zip pfsense-60ebb4736c38669464c48497914baf8cbdb8849e.tar.gz |
Add alias display to target host and target port columns
(cherry picked from commit 474e70a2d178de50060c6e5f1114bb5b6963a6b6)
Diffstat (limited to 'src')
-rw-r--r-- | src/usr/local/www/firewall_nat.php | 49 | ||||
-rw-r--r-- | src/usr/local/www/guiconfig.inc | 8 |
2 files changed, 46 insertions, 11 deletions
diff --git a/src/usr/local/www/firewall_nat.php b/src/usr/local/www/firewall_nat.php index e7f370e..6158c02 100644 --- a/src/usr/local/www/firewall_nat.php +++ b/src/usr/local/www/firewall_nat.php @@ -264,11 +264,22 @@ foreach ($a_nat as $natent): display_separator($separators, $nnats, $columns_in_table); } + $localport = $natent['local-port']; + + list($dstbeginport, $dstendport) = explode("-", $natent['destination']['port']); + + if ($dstendport) { + $localendport = $natent['local-port'] + $dstendport - $dstbeginport; + $localport .= '-' . $localendport; + } + $alias = rule_columns_with_alias( $natent['source']['address'], pprint_port($natent['source']['port']), $natent['destination']['address'], - pprint_port($natent['destination']['port']) + pprint_port($natent['destination']['port']), + $natent['target'], + $localport ); /* if user does not have access to edit an interface skip on to the next record */ @@ -397,22 +408,40 @@ foreach ($a_nat as $natent): endif; ?> </td> + <td> +<?php + if (isset($alias['target'])): +?> + <a href="/firewall_aliases_edit.php?id=<?=$alias['target']?>" data-toggle="popover" data-trigger="hover focus" title="<?=gettext('Alias details')?>" data-content="<?=alias_info_popup($alias['target'])?>" data-html="true"> +<?php + endif; +?> - <td > <?=str_replace('_', ' ', htmlspecialchars($natent['target']))?> +<?php + if (isset($alias['target'])): +?> + </a> +<?php + endif; +?> </td> <td> <?php - $localport = $natent['local-port']; - - list($dstbeginport, $dstendport) = explode("-", $natent['destination']['port']); - - if ($dstendport) { - $localendport = $natent['local-port'] + $dstendport - $dstbeginport; - $localport .= '-' . $localendport; - } + if (isset($alias['targetport'])): +?> + <a href="/firewall_aliases_edit.php?id=<?=$alias['targetport']?>" data-toggle="popover" data-trigger="hover focus" title="<?=gettext('Alias details')?>" data-content="<?=alias_info_popup($alias['targetport'])?>" data-html="true"> +<?php + endif; ?> <?=str_replace('_', ' ', htmlspecialchars(pprint_port($localport)))?> +<?php + if (isset($alias['targetport'])): +?> + </a> +<?php + endif; +?> </td> <td> diff --git a/src/usr/local/www/guiconfig.inc b/src/usr/local/www/guiconfig.inc index 7e1645a..6fe86c0 100644 --- a/src/usr/local/www/guiconfig.inc +++ b/src/usr/local/www/guiconfig.inc @@ -1129,7 +1129,7 @@ function alias_info_popup($alias_id) { return $content; } -function rule_columns_with_alias($src, $srcport, $dst, $dstport) { +function rule_columns_with_alias($src, $srcport, $dst, $dstport, $target, $targetport) { global $config; if ($config['aliases']['alias'] == "" || !is_array($config['aliases']['alias'])) { @@ -1150,6 +1150,12 @@ function rule_columns_with_alias($src, $srcport, $dst, $dstport) { if ($alias_name['name'] == $dstport) { $columns['dstport'] = $alias_id; } + if ($alias_name['name'] == $target) { + $columns['target'] = $alias_id; + } + if ($alias_name['name'] == $targetport) { + $columns['targetport'] = $alias_id; + } } return $columns; |