예제 #1
0
									<td width="78%" class="vtable">
										<input name="maximumstates" type="text" id="maximumstates" value="<?php 
echo $pconfig['maximumstates'];
?>
" />
										<br />
										<strong><?php 
echo gettext("Maximum number of connections to hold in the firewall state table.");
?>
</strong>
										<br />
										<span class="vexpl"><?php 
echo gettext("Note:  Leave this blank for the default.  On your system the default size is:");
?>
 <?php 
echo default_state_size();
?>
</span>
									</td>
								</tr>
								<tr>
									<td width="22%" valign="top" class="vncell"><?php 
echo gettext("Firewall Maximum Table Entries");
?>
</td>
									<td width="78%" class="vtable">
										<input name="maximumtableentries" type="text" id="maximumtableentries" value="<?php 
echo $pconfig['maximumtableentries'];
?>
" />
										<br />
예제 #2
0
function get_pfstate($percent = false)
{
    global $config;
    $matches = "";
    if (isset($config['system']['maximumstates']) and $config['system']['maximumstates'] > 0) {
        $maxstates = "{$config['system']['maximumstates']}";
    } else {
        $maxstates = default_state_size();
    }
    $curentries = `/sbin/pfctl -si |grep current`;
    if (preg_match("/([0-9]+)/", $curentries, $matches)) {
        $curentries = $matches[1];
    }
    if (!is_numeric($curentries)) {
        $curentries = 0;
    }
    if ($percent) {
        if (intval($maxstates) > 0) {
            return round($curentries / $maxstates * 100, 0);
        } else {
            return "NA";
        }
    } else {
        return $curentries . "/" . $maxstates;
    }
}