mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-13 14:05:36 +03:00
fix(docker): bring the veth host end up before a relay attach
The unified veth host end is born admin-down (carrier off until a link attaches), and libpcap cannot open a packet socket on an admin-down interface — its netlink promiscuous-mode transaction returns ENOENT, so 'bridge add_nio_ethernet' failed on every runtime relay link (and would on any relay link at container start). Bring the interface up for the attach; the carrier pass in the caller refines the state afterwards (a suspended NIO sets it back down). Verified live with a direct uBridge probe: attach on a down veth -> ENOENT, after 'link set up' -> OK.
This commit is contained in:
parent
2b45f29b2c
commit
b1eb0984bc
@ -1959,6 +1959,13 @@ class DockerVM(BaseNode):
|
||||
if host_ifc is not None and bridge_name not in self._bridges:
|
||||
await self._ubridge_send(f"bridge create {bridge_name}")
|
||||
self._bridges.add(bridge_name)
|
||||
# libpcap cannot open a packet socket on an admin-down interface
|
||||
# (its netlink promiscuous-mode transaction returns ENOENT), and
|
||||
# the unified veth host end is born down (carrier off until a
|
||||
# link attaches) — bring it up for the relay attach. The carrier
|
||||
# pass in the caller refines the state afterwards (a suspended
|
||||
# NIO sets it back down).
|
||||
await self._ubridge_send(f'link set "{host_ifc}" up')
|
||||
await self._ubridge_send(f'bridge add_nio_ethernet {bridge_name} "{host_ifc}"')
|
||||
await self._ubridge_send(
|
||||
"bridge add_nio_udp {bridge_name} {lport} {rhost} {rport}".format(
|
||||
|
||||
@ -222,6 +222,9 @@ async def test_add_ubridge_connection_udp_relays_over_veth(vm):
|
||||
[
|
||||
call.send(f'docker create_veth "{host_ifc}" "{vm._veth_names(0, 0)[1]}"'),
|
||||
call.send("bridge create bridge0"),
|
||||
# the host end is born down; libpcap cannot attach to an
|
||||
# admin-down interface, so the relay brings it up first
|
||||
call.send(f'link set "{host_ifc}" up'),
|
||||
call.send(f'bridge add_nio_ethernet bridge0 "{host_ifc}"'),
|
||||
call.send("bridge add_nio_udp bridge0 4242 127.0.0.1 4343"),
|
||||
call.send("bridge start bridge0"),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user