service: find our own tunnel among any number of foreign ones (#13) - #14
Merged
Conversation
Tunnel detection polled a fixed ["gpd0", "tun0", "tun1"] list. With two other tun-based VPNs already up, openconnect's kernel-assigned fallback name lands on tun2 - a name that list never contained - so the loop polled forever: authentication and the ESP tunnel succeeded, but the plugin never handed NetworkManager an IP4 config and vpn.timeout tore the connection down. The candidates are now read from /sys/class/net (gpdN/tunN, numerically ordered, gpd first; tunl0 and other look-alikes excluded), so any number of foreign tunnels may be active. The pre-existing-interface snapshot from #7 grows with them and keeps doing the actual safety work. Widening the candidate set also widens the window in which another VPN activated during the SAML login could be adopted as ours, so the tunnel is additionally attributed to gpclient by the file descriptors it holds (iff: in /proc/PID/fdinfo, across gpclient and its children). That check only narrows the choice when it yields something; when the information is unavailable, the snapshot decides on its own as before. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011pqLycL9FbCQWYcTKchZjs
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.
Tunnel detection polled a fixed ["gpd0", "tun0", "tun1"] list. With two
other tun-based VPNs already up, openconnect's kernel-assigned fallback
name lands on tun2 - a name that list never contained - so the loop
polled forever: authentication and the ESP tunnel succeeded, but the
plugin never handed NetworkManager an IP4 config and vpn.timeout tore
the connection down.
The candidates are now read from /sys/class/net (gpdN/tunN, numerically
ordered, gpd first; tunl0 and other look-alikes excluded), so any number
of foreign tunnels may be active. The pre-existing-interface snapshot
from #7 grows with them and keeps doing the actual safety work.
Widening the candidate set also widens the window in which another VPN
activated during the SAML login could be adopted as ours, so the tunnel
is additionally attributed to gpclient by the file descriptors it holds
(iff: in /proc/PID/fdinfo, across gpclient and its children). That check
only narrows the choice when it yields something; when the information
is unavailable, the snapshot decides on its own as before.
Co-Authored-By: Claude noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_011pqLycL9FbCQWYcTKchZjs