Skip to content

network applet: six correctness fixes, incl. multiple active WireGuard connections - #13911

Merged
mtwebster merged 6 commits into
linuxmint:masterfrom
IvanTheGeek:fix/network-applet-correctness
Sep 28, 2026
Merged

mtwebster merged 6 commits into
linuxmint:masterfrom
IvanTheGeek:fix/network-applet-correctness

Conversation

@IvanTheGeek

@IvanTheGeek IvanTheGeek commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

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. _accessPoints is left empty and the notify::strength handlers 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 from pos to 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 sets St.IconType.SYMBOLIC; St appends -symbolic itself at lookup time. The name built here already carried the suffix, so it asked for xsi-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:

FOUND    xsi-network-wireless-signal-good-secure-symbolic
MISSING  xsi-network-wireless-signal-good-secure-symbolic-symbolic

The same commit guards active_access_point, which is null on a wireless device that is still activating.

4. _correctStateForTunnel() returns undefined — 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() takes active as its third argument, but the first-build call omits it, so active is undefined. 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) — NMDeviceWIREGUARD kept a single _activeConnection slot, but every WireGuard connection is handed the same pseudo-device and _syncActiveConnections() calls setActiveConnection() 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:

  • Built and node --checked against master.
  • Smoke-tested by running this branch's applet.js on 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:
    wg active list: [wg-devvps, wg-lab-inet]
    rows: wg-devvps=ON  wg-lab-inet=ON  wg-lab=off  wg-home=off
    
  • Not run on master itself — I don't have a master build here.
  • Bugs 1-5 are reasoned from the code and verified by inspection; 1, 2 and 4 are single-expression fixes.

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: Claude trailer to the same effect. Flagging it so you can weight the review accordingly.

IvanTheGeek and others added 5 commits July 30, 2026 15:07
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>
@github-actions

Copy link
Copy Markdown

Best-practices scanner

This is a regex-based check for API usage that can pose security, performance or
maintainability issues, or that may already be provided by Cinnamon. Most findings
are advisory and do not automatically disqualify a pull request.

This check is not perfect and will not replace a normal review.


Found 2 potential issue(s):

⚠️ WARNING

⚠️ lang_bind

files/usr/share/cinnamon/applets/network@cinnamon.org/applet.js:1138

