Skip to content

Commit

Permalink
TCP flags are valid on any type of rule, don't skip them on block or …
Browse files Browse the repository at this point in the history
…reject rules
  • Loading branch information
Chris Buechler committed Jun 15, 2013
1 parent df78d8c commit e8ddd3a
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions etc/inc/filter.inc
Expand Up @@ -2257,37 +2257,37 @@ function filter_generate_user_rule($rule) {
if ($type == "pass") { if ($type == "pass") {
if (isset($rule['allowopts'])) if (isset($rule['allowopts']))
$aline['allowopts'] = " allow-opts "; $aline['allowopts'] = " allow-opts ";

}
$aline['flags'] = ""; $aline['flags'] = "";
if ($rule['protocol'] == "tcp") { if ($rule['protocol'] == "tcp") {
if (isset($rule['tcpflags_any'])) if (isset($rule['tcpflags_any']))
$aline['flags'] = "flags any "; $aline['flags'] = "flags any ";
else if (!empty($rule['tcpflags2'])) { else if (!empty($rule['tcpflags2'])) {
$aline['flags'] = "flags "; $aline['flags'] = "flags ";
if (!empty($rule['tcpflags1'])) { if (!empty($rule['tcpflags1'])) {
$flags1 = explode(",", $rule['tcpflags1']); $flags1 = explode(",", $rule['tcpflags1']);
foreach ($flags1 as $flag1) { foreach ($flags1 as $flag1) {
// CWR flag needs special treatment // CWR flag needs special treatment
if($flag1[0] == "c") if($flag1[0] == "c")
$aline['flags'] .= "W"; $aline['flags'] .= "W";
else else
$aline['flags'] .= strtoupper($flag1[0]); $aline['flags'] .= strtoupper($flag1[0]);
}
} }
$aline['flags'] .= "/"; }
if (!empty($rule['tcpflags2'])) { $aline['flags'] .= "/";
$flags2 = explode(",", $rule['tcpflags2']); if (!empty($rule['tcpflags2'])) {
foreach ($flags2 as $flag2) { $flags2 = explode(",", $rule['tcpflags2']);
// CWR flag needs special treatment foreach ($flags2 as $flag2) {
if($flag2[0] == "c") // CWR flag needs special treatment
$aline['flags'] .= "W"; if($flag2[0] == "c")
else $aline['flags'] .= "W";
$aline['flags'] .= strtoupper($flag2[0]); else
} $aline['flags'] .= strtoupper($flag2[0]);
} }
$aline['flags'] .= " "; }
} else $aline['flags'] .= " ";
$aline['flags'] = "flags S/SA "; } else {
$aline['flags'] = "flags S/SA ";
} }


/* /*
Expand Down

0 comments on commit e8ddd3a

Please sign in to comment.