vms/qemu: Fix CID range to exclude reserved vsock IDs

This commit is contained in:
Jörg Thalheim
2025-08-25 15:27:03 +02:00
parent 7407fef21b
commit c57d8b30d3

View File

@@ -27,7 +27,8 @@ def graphics_options(vm: VmConfig) -> GraphicOptions:
if vm.waypipe.enable:
# FIXME: check for collisions
cid = secrets.randbelow(2**32 - 1) + 1 # Generate random CID between 1 and 2^32
# Generate random CID in [3, 2^32-1] (0,1,2 are reserved)
cid = secrets.randbelow(2**32 - 3) + 3
# fmt: off
return GraphicOptions([
*common,