From: Marcin Siodelski Date: Sat, 15 Apr 2017 13:07:40 +0000 (+0200) Subject: [5102] 'client-id' host identifier type is now included in default config. X-Git-Tag: trac5243x_base~13^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=54c6fbbdf9de8c121a30412e7acde4b9c1aa4dae;p=thirdparty%2Fkea.git [5102] 'client-id' host identifier type is now included in default config. --- diff --git a/src/bin/dhcp4/tests/dora_unittest.cc b/src/bin/dhcp4/tests/dora_unittest.cc index 534a428869..8535a4f6cf 100644 --- a/src/bin/dhcp4/tests/dora_unittest.cc +++ b/src/bin/dhcp4/tests/dora_unittest.cc @@ -892,7 +892,7 @@ TEST_F(DORATest, reservation) { // DUID carried in the Client Identifier option. TEST_F(DORATest, reservationByDUID) { Dhcp4Client client(Dhcp4Client::SELECTING); - // Use relay agent so as the circuit-id can be inserted. + // Use relay agent. client.useRelay(true, IOAddress("10.0.0.1"), IOAddress("10.0.0.2")); // Modify HW address so as the server doesn't assign reserved // address by HW address. @@ -944,6 +944,30 @@ TEST_F(DORATest, reservationByCircuitId) { ASSERT_EQ("10.0.0.9", client.config_.lease_.addr_.toText()); } +// This test checks that it is possible to make a reservation by +// client-id. +TEST_F(DORATest, reservationByClientId) { + Dhcp4Client client(Dhcp4Client::SELECTING); + // Use relay agent so as the circuit-id can be inserted. + client.useRelay(true, IOAddress("10.0.0.20"), IOAddress("10.0.0.21")); + // Specify client identifier. + client.includeClientId("01:11:22:33:44:55:66"); + + // Configure DHCP server. + configure(DORA_CONFIGS[2], *client.getServer()); + // Client A performs 4-way exchange and should obtain a reserved + // address. + ASSERT_NO_THROW(client.doDORA(boost::shared_ptr< + IOAddress>(new IOAddress("0.0.0.0")))); + // Make sure that the server responded. + ASSERT_TRUE(client.getContext().response_); + Pkt4Ptr resp = client.getContext().response_; + // Make sure that the server has responded with DHCPACK. + ASSERT_EQ(DHCPACK, static_cast(resp->getType())); + // Make sure that the client has got the lease for the reserved address. + ASSERT_EQ("10.0.0.1", client.config_.lease_.addr_.toText()); +} + // This test verifies that order in which host identifiers are used to // retrieve host reservations can be controlled. TEST_F(DORATest, hostIdentifiersOrder) { diff --git a/src/bin/dhcp4/tests/get_config_unittest.cc b/src/bin/dhcp4/tests/get_config_unittest.cc index 8705dcff5a..5c4bff4879 100644 --- a/src/bin/dhcp4/tests/get_config_unittest.cc +++ b/src/bin/dhcp4/tests/get_config_unittest.cc @@ -1515,7 +1515,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -1556,7 +1556,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -1622,7 +1622,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -1688,7 +1688,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -1754,7 +1754,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -1892,7 +1892,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -2030,7 +2030,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -2096,7 +2096,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -2162,7 +2162,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -2228,7 +2228,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -2294,7 +2294,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -2360,7 +2360,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -2450,7 +2450,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -2540,7 +2540,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -2606,7 +2606,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -2702,7 +2702,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -2768,7 +2768,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ ]\n" " },\n" @@ -2819,7 +2819,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ ]\n" " },\n" @@ -2870,7 +2870,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ ]\n" " },\n" @@ -2930,7 +2930,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ ]\n" " },\n" @@ -2981,7 +2981,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ ]\n" " },\n" @@ -3032,7 +3032,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ ]\n" " },\n" @@ -3083,7 +3083,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ ]\n" " },\n" @@ -3134,7 +3134,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -3215,7 +3215,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -3296,7 +3296,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -3387,7 +3387,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -3462,7 +3462,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -3578,7 +3578,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -3667,7 +3667,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -3773,7 +3773,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -3848,7 +3848,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -3955,7 +3955,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -4034,7 +4034,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -4118,7 +4118,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"eth0\", \"eth1\" ]\n" " },\n" @@ -4159,7 +4159,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\", \"eth0\", \"eth1\" ]\n" " },\n" @@ -4200,7 +4200,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -4266,7 +4266,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -4332,7 +4332,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -4543,7 +4543,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -4638,7 +4638,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ ]\n" " },\n" @@ -4776,7 +4776,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -4817,7 +4817,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -4858,7 +4858,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -4899,7 +4899,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 10\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -4940,7 +4940,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -5006,7 +5006,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -5072,7 +5072,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -5138,7 +5138,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -5204,7 +5204,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -5293,7 +5293,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -5359,7 +5359,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -5425,7 +5425,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -5492,7 +5492,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" @@ -5563,7 +5563,7 @@ const char* UNPARSED_CONFIGS[] = { " \"unwarned-reclaim-cycles\": 5\n" " },\n" " \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\" ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ]\n" " },\n" diff --git a/src/lib/dhcpsrv/cfg_host_operations.cc b/src/lib/dhcpsrv/cfg_host_operations.cc index 8910c36000..662e4cd965 100644 --- a/src/lib/dhcpsrv/cfg_host_operations.cc +++ b/src/lib/dhcpsrv/cfg_host_operations.cc @@ -26,6 +26,7 @@ CfgHostOperations::createConfig4() { cfg->addIdentifierType("hw-address"); cfg->addIdentifierType("duid"); cfg->addIdentifierType("circuit-id"); + cfg->addIdentifierType("client-id"); return (cfg); } diff --git a/src/lib/dhcpsrv/tests/cfg_host_operations_unittest.cc b/src/lib/dhcpsrv/tests/cfg_host_operations_unittest.cc index a38152ab2a..0176eb48c8 100644 --- a/src/lib/dhcpsrv/tests/cfg_host_operations_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfg_host_operations_unittest.cc @@ -97,6 +97,7 @@ TEST(CfgHostOperationsTest, createConfig4) { EXPECT_TRUE(identifierAtPosition(*cfg, Host::IDENT_HWADDR, 0)); EXPECT_TRUE(identifierAtPosition(*cfg, Host::IDENT_DUID, 1)); EXPECT_TRUE(identifierAtPosition(*cfg, Host::IDENT_CIRCUIT_ID, 2)); + EXPECT_TRUE(identifierAtPosition(*cfg, Host::IDENT_CLIENT_ID, 3)); } // This test verifies that the default DHCPv6 configuration is created diff --git a/src/lib/dhcpsrv/tests/srv_config_unittest.cc b/src/lib/dhcpsrv/tests/srv_config_unittest.cc index 533941fd73..aef78f0f2c 100644 --- a/src/lib/dhcpsrv/tests/srv_config_unittest.cc +++ b/src/lib/dhcpsrv/tests/srv_config_unittest.cc @@ -450,7 +450,7 @@ TEST_F(SrvConfigTest, unparse) { std::string defaults4 = "\"echo-client-id\": true,\n"; defaults4 += "\"subnet4\": [ ],\n"; defaults4 += "\"host-reservation-identifiers\": "; - defaults4 += "[ \"hw-address\", \"duid\", \"circuit-id\" ],\n"; + defaults4 += "[ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n"; std::string defaults6 = "\"relay-supplied-options\": [ \"65\" ],\n"; defaults6 += "\"subnet6\": [ ],\n";