diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2016-02-09 14:44:30 -0500 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2016-02-09 14:44:30 -0500 |
commit | 8283e679c2fdf0ae4d918655c9feb0ade3351780 (patch) | |
tree | b146b94e1ad8dcc46363c49456bf4e8e56261bb9 /src/etc | |
parent | 97a4a8337479eecdb0ade7c8156e4fd26ef076fc (diff) | |
parent | 51869e0e682bffd574e3912653f99c15fece8485 (diff) | |
download | pfsense-8283e679c2fdf0ae4d918655c9feb0ade3351780.zip pfsense-8283e679c2fdf0ae4d918655c9feb0ade3351780.tar.gz |
Merge pull request #2600 from NOYB/Firewall_/_Rules_-_Page_Efficiency_Upgrade
Diffstat (limited to 'src/etc')
-rw-r--r-- | src/etc/inc/filter.inc | 36 | ||||
-rw-r--r-- | src/etc/inc/globals.inc | 2 | ||||
-rw-r--r-- | src/etc/inc/upgrade_config.inc | 41 |
3 files changed, 78 insertions, 1 deletions
diff --git a/src/etc/inc/filter.inc b/src/etc/inc/filter.inc index efa0d09..81b7a7a 100644 --- a/src/etc/inc/filter.inc +++ b/src/etc/inc/filter.inc @@ -4236,4 +4236,40 @@ function filter_get_antilockout_ports($wantarray = false) { } +/* get rule index within interface */ +function ifridx($if, $ridx) { + global $config; + + if ($ridx < 0) { + return $ridx; + } + + $i = $ifridx = 0; + foreach ($config['filter']['rule'] as $rulen => $filterent) { + if (($filterent['interface'] == $if && !isset($filterent['floating'])) || (isset($filterent['floating']) && "FloatingRules" == $if)) { + if ($i == $ridx) { + return $ifridx; + } + $ifridx++; + } + $i++; + } + return $i; +} + +/* display rules separators */ +function display_separator($separators, $nrules, $columns_in_table) { + if (!empty($separators)) { + foreach ($separators as $sepn => $separator) { + if ($separator['row'][0] == "fr" . $nrules) { + $cellcolor = $separator['color']; + print('<tr class="ui-sortable-handle separator">' . + '<td class="' . $cellcolor . '" colspan="' . ($columns_in_table -1) . '">' . '<span class="' . $cellcolor . '">' . $separator['text'] . '</span></td>' . + '<td class="' . $cellcolor . '"><a href="#"><i class="fa fa-trash no-confirm sepdel" title="delete this separator"></i></a></td>' . + '</tr>' . "\n"); + } + } + } +} + ?> diff --git a/src/etc/inc/globals.inc b/src/etc/inc/globals.inc index bcb4043..a9d2ef5 100644 --- a/src/etc/inc/globals.inc +++ b/src/etc/inc/globals.inc @@ -99,7 +99,7 @@ $g = array( "disablecrashreporter" => false, "crashreporterurl" => "https://crashreporter.pfsense.org/crash_reporter.php", "debug" => false, - "latest_config" => "14.2", + "latest_config" => "14.3", "nopkg_platforms" => array("cdrom"), "minimum_ram_warning" => "101", "minimum_ram_warning_text" => "128 MB", diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc index 0848d0e..1ccb6d9 100644 --- a/src/etc/inc/upgrade_config.inc +++ b/src/etc/inc/upgrade_config.inc @@ -4410,4 +4410,45 @@ function upgrade_141_to_142() { } } +function upgrade_142_to_143() { + global $config; + + /* Re-index firewall rule separators per interface */ + if (!empty($config['filter']['separator'])) { + foreach ($config['filter']['separator'] as $interface => $separators) { + + foreach ($separators as $sepn => $separator) { + + $seprow = substr($separator['row']['0'], 2); + $sepif = $separator['if']; + + // Determine position of separator within the interface rules. + $i = -1; $j = 0; + foreach ($config['filter']['rule'] as $rulen => $filterent) { + + if ($i == $seprow) { + // Set separator row to it's position within the interface rules. + $config['filter']['separator'][$sepif][$sepn]['row'] = 'fr' . $j; + continue 2; // Advance to next separator + } + + // Position within the interface rules. + if (($filterent['interface'] == $sepif && !isset($filterent['floating'])) || (isset($filterent['floating']) && "floatingrules" == $sepif)) { + $j++; + } + $i++; + } + } + } + } + + /* Re-index nat rule separators */ + if (!empty($config['nat']['separator'])) { + foreach ($config['nat']['separator'] as $sepn => $separator) { + $seprow = substr($separator['row']['0'], 2); + $config['nat']['separator'][$sepn]['row'] = 'fr' . ($seprow + 1); + } + } +} + ?> |