Skip to content

Commit

Permalink
Fix route emulation not correctly working and being disabled
Browse files Browse the repository at this point in the history
Signed-off-by: Arne Schwabe <[email protected]>
  • Loading branch information
schwabe authored and dsommers committed Dec 14, 2022
1 parent bc42748 commit aa3bcb8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions client/ovpncli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,9 @@ namespace openvpn {
#endif
#if defined(OPENVPN_EXTERNAL_TRANSPORT_FACTORY)
cc.extern_transport_factory = this;
#endif
#if defined(OPENVPN_PLATFORM_ANDROID)
cc.enable_route_emulation = state->enable_route_emulation;
#endif
// force Session ID use and disable password cache if static challenge is enabled
if (state->creds
Expand Down
4 changes: 3 additions & 1 deletion openvpn/tun/client/tunprop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,14 @@ namespace openvpn {
OptionList excludedRoutesOptions = opt;
for (const std::string& exRoute: tb->tun_builder_get_local_networks(false))
{
/* We abuse here the fact that OpenVPN3 core parses "route", "192.168.0.0/24", "", "net_gateway"
* in the same way as the correct "route 192.168.0.0.0 255.255.255.0 net_gateway statement */
excludedRoutesOptions.add_item(Option{"route", exRoute, "", "net_gateway"});
}

for (const std::string& exRoute: tb->tun_builder_get_local_networks(true))
{
excludedRoutesOptions.add_item(Option{"route-ipv6", exRoute, "", "net_gateway"});
excludedRoutesOptions.add_item(Option{"route-ipv6", exRoute, "net_gateway"});
}

add_routes(tb, excludedRoutesOptions, ipv, eer.get(), quiet);
Expand Down

0 comments on commit aa3bcb8

Please sign in to comment.