Closed reynir closed 5 months ago
While testing this (before I had removed remote_host_route
) I discovered on Linux at least if you try to add the exact same route twice ip route
exits with code 2 and a message RTNETLINK answer: file exists
. I found there is as well ip route replace
which may be worth looking into.
great!
And attempt autolocal.
Instead of the
`Established _
action returning a list of routes it returns an opaque object of typeroute_info
which under the hood isConfig.t
. Then the client of the engine can callMiragevpn.routes
passing theroute_info
as well as some required information on the remote host ip and routing table. This way we can resolve magic keywordsnet_gateway
andremote_host
in--route
directives, and we attempt to figure outautolocal
. We also respect thelocal
flag in--redirect-gateway
if present.I learnt that OpenVPN discards routes which it can't resolve, for example a
--route
withnet_gateway
on an IPv6-only host. Thus I decided to warn and skip such routes. Thenet_gateway
andremote_host
areIpaddr.V4.t option
s in case of IPv6.Certainly the route detection in miragevpn-client-lwt could be made more robust.