summaryrefslogtreecommitdiffstats
path: root/src/etc/inc
diff options
context:
space:
mode:
authorNOYB <Al_Stu@Frontier.com>2016-02-08 18:35:06 -0800
committerNOYB <Al_Stu@Frontier.com>2016-02-08 22:11:43 -0800
commit8f56118348f9269a27764a0e1aa2b9f5a7be8c13 (patch)
treec2944905d5569e0b960715146e43bc87a73b1d80 /src/etc/inc
parentfdb83ce0555487a4ba076aa40f9a1a4886259f22 (diff)
downloadpfsense-8f56118348f9269a27764a0e1aa2b9f5a7be8c13.zip
pfsense-8f56118348f9269a27764a0e1aa2b9f5a7be8c13.tar.gz
Bring NAT separators into the fold.
Also add config empty test to upgrade script.
Diffstat (limited to 'src/etc/inc')
-rw-r--r--src/etc/inc/upgrade_config.inc44
1 files changed, 27 insertions, 17 deletions
diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc
index d3abb0b..1ccb6d9 100644
--- a/src/etc/inc/upgrade_config.inc
+++ b/src/etc/inc/upgrade_config.inc
@@ -4412,33 +4412,43 @@ function upgrade_141_to_142() {
function upgrade_142_to_143() {
global $config;
- /* Index firewall rule separators per interface */
- foreach ($config['filter']['separator'] as $interface => $separators) {
+ /* Re-index firewall rule separators per interface */
+ if (!empty($config['filter']['separator'])) {
+ foreach ($config['filter']['separator'] as $interface => $separators) {
- foreach ($separators as $sepn => $separator) {
+ foreach ($separators as $sepn => $separator) {
- $seprow = substr($separator['row']['0'], 2);
- $sepif = $separator['if'];
+ $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) {
+ // 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
- }
+ 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++;
+ // Position within the interface rules.
+ if (($filterent['interface'] == $sepif && !isset($filterent['floating'])) || (isset($filterent['floating']) && "floatingrules" == $sepif)) {
+ $j++;
+ }
+ $i++;
}
- $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);
+ }
+ }
}
?>
OpenPOWER on IntegriCloud