Commit bdfbe06f authored by Ad Schellevis's avatar Ad Schellevis

(legacy) cleanups system.inc

parent 207b3f70
...@@ -258,7 +258,7 @@ function system_hosts_generate() ...@@ -258,7 +258,7 @@ function system_hosts_generate()
$lhosts = ""; $lhosts = "";
$dhosts = ""; $dhosts = "";
if ($config['interfaces']['lan']) { if (isset($config['interfaces']['lan'])) {
$cfgip = get_interface_ip("lan"); $cfgip = get_interface_ip("lan");
if (is_ipaddr($cfgip)) if (is_ipaddr($cfgip))
$hosts .= "{$cfgip} {$syscfg['hostname']}.{$syscfg['domain']} {$syscfg['hostname']}\n"; $hosts .= "{$cfgip} {$syscfg['hostname']}.{$syscfg['domain']} {$syscfg['hostname']}\n";
...@@ -445,13 +445,13 @@ function system_routing_configure($interface = '') ...@@ -445,13 +445,13 @@ function system_routing_configure($interface = '')
break; break;
} }
} }
if ($foundgw == false) { if (!$foundgw) {
$defaultif = get_real_interface("wan"); $defaultif = get_real_interface("wan");
$interfacegw = "wan"; $interfacegw = "wan";
$gatewayip = get_interface_gateway("wan"); $gatewayip = get_interface_gateway("wan");
@touch("/tmp/{$defaultif}_defaultgw"); @touch("/tmp/{$defaultif}_defaultgw");
} }
if ($foundgwv6 == false) { if (!$foundgwv6) {
$defaultifv6 = get_real_interface("wan"); $defaultifv6 = get_real_interface("wan");
$interfacegwv6 = "wan"; $interfacegwv6 = "wan";
$gatewayipv6 = get_interface_gateway_v6("wan"); $gatewayipv6 = get_interface_gateway_v6("wan");
...@@ -671,6 +671,7 @@ function system_syslogd_get_remote_servers($syslogcfg, $facility = "*.*") { ...@@ -671,6 +671,7 @@ function system_syslogd_get_remote_servers($syslogcfg, $facility = "*.*") {
function system_syslogd_start() function system_syslogd_start()
{ {
global $config, $g; global $config, $g;
$retval = null;
/* XXX temporary hook for newsyslog.conf regeneration */ /* XXX temporary hook for newsyslog.conf regeneration */
configd_run('template reload OPNsense.Syslog'); configd_run('template reload OPNsense.Syslog');
...@@ -940,9 +941,12 @@ function system_generate_lighty_config( ...@@ -940,9 +941,12 @@ function system_generate_lighty_config(
$captiveportal = ',"mod_evasive"'; $captiveportal = ',"mod_evasive"';
$http_rewrite_rules = "url.rewrite-once = ( \"(.*captiveportal.*)\" => \"$1\", \"(.*)\" => \"/index.php?zone={$captive_portal}&redirurl=$1\" )\n"; $http_rewrite_rules = "url.rewrite-once = ( \"(.*captiveportal.*)\" => \"$1\", \"(.*)\" => \"/index.php?zone={$captive_portal}&redirurl=$1\" )\n";
$maxprocperip = $config['captiveportal'][$captive_portal]['maxprocperip']; if (!isset($config['captiveportal'][$captive_portal]['maxprocperip']) || empty($config['captiveportal'][$captive_portal]['maxprocperip'])) {
if (empty($maxprocperip))
$maxprocperip = 10; $maxprocperip = 10;
} else {
$maxprocperip = $config['captiveportal'][$captive_portal]['maxprocperip'];
}
$captive_portal_mod_evasive = "evasive.max-conns-per-ip = {$maxprocperip}"; $captive_portal_mod_evasive = "evasive.max-conns-per-ip = {$maxprocperip}";
$server_upload_dirs = "server.upload-dirs = ( \"/tmp/captiveportal/\" )\n"; $server_upload_dirs = "server.upload-dirs = ( \"/tmp/captiveportal/\" )\n";
...@@ -1239,8 +1243,11 @@ EOD; ...@@ -1239,8 +1243,11 @@ EOD;
// Add HTTP to HTTPS redirect // Add HTTP to HTTPS redirect
if ($captive_portal === false && $config['system']['webgui']['protocol'] == "https" && !isset($config['system']['webgui']['disablehttpredirect'])) { if ($captive_portal === false && $config['system']['webgui']['protocol'] == "https" && !isset($config['system']['webgui']['disablehttpredirect'])) {
if($lighty_port != "443") if($lighty_port != "443") {
$redirectport = ":{$lighty_port}"; $redirectport = ":{$lighty_port}";
} else {
$redirectport = "";
}
$lighty_config .= <<<EOD $lighty_config .= <<<EOD
\$SERVER["socket"] == ":80" { \$SERVER["socket"] == ":80" {
\$HTTP["host"] =~ "(.*)" { \$HTTP["host"] =~ "(.*)" {
...@@ -1711,14 +1718,6 @@ function system_disable_arp_wrong_if() ...@@ -1711,14 +1718,6 @@ function system_disable_arp_wrong_if()
)); ));
} }
function system_enable_arp_wrong_if()
{
set_sysctl(array(
"net.link.ether.inet.log_arp_wrong_iface" => "1",
"net.link.ether.inet.log_arp_movements" => "1"
));
}
function enable_watchdog() function enable_watchdog()
{ {
global $config; global $config;
......
...@@ -33,6 +33,15 @@ require_once("guiconfig.inc"); ...@@ -33,6 +33,15 @@ require_once("guiconfig.inc");
require_once("functions.inc"); require_once("functions.inc");
require_once("filter.inc"); require_once("filter.inc");
function system_enable_arp_wrong_if()
{
set_sysctl(array(
"net.link.ether.inet.log_arp_wrong_iface" => "1",
"net.link.ether.inet.log_arp_movements" => "1"
));
}
$pconfig['ipv6nat_enable'] = isset($config['diag']['ipv6nat']['enable']); $pconfig['ipv6nat_enable'] = isset($config['diag']['ipv6nat']['enable']);
$pconfig['ipv6nat_ipaddr'] = $config['diag']['ipv6nat']['ipaddr']; $pconfig['ipv6nat_ipaddr'] = $config['diag']['ipv6nat']['ipaddr'];
$pconfig['ipv6allow'] = isset($config['system']['ipv6allow']); $pconfig['ipv6allow'] = isset($config['system']['ipv6allow']);
......
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