[rialto] Move connection port numbers to communication protocol lib
Bug: 291732060
Test: atest rialto_test
Change-Id: I27fcab087589acec02f3e55c08b33597ace471d0
diff --git a/rialto/src/main.rs b/rialto/src/main.rs
index 42d39c4..b34b9de 100644
--- a/rialto/src/main.rs
+++ b/rialto/src/main.rs
@@ -34,7 +34,7 @@
use libfdt::FdtError;
use log::{debug, error, info};
use virtio_drivers::{
- device::socket::VsockAddr,
+ device::socket::{VsockAddr, VMADDR_CID_HOST},
transport::{pci::bus::PciRoot, DeviceType, Transport},
Hal,
};
@@ -52,12 +52,7 @@
};
fn host_addr() -> VsockAddr {
- const PROTECTED_VM_PORT: u32 = 5679;
- const NON_PROTECTED_VM_PORT: u32 = 5680;
- const VMADDR_CID_HOST: u64 = 2;
-
- let port = if is_protected_vm() { PROTECTED_VM_PORT } else { NON_PROTECTED_VM_PORT };
- VsockAddr { cid: VMADDR_CID_HOST, port }
+ VsockAddr { cid: VMADDR_CID_HOST, port: service_vm_comm::host_port(is_protected_vm()) }
}
fn is_protected_vm() -> bool {