diff options
author | Marcin Siodelski <marcin@isc.org> | 2016-08-25 15:33:54 +0200 |
---|---|---|
committer | Marcin Siodelski <marcin@isc.org> | 2016-08-25 15:33:54 +0200 |
commit | 7612f815b0f60a9738b2a135cffad6060308cf99 (patch) | |
tree | c369b238abe51793fdf28ce6509e8932b776c194 /src/lib/dhcpsrv/host.cc | |
parent | [4552] Renamed parameter "server-name" to "server-hostname". (diff) | |
download | kea-7612f815b0f60a9738b2a135cffad6060308cf99.tar.xz kea-7612f815b0f60a9738b2a135cffad6060308cf99.zip |
[4552] Addressed review comments.
Diffstat (limited to 'src/lib/dhcpsrv/host.cc')
-rw-r--r-- | src/lib/dhcpsrv/host.cc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/lib/dhcpsrv/host.cc b/src/lib/dhcpsrv/host.cc index 70211e903b..8b3bbb3e1e 100644 --- a/src/lib/dhcpsrv/host.cc +++ b/src/lib/dhcpsrv/host.cc @@ -5,6 +5,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include <config.h> +#include <dhcp/pkt4.h> #include <dhcpsrv/host.h> #include <util/encode/hex.h> #include <util/strutil.h> @@ -365,7 +366,7 @@ Host::setNextServer(const asiolink::IOAddress& next_server) { if (!next_server.isV4()) { isc_throw(isc::BadValue, "next server address '" << next_server << "' is not a valid IPv4 address"); - } else if (next_server.isV4Zero() || next_server.isV4Bcast()) { + } else if (next_server.isV4Bcast()) { isc_throw(isc::BadValue, "invalid next server address '" << next_server << "'"); } @@ -373,6 +374,24 @@ Host::setNextServer(const asiolink::IOAddress& next_server) { next_server_ = next_server; } +void +Host::setServerHostname(const std::string& server_host_name) { + if (server_host_name.size() > Pkt4::MAX_SNAME_LEN - 1) { + isc_throw(isc::BadValue, "server hostname length must not exceed " + << (Pkt4::MAX_SNAME_LEN - 1)); + } + server_host_name_ = server_host_name; +} + +void +Host::setBootFileName(const std::string& boot_file_name) { + if (boot_file_name.size() > Pkt4::MAX_FILE_LEN - 1) { + isc_throw(isc::BadValue, "boot file length must not exceed " + << (Pkt4::MAX_FILE_LEN - 1)); + } + boot_file_name_ = boot_file_name; +} + std::string Host::toText() const { std::ostringstream s; |