Repository navigation
network(networkmanager): refresh wired profiles on settings changes - #3929
Conversation
NewConnection, ConnectionRemoved and Updated refreshed the VPN, Wi-Fi, hotspot and cellular lists but not the wired profile list. Adding or deleting an inactive wired profile does not change any device state, so the list stayed stale until the shell restarted and deleted profiles kept showing in the network settings and control center. listEthernetConnections now also resolves the settings handle through networkManagerSettings(); the old code shadowed the new handle and asserted on a nil interface when the cached handle was unset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
/claude review |
Claude reviewLooks good: the fix is correct and small. |
Description
Deleted wired profiles kept showing in the network settings and the control center until the shell was restarted.
handleDBusSignalrefreshes the VPN, Wi-Fi, hotspot and cellular lists onSettings.NewConnection,Settings.ConnectionRemovedandSettings.Connection.Updated, but not the wired profile list. The wired list is otherwise only rebuilt on a deviceStatechange, and adding or deleting an inactive wired profile changes no device state. This is common with USB tethering and USB Ethernet adapters: NetworkManager keeps one "Wired connection N" profile per interface name, and the name depends on the USB port.This PR calls
listEthernetConnections()in that handler. It also makeslistEthernetConnections()get its settings handle throughnetworkManagerSettings(). The old code shadowed the new handle inside theif s == nilblock, so it asserted on a nil interface whenever the cached handle was unset.#3727 makes the same one-line handler change as part of the larger connection editor work. This PR is only the bug fix, so it can land on its own. If #3727 merges first, this one can be closed.
Type of change
Related issues
Related: #3727
Screenshots / video
No visual change. The existing list now updates when profiles are added or removed.
Checklist
gofmt, added/updated tests,go test ./...passes incore/, andgo mod tidyis cleanTesting
TestNetworkManagerBackend_HandleDBusSignal_ConnectionRemovedRefreshesWiredConnections: starts with a stale wired list, sendsConnectionRemoved, and checks that only the remaining profile is listed. It fails without the fix.TestNetworkManagerBackend_ListEthernetConnections_InvalidSettingsHandle: panicked before the fix, now returns an error.go vetandgo test ./...pass incore/.nmcli connection add type ethernet ... autoconnect noshowed up in the wired list right away, andnmcli connection deleteremoved it, with no shell restart.🤖 Generated with Claude Code