Commit 8b58be9b authored by Marcin Siodelski's avatar Marcin Siodelski

[3367] Set 0 ciaddr for DHCPOFFER and DHCPNAK.

parent f3e132d5
......@@ -507,6 +507,9 @@ Dhcpv4Srv::copyDefaultFields(const Pkt4Ptr& question, Pkt4Ptr& answer) {
answer->setCiaddr(question->getCiaddr());
answer->setSiaddr(IOAddress("0.0.0.0")); // explicitly set this to 0
// ciaddr is always 0, except for the Renew/Rebind state when it may
// be set to the ciaddr sent by the client.
answer->setCiaddr(IOAddress("0.0.0.0"));
answer->setHops(question->getHops());
// copy MAC address
......@@ -1050,6 +1053,18 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) {
answer->setYiaddr(lease->addr_);
/// @todo The server should check what ciaddr the client has supplied
/// in ciaddr. Currently the ciaddr is ignored except for the subnet
/// selection. If the client supplied an invalid address, the server
/// will also return an invalid address here.
if (!fake_allocation) {
// If this is a renewing client it will set a ciaddr which the
// server may include in the response. If this is a new allocation
// the client will set ciaddr to 0 and this will also be propagated
// to the server's answer.
answer->setCiaddr(question->getCiaddr());
}
// If there has been Client FQDN or Hostname option sent, but the
// hostname is empty, it means that server is responsible for
// generating the entire hostname for the client. The example of the
......
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