const Triplet<uint32_t>& t2,
const Triplet<uint32_t>& valid_lifetime,
const SubnetID id)
-:Subnet(prefix, length, t1, t2, valid_lifetime,
- RelayInfo(IOAddress("0.0.0.0")), id), siaddr_(IOAddress("0.0.0.0")) {
+ : Subnet(prefix, length, t1, t2, valid_lifetime, RelayInfo(IOAddress("0.0.0.0")), id),
+ siaddr_(IOAddress("0.0.0.0")), ignore_client_id_(false) {
if (!prefix.isV4()) {
isc_throw(BadValue, "Non IPv4 prefix " << prefix.toText()
<< " specified in subnet4");
/// @return siaddr value
isc::asiolink::IOAddress getSiaddr() const;
-protected:
+ /// @brief Sets the flag indicating if the client identifier should be
+ /// ignored in the client's message.
+ ///
+ /// @param ignore If this value is true, the client identifiers are ignored
+ /// in the messages from the clients for this subnet.
+ void setIgnoreClientId(const bool ignore) {
+ ignore_client_id_ = ignore;
+ }
+
+ /// @brief Returns the flag indicating if the client identifiers should
+ /// be ignored for this subnet.
+ ///
+ /// @return true if client identifiers should be ignored, false otherwise.
+ bool getIgnoreClientId() const {
+ return (ignore_client_id_);
+ }
+
+private:
/// @brief Returns default address for pool selection
/// @return ANY IPv4 address
/// @brief siaddr value for this subnet
isc::asiolink::IOAddress siaddr_;
+
+ /// @brief Should server ignore client identifiers.
+ bool ignore_client_id_;
};
/// @brief A pointer to a @c Subnet4 object
BadValue);
}
+// Checks if the ignore-client-id flag can be set and retrieved.
+TEST(Subnet4Test, ignoreClientId) {
+ Subnet4 subnet(IOAddress("192.0.2.1"), 24, 1000, 2000, 3000);
+
+ // By default the flag should be set to false.
+ EXPECT_FALSE(subnet.getIgnoreClientId());
+
+ // Modify it and retrieve.
+ subnet.setIgnoreClientId(true);
+ EXPECT_TRUE(subnet.getIgnoreClientId());
+
+ // Modify again.
+ subnet.setIgnoreClientId(false);
+ EXPECT_FALSE(subnet.getIgnoreClientId());
+}
+
TEST(Subnet4Test, Pool4InSubnet4) {
Subnet4Ptr subnet(new Subnet4(IOAddress("192.1.2.0"), 24, 1, 2, 3));