marker: make per-filter toggle a no-op when the marker isn't installed

_ubridge_set_marker_filter_state raised "Marker X is not installed on this
node" when the capture node wasn't running — the name->bridge map is only
populated during _ubridge_apply_markers, which runs when the node is up. The
error was noise: the controller's enabled-only short-circuit catches it and
falls back, and the controller-layer enabled is authoritative (honoured when
the node starts and applies the marker). Treat a missing entry as a no-op
instead of raising.
This commit is contained in:
YueGuobin 2026-08-02 23:23:53 +08:00
parent 1eeee024bd
commit 0afbb897a5
No known key found for this signature in database
2 changed files with 8 additions and 2 deletions

View File

@ -1197,7 +1197,11 @@ class BaseNode:
bridge_name = self._marker_filter_bridges.get(name)
if not bridge_name:
raise UbridgeError(f"Marker '{name}' is not installed on this node")
# Marker not installed on this uBridge (node not started, or not yet
# applied). The controller-layer `enabled` is still authoritative and
# is honoured when the node starts and applies the marker, so a
# toggle here is a no-op rather than an error.
return
state = "on" if enabled else "off"
await self._ubridge_send(f"bridge enable_packet_filter {bridge_name} {name} {state}")

View File

@ -1337,7 +1337,9 @@ class IOUVM(BaseNode):
location = self._marker_filter_bridges.get(name)
if not location:
raise UbridgeError(f"Marker '{name}' is not installed on this node")
# Marker not installed on this uBridge (node not started, or not yet
# applied); controller-layer `enabled` is authoritative. No-op.
return
state = "on" if enabled else "off"
await self._ubridge_send(f"iol_bridge enable_packet_filter {location} {name} {state}")