Commit 89c55e1b authored by Ad Schellevis's avatar Ad Schellevis

(filter) refactor inet46 to single rule and add some more tags

parent b9c8e159
......@@ -46,6 +46,9 @@ class FilterRule
'interface' => 'parseInterface',
'ipprotocol' => 'parsePlain',
'protocol' => 'parseReplaceSimple,tcp/udp:{tcp udp}',
'from' => 'parsePlain',
'to' => 'parsePlain',
'icmp6-type' => 'parsePlain,{,}',
'state' => 'parseState',
'label' => 'parsePlain,label ","'
);
......@@ -161,17 +164,14 @@ class FilterRule
$result = array();
$interfaces = empty($this->rule['interface']) ? array(null) : explode(',', $this->rule['interface']);
foreach ($interfaces as $interface) {
if (isset($this->rule['ipprotocol']) && $this->rule['ipprotocol'] == 'inet46') {
$ipprotos = array('inet', 'inet6');
} elseif (isset($this->rule['ipprotocol'])) {
$ipprotos = array($this->rule['ipprotocol']);
$tmp = $this->rule;
// protocol handling
if (empty($this->rule['ipprotocol']) || $this->rule['ipprotocol'] == 'inet46') {
$tmp['ipprotocol'] = "";
} else {
$ipprotos = array(null);
$tmp['ipprotocol'] = $this->rule['ipprotocol'];
}
foreach ($ipprotos as $ipproto) {
$tmp = $this->rule;
$tmp['interface'] = $interface;
$tmp['ipprotocol'] = $ipproto;
// disable rule when interface not found
if (!empty($interface) && empty($this->interfaceMapping[$interface]['if'])) {
$tmp['disabled'] = true;
......@@ -212,7 +212,6 @@ class FilterRule
}
$result[] = $tmp;
}
}
return $result;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment