Makes launch_cvd start socket_forward_proxy
This, paired with the service to start socket_forward_proxy on the
guest, eliminate the need to manually run both binaries.
There is a command line flag defaulted to 5555 that decides the
host-side port. I'll need to work out how to bias this number sanely.
BUG: 72654144
Change-Id: I09b2c6950693fa373de2bc6873306ee481bae2f8
diff --git a/host/commands/launch/main.cc b/host/commands/launch/main.cc
index 789004d..d1a0443 100644
--- a/host/commands/launch/main.cc
+++ b/host/commands/launch/main.cc
@@ -118,6 +118,14 @@
"Location of the vnc server binary.");
DEFINE_int32(vnc_server_port, vsoc::GetPerInstanceDefault(6444),
"The port on which the vnc server should listen");
+// TODO(haining) bias the port number in a way that still goes to 5555 on the
+// guest-side
+DEFINE_string(socket_forward_proxy_binary,
+ StringFromEnv("ANDROID_HOST_OUT", StringFromEnv("HOME", ".")) +
+ "/bin/socket_forward_proxy",
+ "Location of the socket_forward_proxy binary.");
+DEFINE_int32(socket_forward_proxy_port, 5555, "port on which to run the "
+ "socket_forward_proxy server");
namespace {
const std::string kDataPolicyUseExisting = "use_existing";
@@ -406,6 +414,12 @@
std::string entropy_source = "/dev/urandom";
+ auto port_arg = std::string{"--port="} +
+ std::to_string(FLAGS_socket_forward_proxy_port);
+ const char* const socket_proxy[] =
+ {FLAGS_socket_forward_proxy_binary.c_str(), port_arg.c_str(), NULL};
+ subprocess(socket_proxy, nullptr, false);
+
config::GuestConfig cfg;
cfg.SetID(FLAGS_instance)
.SetVCPUs(FLAGS_cpus)