Commit cacfdd05 authored by Ad Schellevis's avatar Ad Schellevis

(filter) work in progress filter refactoring

parent f88eabc0
...@@ -107,16 +107,21 @@ class FilterRule ...@@ -107,16 +107,21 @@ class FilterRule
$interfaces = empty($this->rule['interface']) ? array(null) : explode(',', $this->rule['interface']); $interfaces = empty($this->rule['interface']) ? array(null) : explode(',', $this->rule['interface']);
foreach ($interfaces as $interface) { foreach ($interfaces as $interface) {
if (isset($this->rule['ipprotocol']) && $this->rule['ipprotocol'] == 'inet46') { if (isset($this->rule['ipprotocol']) && $this->rule['ipprotocol'] == 'inet46') {
foreach (array('inet', 'inet6') as $ipproto) { $ipprotos = array('inet', 'inet6');
} elseif (isset($this->rule['ipprotocol'])) {
$ipprotos = array($this->rule['ipprotocol']);
} else {
$ipprotos = array(null);
}
foreach ($ipprotos as $ipproto) {
$tmp = $this->rule; $tmp = $this->rule;
$tmp['interface'] = $interface; $tmp['interface'] = $interface;
$tmp['ipprotocol'] = $ipproto; $tmp['ipprotocol'] = $ipproto;
$result[] = $tmp; if (empty($this->interfaceMapping[$interface]['if'])) {
// disable rule when interface not found
$tmp['disabled'] = true;
} }
} else { $result[] = $tmp;
$tmp = $this->rule;
$tmp['interface'] = $interface;
$result[] = $this->rule;
} }
} }
return $result; 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