Skip to content

network(networkd): treat bridge, bond, team and vlan links as wired - #3706

Merged
bbedward merged 2 commits into
duxlabs-dev:masterfrom
Pedroj-64:fix/networkd-bridge-wired-link
Oct 6, 2026
Merged

bbedward merged 2 commits into
duxlabs-dev:masterfrom
Pedroj-64:fix/networkd-bridge-wired-link

Conversation

@Pedroj-64

Copy link
Copy Markdown
Contributor

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 accepted Type == "ether". For a setup like br0 (type bridge) holding the address and enp42s0 enslaved to it:

  • enp42s0 is wired but its OperationalState is enslaved, so it is never considered connected.
  • br0 is the interface that is actually routable, but its type is bridge, so it was dropped before the uplink selection in updateState().

Result: EthernetConnected stays false and the status is disconnected. NetworkManager had the same problem and was fixed in #1581 by accepting bridge, bond, team and vlan; the networkd backend was not covered.

Change

  • backend_networkd.go: isWired() now uses a small isWiredLinkType() accepting ether, bridge, bond, team, vlan, mirroring the list used for NetworkManager. The name-prefix fallback (when Describe returns no Type) is unchanged.
  • Because bridges are now a wired type, lxdbr* and incusbr* are added to looksVirtual(). 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 in TestLinkInfo_Classify (bridge, bond, team, vlan accepted; lxd, docker user-defined and libvirt bridges still excluded) and in TestLooksVirtual.

Testing

  • go test ./internal/server/network/ passes.
  • The new TestLinkInfo_Classify cases and the TestLooksVirtual additions fail without the backend_networkd.go change and pass with it.
  • gofmt and go vet are clean.
  • Not tested against a live systemd-networkd bridge setup; the classification logic is covered by the unit tests, and the link types come from the Type values reported in the debug log attached to Network widget reports "Disconnected" when using a Network Bridge (systemd-networkd backend) #3463 (type="bridge" for br0).

No UI change, so no screenshots.

Fixes #3463

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
@xlsigned

xlsigned commented Oct 6, 2026

Copy link
Copy Markdown

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"}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about testing team0 and vlan10, too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added both to the non-virtual list, thanks.

@bbedward

bbedward commented Oct 6, 2026

Copy link
Copy Markdown
Member

/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",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Suggested change
"vboxnet", "vmnet", "kube", "cni", "flannel", "cali", "lxdbr", "incusbr",
"vboxnet", "vmnet", "kube", "cni", "flannel", "cali", "lxdbr", "incusbr", "lxcbr", "waydroid",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

claude Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Claude review

Fix looks right; one regression from treating bridges as wired.

  • lxcbr0/waydroid0 bridges can now be picked as the wired uplink and override Wi‑Fi status, core/internal/server/network/backend_networkd.go:64
    Checked: isWired/looksVirtual changes, uplink selection and status precedence in updateState, ethernet handlers, new tests. Model: claude-opus-5-5.

@xlsigned

xlsigned commented Oct 6, 2026

Copy link
Copy Markdown

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.
@Pedroj-64

Copy link
Copy Markdown
Contributor Author

Good idea, thanks. A bridge link now only counts as wired if at least one of its members (/sys/class/net/<br>/brif) is not virtual (veth*, tap*, vnet*, ...). That replaces the lxdbr/incusbr prefixes, so lxcbr0/waydroid0 are excluded too (tests added). I did not add the "configured by systemd-networkd" condition, since the uplink selection already looks at the bridge's own networkd state. Pushed in a1328e3.

@bbedward

bbedward commented Oct 6, 2026

Copy link
Copy Markdown
Member

/claude review

@claude

claude Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Claude review

No issues found. The earlier lxcbr0/waydroid0 finding is resolved by the physical-member check.
Checked: isWired bridge/bond/team/vlan classification, the sysfs brif lookup and its cost per updateState (event-driven, no new timers or processes), uplink selection with enslaved members in updateState, ConnectEthernet/GetWiredConnections callers, and the test stub of bridgeMembers (no parallel tests in the package). Model: claude-opus-5-5.

@bbedward
bbedward merged commit f886789 into duxlabs-dev:master Oct 6, 2026
3 checks passed
bbedward pushed a commit that referenced this pull request Oct 7, 2026
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Network widget reports "Disconnected" when using a Network Bridge (systemd-networkd backend)

3 participants