Repository navigation
network(networkd): treat bridge, bond, team and vlan links as wired - #3706
Conversation
When the IP configuration lives on a bridge or link aggregate, the enslaved member NIC reports opState=enslaved and the aggregate itself was dropped by isWired() because only Type=ether was accepted, so the widget showed Disconnected. Accept the same link types NetworkManager already handles (duxlabs-dev#1581). Also treat lxdbr*/incusbr* as virtual so container bridges, now of a wired type, are not picked as the uplink. Fixes duxlabs-dev#3463
|
Looks good to me, but I haven't tested it (yet). |
| assert.True(t, looksVirtual(n), "%s should look virtual", n) | ||
| } | ||
| real := []string{"enp141s0", "eno1", "wlan0", "wlp3s0", "wifi", "dock", "nebula.homelab", "wg0"} | ||
| real := []string{"enp141s0", "eno1", "wlan0", "wlp3s0", "wifi", "dock", "nebula.homelab", "wg0", "br0", "bond0"} |
There was a problem hiding this comment.
How about testing team0 and vlan10, too?
There was a problem hiding this comment.
Added both to the non-virtual list, thanks.
|
/claude review |
| virtualPrefixes := []string{ | ||
| "lo", "docker", "podman", "veth", "virbr", "br-", "vnet", "tun", "tap", | ||
| "vboxnet", "vmnet", "kube", "cni", "flannel", "cali", | ||
| "vboxnet", "vmnet", "kube", "cni", "flannel", "cali", "lxdbr", "incusbr", |
There was a problem hiding this comment.
Now that bridge counts as wired, other common local-only bridges get through too. lxcbr0 (the lxc-net default) and waydroid0 (Waydroid) are type bridge, have an address, and go routable while the container is running. Before this PR they were dropped. Now one can become wiredIface. Because ethernet takes priority over Wi‑Fi in updateState(), a laptop on Wi‑Fi with LXC or Waydroid running would show "Ethernet" with the bridge's private IP. Add them to the virtual prefixes:
| "vboxnet", "vmnet", "kube", "cni", "flannel", "cali", "lxdbr", "incusbr", | |
| "vboxnet", "vmnet", "kube", "cni", "flannel", "cali", "lxdbr", "incusbr", "lxcbr", "waydroid", |
There was a problem hiding this comment.
Good catch. Rather than keep growing the prefix list, bridges are now only accepted when they have at least one non-virtual member (see the other thread), so lxcbr0/waydroid0 are excluded without naming them. Added test cases for both.
Claude reviewFix looks right; one regression from treating bridges as wired.
|
|
Excluding/including bridges by inspecting their names can only get us thus far. How about checking whether the bridge has at least one member that isn't a virtual (veth*, tap*, ...) ethernet device (and is configured by systemd-networkd)? |
…member Name prefixes can't cover every container/VM bridge (lxcbr0, waydroid0, ...). Check the bridge's members in /sys/class/net/<br>/brif instead and only accept it as the uplink when at least one member is not virtual (veth*, tap*, ...). This replaces the lxdbr*/incusbr* prefixes.
|
Good idea, thanks. A |
|
/claude review |
Claude reviewNo issues found. The earlier |
…3706) * network(networkd): treat bridge, bond, team and vlan links as wired When the IP configuration lives on a bridge or link aggregate, the enslaved member NIC reports opState=enslaved and the aggregate itself was dropped by isWired() because only Type=ether was accepted, so the widget showed Disconnected. Accept the same link types NetworkManager already handles (#1581). Also treat lxdbr*/incusbr* as virtual so container bridges, now of a wired type, are not picked as the uplink. Fixes #3463 * network(networkd): only treat a bridge as wired if it has a physical member Name prefixes can't cover every container/VM bridge (lxcbr0, waydroid0, ...). Check the bridge's members in /sys/class/net/<br>/brif instead and only accept it as the uplink when at least one member is not virtual (veth*, tap*, ...). This replaces the lxdbr*/incusbr* prefixes. (cherry picked from commit f886789)
Problem
With the systemd-networkd backend, the network widget reports "Disconnected" when the IP configuration lives on a bridge (or bond/team/vlan) and the physical NIC is enslaved to it (#3463).
linkInfo.isWired()only acceptedType == "ether". For a setup likebr0(typebridge) holding the address andenp42s0enslaved to it:enp42s0is wired but itsOperationalStateisenslaved, so it is never considered connected.br0is the interface that is actuallyroutable, but its type isbridge, so it was dropped before the uplink selection inupdateState().Result:
EthernetConnectedstays false and the status isdisconnected. NetworkManager had the same problem and was fixed in #1581 by acceptingbridge,bond,teamandvlan; the networkd backend was not covered.Change
backend_networkd.go:isWired()now uses a smallisWiredLinkType()acceptingether,bridge,bond,team,vlan, mirroring the list used for NetworkManager. The name-prefix fallback (when Describe returns no Type) is unchanged.lxdbr*andincusbr*are added tolooksVirtual(). Docker (docker0,br-*), libvirt (virbr*) and podman (podman*) bridges were already excluded by prefix; without this, an LXD/Incus bridge that is routable could be picked as the wired uplink.backend_networkd_test.go: new cases inTestLinkInfo_Classify(bridge, bond, team, vlan accepted; lxd, docker user-defined and libvirt bridges still excluded) and inTestLooksVirtual.Testing
go test ./internal/server/network/passes.TestLinkInfo_Classifycases and theTestLooksVirtualadditions fail without thebackend_networkd.gochange and pass with it.gofmtandgo vetare clean.Typevalues reported in the debug log attached to Network widget reports "Disconnected" when using a Network Bridge (systemd-networkd backend) #3463 (type="bridge"forbr0).No UI change, so no screenshots.
Fixes #3463