network applet: six correctness fixes, incl. multiple active WireGuard connections - #13911
network applet: six correctness fixes, incl. multiple active WireGuard connections#13911IvanTheGeek wants to merge 6 commits into
Conversation
The loop compared the index against the accessPoints ARRAY rather than its length, so the body never executed. _accessPoints was left empty and the notify::strength handlers were never connected, silently stopping signal strength updates for that network. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Array.splice(pos) with no delete count removes everything from pos to the end of the array, so removing one connection dropped every connection after it from _connections. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…point set_applet_icon_symbolic_name() passes the name through unchanged and sets St.IconType.SYMBOLIC; St appends '-symbolic' itself during lookup. The name built here already carried the suffix, so it resolved to '...-secure-symbolic-symbolic', which does not exist, and the panel icon rendered as nothing while a VPN was active over wireless. Also guard active_access_point, which is null on a wireless device that is still activating. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The function fell through without a return when no tun/wireguard connection was active, yielding undefined instead of the state it was given. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… first built _updateConnectionItemView() takes 'active' as its third argument, but the first-build call omitted it, so a connection that was already up drew no dot until some later refresh happened to redraw the row. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Best-practices scannerThis is a regex-based check for API usage that can pose security, performance or This check is not perfect and will not replace a normal review.Found 2 potential issue(s):
|
NMDeviceWIREGUARD kept a single _activeConnection slot, but every WireGuard connection is handed the same pseudo-device and _syncActiveConnections called setActiveConnection() once per connection - so each activation overwrote the previous one. With two tunnels up the menu showed one as connected and drew the other as if it were down, and the section switch tore down only one of them and then flipped straight back on. This mirrors what commit 'nm-applet: make visible multiple active vpn connection' (PR linuxmint#12930) did for NMDeviceVPN: keep a list, assign it once after the sync loop instead of per connection, and deactivate all of them. Rows become a switch each rather than a pick-one list, since WireGuard connections are independent of one another - this is the behaviour requested in the issue. Closes linuxmint#12178 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
77ed2d3 to
722dd35
Compare
|
The best-practices scanner findings above are addressed — all of the flagged The scanner comment is stale rather than wrong: the workflow re-run is sitting in |
Six independent correctness fixes in
network@cinnamon.org, one per commit so they can be taken or dropped individually. No new UI.The bugs
1.
updateAccessPoints()never loops —for (let i = 0; i < accessPoints; i++)compares the index to the array rather than its length, so the body never runs._accessPointsis left empty and thenotify::strengthhandlers are never reconnected, silently stopping signal-strength updates for that network.2.
splice(pos)truncates the connection list —Array.splice(pos)with no delete count removes everything fromposto the end, so removing one connection dropped every connection after it from_connections.3. The VPN-over-wireless icon never resolves —
set_applet_icon_symbolic_name()passes the name through unchanged and setsSt.IconType.SYMBOLIC; St appends-symbolicitself at lookup time. The name built here already carried the suffix, so it asked forxsi-network-wireless-signal-<level>-secure-symbolic-symbolic, which does not exist. The panel icon renders as nothing while a VPN is active over wireless. Verified against the shipped icon set:The same commit guards
active_access_point, which is null on a wireless device that is still activating.4.
_correctStateForTunnel()returnsundefined— it falls through without a return when no tun/wireguard connection is active. Only reached from the currently-disabled connectivity check, but wrong either way.5. An already-connected VPN draws no dot when its row is first built —
_updateConnectionItemView()takesactiveas its third argument, but the first-build call omits it, soactiveisundefined. The row corrects itself on the next redraw, which is why it reads as intermittent. This is likely what #12550 is seeing.6. Only one WireGuard connection can be active in the UI (#12178) —
NMDeviceWIREGUARDkept a single_activeConnectionslot, but every WireGuard connection is handed the same pseudo-device and_syncActiveConnections()callssetActiveConnection()once per connection, so each activation overwrites the previous one. With two tunnels up the menu shows one as connected and draws the other as if it were down; the section switch tears down only one and then flips straight back on.This last one mirrors what #12930 did for
NMDeviceVPN— keep a list, assign it once after the sync loop rather than per connection, and deactivate all of them. The VPN section got that treatment; the WireGuard section was left behind.Rows become a switch each rather than a pick-one list, since WireGuard connections are independent of one another. That is the behaviour asked for in #12178 ("checkboxes instead of the radio items to toggle the Networks independently") and re-confirmed there in February.
Testing
Honest about what was and wasn't done:
node --checked againstmaster.applet.json Cinnamon 6.6.9, which differs from master only by the four lines of network: Remove stale wireguard connections #13847. With two WireGuard tunnels up simultaneously the applet reported both, each with its own working switch:Closes #12178
Disclosure: I worked on this with Claude (Anthropic's Claude Code). It did the bulk of the code reading, diagnosis and patch authoring, and drafted this write-up; I reviewed the changes and ran them on my own machine before filing. The commits carry a
Co-Authored-By: Claudetrailer to the same effect. Flagging it so you can weight the review accordingly.