From: Nadav Har'El <[email protected]>
Committer: Nadav Har'El <[email protected]>
Branch: master
dhcp: ignore empty hostname
If the DHCP server does not send back a hostname, the existing code
called sethostname() with an empty host name. Do not do that.
Signed-off-by: Nadav Har'El <[email protected]>
---
diff --git a/core/dhcp.cc b/core/dhcp.cc
--- a/core/dhcp.cc
+++ b/core/dhcp.cc
@@ -568,7 +568,9 @@ namespace dhcp {
});
osv::set_dns_config(dm.get_dns_ips(),
std::vector<std::string>());
- sethostname(dm.get_hostname().c_str(),
dm.get_hostname().size());
+ if (dm.get_hostname().size()) {
+ sethostname(dm.get_hostname().c_str(),
dm.get_hostname().size());
+ }
// TODO: setup lease
} else if (dm.get_message_type() == DHCP_MT_NAK) {
// from RFC 2131 section 3.1.5
--
You received this message because you are subscribed to the Google Groups "OSv
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.