firewall: remove ether support from anchor registration

This commit is contained in:
Stephan de Wit 2025-12-01 14:08:06 +01:00
parent d0e53868c5
commit 2f60fcb062

View file

@ -220,10 +220,10 @@ class Plugin
* @param bool $quick * @param bool $quick
* @return null * @return null
*/ */
public function registerAnchor($name, $type = "fw", $priority = 0, $placement = "tail", $quick = false, $ifs = null) public function registerAnchor($name, $type = "fw", $priority = 0, $placement = "tail", $quick = false)
{ {
$anchorKey = sprintf("%s.%s.%08d.%08d", $type, $placement, $priority, count($this->anchors)); $anchorKey = sprintf("%s.%s.%08d.%08d", $type, $placement, $priority, count($this->anchors));
$this->anchors[$anchorKey] = ['name' => $name, 'quick' => $quick, 'ifs' => $ifs]; $this->anchors[$anchorKey] = ['name' => $name, 'quick' => $quick];
ksort($this->anchors); ksort($this->anchors);
} }
@ -239,21 +239,9 @@ class Plugin
foreach (explode(',', $types) as $type) { foreach (explode(',', $types) as $type) {
foreach ($this->anchors as $anchorKey => $anchor) { foreach ($this->anchors as $anchorKey => $anchor) {
if (strpos($anchorKey, "{$type}.{$placement}") === 0) { if (strpos($anchorKey, "{$type}.{$placement}") === 0) {
$result .= ($type == "fw" || $type == "ether") ? "" : "{$type}-";
$prefix = $type == "ether" ? "ether " : "";
$result .= "{$prefix}anchor \"{$anchor['name']}\"";
if ($anchor['quick']) { if ($anchor['quick']) {
$result .= " quick"; $result .= " quick";
} }
if (!empty($anchor['ifs'])) {
$ifs = array_filter(array_map(function ($if) {
return $this->interfaceMapping[$if]['if'] ?? null;
}, explode(',', $anchor['ifs'])));
if (!empty($ifs)) {
$result .= " on {" . implode(', ', $ifs) . "}";
}
}
$result .= "\n"; $result .= "\n";
} }
} }