mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Revert broken OPT interface removal commit. This breaks configurations entirely, worse than just improperly shifting configuration items.
Ticket #1532
This commit is contained in:
parent
4297bc4954
commit
b73eda208e
@ -1337,12 +1337,10 @@ function generate_user_filter_rule_arr($rule, $ngcounter) {
|
||||
$line = generate_user_filter_rule($rule, $ngcounter);
|
||||
$ret['rule'] = $line;
|
||||
$ret['interface'] = $rule['interface'];
|
||||
if ($line[0] != '#') {
|
||||
if($rule['descr'] != "" and $line != "")
|
||||
$ret['descr'] = "label \"USER_RULE: " . str_replace('"', '', $rule['descr']) . "\"";
|
||||
else
|
||||
$ret['descr'] = "label \"USER_RULE\"";
|
||||
}
|
||||
if($rule['descr'] != "" and $line != "")
|
||||
$ret['descr'] = "label \"USER_RULE: " . str_replace('"', '', $rule['descr']) . "\"";
|
||||
else
|
||||
$ret['descr'] = "label \"USER_RULE\"";
|
||||
$ret['ackq'] = get_ack_queue($rule['interface']);
|
||||
|
||||
return $ret;
|
||||
@ -1395,7 +1393,7 @@ function generate_user_filter_rule($rule, $ngcounter) {
|
||||
|
||||
/* don't include disabled rules */
|
||||
if (isset($rule['disabled'])) {
|
||||
return "# rule " . $rule['descr'] . " disabled ";
|
||||
return "# rule " . $rule['descr'] . " disabled \n";
|
||||
}
|
||||
|
||||
$pptpdcfg = $config['pptpd'];
|
||||
@ -1433,8 +1431,6 @@ function generate_user_filter_rule($rule, $ngcounter) {
|
||||
if($config['pppoe']['n_pppoe_units'] <> "")
|
||||
$nif = $config['pppoe']['n_pppoe_units'];
|
||||
$ispppoe = true;
|
||||
} else if(!isset($rule['interface'])) {
|
||||
return '# Interface empty for rule: '.$rule['descr'];
|
||||
} else {
|
||||
|
||||
/* Check to see if the interface is opt and in our opt list */
|
||||
@ -2891,10 +2887,10 @@ anchor "imspector"
|
||||
anchor "miniupnpd"
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# default deny rules
|
||||
# default rules (just to be sure)
|
||||
#---------------------------------------------------------------------------
|
||||
block in $log quick all label "Default deny rule"
|
||||
block out $log quick all label "Default deny rule"
|
||||
block in $log quick all label "Default block all just to be sure."
|
||||
block out $log quick all label "Default block all just to be sure."
|
||||
|
||||
EOD;
|
||||
|
||||
@ -3298,4 +3294,4 @@ function return_vpn_subnet($adr) {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
@ -2452,15 +2452,21 @@ function cleanup_opt_interfaces_after_removal($opt_interface_num) {
|
||||
unlink_if_exists("{$g['tmp_path']}/config.cache");
|
||||
$config_file = file_get_contents("/cf/conf/config.xml");
|
||||
/* loop through and reassign deleted items */
|
||||
$orig = array('opt'.$opt_interface_num,'OPT'.$opt_interface_num);
|
||||
$repl = array('optXXXX','OPTXXXX');
|
||||
for ($i = $opt_interface_num+1; isset ($config['interfaces']['opt' . $i]); $i++) {
|
||||
array_push($orig,'opt'.$i);
|
||||
array_push($repl,'opt'.($i -1));
|
||||
array_push($orig,'OPT'.$i);
|
||||
array_push($repl,'OPT'.($i -1));
|
||||
for ($i = 500; isset ($config['interfaces']['opt' . $i]); $i--) {
|
||||
if ($i < $opt_interface_num)
|
||||
break;
|
||||
if ($i == $opt_interface_num) {
|
||||
/* item should be deleted */
|
||||
str_replace("opt" . $i, "optXXXX", $config_file);
|
||||
}
|
||||
}
|
||||
/* loop through and reassign optional items */
|
||||
for ($i = 500; isset ($config['interfaces']['opt' . $i]); $i--) {
|
||||
if ($i < $opt_interface_num)
|
||||
break;
|
||||
/* replace opt$i with $i -1 */
|
||||
str_replace("opt" . $i, "opt" . ($i -1), $config_file);
|
||||
}
|
||||
$config_file = str_replace($orig, $repl, $config_file);
|
||||
$fd = fopen("/cf/conf/config.xml", "w");
|
||||
fwrite($fd, $config_file);
|
||||
fclose($fd);
|
||||
@ -2484,7 +2490,6 @@ function cleanup_opt_interfaces_after_removal($opt_interface_num) {
|
||||
if($config['nat']['rule'][$x]['interface'] == "optXXXX")
|
||||
unset($config['nat']['rule'][$x]['interface']);
|
||||
}
|
||||
write_config();
|
||||
conf_mount_ro();
|
||||
config_unlock();
|
||||
return true;
|
||||
@ -3617,4 +3622,4 @@ function is_wan_interface_up($interface) {
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
@ -126,6 +126,22 @@ if ($_GET['act'] == "del") {
|
||||
|
||||
unset($config['interfaces'][$id]); /* delete the specified OPTn */
|
||||
|
||||
/* shift down other OPTn interfaces to get rid of holes */
|
||||
$i = substr($id, 3); /* the number of the OPTn port being deleted */
|
||||
$i++;
|
||||
|
||||
/* look at the following OPTn ports */
|
||||
while (is_array($config['interfaces']['opt' . $i])) {
|
||||
$config['interfaces']['opt' . ($i - 1)] =
|
||||
$config['interfaces']['opt' . $i];
|
||||
|
||||
if ($config['interfaces']['opt' . ($i - 1)]['descr'] == "OPT" . $i)
|
||||
$config['interfaces']['opt' . ($i - 1)]['descr'] = "OPT" . ($i - 1);
|
||||
|
||||
unset($config['interfaces']['opt' . $i]);
|
||||
$i++;
|
||||
}
|
||||
|
||||
write_config();
|
||||
|
||||
/* move all the interfaces up. for example:
|
||||
@ -280,4 +296,4 @@ if(file_exists("/var/run/interface_mismatch_reboot_needed"))
|
||||
exec("/etc/rc.reboot");
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user