diff --git a/src/shared/inc/lxinitshared.h b/src/shared/inc/lxinitshared.h index b64fbf13e..d0dcefb04 100644 --- a/src/shared/inc/lxinitshared.h +++ b/src/shared/inc/lxinitshared.h @@ -287,8 +287,11 @@ Module Name: // Definitions used by WSLA // -constexpr auto c_ephemeralPortRange = std::pair(10000, 20000); +constexpr auto c_ephemeralPortRange = std::pair(10000, 20001); +static_assert((c_ephemeralPortRange.first & 1) ^ (c_ephemeralPortRange.second & 1), "port range must have different parities"); + +// // The types of messages that can be sent to init and mini init. // diff --git a/src/windows/wslaservice/exe/WSLAVirtualMachine.cpp b/src/windows/wslaservice/exe/WSLAVirtualMachine.cpp index 1d2dfb6d7..fc05a326b 100644 --- a/src/windows/wslaservice/exe/WSLAVirtualMachine.cpp +++ b/src/windows/wslaservice/exe/WSLAVirtualMachine.cpp @@ -32,7 +32,7 @@ constexpr auto MAX_CRASH_DUMPS = 10; constexpr auto SAVED_STATE_FILE_EXTENSION = L".vmrs"; constexpr auto SAVED_STATE_FILE_PREFIX = L"saved-state-"; constexpr auto RECEIVE_TIMEOUT = 30 * 1000; -constexpr auto CONTAINER_PORT_RANGE = std::pair(20001, 65535); +constexpr auto CONTAINER_PORT_RANGE = std::pair(20002, 65535); static_assert(c_ephemeralPortRange.second < CONTAINER_PORT_RANGE.first);