obj.item.connect('toggled', Lang.bind(this, function(item, state) {

Lang.bind() is deprecated. Use arrow functions (() => {}) or Function.prototype.bind() instead.

files/usr/share/cinnamon/applets/network@cinnamon.org/applet.js:1948

this._devices.wireguard.device.connect('active-connections-changed', Lang.bind(this, function() {

Lang.bind() is deprecated. Use arrow functions (() => {}) or Function.prototype.bind() instead.


Automated pattern check.

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>
@IvanTheGeek
IvanTheGeek force-pushed the fix/network-applet-correctness branch from 77ed2d3 to 722dd35 Compare July 30, 2026 19:17
@IvanTheGeek

Copy link
Copy Markdown
Contributor Author

The best-practices scanner findings above are addressed — all of the flagged Lang.bind() uses were in code this PR adds, and they are now arrow functions (which capture this the same way). No new Lang.bind() is introduced; the count in this file actually goes down versus master.

The scanner comment is stale rather than wrong: the workflow re-run is sitting in action_required, since runs from a first-time contributor need maintainer approval. It should clear once someone approves the run.

@mtwebster
mtwebster merged commit 5bfbcea into linuxmint:master Sep 28, 2026
2 checks passed
IvanTheGeek added a commit to IvanTheGeek/cinnamon that referenced this pull request Oct 3, 2026
WireGuard connections had a section of their own, "WIREGUARD
Connections", backed by a copy of the VPN code (NMDeviceWIREGUARD) and
a panel-icon override of its own. To the user both lists hold the same
kind of thing, a tunnel on top of the real link, and the separate path
gets the panel wrong. The override keyed off the WireGuard title
switch, so the tooltip said "Connected to WIREGUARD" while a tunnel
was still connecting or already disconnecting. The override is also
older than the VPN icon from linuxmint#12142 (it came with linuxmint#11905), so with
Wi-Fi as the main connection a WireGuard tunnel replaced the signal
bars with the plain VPN icon, where a VPN-plugin connection shows the
Wi-Fi bars with a padlock.

List WireGuard connections under "VPN Connections" instead.
NMDeviceVPN accepts both types and WireGuard maps to the VPN category,
so WireGuard runs through the VPN code: the multiple-connection
handling from linuxmint#12930, the removal of deleted profiles that linuxmint#13847
copied for WireGuard, and the panel icon from linuxmint#12142. That icon shows
the Wi-Fi bars with a padlock when Wi-Fi is the main connection, the
VPN icon otherwise, and the acquiring icon while a tunnel connects.
NMDeviceWIREGUARD, the WIREGUARD category and the override go away.

Every row is now a switch that turns its own connection on or off, as
WireGuard rows have been since linuxmint#13911. VPN-plugin rows used to be
click-to-toggle items with a dot. Nameless connections still read
"Connected (private)", and WireGuard rows now follow a rename, as VPN
rows already did. The section's title switch keeps its code, so it now
covers both kinds: off disconnects every tunnel, WireGuard included,
and on starts the most recently used connection, which may now be a
WireGuard one.

This drops the three WIREGUARD strings and adds none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mtwebster pushed a commit that referenced this pull request Nov 1, 2026
…s kind (#13913)

* network applet: list WireGuard connections in the VPN section

WireGuard connections had a section of their own, "WIREGUARD
Connections", backed by a copy of the VPN code (NMDeviceWIREGUARD) and
a panel-icon override of its own. To the user both lists hold the same
kind of thing, a tunnel on top of the real link, and the separate path
gets the panel wrong. The override keyed off the WireGuard title
switch, so the tooltip said "Connected to WIREGUARD" while a tunnel
was still connecting or already disconnecting. The override is also
older than the VPN icon from #12142 (it came with #11905), so with
Wi-Fi as the main connection a WireGuard tunnel replaced the signal
bars with the plain VPN icon, where a VPN-plugin connection shows the
Wi-Fi bars with a padlock.

List WireGuard connections under "VPN Connections" instead.
NMDeviceVPN accepts both types and WireGuard maps to the VPN category,
so WireGuard runs through the VPN code: the multiple-connection
handling from #12930, the removal of deleted profiles that #13847
copied for WireGuard, and the panel icon from #12142. That icon shows
the Wi-Fi bars with a padlock when Wi-Fi is the main connection, the
VPN icon otherwise, and the acquiring icon while a tunnel connects.
NMDeviceWIREGUARD, the WIREGUARD category and the override go away.

Every row is now a switch that turns its own connection on or off, as
WireGuard rows have been since #13911. VPN-plugin rows used to be
click-to-toggle items with a dot. Nameless connections still read
"Connected (private)", and WireGuard rows now follow a rename, as VPN
rows already did. The section's title switch keeps its code, so it now
covers both kinds: off disconnects every tunnel, WireGuard included,
and on starts the most recently used connection, which may now be a
WireGuard one.

This drops the three WIREGUARD strings and adds none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* network applet: show each VPN connection's kind next to its name

With WireGuard and VPN-plugin connections in one list, the name is all
a row has to go on, and connection names often do not say what kind
of tunnel they are. Show the kind next to the name, in the switch
row's status label: "WireGuard" for WireGuard connections, and for VPN
plugins a name looked up from the plugin's service type (OpenVPN,
PPTP, L2TP, OpenConnect, ...). A plugin that is not in the table shows
the last part of its service type, such as "iodine".

"WireGuard" reuses the translated string the applet already has for
the WireGuard device description. The plugin names are product and
protocol names and are left untranslated, so the change adds no
strings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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@cinnamon.org applet can only show a single active WireGuard connection

2 participants