Commit 83fb1d35 authored by Brian Kocoloski's avatar Brian Kocoloski

update guest VM hostname on virtual network initialization

parent b0490dc0
......@@ -436,6 +436,27 @@ __bring_up_iface(const char * iface,
return status;
}
static int
__set_hostname(hobbes_id_t enclave_id)
{
int status;
char * enclave_name;
enclave_name = hobbes_get_enclave_name(enclave_id);
if (enclave_name == NULL) {
ERROR("Could not query enclave name from Hobbes DB\n");
return -1;
}
status = sethostname(enclave_name, strlen(enclave_name));
if (status != 0) {
ERROR("Could not set hostname to '%s': %s\n", enclave_name, strerror(errno));
return -1;
}
return 0;
}
/* Create a bridge */
static int
......@@ -593,6 +614,13 @@ client_net_init(void)
return -1;
}
/* Set our hostname to be the name of our enclave */
status = __set_hostname(enclave_id);
if (status != 0) {
ERROR("Could not set hostname\n");
return -1;
}
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment