diff options
author | Bill Marquette <billm@pfsense.org> | 2007-10-17 23:51:26 +0000 |
---|---|---|
committer | Bill Marquette <billm@pfsense.org> | 2007-10-17 23:51:26 +0000 |
commit | 639aaa954cc2c87aa0d85fef1659d3f0c5afdcb9 (patch) | |
tree | 03ff1dea7673eb4dced6be43c8fd6edbe945eb86 /etc | |
parent | 468b0d65e76d31b6faa9f1d46c2f5e655d91d7a6 (diff) | |
download | pfsense-639aaa954cc2c87aa0d85fef1659d3f0c5afdcb9.zip pfsense-639aaa954cc2c87aa0d85fef1659d3f0c5afdcb9.tar.gz |
MFC of change [19782] per request from sullrich@
Scale state table size with memory, never allocate more than 10% system ram, this leads to 12K states on 128M and 102K on 1G systems - this should be a good default
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/filter.inc | 3 | ||||
-rw-r--r-- | etc/inc/pfsense-utils.inc | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 00cfc93..653ccd7 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -177,6 +177,9 @@ function filter_configure_sync() { if ($config['system']['maximumstates'] <> "" && is_numeric($config['system']['maximumstates'])) { /* User defined maximum states in Advanced menu. */ $rules .= "set limit states {$config['system']['maximumstates']}\n"; + } else { + $max_states = pfsense_default_state_size(); + $rules .= "set limit states {$max_states}\n"; } $rules .= "\n"; diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index a295dc4..51e3489 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -3750,4 +3750,13 @@ function is_fqdn($fqdn) { return($hostname); } +function pfsense_default_state_size() { + /* get system memory amount */ + $memory = get_memory(); + $avail = $memory[0]; + /* Be cautious and only allocate 10% of system memory to the state table */ + $max_states = (int) ($avail/10)*1000; + return $max_states; +} + ?> |