mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
fix: resolve the code-review findings on the kernel datapath
Compute: - Track the anchor that owns uBridge's single AF_PACKET capture slot: a second kernel port's capture is refused with a clear error (its flag rolled back), a failed start no longer wedges the port, and only the owning port's stop issues the process-wide `capture stop_kernel` (docker/qemu/iou/dynamips/switch, via the mixin's slot helpers). - Unwind failed starts instead of leaking uBridge and the anchor TAPs: QEMU's stop body runs under try/finally, QEMU and IOU start the datapath inside the launch try, Dynamips undoes a half-attached port (the retry used to be short-circuited into a silent black hole), and Docker deletes the veth pair when the namespace move fails. - Restore the relay filter guard on IOU (kernel-only filters raise NodeError, an uncompilable BPF line degrades to a warning), validate the eBPF/quota/window/bpf filter shapes before touching the bridge (short or non-numeric values surfaced as 500s after partial state), and refuse a second NIO on an occupied Docker/QEMU port (the guard IOU and Dynamips already had). - Probe fixes: `_probe_bridge_tap` survives a failing uBridge start, and the probe caches key on ctime too, so a chmod/setcap remedy re-probes. Controller: - Parse GNS3_UNIX_SOCKET_NIO like the compute does (line-anchored, truthy value) and mirror the compute's class selection in kernel_anchor_type. - Read partial capability reports defensively; make BridgeNIO.bridge required-but-nullable so an omitted key is a 422 rather than a KeyError. - Strip the packet_loss correlation slot even when it is zero: the relay filter takes exactly one argument and rejected `packet_loss 10 0`. Ethernet switch: skip ports whose absorbed anchor does not exist yet (the join is deferred by design) and roll the ports_mapping back when the VLAN reconcile fails, so a retry still diffs against the old mapping. Agent: reject device config entries without a device_name instead of silently dropping them (a malformed batch used to execute partially while reporting success). Also split the netem builder to clear C901 and drop the two per-file ruff ignores the PR had added, keeping the remove-only policy.
This commit is contained in:
21 files changed
+654
-274
No files matched your search
@@ -59,12 +59,18 @@ def kernel_anchor_type(node_type, environment=None):
|
||||
its own key unchanged.
|
||||
"""
|
||||
|
||||
# The marker check mirrors utils.application_id.is_iol_runner_environment
|
||||
# inline: this module sits below every node module (compute and
|
||||
# controller alike import it during their own import), so it must not
|
||||
# depend on anything that pulls the controller package in.
|
||||
if node_type == "docker" and "GNS3_IOL_RUNNER=" in (environment or ""):
|
||||
return "iol_docker"
|
||||
# The marker check mirrors the compute's class selection
|
||||
# (compute/docker/__init__.py, _select_node_class) inline: only a
|
||||
# stripped, comma-trimmed line *beginning* with the marker selects
|
||||
# IOLDockerVM, so e.g. NOTE=GNS3_IOL_RUNNER=1 must not be named as an
|
||||
# IOL TAP anchor here. The check stays dependency-free on purpose: this
|
||||
# module sits below every node module (compute and controller alike
|
||||
# import it during their own import), so it must not import them back.
|
||||
if node_type == "docker":
|
||||
for line in (environment or "").splitlines():
|
||||
line = line.strip().rstrip(",")
|
||||
if line.startswith("GNS3_IOL_RUNNER="):
|
||||
return "iol_docker"
|
||||
return node_type
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user