network applet: fix WireGuard connection state handling - #13986
Open
wocisjr wants to merge 1 commit into
Open
Conversation
Three separate issues in the WireGuard part of the network applet: * NMDeviceWIREGUARD kept a single _activeConnection, so when more than one tunnel was up, _syncActiveConnections() overwrote it once per active connection and only the last one seen was shown as connected. It now keeps a list of active connections, mirroring what NMDeviceVPN already does, so every tunnel that is up gets its dot, and clicking a row toggles that specific tunnel instead of only ever activating it. * _connectionRemoved() called this._connections.splice(pos) without a delete count, which drops every element from pos to the end of the array rather than the single removed connection. Removing one profile could therefore silently discard unrelated ones from the applet's bookkeeping, leaving menu rows without their label or toggle state until Cinnamon was restarted. * _updateIcon() runs entirely inside a try/catch, so anything thrown in it leaves the icon and tooltip frozen at their previous values. Two throws lived there: reading _switch.state off this._devices.wireguard.item without checking that the switch exists, and dereferencing mc._section in the VPN loop when there is no main connection at all. Both are now guarded, and the VPN and WireGuard cases share one code path. The tooltip now also names every active tunnel rather than just the first. Tested against NetworkManager 1.46.0 on Cinnamon 6.6.9 with three concurrent WireGuard tunnels, including removing both a running and a stopped profile.
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):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three separate issues in the WireGuard part of the network applet:
NMDeviceWIREGUARD kept a single _activeConnection, so when more than one tunnel was up, _syncActiveConnections() overwrote it once per active connection and only the last one seen was shown as connected. It now keeps a list of active connections, mirroring what NMDeviceVPN already does, so every tunnel that is up gets its dot, and clicking a row toggles that specific tunnel instead of only ever activating it.
_connectionRemoved() called this._connections.splice(pos) without a delete count, which drops every element from pos to the end of the array rather than the single removed connection. Removing one profile could therefore silently discard unrelated ones from the applet's bookkeeping, leaving menu rows without their label or toggle state until Cinnamon was restarted.
_updateIcon() runs entirely inside a try/catch, so anything thrown in it leaves the icon and tooltip frozen at their previous values. Two throws lived there: reading _switch.state off this._devices.wireguard.item without checking that the switch exists, and dereferencing mc._section in the VPN loop when there is no main connection at all. Both are now guarded, and the VPN and WireGuard cases share one code path.
The tooltip now also names every active tunnel rather than just the first.
Tested against NetworkManager 1.46.0 on Cinnamon 6.6.9 with three concurrent WireGuard tunnels, including removing both a running and a stopped profile.