Commit f3597390 authored by Franco Fichtner's avatar Franco Fichtner

src: fix a few crash reports

parent 4f5144f9
...@@ -73,6 +73,7 @@ function unbound_optimization() { ...@@ -73,6 +73,7 @@ function unbound_optimization() {
* Larger socket buffer for busy servers * Larger socket buffer for busy servers
* Check that it is set to 4MB (by default the OS has it configured to 4MB) * Check that it is set to 4MB (by default the OS has it configured to 4MB)
*/ */
if (isset($config['sysctl']['item'])) {
foreach ($config['sysctl']['item'] as $tunable) { foreach ($config['sysctl']['item'] as $tunable) {
if ($tunable['tunable'] == 'kern.ipc.maxsockbuf') { if ($tunable['tunable'] == 'kern.ipc.maxsockbuf') {
$so = floor(($tunable['value']/1024/1024)-1); $so = floor(($tunable['value']/1024/1024)-1);
...@@ -88,9 +89,9 @@ function unbound_optimization() { ...@@ -88,9 +89,9 @@ function unbound_optimization() {
if (!isset($optimization['so_rcvbuf'])) { if (!isset($optimization['so_rcvbuf'])) {
$optimization['so_rcvbuf'] = "#so-rcvbuf: 4m"; $optimization['so_rcvbuf'] = "#so-rcvbuf: 4m";
} }
}
return $optimization; return $optimization;
} }
function bootstrap_unbound_root() function bootstrap_unbound_root()
...@@ -701,7 +702,7 @@ function unbound_acls_config() { ...@@ -701,7 +702,7 @@ function unbound_acls_config() {
} }
// Configure the custom ACLs // Configure the custom ACLs
if (is_array($config['unbound']['acls'])) { if (isset($config['unbound']['acls'])) {
foreach($config['unbound']['acls'] as $unbound_acl) { foreach($config['unbound']['acls'] as $unbound_acl) {
$aclcfg .= "#{$unbound_acl['aclname']}\n"; $aclcfg .= "#{$unbound_acl['aclname']}\n";
foreach($unbound_acl['row'] as $network) { foreach($unbound_acl['row'] as $network) {
......
...@@ -34,6 +34,7 @@ require_once("interfaces.inc"); ...@@ -34,6 +34,7 @@ require_once("interfaces.inc");
function interfaces_carp_set_maintenancemode($carp_maintenancemode) function interfaces_carp_set_maintenancemode($carp_maintenancemode)
{ {
global $config; global $config;
if (isset($config["virtualip_carp_maintenancemode"]) && $carp_maintenancemode == false) { if (isset($config["virtualip_carp_maintenancemode"]) && $carp_maintenancemode == false) {
unset($config["virtualip_carp_maintenancemode"]); unset($config["virtualip_carp_maintenancemode"]);
write_config("Leave CARP maintenance mode"); write_config("Leave CARP maintenance mode");
...@@ -42,12 +43,14 @@ function interfaces_carp_set_maintenancemode($carp_maintenancemode) ...@@ -42,12 +43,14 @@ function interfaces_carp_set_maintenancemode($carp_maintenancemode)
write_config("Enter CARP maintenance mode"); write_config("Enter CARP maintenance mode");
} }
if (isset($config['virtualip']['vip'])) {
$viparr = &$config['virtualip']['vip']; $viparr = &$config['virtualip']['vip'];
foreach ($viparr as $vip) { foreach ($viparr as $vip) {
if ($vip['mode'] == "carp") { if ($vip['mode'] == 'carp') {
interface_carp_configure($vip); interface_carp_configure($vip);
} }
} }
}
} }
// init $config['virtualip']['vip'] // init $config['virtualip']['vip']
......
...@@ -212,9 +212,10 @@ function show_advanced_dns() { ...@@ -212,9 +212,10 @@ function show_advanced_dns() {
<option value="" <?php if (empty($pconfig['active_interface']) || empty($pconfig['active_interface'][0])) echo 'selected="selected"'; ?>>All</option> <option value="" <?php if (empty($pconfig['active_interface']) || empty($pconfig['active_interface'][0])) echo 'selected="selected"'; ?>>All</option>
<?php <?php
foreach ($interface_addresses as $laddr): foreach ($interface_addresses as $laddr):
$selected = ""; $selected = '';
if (in_array($laddr['value'], $pconfig['active_interface'])) if (!empty($pconfig['active_interface']) && in_array($laddr['value'], $pconfig['active_interface'])) {
$selected = 'selected="selected"'; $selected = 'selected="selected"';
}
?> ?>
<option value="<?=$laddr['value'];?>" <?=$selected;?>> <option value="<?=$laddr['value'];?>" <?=$selected;?>>
<?=htmlspecialchars($laddr['name']);?> <?=htmlspecialchars($laddr['name']);?>
...@@ -237,9 +238,10 @@ function show_advanced_dns() { ...@@ -237,9 +238,10 @@ function show_advanced_dns() {
<option value="" <?php if (empty($pconfig['outgoing_interface']) || empty($pconfig['outgoing_interface'][0])) echo 'selected="selected"'; ?>>All</option> <option value="" <?php if (empty($pconfig['outgoing_interface']) || empty($pconfig['outgoing_interface'][0])) echo 'selected="selected"'; ?>>All</option>
<?php <?php
foreach ($interface_addresses as $laddr): foreach ($interface_addresses as $laddr):
$selected = ""; $selected = '';
if (in_array($laddr['value'], $pconfig['outgoing_interface'])) if (!empty($pconfig['outgoing_interface']) && in_array($laddr['value'], $pconfig['outgoing_interface'])) {
$selected = 'selected="selected"'; $selected = 'selected="selected"';
}
?> ?>
<option value="<?=$laddr['value'];?>" <?=$selected;?>> <option value="<?=$laddr['value'];?>" <?=$selected;?>>
<?=htmlspecialchars($laddr['name']);?> <?=htmlspecialchars($laddr['name']);?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment