From 348b7382dd9ddfeaffc0bfa45bb862f01e42df36 Mon Sep 17 00:00:00 2001 From: Tomek Mrugalski Date: Tue, 8 Sep 2015 14:35:28 +0200 Subject: [3981] DHCPDECLINE support implemented. --- src/bin/dhcp4/tests/dhcp4_client.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/bin/dhcp4/tests/dhcp4_client.cc') diff --git a/src/bin/dhcp4/tests/dhcp4_client.cc b/src/bin/dhcp4/tests/dhcp4_client.cc index 750e6657b2..6ff104aba8 100644 --- a/src/bin/dhcp4/tests/dhcp4_client.cc +++ b/src/bin/dhcp4/tests/dhcp4_client.cc @@ -280,6 +280,30 @@ Dhcp4Client::doRelease() { sendMsg(context_.query_); } +void +Dhcp4Client::doDecline() { + if (config_.lease_.addr_ == IOAddress::IPV4_ZERO_ADDRESS()) { + isc_throw(Dhcp4ClientError, "failed to send the decline" + " message because client doesn't have a lease"); + } + context_.query_ = createMsg(DHCPDECLINE); + + // Set ciaddr to 0. + context_.query_->setCiaddr(IOAddress("0.0.0.0")); + + // Include Requested IP Address Option + addRequestedAddress(config_.lease_.addr_); + + // Include client identifier. + appendClientId(); + + // Remove configuration. + config_.reset(); + + // Send the message to the server. + sendMsg(context_.query_); +} + void Dhcp4Client::doRequest() { context_.query_ = createMsg(DHCPREQUEST); -- cgit v1.2.3