Commit f3597390 authored by Franco Fichtner's avatar Franco Fichtner

src: fix a few crash reports

parent 4f5144f9
......@@ -73,24 +73,25 @@ function unbound_optimization() {
* Larger socket buffer for busy servers
* Check that it is set to 4MB (by default the OS has it configured to 4MB)
*/
foreach ($config['sysctl']['item'] as $tunable) {
if ($tunable['tunable'] == 'kern.ipc.maxsockbuf') {
$so = floor(($tunable['value']/1024/1024)-1);
// Check to ensure that the number is not a negative
if ($so > 0) {
$optimization['so_rcvbuf'] = "so-rcvbuf: {$so}m";
} else {
unset($optimization['so_rcvbuf']);
if (isset($config['sysctl']['item'])) {
foreach ($config['sysctl']['item'] as $tunable) {
if ($tunable['tunable'] == 'kern.ipc.maxsockbuf') {
$so = floor(($tunable['value']/1024/1024)-1);
// Check to ensure that the number is not a negative
if ($so > 0) {
$optimization['so_rcvbuf'] = "so-rcvbuf: {$so}m";
} else {
unset($optimization['so_rcvbuf']);
}
}
}
}
// Safety check in case kern.ipc.maxsockbuf is not available.
if (!isset($optimization['so_rcvbuf'])) {
$optimization['so_rcvbuf'] = "#so-rcvbuf: 4m";
// Safety check in case kern.ipc.maxsockbuf is not available.
if (!isset($optimization['so_rcvbuf'])) {
$optimization['so_rcvbuf'] = "#so-rcvbuf: 4m";
}
}
return $optimization;
}
function bootstrap_unbound_root()
......@@ -701,7 +702,7 @@ function unbound_acls_config() {
}
// Configure the custom ACLs
if (is_array($config['unbound']['acls'])) {
if (isset($config['unbound']['acls'])) {
foreach($config['unbound']['acls'] as $unbound_acl) {
$aclcfg .= "#{$unbound_acl['aclname']}\n";
foreach($unbound_acl['row'] as $network) {
......
......@@ -34,6 +34,7 @@ require_once("interfaces.inc");
function interfaces_carp_set_maintenancemode($carp_maintenancemode)
{
global $config;
if (isset($config["virtualip_carp_maintenancemode"]) && $carp_maintenancemode == false) {
unset($config["virtualip_carp_maintenancemode"]);
write_config("Leave CARP maintenance mode");
......@@ -42,10 +43,12 @@ function interfaces_carp_set_maintenancemode($carp_maintenancemode)
write_config("Enter CARP maintenance mode");
}
$viparr = &$config['virtualip']['vip'];
foreach ($viparr as $vip) {
if ($vip['mode'] == "carp") {
interface_carp_configure($vip);
if (isset($config['virtualip']['vip'])) {
$viparr = &$config['virtualip']['vip'];
foreach ($viparr as $vip) {
if ($vip['mode'] == 'carp') {
interface_carp_configure($vip);
}
}
}
}
......
......@@ -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>
<?php
foreach ($interface_addresses as $laddr):
$selected = "";
if (in_array($laddr['value'], $pconfig['active_interface']))
$selected = '';
if (!empty($pconfig['active_interface']) && in_array($laddr['value'], $pconfig['active_interface'])) {
$selected = 'selected="selected"';
}
?>
<option value="<?=$laddr['value'];?>" <?=$selected;?>>
<?=htmlspecialchars($laddr['name']);?>
......@@ -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>
<?php
foreach ($interface_addresses as $laddr):
$selected = "";
if (in_array($laddr['value'], $pconfig['outgoing_interface']))
$selected = 'selected="selected"';
$selected = '';
if (!empty($pconfig['outgoing_interface']) && in_array($laddr['value'], $pconfig['outgoing_interface'])) {
$selected = 'selected="selected"';
}
?>
<option value="<?=$laddr['value'];?>" <?=$selected;?>>
<?=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