From b0b445d6c29387fbc3c84741895b515880f259ea Mon Sep 17 00:00:00 2001 From: Krasovskiy Saveliy Igorevich Date: Wed, 3 Apr 2024 15:57:10 +0200 Subject: [PATCH] fix: set adapter domain suffix correctly with DCO --- openvpn/client/win/cmdagent.hpp | 4 +++- openvpn/ovpnagent/win/ovpnagent.cpp | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/openvpn/client/win/cmdagent.hpp b/openvpn/client/win/cmdagent.hpp index eaa1a6234..86aaecd1e 100644 --- a/openvpn/client/win/cmdagent.hpp +++ b/openvpn/client/win/cmdagent.hpp @@ -181,6 +181,7 @@ class WinCommandAgent : public TunWin::SetupFactory os << "TAP handle: " << tap_handle_hex << std::endl; const HANDLE h = BufHex::parse(tap_handle_hex, "TAP handle"); + tap_.guid = json::get_string(jres, "adapter_guid"); tap_.index = (DWORD)json::get_int(jres, "adapter_index"); tap_.name = json::get_string(jres, "adapter_name"); @@ -220,8 +221,9 @@ class WinCommandAgent : public TunWin::SetupFactory } else { - jreq["adapter_name"] = tap_.name; + jreq["adapter_guid"] = tap_.guid; jreq["adapter_index"] = Json::Int(tap_.index); + jreq["adapter_name"] = tap_.name; } jreq["allow_local_dns_resolvers"] = config->allow_local_dns_resolvers; diff --git a/openvpn/ovpnagent/win/ovpnagent.cpp b/openvpn/ovpnagent/win/ovpnagent.cpp index deb5d6d9a..0f4ca9708 100644 --- a/openvpn/ovpnagent/win/ovpnagent.cpp +++ b/openvpn/ovpnagent/win/ovpnagent.cpp @@ -636,6 +636,7 @@ class MyClientInstance : public WS::Server::Listener::Client jout["tap_handle_hex"] = parent()->get_remote_tap_handle_hex(); auto tap = parent()->get_adapter_state(); + jout["adapter_guid"] = tap.guid; jout["adapter_index"] = Json::Int(tap.index); jout["adapter_name"] = tap.name; @@ -710,6 +711,7 @@ class MyClientInstance : public WS::Server::Listener::Client TunWin::Util::TapNameGuidPair tap; if (tun_type == TunWin::OvpnDco) { + tap.guid = json::get_string(root, "adapter_guid"); tap.index = (DWORD)json::get_int(root, "adapter_index"); tap.name = json::get_string(root, "adapter_name"); }