Skip to content

service: find our own tunnel among any number of foreign ones (#13) - #14

Merged
WMP merged 1 commit into
mainfrom
claude/globalprotect-saml-nm-issue-vgz1xb
Aug 26, 2026
Merged

service: find our own tunnel among any number of foreign ones (#13)#14
WMP merged 1 commit into
mainfrom
claude/globalprotect-saml-nm-issue-vgz1xb

Conversation

@WMP

@WMP WMP commented Aug 26, 2026

Copy link
Copy Markdown
Owner

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

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
@WMP
WMP merged commit 70f506b into main Aug 26, 2026
5 checks passed
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.

2 participants