File tree Expand file tree Collapse file tree
pfSense-pkg-API/files/etc/inc/api/models Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515
1616require_once ("api/framework/APIModel.inc " );
1717require_once ("api/framework/APIResponse.inc " );
18+ require_once ("includes/functions.inc.php " );
1819
1920
2021class APIFirewallStatesSizeRead extends APIModel {
@@ -25,16 +26,19 @@ class APIFirewallStatesSizeRead extends APIModel {
2526 }
2627
2728 public function action () {
28- # Check our maximum state table size
29- if (isset ($ this ->config ["system " ]["maximumstates " ])) {
29+ # Check our default state table size
30+ $ size_array ["defaultmaximumstates " ] = intval (pfsense_default_state_size ());
31+
32+ # Check our maximum state table size if configured, Otherwise, use default.
33+ if (!empty ($ this ->config ["system " ]["maximumstates " ])) {
3034 $ size_array ["maximumstates " ] = intval ($ this ->config ["system " ]["maximumstates " ]);
3135 } else {
32- $ size_array ["maximumstates " ] = intval ( pfsense_default_state_size ()) ;
36+ $ size_array ["maximumstates " ] = $ size_array [ " defaultmaximumstates " ] ;
3337 }
38+
3439 # Check our current state table size
35- $ size_array ["currentstates " ] = count (APIFirewallStatesRead::get_state_table ());
36- # Check our default state table size
37- $ size_array ["defaultmaximumstates " ] = intval (pfsense_default_state_size ());
40+ $ size_array ["currentstates " ] = intval (explode ("/ " , get_pfstate ())[0 ]);
41+
3842 return APIResponse \get (0 , $ size_array );
3943 }
4044}
You can’t perform that action at this time.
0 commit comments