ubridge: require version >= 1.2.0

Drop the platform-specific floor (0.9.12 darwin / 0.9.14 others) in
favour of a single 1.2.0 minimum. This server now relies on features
only present in recent uBridge builds: the AF_UNIX control channel
(-U / SO_PEERCRED), the marker (mark) filter, and the brctl-backed
builtin Ethernet Switch. Removes the now-unused sys import left behind
by the dropped darwin branch (target is Linux-only).
This commit is contained in:
YueGuobin 2026-08-06 21:33:34 +08:00
parent 29c1b04078
commit b8ac76f047
No known key found for this signature in database

View File

@ -18,7 +18,6 @@
Represents a uBridge hypervisor and starts/stops the associated uBridge process.
"""
import sys
import os
import socket
import subprocess
@ -154,19 +153,17 @@ class Hypervisor(UBridgeHypervisor):
async def _check_ubridge_version(self, env=None):
"""
Checks if the ubridge executable version
Checks if the ubridge executable version meets the minimum required.
"""
try:
output = await subprocess_check_output(self._path, "-v", cwd=self._working_dir, env=env)
match = re.search(r"ubridge version ([0-9a-z\.]+)", output)
if match:
self._version = match.group(1)
if sys.platform.startswith("darwin"):
minimum_required_version = "0.9.12"
else:
# uBridge version 0.9.14 is required for packet filters
# to work for IOU nodes.
minimum_required_version = "0.9.14"
# uBridge >= 1.2.0 is required for features this server now
# relies on: the AF_UNIX control channel (-U), the marker
# (mark) filter, and the brctl-backed builtin Ethernet Switch.
minimum_required_version = "1.2.0"
if parse_version(self._version) < parse_version(minimum_required_version):
raise UbridgeError(f"uBridge executable version must be >= {minimum_required_version}")
else: