Handle reason='attempt-reconnect' on Linux, and stub for it on macOS/*BSD #89
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.
The case where the "real" network device disappears or disconnects, while the VPN/tunnel device stays up is a surprisingly complex one to handle correctly. The main issue is that the "explicit route" to the VPN gateway on the underlying network device may have disappeared, and the OS routing utilities may erroneously suggest a looped-back route (over the VPN/tunnel device) as the optimal route to the gateway.
This issue arises particularly — but NOT exclusively — if the default route for the relevant network family is now assigned to the VPN/tunnel device.
See:
for where the vpnc-script call with reason='attempt-reconnect' was added
to OpenConnect (merged in v8.02)
for where an initial placeholder was first added to vpnc-script
first actually-working support in vpnc-script (for Linux)m
We need to handle attempt-reconnect in
vpn-slice. This mostly borrows from whatvpnc-scriptdoes.Still TODO:
route -n get, we should usenetstat -r -nto ensure that we don't get a looped-back route, as
vpnc-scriptdoes sincehttps://gitlab.com/openconnect/vpnc-scripts/-/blob/412a1faffa72fcda54e8c42d22e0057e56240ff1/vpnc-script#L395-402
onlinkroute flag. This requires replacingip route getwithip route showin all cases. See https://gitlab.com/openconnect/vpnc-scripts/-/merge_requests/27
Here is an example of OpenConnect +
vpn-slicecorrectly re-establishing the routeto the VPN gateway even after it's removed by a network outage, leaving the default route looped-back
through the VPN/tunnel interface.