// explicitly set this to 0
resp_->setSiaddr(IOAddress::IPV4_ZERO_ADDRESS());
- // ciaddr is always 0, except for the Renew/Rebind state when it may
- // be set to the ciaddr sent by the client.
- resp_->setCiaddr(IOAddress::IPV4_ZERO_ADDRESS());
+ // ciaddr is always 0, except for the Renew/Rebind state and for
+ // Inform when it may be set to the ciaddr sent by the client.
+ if (query_->getType() == DHCPINFORM) {
+ resp_->setCiaddr(query_->getCiaddr());
+ } else {
+ resp_->setCiaddr(IOAddress::IPV4_ZERO_ADDRESS());
+ }
resp_->setHops(query_->getHops());
// copy MAC address
-// Copyright (C) 2014-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
ASSERT_EQ(DHCPACK, static_cast<int>(resp->getType()));
// Response should have been unicast to the ciaddr.
EXPECT_EQ(IOAddress("10.0.0.56"), resp->getLocalAddr());
+ // The ciaddr should have been copied.
+ EXPECT_EQ(IOAddress("10.0.0.56"), resp->getCiaddr());
// Response must not be relayed.
EXPECT_FALSE(resp->isRelayed());
// Make sure that the server id is present.
ASSERT_EQ(DHCPACK, static_cast<int>(resp->getType()));
// Response should have been unicast to the ciaddr.
EXPECT_EQ(IOAddress("10.0.0.12"), resp->getLocalAddr());
+ // The ciaddr should have been copied.
+ EXPECT_EQ(IOAddress("10.0.0.12"), resp->getCiaddr());
// Response must not be relayed.
EXPECT_FALSE(resp->isRelayed());
ASSERT_EQ(DHCPACK, static_cast<int>(resp->getType()));
// Response should have been unicast to the ciaddr.
EXPECT_EQ(IOAddress("10.0.0.56"), resp->getLocalAddr());
+ // The ciaddr should have been copied.
+ EXPECT_EQ(IOAddress("10.0.0.56"), resp->getCiaddr());
// Response must not be relayed.
EXPECT_FALSE(resp->isRelayed());
// Make sure that the server id is present.
Pkt4Ptr resp = client.getContext().response_;
// Make sure that the server has responded with DHCPACK.
ASSERT_EQ(DHCPACK, static_cast<int>(resp->getType()));
- // Response should have been unicast to the ciaddr.
+ // Response should have been unicast to the client address.
EXPECT_EQ(IOAddress("10.0.0.56"), resp->getLocalAddr());
+ // The ciaddr should be 0.
+ EXPECT_EQ(IOAddress("0.0.0.0"), resp->getCiaddr());
// Response must not be relayed.
EXPECT_FALSE(resp->isRelayed());
EXPECT_EQ(DHCP4_CLIENT_PORT, resp->getLocalPort());
ASSERT_EQ(DHCPACK, static_cast<int>(resp->getType()));
// Response should have been unicast to the ciaddr.
EXPECT_EQ(IOAddress("192.0.2.56"), resp->getLocalAddr());
+ // The ciaddr should have been copied.
+ EXPECT_EQ(IOAddress("192.0.2.56"), resp->getCiaddr());
// Response is unicast to the client, so it must not be relayed.
EXPECT_FALSE(resp->isRelayed());
EXPECT_EQ(DHCP4_CLIENT_PORT, resp->getLocalPort());