robur-coop / miragevpn

An opinionated implementation of the OpenVPN protocol
BSD 2-Clause "Simplified" License
79 stars 9 forks source link

Restart semantics #248

Open reynir opened 6 months ago

reynir commented 6 months ago

In https://github.com/robur-coop/miragevpn/pull/247 and an earlier commit the HALT, EXIT and RESTART control channel messages were implemented. In the implementations they exit on all three commands. At an earlier point I tried to reconnect (in the client), but it was problematic because the pulled config was still present in the state's config and thus the PUSH_REPLY sent by the server was unexpected (because our config has ifconfig already - and this shows it is maybe not the right way to determine if this is the first PUSH_REPLY).

Probably we can get away with using a fresh (client) state rather than try to clean up the client state when receiving RESTART (and maybe EXIT as well).

hannesm commented 6 months ago

We could create a fresh client value using the Miragevpn.client function.

reynir commented 6 months ago

A slightly annoying quirk of using a fresh client is that it would not keep track of the last remote tried. In some cases you want to retry the same remote, in others you want to try the next remote. I would not spend time on implementing that for now unless someone has the need for this semantics.