mirror of
https://github.com/microsoft/WSL.git
synced 2025-12-10 16:30:30 -06:00
WSLA: Add WSLA-specific class registration for virtio networking
Update wsldevicehost nuget package with new version that contains the new class ID
This commit is contained in:
parent
2a41fe20e3
commit
f61b45e152
@ -343,6 +343,27 @@
|
|||||||
</RegistryKey>
|
</RegistryKey>
|
||||||
</RegistryKey>
|
</RegistryKey>
|
||||||
|
|
||||||
|
<!-- wsldevicehost.dll -->
|
||||||
|
<RegistryKey Root="HKCR" Key="AppID\{C457EA11-5486-4174-B90D-089909EDB170}">
|
||||||
|
<RegistryValue Name="DllSurrogate" Value="" Type="string" />
|
||||||
|
<RegistryValue Name="AppIDFlags" Value="2048" Type="integer" />
|
||||||
|
|
||||||
|
<!-- O:BAG:BAD:(A;;CCDCSW;;;AU)(A;;CCDCSW;;;PS)(A;;CCDCSW;;;SY) -->
|
||||||
|
<RegistryValue Name="AccessPermission" Value="01000480580000006800000000000000140000000200440003000000000014000B00000001010000000000050B000000000014000B00000001010000000000050A000000000014000B0000000101000000000005120000000102000000000005200000002002000001020000000000052000000020020000" Type="binary" />
|
||||||
|
<RegistryValue Name="LaunchPermission" Value="01000480580000006800000000000000140000000200440003000000000014000B00000001010000000000050B000000000014000B00000001010000000000050A000000000014000B0000000101000000000005120000000102000000000005200000002002000001020000000000052000000020020000" Type="binary" />
|
||||||
|
</RegistryKey>
|
||||||
|
|
||||||
|
<!-- WslDeviceHost_VirtioNet -->
|
||||||
|
<RegistryKey Root="HKCR" Key="CLSID\{7B3C9A42-8E1F-4D5A-9F2E-C4A7B8D3E6F1}">
|
||||||
|
<RegistryValue Value="WslDeviceHost_Net" Type="string" />
|
||||||
|
<RegistryValue Name="AppId" Value="{C457EA11-5486-4174-B90D-089909EDB170}" Type="string" />
|
||||||
|
|
||||||
|
<RegistryKey Key="InProcServer32">
|
||||||
|
<RegistryValue Value="[INSTALLDIR]wsldevicehost.dll" Type="string" />
|
||||||
|
<RegistryValue Name="ThreadingModel" Value="Both" Type="string" />
|
||||||
|
</RegistryKey>
|
||||||
|
</RegistryKey>
|
||||||
|
|
||||||
<File Id="wslaservice.exe" Source="${BIN}/wslaservice.exe" KeyPath="yes" />
|
<File Id="wslaservice.exe" Source="${BIN}/wslaservice.exe" KeyPath="yes" />
|
||||||
<File Id="wslaserviceproxystub.dll" Name="wslaserviceproxystub.dll" Source="${BIN}/wslaserviceproxystub.dll" />
|
<File Id="wslaserviceproxystub.dll" Name="wslaserviceproxystub.dll" Source="${BIN}/wslaserviceproxystub.dll" />
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
<package id="Microsoft.WSL.bsdtar" version="0.0.2-2" />
|
<package id="Microsoft.WSL.bsdtar" version="0.0.2-2" />
|
||||||
<package id="Microsoft.WSL.Dependencies.amd64fre" version="10.0.27820.1000-250318-1700.rs-base2-hyp" targetFramework="native" />
|
<package id="Microsoft.WSL.Dependencies.amd64fre" version="10.0.27820.1000-250318-1700.rs-base2-hyp" targetFramework="native" />
|
||||||
<package id="Microsoft.WSL.Dependencies.arm64fre" version="10.0.27820.1000-250318-1700.rs-base2-hyp" targetFramework="native" />
|
<package id="Microsoft.WSL.Dependencies.arm64fre" version="10.0.27820.1000-250318-1700.rs-base2-hyp" targetFramework="native" />
|
||||||
<package id="Microsoft.WSL.DeviceHost" version="1.0.0-20251015.1" />
|
<package id="Microsoft.WSL.DeviceHost" version="1.0.0-20251202.1" />
|
||||||
<package id="Microsoft.WSL.Kernel" version="6.6.87.2-1" targetFramework="native" />
|
<package id="Microsoft.WSL.Kernel" version="6.6.87.2-1" targetFramework="native" />
|
||||||
<package id="Microsoft.WSL.LinuxSdk" version="1.20.0" targetFramework="native" />
|
<package id="Microsoft.WSL.LinuxSdk" version="1.20.0" targetFramework="native" />
|
||||||
<package id="Microsoft.WSL.LxUtil.amd64fre" version="10.0.26100.1-240331-1435.ge-release" />
|
<package id="Microsoft.WSL.LxUtil.amd64fre" version="10.0.26100.1-240331-1435.ge-release" />
|
||||||
|
|||||||
@ -70,7 +70,7 @@ void GuestDeviceManager::AddSharedMemoryDevice(_In_ const GUID& ImplementationCl
|
|||||||
static constexpr auto VIRTIO_FS_FLAGS_SHMEM_SIZE_SHIFT = 16;
|
static constexpr auto VIRTIO_FS_FLAGS_SHMEM_SIZE_SHIFT = 16;
|
||||||
UINT32 flags = (SizeMb << VIRTIO_FS_FLAGS_SHMEM_SIZE_SHIFT);
|
UINT32 flags = (SizeMb << VIRTIO_FS_FLAGS_SHMEM_SIZE_SHIFT);
|
||||||
WI_SetFlag(flags, VIRTIO_FS_FLAGS_TYPE_SECTIONS);
|
WI_SetFlag(flags, VIRTIO_FS_FLAGS_TYPE_SECTIONS);
|
||||||
(void)AddHdvShareWithOptions(VIRTIO_VIRTIOFS_DEVICE_ID, ImplementationClsid, Tag, {}, objectLifetime.Path.c_str(), flags, UserToken);
|
(void)AddHdvShareWithOptions(VIRTIO_FS_DEVICE_ID, ImplementationClsid, Tag, {}, objectLifetime.Path.c_str(), flags, UserToken);
|
||||||
m_objectDirectories.emplace_back(std::move(objectLifetime));
|
m_objectDirectories.emplace_back(std::move(objectLifetime));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,14 +8,13 @@
|
|||||||
#define VIRTIO_FS_FLAGS_TYPE_FILES 0x8000
|
#define VIRTIO_FS_FLAGS_TYPE_FILES 0x8000
|
||||||
#define VIRTIO_FS_FLAGS_TYPE_SECTIONS 0x4000
|
#define VIRTIO_FS_FLAGS_TYPE_SECTIONS 0x4000
|
||||||
|
|
||||||
// {872270E1-A899-4AF6-B454-7193634435AD}
|
|
||||||
DEFINE_GUID(VIRTIO_VIRTIOFS_DEVICE_ID, 0x872270E1, 0xA899, 0x4AF6, 0xB4, 0x54, 0x71, 0x93, 0x63, 0x44, 0x35, 0xAD);
|
|
||||||
|
|
||||||
// {ABB755FC-1B86-4255-83E2-E5787ABCF6C2}
|
|
||||||
DEFINE_GUID(VIRTIO_PMEM_CLASS_ID, 0xABB755FC, 0x1B86, 0x4255, 0x83, 0xe2, 0xe5, 0x78, 0x7a, 0xbc, 0xf6, 0xc2);
|
|
||||||
|
|
||||||
inline const std::wstring c_defaultDeviceTag = L"default";
|
inline const std::wstring c_defaultDeviceTag = L"default";
|
||||||
|
|
||||||
|
// These device types are implemented by the external wsldevicehost vdev.
|
||||||
|
DEFINE_GUID(VIRTIO_FS_DEVICE_ID, 0x872270E1, 0xA899, 0x4AF6, 0xB4, 0x54, 0x71, 0x93, 0x63, 0x44, 0x35, 0xAD); // {872270E1-A899-4AF6-B454-7193634435AD}
|
||||||
|
DEFINE_GUID(VIRTIO_NET_DEVICE_ID, 0xF07010D0, 0x0EA9, 0x447F, 0x88, 0xEF, 0xBD, 0x95, 0x2A, 0x4D, 0x2F, 0x14); // {F07010D0-0EA9-447F-88EF-BD952A4D2F14}
|
||||||
|
DEFINE_GUID(VIRTIO_PMEM_DEVICE_ID, 0xEDBB24BB, 0x5E19, 0x40F4, 0x8A, 0x0F, 0x82, 0x24, 0x31, 0x30, 0x64, 0xFD); // {EDBB24BB-5E19-40F4-8A0F-8224313064FD}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Provides synchronized access to guest device operations.
|
// Provides synchronized access to guest device operations.
|
||||||
//
|
//
|
||||||
|
|||||||
@ -14,16 +14,16 @@ using wsl::core::VirtioNetworking;
|
|||||||
static constexpr auto c_loopbackDeviceName = TEXT(LX_INIT_LOOPBACK_DEVICE_NAME);
|
static constexpr auto c_loopbackDeviceName = TEXT(LX_INIT_LOOPBACK_DEVICE_NAME);
|
||||||
|
|
||||||
VirtioNetworking::VirtioNetworking(
|
VirtioNetworking::VirtioNetworking(
|
||||||
GnsChannel&& gnsChannel, bool enableLocalhostRelay, std::shared_ptr<GuestDeviceManager> guestDeviceManager, wil::shared_handle userToken) :
|
GnsChannel&& gnsChannel, bool enableLocalhostRelay, std::shared_ptr<GuestDeviceManager> guestDeviceManager, GUID classId, wil::shared_handle userToken) :
|
||||||
m_guestDeviceManager(std::move(guestDeviceManager)),
|
m_guestDeviceManager(std::move(guestDeviceManager)),
|
||||||
m_userToken(std::move(userToken)),
|
m_userToken(std::move(userToken)),
|
||||||
m_gnsChannel(std::move(gnsChannel)),
|
m_gnsChannel(std::move(gnsChannel)),
|
||||||
m_enableLocalhostRelay(enableLocalhostRelay)
|
m_enableLocalhostRelay(enableLocalhostRelay),
|
||||||
|
m_virtioNetworkClsid(classId)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void VirtioNetworking::Initialize()
|
void VirtioNetworking::Initialize()
|
||||||
try
|
|
||||||
{
|
{
|
||||||
m_networkSettings = GetHostEndpointSettings();
|
m_networkSettings = GetHostEndpointSettings();
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ try
|
|||||||
|
|
||||||
// Add virtio net adapter to guest
|
// Add virtio net adapter to guest
|
||||||
m_adapterId = m_guestDeviceManager->AddGuestDevice(
|
m_adapterId = m_guestDeviceManager->AddGuestDevice(
|
||||||
c_virtioNetworkDeviceId, c_virtioNetworkClsid, L"eth0", nullptr, device_options.str().c_str(), 0, m_userToken.get());
|
VIRTIO_NET_DEVICE_ID, m_virtioNetworkClsid, L"eth0", nullptr, device_options.str().c_str(), 0, m_userToken.get());
|
||||||
|
|
||||||
hns::HNSEndpoint endpointProperties;
|
hns::HNSEndpoint endpointProperties;
|
||||||
endpointProperties.ID = m_adapterId;
|
endpointProperties.ID = m_adapterId;
|
||||||
@ -114,13 +114,12 @@ try
|
|||||||
|
|
||||||
THROW_IF_WIN32_ERROR(NotifyNetworkConnectivityHintChange(&VirtioNetworking::OnNetworkConnectivityChange, this, true, &m_networkNotifyHandle));
|
THROW_IF_WIN32_ERROR(NotifyNetworkConnectivityHintChange(&VirtioNetworking::OnNetworkConnectivityChange, this, true, &m_networkNotifyHandle));
|
||||||
}
|
}
|
||||||
CATCH_LOG()
|
|
||||||
|
|
||||||
void VirtioNetworking::SetupLoopbackDevice()
|
void VirtioNetworking::SetupLoopbackDevice()
|
||||||
{
|
{
|
||||||
m_localhostAdapterId = m_guestDeviceManager->AddGuestDevice(
|
m_localhostAdapterId = m_guestDeviceManager->AddGuestDevice(
|
||||||
c_virtioNetworkDeviceId,
|
VIRTIO_NET_DEVICE_ID,
|
||||||
c_virtioNetworkClsid,
|
m_virtioNetworkClsid,
|
||||||
c_loopbackDeviceName,
|
c_loopbackDeviceName,
|
||||||
nullptr,
|
nullptr,
|
||||||
L"client_ip=127.0.0.1;client_mac=00:11:22:33:44:55",
|
L"client_ip=127.0.0.1;client_mac=00:11:22:33:44:55",
|
||||||
@ -188,13 +187,13 @@ HRESULT VirtioNetworking::HandlePortNotification(const SOCKADDR_INET& addr, int
|
|||||||
localAddr.Ipv6.sin6_port = addr.Ipv6.sin6_port;
|
localAddr.Ipv6.sin6_port = addr.Ipv6.sin6_port;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = ModifyOpenPorts(c_virtioNetworkClsid, c_loopbackDeviceName, localAddr, protocol, allocate);
|
result = ModifyOpenPorts(c_loopbackDeviceName, localAddr, protocol, allocate);
|
||||||
LOG_HR_IF_MSG(E_FAIL, result != S_OK, "Failure adding localhost relay port %d", localAddr.Ipv4.sin_port);
|
LOG_HR_IF_MSG(E_FAIL, result != S_OK, "Failure adding localhost relay port %d", localAddr.Ipv4.sin_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!loopback)
|
if (!loopback)
|
||||||
{
|
{
|
||||||
const int localResult = ModifyOpenPorts(c_virtioNetworkClsid, L"eth0", addr, protocol, allocate);
|
const int localResult = ModifyOpenPorts(L"eth0", addr, protocol, allocate);
|
||||||
LOG_HR_IF_MSG(E_FAIL, localResult != S_OK, "Failure adding relay port %d", addr.Ipv4.sin_port);
|
LOG_HR_IF_MSG(E_FAIL, localResult != S_OK, "Failure adding relay port %d", addr.Ipv4.sin_port);
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
{
|
{
|
||||||
@ -205,7 +204,7 @@ HRESULT VirtioNetworking::HandlePortNotification(const SOCKADDR_INET& addr, int
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int VirtioNetworking::ModifyOpenPorts(_In_ const GUID& clsid, _In_ PCWSTR tag, _In_ const SOCKADDR_INET& addr, _In_ int protocol, _In_ bool isOpen) const
|
int VirtioNetworking::ModifyOpenPorts(_In_ PCWSTR tag, _In_ const SOCKADDR_INET& addr, _In_ int protocol, _In_ bool isOpen) const
|
||||||
{
|
{
|
||||||
if (protocol != IPPROTO_TCP && protocol != IPPROTO_UDP)
|
if (protocol != IPPROTO_TCP && protocol != IPPROTO_UDP)
|
||||||
{
|
{
|
||||||
@ -221,7 +220,7 @@ int VirtioNetworking::ModifyOpenPorts(_In_ const GUID& clsid, _In_ PCWSTR tag, _
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto lock = m_lock.lock_exclusive();
|
auto lock = m_lock.lock_exclusive();
|
||||||
const auto server = m_guestDeviceManager->GetRemoteFileSystem(clsid, c_defaultDeviceTag);
|
const auto server = m_guestDeviceManager->GetRemoteFileSystem(m_virtioNetworkClsid, c_defaultDeviceTag);
|
||||||
if (server)
|
if (server)
|
||||||
{
|
{
|
||||||
std::wstring portString = std::format(L"tag={};port_number={}", tag, addr.Ipv4.sin_port);
|
std::wstring portString = std::format(L"tag={};port_number={}", tag, addr.Ipv4.sin_port);
|
||||||
|
|||||||
@ -13,7 +13,7 @@ namespace wsl::core {
|
|||||||
class VirtioNetworking : public INetworkingEngine
|
class VirtioNetworking : public INetworkingEngine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VirtioNetworking(GnsChannel&& gnsChannel, bool enableLocalhostRelay, std::shared_ptr<GuestDeviceManager> guestDeviceManager, wil::shared_handle userToken);
|
VirtioNetworking(GnsChannel&& gnsChannel, bool enableLocalhostRelay, std::shared_ptr<GuestDeviceManager> guestDeviceManager, GUID classId, wil::shared_handle userToken);
|
||||||
~VirtioNetworking() = default;
|
~VirtioNetworking() = default;
|
||||||
|
|
||||||
// Note: This class cannot be moved because m_networkNotifyHandle captures a 'this' pointer.
|
// Note: This class cannot be moved because m_networkNotifyHandle captures a 'this' pointer.
|
||||||
@ -35,7 +35,7 @@ private:
|
|||||||
static std::optional<ULONGLONG> FindVirtioInterfaceLuid(const SOCKADDR_INET& virtioAddress, const NL_NETWORK_CONNECTIVITY_HINT& currentConnectivityHint);
|
static std::optional<ULONGLONG> FindVirtioInterfaceLuid(const SOCKADDR_INET& virtioAddress, const NL_NETWORK_CONNECTIVITY_HINT& currentConnectivityHint);
|
||||||
|
|
||||||
HRESULT HandlePortNotification(const SOCKADDR_INET& addr, int protocol, bool allocate) const noexcept;
|
HRESULT HandlePortNotification(const SOCKADDR_INET& addr, int protocol, bool allocate) const noexcept;
|
||||||
int ModifyOpenPorts(_In_ const GUID& clsid, _In_ PCWSTR tag, _In_ const SOCKADDR_INET& addr, _In_ int protocol, _In_ bool isOpen) const;
|
int ModifyOpenPorts(_In_ PCWSTR tag, _In_ const SOCKADDR_INET& addr, _In_ int protocol, _In_ bool isOpen) const;
|
||||||
void RefreshGuestConnection(NL_NETWORK_CONNECTIVITY_HINT hint) noexcept;
|
void RefreshGuestConnection(NL_NETWORK_CONNECTIVITY_HINT hint) noexcept;
|
||||||
void SetupLoopbackDevice();
|
void SetupLoopbackDevice();
|
||||||
void UpdateDns(wsl::shared::hns::DNS&& dnsSettings);
|
void UpdateDns(wsl::shared::hns::DNS&& dnsSettings);
|
||||||
@ -51,6 +51,7 @@ private:
|
|||||||
bool m_enableLocalhostRelay;
|
bool m_enableLocalhostRelay;
|
||||||
GUID m_localhostAdapterId;
|
GUID m_localhostAdapterId;
|
||||||
GUID m_adapterId;
|
GUID m_adapterId;
|
||||||
|
GUID m_virtioNetworkClsid;
|
||||||
|
|
||||||
std::optional<ULONGLONG> m_interfaceLuid;
|
std::optional<ULONGLONG> m_interfaceLuid;
|
||||||
ULONG m_networkMtu = 0;
|
ULONG m_networkMtu = 0;
|
||||||
@ -58,11 +59,6 @@ private:
|
|||||||
|
|
||||||
// Note: this field must be destroyed first to stop the callbacks before any other field is destroyed.
|
// Note: this field must be destroyed first to stop the callbacks before any other field is destroyed.
|
||||||
networking::unique_notify_handle m_networkNotifyHandle;
|
networking::unique_notify_handle m_networkNotifyHandle;
|
||||||
|
|
||||||
// 16479D2E-F0C3-4DBA-BF7A-04FFF0892B07
|
|
||||||
static constexpr GUID c_virtioNetworkClsid = {0x16479D2E, 0xF0C3, 0x4DBA, {0xBF, 0x7A, 0x04, 0xFF, 0xF0, 0x89, 0x2B, 0x07}};
|
|
||||||
// F07010D0-0EA9-447F-88EF-BD952A4D2F14
|
|
||||||
static constexpr GUID c_virtioNetworkDeviceId = {0xF07010D0, 0x0EA9, 0x447F, {0x88, 0xEF, 0xBD, 0x95, 0x2A, 0x4D, 0x2F, 0x14}};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace wsl::core
|
} // namespace wsl::core
|
||||||
|
|||||||
@ -39,13 +39,15 @@ using namespace std::string_literals;
|
|||||||
// Start of unaddressable memory if guest only supports the minimum 36-bit addressing.
|
// Start of unaddressable memory if guest only supports the minimum 36-bit addressing.
|
||||||
#define MAX_36_BIT_PAGE_IN_MB (0x1000000000 / _1MB)
|
#define MAX_36_BIT_PAGE_IN_MB (0x1000000000 / _1MB)
|
||||||
|
|
||||||
// This device type is implemented by the external virtio-pmem vdev.
|
|
||||||
// {EDBB24BB-5E19-40F4-8A0F-8224313064FD}
|
|
||||||
DEFINE_GUID(VIRTIO_PMEM_DEVICE_ID, 0xEDBB24BB, 0x5E19, 0x40F4, 0x8A, 0x0F, 0x82, 0x24, 0x31, 0x30, 0x64, 0xFD);
|
|
||||||
|
|
||||||
#define WSLG_SHARED_MEMORY_SIZE_MB 8192
|
#define WSLG_SHARED_MEMORY_SIZE_MB 8192
|
||||||
#define PAGE_SIZE 0x1000
|
#define PAGE_SIZE 0x1000
|
||||||
|
|
||||||
|
// WSL-specific virtio device class IDs.
|
||||||
|
DEFINE_GUID(VIRTIO_FS_ADMIN_CLASS_ID, 0x7E6AD219, 0xD1B3, 0x42D5, 0xB8, 0xEE, 0xD9, 0x63, 0x24, 0xE6, 0x4F, 0xF6); // {7E6AD219-D1B3-42D5-B8EE-D96324E64FF6}
|
||||||
|
DEFINE_GUID(VIRTIO_FS_CLASS_ID, 0x60285AE6, 0xAAF3, 0x4456, 0xB4, 0x44, 0xA6, 0xC2, 0xD0, 0xDE, 0xDA, 0x38); // {60285AE6-AAF3-4456-B444-A6C2D0DEDA38}
|
||||||
|
DEFINE_GUID(VIRTIO_NET_CLASS_ID, 0x16479D2E, 0xF0C3, 0x4DBA, 0xBF, 0x7A, 0x04, 0xFF, 0xF0, 0x89, 0x2B, 0x07); // {16479D2E-F0C3-4DBA-BF7A-04FFF0892B07}
|
||||||
|
DEFINE_GUID(VIRTIO_PMEM_CLASS_ID, 0xABB755FC, 0x1B86, 0x4255, 0x83, 0xE2, 0xE5, 0x78, 0x7A, 0xBC, 0xF6, 0xC2); // {ABB755FC-1B86-4255-83E2-E5787ABCF6C2}
|
||||||
|
|
||||||
static constexpr size_t c_bootEntropy = 0x1000;
|
static constexpr size_t c_bootEntropy = 0x1000;
|
||||||
static constexpr auto c_localDevicesKey = L"SOFTWARE\\Microsoft\\Terminal Server Client\\LocalDevices";
|
static constexpr auto c_localDevicesKey = L"SOFTWARE\\Microsoft\\Terminal Server Client\\LocalDevices";
|
||||||
|
|
||||||
@ -589,7 +591,7 @@ void WslCoreVm::Initialize(const GUID& VmId, const wil::shared_handle& UserToken
|
|||||||
else if (m_vmConfig.NetworkingMode == NetworkingMode::VirtioProxy)
|
else if (m_vmConfig.NetworkingMode == NetworkingMode::VirtioProxy)
|
||||||
{
|
{
|
||||||
m_networkingEngine = std::make_unique<wsl::core::VirtioNetworking>(
|
m_networkingEngine = std::make_unique<wsl::core::VirtioNetworking>(
|
||||||
std::move(gnsChannel), m_vmConfig.EnableLocalhostRelay, m_guestDeviceManager, m_userToken);
|
std::move(gnsChannel), m_vmConfig.EnableLocalhostRelay, m_guestDeviceManager, VIRTIO_NET_CLASS_ID, m_userToken);
|
||||||
}
|
}
|
||||||
else if (m_vmConfig.NetworkingMode == NetworkingMode::Bridged)
|
else if (m_vmConfig.NetworkingMode == NetworkingMode::Bridged)
|
||||||
{
|
{
|
||||||
@ -1754,7 +1756,7 @@ void WslCoreVm::InitializeGuest()
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_guestDeviceManager->AddSharedMemoryDevice(
|
m_guestDeviceManager->AddSharedMemoryDevice(
|
||||||
c_virtiofsClassId, L"wslg", L"wslg", WSLG_SHARED_MEMORY_SIZE_MB, m_userToken.get());
|
VIRTIO_FS_CLASS_ID, L"wslg", L"wslg", WSLG_SHARED_MEMORY_SIZE_MB, m_userToken.get());
|
||||||
m_sharedMemoryRoot = std::format(L"WSL\\{}\\wslg", m_machineId);
|
m_sharedMemoryRoot = std::format(L"WSL\\{}\\wslg", m_machineId);
|
||||||
}
|
}
|
||||||
CATCH_LOG()
|
CATCH_LOG()
|
||||||
@ -2107,8 +2109,8 @@ std::wstring WslCoreVm::AddVirtioFsShare(_In_ bool Admin, _In_ PCWSTR Path, _In_
|
|||||||
WI_ASSERT(!FindVirtioFsShare(tag.c_str(), Admin));
|
WI_ASSERT(!FindVirtioFsShare(tag.c_str(), Admin));
|
||||||
|
|
||||||
(void)m_guestDeviceManager->AddGuestDevice(
|
(void)m_guestDeviceManager->AddGuestDevice(
|
||||||
VIRTIO_VIRTIOFS_DEVICE_ID,
|
VIRTIO_FS_DEVICE_ID,
|
||||||
Admin ? c_virtiofsAdminClassId : c_virtiofsClassId,
|
Admin ? VIRTIO_FS_ADMIN_CLASS_ID : VIRTIO_FS_CLASS_ID,
|
||||||
tag.c_str(),
|
tag.c_str(),
|
||||||
key.OptionsString().c_str(),
|
key.OptionsString().c_str(),
|
||||||
sharePath.c_str(),
|
sharePath.c_str(),
|
||||||
|
|||||||
@ -40,11 +40,6 @@ inline constexpr auto c_optionsValueName = L"Options";
|
|||||||
inline constexpr auto c_typeValueName = L"Type";
|
inline constexpr auto c_typeValueName = L"Type";
|
||||||
inline constexpr auto c_mountNameValueName = L"Name";
|
inline constexpr auto c_mountNameValueName = L"Name";
|
||||||
|
|
||||||
static constexpr GUID c_virtiofsAdminClassId = {0x7e6ad219, 0xd1b3, 0x42d5, {0xb8, 0xee, 0xd9, 0x63, 0x24, 0xe6, 0x4f, 0xf6}};
|
|
||||||
|
|
||||||
// {60285AE6-AAF3-4456-B444-A6C2D0DEDA38}
|
|
||||||
static constexpr GUID c_virtiofsClassId = {0x60285ae6, 0xaaf3, 0x4456, {0xb4, 0x44, 0xa6, 0xc2, 0xd0, 0xde, 0xda, 0x38}};
|
|
||||||
|
|
||||||
namespace wrl = Microsoft::WRL;
|
namespace wrl = Microsoft::WRL;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -33,6 +33,9 @@ constexpr auto SAVED_STATE_FILE_EXTENSION = L".vmrs";
|
|||||||
constexpr auto SAVED_STATE_FILE_PREFIX = L"saved-state-";
|
constexpr auto SAVED_STATE_FILE_PREFIX = L"saved-state-";
|
||||||
constexpr auto RECEIVE_TIMEOUT = 30 * 1000;
|
constexpr auto RECEIVE_TIMEOUT = 30 * 1000;
|
||||||
|
|
||||||
|
// WSLA-specific virtio device class IDs.
|
||||||
|
DEFINE_GUID(WSLA_VIRTIO_NET_CLASS_ID, 0x7B3C9A42, 0x8E1F, 0x4D5A, 0x9F, 0x2E, 0xC4, 0xA7, 0xB8, 0xD3, 0xE6, 0xF1); // {7B3C9A42-8E1F-4D5A-9F2E-C4A7B8D3E6F1}
|
||||||
|
|
||||||
WSLAVirtualMachine::WSLAVirtualMachine(const VIRTUAL_MACHINE_SETTINGS& Settings, PSID UserSid, WSLAUserSessionImpl* Session) :
|
WSLAVirtualMachine::WSLAVirtualMachine(const VIRTUAL_MACHINE_SETTINGS& Settings, PSID UserSid, WSLAUserSessionImpl* Session) :
|
||||||
m_settings(Settings), m_userSid(UserSid)
|
m_settings(Settings), m_userSid(UserSid)
|
||||||
{
|
{
|
||||||
@ -541,7 +544,8 @@ void WSLAVirtualMachine::ConfigureNetworking()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_networkEngine = std::make_unique<wsl::core::VirtioNetworking>(std::move(gnsChannel), true, m_guestDeviceManager, m_userToken);
|
m_networkEngine = std::make_unique<wsl::core::VirtioNetworking>(
|
||||||
|
std::move(gnsChannel), true, m_guestDeviceManager, WSLA_VIRTIO_NET_CLASS_ID, m_userToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_networkEngine->Initialize();
|
m_networkEngine->Initialize();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user