summaryrefslogtreecommitdiffstats
path: root/usr/local/www/firewall_rules_edit.php
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2014-04-29 11:52:11 -0400
committerjim-p <jimp@pfsense.org>2014-04-29 11:52:11 -0400
commit6316efd305fdce649851634fcd8bd123686d8d18 (patch)
tree3644d96f1ec61e22934edd95f74f708b089c646c /usr/local/www/firewall_rules_edit.php
parent4845d642de25f039030b249e85f7a7cb53b3e749 (diff)
downloadpfsense-6316efd305fdce649851634fcd8bd123686d8d18.zip
pfsense-6316efd305fdce649851634fcd8bd123686d8d18.tar.gz
Expose all p0f OS types that it supports so that subtypes of various Operating Systems can be detected
Diffstat (limited to 'usr/local/www/firewall_rules_edit.php')
-rw-r--r--usr/local/www/firewall_rules_edit.php48
1 files changed, 31 insertions, 17 deletions
diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php
index e65fc81..bb286fe 100644
--- a/usr/local/www/firewall_rules_edit.php
+++ b/usr/local/www/firewall_rules_edit.php
@@ -68,6 +68,29 @@ function is_aoadv_used($rule_config) {
return false;
}
+$ostypes = array();
+exec('/sbin/pfctl -s osfp | /usr/bin/tr \'\t\' \' \'', $ostypes);
+
+if (count($ostypes) > 2) {
+ // Remove header rows from pfctl output
+ array_shift($ostypes);
+ array_shift($ostypes);
+} else {
+ // Fall back to a default list
+ $ostypes = array(
+ "AIX",
+ "Linux",
+ "FreeBSD",
+ "NetBSD",
+ "OpenBSD",
+ "Solaris",
+ "MacOS",
+ "Windows",
+ "Novell",
+ "NMAP"
+ );
+}
+
$specialsrcdst = explode(" ", "any pptp pppoe l2tp openvpn");
$ifdisp = get_configured_interface_with_descr();
foreach ($ifdisp as $kif => $kdescr) {
@@ -464,9 +487,12 @@ if ($_POST) {
$_POST['dstendport'] = $_POST['dstbeginport'];
$_POST['dstbeginport'] = $tmp;
}
- if ($_POST['os'])
+ if ($_POST['os']) {
if( $_POST['proto'] != "tcp" )
$input_errors[] = gettext("OS detection is only valid with protocol tcp.");
+ if (!in_array($_POST['os'], $ostypes))
+ $input_errors[] = gettext("Invalid OS detection selection. Please select a valid OS.");
+ }
if ($_POST['ackqueue'] != "") {
if ($_POST['defaultqueue'] == "" )
@@ -1242,28 +1268,16 @@ $i--): ?>
<div id="showsourceosadv" <?php if (empty($pconfig['os'])) echo "style='display:none'"; ?>>
<?=gettext("OS Type:");?>&nbsp;
<select name="os" id="os" class="formselect">
+ <option value="" <?php if (empty($pconfig['os'])) echo "selected=\"selected\""; ?>>Any</option>
<?php
- $ostypes = array(
- "" => gettext("any"),
- "AIX" => "AIX",
- "Linux" => "Linux",
- "FreeBSD" => "FreeBSD",
- "NetBSD" => "NetBSD",
- "OpenBSD" => "OpenBSD",
- "Solaris" => "Solaris",
- "MacOS" => "MacOS",
- "Windows" => "Windows",
- "Novell" => "Novell",
- "NMAP" => "NMAP"
- );
- foreach ($ostypes as $ostype => $descr): ?>
- <option value="<?=$ostype;?>" <?php if ($ostype == $pconfig['os']) echo "selected=\"selected\""; ?>><?=htmlspecialchars($descr);?></option>
+ foreach ($ostypes as $ostype): ?>
+ <option value="<?=$ostype;?>" <?php if ($ostype == $pconfig['os']) echo "selected=\"selected\""; ?>><?=htmlspecialchars($ostype);?></option>
<?php
endforeach;
?>
</select>
<br />
- <?=gettext("Note: this only works for TCP rules");?>
+ <?=gettext("Note: this only works for TCP rules. General OS choice matches all subtypes.");?>
</div>
</td>
</tr>
OpenPOWER on IntegriCloud