summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2011-03-18 22:09:33 +0000
committerErmal <eri@pfsense.org>2011-03-18 22:11:05 +0000
commitb2305621e59b330290d337e7855acb8e90b6dd65 (patch)
tree9530d4902235d420bd8f6a16c794befda9bcf1cc /etc
parente9e295f7c0c2e8a3c156a79db1311cae107c884c (diff)
downloadpfsense-b2305621e59b330290d337e7855acb8e90b6dd65.zip
pfsense-b2305621e59b330290d337e7855acb8e90b6dd65.tar.gz
Generate the config file in a variable then write it as a whole to a file.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/filter.inc2
-rw-r--r--etc/inc/system.inc34
2 files changed, 15 insertions, 21 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index 8fd042f..41e3708 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -1913,8 +1913,6 @@ function filter_generate_user_rule($rule) {
$aline['flags'] .= "max-src-conn-rate " . $rule['max-src-conn-rate'] . " ";
$aline['flags'] .= "/" . $rule['max-src-conn-rates'] . ", overload <virusprot> flush global ";
}
- if(!empty($aline['divert']))
- $aline['flags'] .= "max-packets 10 ";
$aline['flags'] .= " ) ";
}
diff --git a/etc/inc/system.inc b/etc/inc/system.inc
index 4a8214d..4821a8a 100644
--- a/etc/inc/system.inc
+++ b/etc/inc/system.inc
@@ -1147,22 +1147,13 @@ function system_timezone_configure() {
function system_ntp_configure() {
global $config, $g;
- $syscfg =& $config['system'];
-
- /* open configuration for wrting or bail */
- $fd = fopen("{$g['varetc_path']}/ntpd.conf","w");
- if(!$fd) {
- log_error("Could not open {$g['varetc_path']}/ntpd.conf for writing");
- return;
- }
-
- fwrite($fd, "# \n");
- fwrite($fd, "# pfSense OpenNTPD configuration file \n");
- fwrite($fd, "# \n\n");
+ $ntpcfg = "# \n";
+ $ntpcfg .= "# pfSense OpenNTPD configuration file \n";
+ $ntpcfg .= "# \n\n";
/* foreach through servers and write out to ntpd.conf */
- foreach (explode(' ', $syscfg['timeservers']) as $ts)
- fwrite($fd, "servers {$ts}\n");
+ foreach (explode(' ', $config['system']['timeservers']) as $ts)
+ $ntpcfg .= "servers {$ts}\n";
/* Setup listener(s) if the user has configured one */
if ($config['installedpackages']['openntpd']) {
@@ -1175,12 +1166,19 @@ function system_ntp_configure() {
$ips = array_map('find_interface_ip', $ifaces);
foreach ($ips as $ip) {
if (is_ipaddr($ip))
- fwrite($fd, "listen on $ip\n");
+ $ntpdcfg .= "listen on $ip\n";
}
}
}
+ $ntpdcfg .= "\n";
- fwrite($fd, "\n");
+ /* open configuration for wrting or bail */
+ $fd = fopen("{$g['varetc_path']}/ntpd.conf","w");
+ if(!$fd) {
+ log_error("Could not open {$g['varetc_path']}/ntpd.conf for writing");
+ return;
+ }
+ fwrite($fd, $ntpcfg);
/* slurp! */
fclose($fd);
@@ -1208,13 +1206,11 @@ function system_ntp_configure() {
function sync_system_time() {
global $config, $g;
- $syscfg = $config['system'];
-
if ($g['booting'])
echo "Syncing system time before startup...";
/* foreach through servers and write out to ntpd.conf */
- foreach (explode(' ', $syscfg['timeservers']) as $ts) {
+ foreach (explode(' ', $config['system']['timeservers']) as $ts) {
mwexec("/usr/sbin/ntpdate -s $ts");
}
OpenPOWER on IntegriCloud