Revision a3bac4ce
Added by Ermal LUÇI over 14 years ago
etc/inc/upgrade_config.inc | ||
---|---|---|
2206 | 2206 |
|
2207 | 2207 |
/* Convert NAT 1:1 rules */ |
2208 | 2208 |
if (is_array($config['nat']['onetoone'])) { |
2209 |
$a_nat = &$config['nat']['onetoone']; |
|
2210 |
|
|
2211 |
foreach ($a_nat as &$natent) { |
|
2209 |
foreach ($config['nat']['onetoone'] as $nidx => $natent) { |
|
2212 | 2210 |
if ($natent['subnet'] == 32) |
2213 |
$natent['source'] = array("address" => $natent['internal']);
|
|
2211 |
$config['nat']['onetoone'][$nidx]['source'] = array("address" => $natent['internal']);
|
|
2214 | 2212 |
else |
2215 |
$natent['source'] = array("address" => $natent['internal'] . "/" . $natent['subnet']);
|
|
2213 |
$config['nat']['onetoone'][$nidx]['source'] = array("address" => $natent['internal'] . "/" . $natent['subnet']);
|
|
2216 | 2214 |
|
2217 |
$natent['destination'] = array("any" => true);
|
|
2215 |
$config['nat']['onetoone'][$nidx]['destination'] = array("any" => true);
|
|
2218 | 2216 |
|
2219 |
unset($natent['internal']);
|
|
2220 |
unset($natent['subnet']);
|
|
2217 |
unset($config['nat']['onetoone'][$nidx]['internal']);
|
|
2218 |
unset($config['nat']['onetoone'][$nidx]['subnet']);
|
|
2221 | 2219 |
} |
2222 | 2220 |
|
2223 | 2221 |
unset($natent); |
Also available in: Unified diff
Do not rely on php new foreach by reference and use the old method of chaning array members by using full path. This fixes nat 1:1 upgrades.