Do not directly print out a message when checking the interfaces, instead saving the list to use later. Display this list before the interface mismatch message. Fixes #2468 and fixes #2531

This commit is contained in:
Erik Fonnesbeck 2012-07-02 03:51:01 -06:00
parent 58d609d420
commit e0a45ce03c
2 changed files with 10 additions and 2 deletions

View File

@ -1473,6 +1473,7 @@ function is_interface_mismatch() {
$do_assign = false;
$i = 0;
$missing_interfaces = array();
if (is_array($config['interfaces'])) {
foreach ($config['interfaces'] as $ifname => $ifcfg) {
if (preg_match("/^enc|^cua|^tun|^tap|^l2tp|^pptp|^ppp|^ovpn|^gif|^gre|^lagg|^bridge|vlan|_wlan/i", $ifcfg['if'])) {
@ -1481,7 +1482,7 @@ function is_interface_mismatch() {
continue;
}
else if (does_interface_exist($ifcfg['if']) == false) {
echo "Warning: Interface '{$ifcfg['if']}' does not exist.\n";
$missing_interfaces[] = $ifcfg['if'];
$do_assign = true;
} else
$i++;
@ -1491,7 +1492,12 @@ function is_interface_mismatch() {
if ($g['minimum_nic_count'] > $i) {
$do_assign = true;
} else if (file_exists("{$g['tmp_path']}/assign_complete"))
$do_assign = false;
$do_assign = false;
if (!empty($missing_interfaces) && $do_assign)
file_put_contents("{$g['tmp_path']}/missing_interfaces", implode(' ', $missing_interfaces));
else
@unlink("{$g['tmp_path']}/missing_interfaces");
return $do_assign;
}

View File

@ -190,6 +190,8 @@ if($g['platform'] == "jail") {
*/
while(is_interface_mismatch() == true) {
led_assigninterfaces();
if (file_exists("{$g['tmp_path']}/missing_interfaces"))
echo "Warning: Configuration references interfaces that do not exist: " . file_get_contents("{$g['tmp_path']}/missing_interfaces") . "\n";
echo "\nNetwork interface mismatch -- Running interface assignment option.\n";
$ifaces = get_interface_list();
if (is_array($ifaces)) {