From: Francis Dupont Date: Fri, 19 Jan 2018 22:53:36 +0000 (+0100) Subject: [5425a] Ported last changes and fixes X-Git-Tag: trac5524_base~19^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb9efffcb0dcac06fb26afac719bf86cfc388e40;p=thirdparty%2Fkea.git [5425a] Ported last changes and fixes --- diff --git a/doc/examples/kea4/classify.json b/doc/examples/kea4/classify.json index e769e581f0..a44b030455 100644 --- a/doc/examples/kea4/classify.json +++ b/doc/examples/kea4/classify.json @@ -76,18 +76,19 @@ // everyone is allowed. When a class is specified, only packets belonging // to that class are allowed for that subnet. "subnet4": [ + // This one is for VoIP devices only. { -// This one is for VoIP devices only. "pools": [ { "pool": "192.0.2.1 - 192.0.2.200" } ], "subnet": "192.0.2.0/24", "client-class": "VoIP", "interface": "ethX" }, -// This one doesn't have any client-class specified, so everyone -// is allowed in. The normal subnet selection rules still apply, -// though. There is also a static class reservation for a client -// using MAC address 1a:1b:1c:1d:1e:1f. This client will always -// be assigned to this class. + + // This one doesn't have any client-class specified, so everyone + // is allowed in. The normal subnet selection rules still apply, + // though. There is also a static class reservation for a client + // using MAC address 1a:1b:1c:1d:1e:1f. This client will always + // be assigned to this class. { "pools": [ { "pool": "192.0.3.1 - 192.0.3.200" } ], "subnet": "192.0.3.0/24", @@ -99,25 +100,27 @@ "interface": "ethX" }, -// The following list defines a subnet with pools. For some pools -// we defined a class that is allowed in that pool. If not specified -// everyone is allowed. When a class is specified, only packets belonging -// to that class are allowed for that pool. - { + // The following list defines a subnet with pools. For some pools + // we defined a class that is allowed in that pool. If not specified + // everyone is allowed. When a class is specified, only packets belonging + // to that class are allowed for that pool. + { "pools": [ + // This one is for VoIP devices only. { -// This one is for VoIP devices only. "pool": "192.0.4.1 - 192.0.4.200", "client-class": "VoIP" }, -// This one doesn't have any client-class specified, so everyone -// is allowed in. + + // This one doesn't have any client-class specified, + // so everyone is allowed in. { "pool": "192.0.5.1 - 192.0.5.200" } ], - "subnet": "192.0.4.0/23", - "interface": "ethY" - } + + "subnet": "192.0.4.0/23", + "interface": "ethY" + } ] }, diff --git a/doc/examples/kea6/classify.json b/doc/examples/kea6/classify.json index b6e184b618..151392e845 100644 --- a/doc/examples/kea6/classify.json +++ b/doc/examples/kea6/classify.json @@ -61,9 +61,10 @@ "client-class": "cable-modems", "interface": "ethX" }, -// The following subnet contains a class reservation for a client using -// DUID 01:02:03:04:05:0A:0B:0C:0D:0E. This client will always be assigned -// to this class. + + // The following subnet contains a class reservation for a client using + // DUID 01:02:03:04:05:0A:0B:0C:0D:0E. This client will always be assigned + // to this class. { "pools": [ { "pool": "2001:db8:2::/80" } ], "subnet": "2001:db8:2::/64", @@ -74,8 +75,9 @@ } ], "interface": "ethX" }, -// The following subnet contains a pool with a class constraint: only -// clients which belong to the class are allowed to use this pool. + + // The following subnet contains a pool with a class constraint: only + // clients which belong to the class are allowed to use this pool. { "pools": [ { diff --git a/doc/guide/classify.xml b/doc/guide/classify.xml index bd5ab03907..23009e98f5 100644 --- a/doc/guide/classify.xml +++ b/doc/guide/classify.xml @@ -804,18 +804,18 @@ concatenation of the strings
Configuring Pools With Class Information - Similar to subnets in certain cases access to certain address or - prefix pools must be restricted to only clients that belong to a - given class, using the "client-class" when defining the pool. + Similar to the subnets, it is possible to restrict access to the certain address + or prefix pools to the clients belonging to a specific class, using + the "client-class" parameter when defining the pool. - Let's assume that the server is connected to a network segment that uses + Let's assume that the server is connected to a network segment using the 192.0.2.0/24 prefix. The Administrator of that network has decided - that addresses from range 192.0.2.10 to 192.0.2.20 are going to be - managed by the DHCP4 server. Only clients belonging to client class - Client_foo are allowed to use this pool. Such a - configuration can be achieved in the following way: + that addresses from the range of 192.0.2.10 to 192.0.2.20 are going to be + managed by the DHCP4 server. Only the clients belonging to the client class + Client_foo are allowed to use this pool. Such a configuration can be + achieved in the following way: "Dhcp4": { "client-classes": [ @@ -833,19 +833,59 @@ concatenation of the strings ] }, ... - ], + ], "subnet4": [ { "subnet": "192.0.2.0/24", + "pools": [ { "pool": "192.0.2.10 - 192.0.2.20", "client-class": "Client_foo" } + ] + }, + ... + ], + ... +} + + + + The following example shows restricting access to an address pool. + This configuration will restrict use of the addresses 2001:db8:1::1 + to 2001:db8:1::FFFF to members of the "Client_enterprise" class. + +"Dhcp6": { + "client-classes": [ + { + "name": "Client_enterprise_", + "test": "substring(option[1].hex,0,6) == 0x0002AABBCCDD'", + "option-data": [ + { + "name": "dns-servers", + "code": 23, + "space": "dhcp6", + "csv-format": true, + "data": "2001:db8:0::1, 2001:db8:2::1" + } ] }, ... - ],, + ], + "subnet6": [ + { + "subnet": "2001:db8:1::/64", + + "pools": [ + { + "pool": "2001:db8:1::-2001:db8:1::ffff", + "client-class": "Client_foo" + } + ] + }, + ... + ], ... } diff --git a/doc/guide/dhcp4-srv.xml b/doc/guide/dhcp4-srv.xml index c83ce6333d..4ede2df9e8 100644 --- a/doc/guide/dhcp4-srv.xml +++ b/doc/guide/dhcp4-srv.xml @@ -2068,16 +2068,13 @@ It is merely echoed by the server discussion of the classification process see . - - In certain cases it is useful to differentiate between different types of - clients and treat them accordingly. It is envisaged that client - classification will be used for changing the behavior of almost any part of - the DHCP message processing, including the assignment of leases from different - pools, the assignment of different options (or different values of the same - options) etc. In the current release of the software however, there are - only three mechanisms that take advantage of client classification: - subnet selection, assignment of different options, and, for cable modems, there - are specific options for use with the TFTP server address and the boot file field. + In certain cases it is useful to configure the server to differentiate between + DHCP clients types and treat them accordingly. It is envisaged that client + classification will be used for modifying the behavior of almost any part of + the DHCP message processing. In the current release of Kea, there are four + mechanisms that take advantage of the client classification in DHCPv4: subnet + selection, address pool selection, DHCP options assignment, and, for cable modems, + there are specific options for use with the TFTP server address and boot file field. @@ -2093,12 +2090,9 @@ It is merely echoed by the server - When subnets belong to a shared network the classification applies - to subnet selection but not to pools, e.g., a pool in a subnet - limited to a particular class can still be used by clients which do not - belong to the class if the pool they are expected to use is exhausted. - So the limit access based on class information is also available - at the pool level, see . + Client classification can also be used to restrict access to specific + pools within a subnet. This is useful when to segregate clients belonging + to the same subnet into different address ranges. diff --git a/doc/guide/dhcp6-srv.xml b/doc/guide/dhcp6-srv.xml index 74ec99a5c1..4b667a2a47 100644 --- a/doc/guide/dhcp6-srv.xml +++ b/doc/guide/dhcp6-srv.xml @@ -1927,6 +1927,14 @@ should include options from the isc option space: discussion of the classification process see . + In certain cases it is useful to configure the server to differentiate between + DHCP clients types and treat them accordingly. It is envisaged that client + classification will be used for modifying the behavior of almost any part of + the DHCP message processing. In the current release of Kea, there are three + mechanisms that take advantage of the client classification in DHCPv6: subnet + selection, address pool selection and DHCP options assignment. + + In certain cases it is useful to differentiate between different types of clients and treat them accordingly. It is envisaged that client @@ -1951,13 +1959,9 @@ should include options from the isc option space: - When subnets belong to a shared network the classification applies - to subnet selection but not to pools, e.g., a pool in a subnet - limited to a particular class can still be used by clients which do not - belong to the class if the pool they are expected to use is exhausted. - So the limit access based on class information is also available - at the address/prefix pool level, see . + Client classification can also be used to restrict access to specific + pools within a subnet. This is useful when to segregate clients belonging + to the same subnet into different address ranges. diff --git a/src/bin/dhcp4/tests/get_config_unittest.cc b/src/bin/dhcp4/tests/get_config_unittest.cc index 1f6833d25f..d06bd40017 100644 --- a/src/bin/dhcp4/tests/get_config_unittest.cc +++ b/src/bin/dhcp4/tests/get_config_unittest.cc @@ -1196,6 +1196,85 @@ const char* EXTRACTED_CONFIGS[] = { " \"renew-timer\": 1000,\n" " \"subnet4\": [\n" " {\n" +" \"client-class\": \"alpha\",\n" +" \"pools\": [\n" +" {\n" +" \"pool\": \"192.0.2.1 - 192.0.2.100\"\n" +" }\n" +" ],\n" +" \"subnet\": \"192.0.2.0/24\"\n" +" },\n" +" {\n" +" \"client-class\": \"beta\",\n" +" \"pools\": [\n" +" {\n" +" \"pool\": \"192.0.3.101 - 192.0.3.150\"\n" +" }\n" +" ],\n" +" \"subnet\": \"192.0.3.0/24\"\n" +" },\n" +" {\n" +" \"client-class\": \"gamma\",\n" +" \"pools\": [\n" +" {\n" +" \"pool\": \"192.0.4.101 - 192.0.4.150\"\n" +" }\n" +" ],\n" +" \"subnet\": \"192.0.4.0/24\"\n" +" },\n" +" {\n" +" \"pools\": [\n" +" {\n" +" \"pool\": \"192.0.5.101 - 192.0.5.150\"\n" +" }\n" +" ],\n" +" \"subnet\": \"192.0.5.0/24\"\n" +" }\n" +" ],\n" +" \"valid-lifetime\": 4000\n" +" }\n", + // CONFIGURATION 42 +"{\n" +" \"interfaces-config\": {\n" +" \"interfaces\": [ \"*\" ],\n" +" \"re-detect\": false\n" +" },\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" +" \"subnet4\": [\n" +" {\n" +" \"pools\": [\n" +" {\n" +" \"client-class\": \"alpha\",\n" +" \"pool\": \"192.0.2.1 - 192.0.2.100\"\n" +" },\n" +" {\n" +" \"client-class\": \"beta\",\n" +" \"pool\": \"192.0.3.101 - 192.0.3.150\"\n" +" },\n" +" {\n" +" \"client-class\": \"gamma\",\n" +" \"pool\": \"192.0.4.101 - 192.0.4.150\"\n" +" },\n" +" {\n" +" \"pool\": \"192.0.5.101 - 192.0.5.150\"\n" +" }\n" +" ],\n" +" \"subnet\": \"192.0.0.0/16\"\n" +" }\n" +" ],\n" +" \"valid-lifetime\": 4000\n" +" }\n", + // CONFIGURATION 43 +"{\n" +" \"interfaces-config\": {\n" +" \"interfaces\": [ \"*\" ],\n" +" \"re-detect\": false\n" +" },\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" +" \"subnet4\": [\n" +" {\n" " \"id\": 123,\n" " \"pools\": [\n" " {\n" @@ -1285,7 +1364,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 42 + // CONFIGURATION 44 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1327,7 +1406,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 43 + // CONFIGURATION 45 "{\n" " \"rebind-timer\": 2000,\n" " \"renew-timer\": 1000,\n" @@ -1370,7 +1449,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 44 + // CONFIGURATION 46 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1378,7 +1457,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet4\": [ ]\n" " }\n", - // CONFIGURATION 45 + // CONFIGURATION 47 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1386,7 +1465,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet4\": [ ]\n" " }\n", - // CONFIGURATION 46 + // CONFIGURATION 48 "{\n" " \"decline-probation-period\": 12345,\n" " \"interfaces-config\": {\n" @@ -1395,7 +1474,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet4\": [ ]\n" " }\n", - // CONFIGURATION 47 + // CONFIGURATION 49 "{\n" " \"expired-leases-processing\": {\n" " \"flush-reclaimed-timer-wait-time\": 35,\n" @@ -1411,7 +1490,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet4\": [ ]\n" " }\n", - // CONFIGURATION 48 + // CONFIGURATION 50 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1431,7 +1510,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 49 + // CONFIGURATION 51 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1452,7 +1531,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 50 + // CONFIGURATION 52 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1473,7 +1552,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 51 + // CONFIGURATION 53 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1495,7 +1574,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 52 + // CONFIGURATION 54 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1516,7 +1595,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 53 + // CONFIGURATION 55 "{\n" " \"client-classes\": [\n" " {\n" @@ -1547,7 +1626,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 54 + // CONFIGURATION 56 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1567,7 +1646,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 55 + // CONFIGURATION 57 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1588,7 +1667,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 56 + // CONFIGURATION 58 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1613,7 +1692,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 57 + // CONFIGURATION 59 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1638,7 +1717,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 58 + // CONFIGURATION 60 "{\n" " \"comment\": \"A DHCPv4 server\",\n" " \"client-classes\": [\n" @@ -5031,6 +5110,242 @@ const char* UNPARSED_CONFIGS[] = { " \"4o6-interface-id\": \"\",\n" " \"4o6-subnet\": \"\",\n" " \"boot-file-name\": \"\",\n" +" \"client-class\": \"alpha\",\n" +" \"id\": 1,\n" +" \"match-client-id\": true,\n" +" \"next-server\": \"0.0.0.0\",\n" +" \"option-data\": [ ],\n" +" \"pools\": [\n" +" {\n" +" \"option-data\": [ ],\n" +" \"pool\": \"192.0.2.1-192.0.2.100\"\n" +" }\n" +" ],\n" +" \"rebind-timer\": 2000,\n" +" \"relay\": {\n" +" \"ip-address\": \"0.0.0.0\"\n" +" },\n" +" \"renew-timer\": 1000,\n" +" \"reservation-mode\": \"all\",\n" +" \"reservations\": [ ],\n" +" \"server-hostname\": \"\",\n" +" \"subnet\": \"192.0.2.0/24\",\n" +" \"valid-lifetime\": 4000\n" +" },\n" +" {\n" +" \"4o6-interface\": \"\",\n" +" \"4o6-interface-id\": \"\",\n" +" \"4o6-subnet\": \"\",\n" +" \"boot-file-name\": \"\",\n" +" \"client-class\": \"beta\",\n" +" \"id\": 2,\n" +" \"match-client-id\": true,\n" +" \"next-server\": \"0.0.0.0\",\n" +" \"option-data\": [ ],\n" +" \"pools\": [\n" +" {\n" +" \"option-data\": [ ],\n" +" \"pool\": \"192.0.3.101-192.0.3.150\"\n" +" }\n" +" ],\n" +" \"rebind-timer\": 2000,\n" +" \"relay\": {\n" +" \"ip-address\": \"0.0.0.0\"\n" +" },\n" +" \"renew-timer\": 1000,\n" +" \"reservation-mode\": \"all\",\n" +" \"reservations\": [ ],\n" +" \"server-hostname\": \"\",\n" +" \"subnet\": \"192.0.3.0/24\",\n" +" \"valid-lifetime\": 4000\n" +" },\n" +" {\n" +" \"4o6-interface\": \"\",\n" +" \"4o6-interface-id\": \"\",\n" +" \"4o6-subnet\": \"\",\n" +" \"boot-file-name\": \"\",\n" +" \"client-class\": \"gamma\",\n" +" \"id\": 3,\n" +" \"match-client-id\": true,\n" +" \"next-server\": \"0.0.0.0\",\n" +" \"option-data\": [ ],\n" +" \"pools\": [\n" +" {\n" +" \"option-data\": [ ],\n" +" \"pool\": \"192.0.4.101-192.0.4.150\"\n" +" }\n" +" ],\n" +" \"rebind-timer\": 2000,\n" +" \"relay\": {\n" +" \"ip-address\": \"0.0.0.0\"\n" +" },\n" +" \"renew-timer\": 1000,\n" +" \"reservation-mode\": \"all\",\n" +" \"reservations\": [ ],\n" +" \"server-hostname\": \"\",\n" +" \"subnet\": \"192.0.4.0/24\",\n" +" \"valid-lifetime\": 4000\n" +" },\n" +" {\n" +" \"4o6-interface\": \"\",\n" +" \"4o6-interface-id\": \"\",\n" +" \"4o6-subnet\": \"\",\n" +" \"boot-file-name\": \"\",\n" +" \"id\": 4,\n" +" \"match-client-id\": true,\n" +" \"next-server\": \"0.0.0.0\",\n" +" \"option-data\": [ ],\n" +" \"pools\": [\n" +" {\n" +" \"option-data\": [ ],\n" +" \"pool\": \"192.0.5.101-192.0.5.150\"\n" +" }\n" +" ],\n" +" \"rebind-timer\": 2000,\n" +" \"relay\": {\n" +" \"ip-address\": \"0.0.0.0\"\n" +" },\n" +" \"renew-timer\": 1000,\n" +" \"reservation-mode\": \"all\",\n" +" \"reservations\": [ ],\n" +" \"server-hostname\": \"\",\n" +" \"subnet\": \"192.0.5.0/24\",\n" +" \"valid-lifetime\": 4000\n" +" }\n" +" ]\n" +" }\n", + // CONFIGURATION 42 +"{\n" +" \"decline-probation-period\": 86400,\n" +" \"dhcp-ddns\": {\n" +" \"always-include-fqdn\": false,\n" +" \"enable-updates\": false,\n" +" \"generated-prefix\": \"myhost\",\n" +" \"max-queue-size\": 1024,\n" +" \"ncr-format\": \"JSON\",\n" +" \"ncr-protocol\": \"UDP\",\n" +" \"override-client-update\": false,\n" +" \"override-no-update\": false,\n" +" \"qualifying-suffix\": \"\",\n" +" \"replace-client-name\": \"never\",\n" +" \"sender-ip\": \"0.0.0.0\",\n" +" \"sender-port\": 0,\n" +" \"server-ip\": \"127.0.0.1\",\n" +" \"server-port\": 53001\n" +" },\n" +" \"dhcp4o6-port\": 0,\n" +" \"echo-client-id\": true,\n" +" \"expired-leases-processing\": {\n" +" \"flush-reclaimed-timer-wait-time\": 25,\n" +" \"hold-reclaimed-time\": 3600,\n" +" \"max-reclaim-leases\": 100,\n" +" \"max-reclaim-time\": 250,\n" +" \"reclaim-timer-wait-time\": 10,\n" +" \"unwarned-reclaim-cycles\": 5\n" +" },\n" +" \"hooks-libraries\": [ ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" +" \"interfaces-config\": {\n" +" \"interfaces\": [ \"*\" ],\n" +" \"re-detect\": false\n" +" },\n" +" \"lease-database\": {\n" +" \"type\": \"memfile\"\n" +" },\n" +" \"option-data\": [ ],\n" +" \"option-def\": [ ],\n" +" \"shared-networks\": [ ],\n" +" \"subnet4\": [\n" +" {\n" +" \"4o6-interface\": \"\",\n" +" \"4o6-interface-id\": \"\",\n" +" \"4o6-subnet\": \"\",\n" +" \"boot-file-name\": \"\",\n" +" \"id\": 1,\n" +" \"match-client-id\": true,\n" +" \"next-server\": \"0.0.0.0\",\n" +" \"option-data\": [ ],\n" +" \"pools\": [\n" +" {\n" +" \"client-class\": \"alpha\",\n" +" \"option-data\": [ ],\n" +" \"pool\": \"192.0.2.1-192.0.2.100\"\n" +" },\n" +" {\n" +" \"client-class\": \"beta\",\n" +" \"option-data\": [ ],\n" +" \"pool\": \"192.0.3.101-192.0.3.150\"\n" +" },\n" +" {\n" +" \"client-class\": \"gamma\",\n" +" \"option-data\": [ ],\n" +" \"pool\": \"192.0.4.101-192.0.4.150\"\n" +" },\n" +" {\n" +" \"option-data\": [ ],\n" +" \"pool\": \"192.0.5.101-192.0.5.150\"\n" +" }\n" +" ],\n" +" \"rebind-timer\": 2000,\n" +" \"relay\": {\n" +" \"ip-address\": \"0.0.0.0\"\n" +" },\n" +" \"renew-timer\": 1000,\n" +" \"reservation-mode\": \"all\",\n" +" \"reservations\": [ ],\n" +" \"server-hostname\": \"\",\n" +" \"subnet\": \"192.0.0.0/16\",\n" +" \"valid-lifetime\": 4000\n" +" }\n" +" ]\n" +" }\n", + // CONFIGURATION 43 +"{\n" +" \"decline-probation-period\": 86400,\n" +" \"dhcp-ddns\": {\n" +" \"always-include-fqdn\": false,\n" +" \"enable-updates\": false,\n" +" \"generated-prefix\": \"myhost\",\n" +" \"max-queue-size\": 1024,\n" +" \"ncr-format\": \"JSON\",\n" +" \"ncr-protocol\": \"UDP\",\n" +" \"override-client-update\": false,\n" +" \"override-no-update\": false,\n" +" \"qualifying-suffix\": \"\",\n" +" \"replace-client-name\": \"never\",\n" +" \"sender-ip\": \"0.0.0.0\",\n" +" \"sender-port\": 0,\n" +" \"server-ip\": \"127.0.0.1\",\n" +" \"server-port\": 53001\n" +" },\n" +" \"dhcp4o6-port\": 0,\n" +" \"echo-client-id\": true,\n" +" \"expired-leases-processing\": {\n" +" \"flush-reclaimed-timer-wait-time\": 25,\n" +" \"hold-reclaimed-time\": 3600,\n" +" \"max-reclaim-leases\": 100,\n" +" \"max-reclaim-time\": 250,\n" +" \"reclaim-timer-wait-time\": 10,\n" +" \"unwarned-reclaim-cycles\": 5\n" +" },\n" +" \"hooks-libraries\": [ ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" +" \"interfaces-config\": {\n" +" \"interfaces\": [ \"*\" ],\n" +" \"re-detect\": false\n" +" },\n" +" \"lease-database\": {\n" +" \"type\": \"memfile\"\n" +" },\n" +" \"option-data\": [ ],\n" +" \"option-def\": [ ],\n" +" \"shared-networks\": [ ],\n" +" \"subnet4\": [\n" +" {\n" +" \"4o6-interface\": \"\",\n" +" \"4o6-interface-id\": \"\",\n" +" \"4o6-subnet\": \"\",\n" +" \"boot-file-name\": \"\",\n" " \"id\": 123,\n" " \"match-client-id\": true,\n" " \"next-server\": \"0.0.0.0\",\n" @@ -5209,7 +5524,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 42 + // CONFIGURATION 44 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5309,7 +5624,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 43 + // CONFIGURATION 45 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5457,7 +5772,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 44 + // CONFIGURATION 46 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5500,7 +5815,7 @@ const char* UNPARSED_CONFIGS[] = { " \"shared-networks\": [ ],\n" " \"subnet4\": [ ]\n" " }\n", - // CONFIGURATION 45 + // CONFIGURATION 47 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5543,7 +5858,7 @@ const char* UNPARSED_CONFIGS[] = { " \"shared-networks\": [ ],\n" " \"subnet4\": [ ]\n" " }\n", - // CONFIGURATION 46 + // CONFIGURATION 48 "{\n" " \"decline-probation-period\": 12345,\n" " \"dhcp-ddns\": {\n" @@ -5586,7 +5901,7 @@ const char* UNPARSED_CONFIGS[] = { " \"shared-networks\": [ ],\n" " \"subnet4\": [ ]\n" " }\n", - // CONFIGURATION 47 + // CONFIGURATION 49 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5629,7 +5944,7 @@ const char* UNPARSED_CONFIGS[] = { " \"shared-networks\": [ ],\n" " \"subnet4\": [ ]\n" " }\n", - // CONFIGURATION 48 + // CONFIGURATION 50 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5699,7 +6014,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 49 + // CONFIGURATION 51 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5769,7 +6084,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 50 + // CONFIGURATION 52 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5839,7 +6154,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 51 + // CONFIGURATION 53 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5909,7 +6224,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 52 + // CONFIGURATION 54 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5979,7 +6294,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 53 + // CONFIGURATION 55 "{\n" " \"client-classes\": [\n" " {\n" @@ -6075,7 +6390,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 54 + // CONFIGURATION 56 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -6145,7 +6460,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 55 + // CONFIGURATION 57 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -6216,7 +6531,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 56 + // CONFIGURATION 58 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -6291,7 +6606,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 57 + // CONFIGURATION 59 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -6366,7 +6681,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 58 + // CONFIGURATION 60 "{\n" " \"comment\": \"A DHCPv4 server\",\n" " \"client-classes\": [\n" diff --git a/src/bin/dhcp6/tests/classify_unittests.cc b/src/bin/dhcp6/tests/classify_unittests.cc index 7a81310f92..e09ad8ea6f 100644 --- a/src/bin/dhcp6/tests/classify_unittests.cc +++ b/src/bin/dhcp6/tests/classify_unittests.cc @@ -176,6 +176,17 @@ public: } } + /// @brief Create a solicit + Pkt6Ptr createSolicit(std::string remote_addr = "fe80::abcd") { + OptionPtr clientid = generateClientId(); + Pkt6Ptr query(new Pkt6(DHCPV6_SOLICIT, 1234)); + query->setRemoteAddr(IOAddress(remote_addr)); + query->addOption(clientid); + query->setIface("eth1"); + query->addOption(generateIA(D6O_IA_NA, 123, 1500, 3000)); + return (query); + } + /// @brief Interface Manager's fake configuration control. IfaceMgrTestConfig iface_mgr_test_config_; }; @@ -244,22 +255,9 @@ TEST_F(ClassifyTest, matchClassification) { ASSERT_NO_THROW(configure(config)); // Create packets with enough to select the subnet - OptionPtr clientid = generateClientId(); - Pkt6Ptr query1(new Pkt6(DHCPV6_SOLICIT, 1234)); - query1->setRemoteAddr(IOAddress("fe80::abcd")); - query1->addOption(clientid); - query1->setIface("eth1"); - query1->addOption(generateIA(D6O_IA_NA, 123, 1500, 3000)); - Pkt6Ptr query2(new Pkt6(DHCPV6_SOLICIT, 1234)); - query2->setRemoteAddr(IOAddress("fe80::abcd")); - query2->addOption(clientid); - query2->setIface("eth1"); - query2->addOption(generateIA(D6O_IA_NA, 234, 1500, 3000)); - Pkt6Ptr query3(new Pkt6(DHCPV6_SOLICIT, 1234)); - query3->setRemoteAddr(IOAddress("fe80::abcd")); - query3->addOption(clientid); - query3->setIface("eth1"); - query3->addOption(generateIA(D6O_IA_NA, 345, 1500, 3000)); + Pkt6Ptr query1 = createSolicit(); + Pkt6Ptr query2 = createSolicit(); + Pkt6Ptr query3 = createSolicit(); // Create and add an ORO option to the first 2 queries OptionUint16ArrayPtr oro(new OptionUint16Array(Option::V6, D6O_ORO)); @@ -341,12 +339,7 @@ TEST_F(ClassifyTest, subnetClassPriority) { // Create a packet with enough to select the subnet and go through // the SOLICIT processing - Pkt6Ptr query(new Pkt6(DHCPV6_SOLICIT, 1234)); - query->setRemoteAddr(IOAddress("fe80::abcd")); - OptionPtr clientid = generateClientId(); - query->addOption(clientid); - query->setIface("eth1"); - query->addOption(generateIA(D6O_IA_NA, 123, 1500, 3000)); + Pkt6Ptr query = createSolicit(); // Create and add an ORO option to the query OptionUint16ArrayPtr oro(new OptionUint16Array(Option::V6, D6O_ORO)); @@ -413,12 +406,7 @@ TEST_F(ClassifyTest, subnetGlobalPriority) { // Create a packet with enough to select the subnet and go through // the SOLICIT processing - Pkt6Ptr query(new Pkt6(DHCPV6_SOLICIT, 1234)); - query->setRemoteAddr(IOAddress("fe80::abcd")); - OptionPtr clientid = generateClientId(); - query->addOption(clientid); - query->setIface("eth1"); - query->addOption(generateIA(D6O_IA_NA, 123, 1500, 3000)); + Pkt6Ptr query = createSolicit(); // Create and add an ORO option to the query OptionUint16ArrayPtr oro(new OptionUint16Array(Option::V6, D6O_ORO)); @@ -482,12 +470,7 @@ TEST_F(ClassifyTest, classGlobalPriority) { // Create a packet with enough to select the subnet and go through // the SOLICIT processing - Pkt6Ptr query(new Pkt6(DHCPV6_SOLICIT, 1234)); - query->setRemoteAddr(IOAddress("fe80::abcd")); - OptionPtr clientid = generateClientId(); - query->addOption(clientid); - query->setIface("eth1"); - query->addOption(generateIA(D6O_IA_NA, 123, 1500, 3000)); + Pkt6Ptr query = createSolicit(); // Create and add an ORO option to the query OptionUint16ArrayPtr oro(new OptionUint16Array(Option::V6, D6O_ORO)); @@ -558,12 +541,7 @@ TEST_F(ClassifyTest, classGlobalPersistency) { // Create a packet with enough to select the subnet and go through // the SOLICIT processing - Pkt6Ptr query(new Pkt6(DHCPV6_SOLICIT, 1234)); - query->setRemoteAddr(IOAddress("fe80::abcd")); - OptionPtr clientid = generateClientId(); - query->addOption(clientid); - query->setIface("eth1"); - query->addOption(generateIA(D6O_IA_NA, 123, 1500, 3000)); + Pkt6Ptr query = createSolicit(); // Do not add an ORO. OptionPtr oro = query->getOption(D6O_ORO); @@ -620,11 +598,7 @@ TEST_F(ClassifyTest, clientClassifySubnet) { ASSERT_NO_THROW(configure(config)); - Pkt6Ptr sol = Pkt6Ptr(new Pkt6(DHCPV6_SOLICIT, 1234)); - sol->setRemoteAddr(IOAddress("2001:db8:1::3")); - sol->addOption(generateIA(D6O_IA_NA, 234, 1500, 3000)); - OptionPtr clientid = generateClientId(); - sol->addOption(clientid); + Pkt6Ptr sol = createSolicit("2001:db8:1::3"); // This discover does not belong to foo class, so it will not // be serviced @@ -685,22 +659,9 @@ TEST_F(ClassifyTest, clientClassifyPool) { ASSERT_NO_THROW(configure(config)); - OptionPtr clientid = generateClientId(); - Pkt6Ptr query1 = Pkt6Ptr(new Pkt6(DHCPV6_SOLICIT, 1234)); - query1->setRemoteAddr(IOAddress("2001:db8:1::3")); - query1->addOption(generateIA(D6O_IA_NA, 234, 1500, 3000)); - query1->addOption(clientid); - query1->setIface("eth1"); - Pkt6Ptr query2 = Pkt6Ptr(new Pkt6(DHCPV6_SOLICIT, 1234)); - query2->setRemoteAddr(IOAddress("2001:db8:1::3")); - query2->addOption(generateIA(D6O_IA_NA, 234, 1500, 3000)); - query2->addOption(clientid); - query2->setIface("eth1"); - Pkt6Ptr query3 = Pkt6Ptr(new Pkt6(DHCPV6_SOLICIT, 1234)); - query3->setRemoteAddr(IOAddress("2001:db8:1::3")); - query3->addOption(generateIA(D6O_IA_NA, 234, 1500, 3000)); - query3->addOption(clientid); - query3->setIface("eth1"); + Pkt6Ptr query1 = createSolicit("2001:db8:1::3"); + Pkt6Ptr query2 = createSolicit("2001:db8:1::3"); + Pkt6Ptr query3 = createSolicit("2001:db8:1::3"); // This discover does not belong to foo class, so it will not // be serviced @@ -741,11 +702,7 @@ TEST_F(ClassifyTest, vendorClientClassification2) { NakedDhcpv6Srv srv(0); // Let's create a SOLICIT. - Pkt6Ptr sol = Pkt6Ptr(new Pkt6(DHCPV6_SOLICIT, 1234)); - sol->setRemoteAddr(IOAddress("2001:db8:1::3")); - sol->addOption(generateIA(D6O_IA_NA, 234, 1500, 3000)); - OptionPtr clientid = generateClientId(); - sol->addOption(clientid); + Pkt6Ptr sol = createSolicit("2001:db8:1::3"); // Now let's add a vendor-class with id=1234 and content "foo" OptionVendorClassPtr vendor_class(new OptionVendorClass(Option::V6, 1234)); @@ -808,11 +765,7 @@ TEST_F(ClassifyTest, relayOverrideAndClientClass) { ASSERT_TRUE(subnet1); ASSERT_TRUE(subnet2); - Pkt6Ptr sol = Pkt6Ptr(new Pkt6(DHCPV6_SOLICIT, 1234)); - sol->setRemoteAddr(IOAddress("2001:db8:1::3")); - sol->addOption(generateIA(D6O_IA_NA, 234, 1500, 3000)); - OptionPtr clientid = generateClientId(); - sol->addOption(clientid); + Pkt6Ptr sol = createSolicit("2001:db8:1::3"); // Now pretend the packet came via one relay. Pkt6::RelayInfo relay; diff --git a/src/bin/dhcp6/tests/get_config_unittest.cc b/src/bin/dhcp6/tests/get_config_unittest.cc index ec436977f0..1759c8373b 100644 --- a/src/bin/dhcp6/tests/get_config_unittest.cc +++ b/src/bin/dhcp6/tests/get_config_unittest.cc @@ -1017,6 +1017,80 @@ const char* EXTRACTED_CONFIGS[] = { " }\n", // CONFIGURATION 32 "{\n" +" \"interfaces-config\": {\n" +" \"interfaces\": [ \"*\" ],\n" +" \"re-detect\": false\n" +" },\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" +" \"subnet6\": [\n" +" {\n" +" \"pools\": [\n" +" {\n" +" \"client-class\": \"alpha\",\n" +" \"pool\": \"2001:db8:1::/80\"\n" +" },\n" +" {\n" +" \"client-class\": \"beta\",\n" +" \"pool\": \"2001:db8:2::/80\"\n" +" },\n" +" {\n" +" \"client-class\": \"gamma\",\n" +" \"pool\": \"2001:db8:3::/80\"\n" +" },\n" +" {\n" +" \"pool\": \"2001:db8:4::/80\"\n" +" }\n" +" ],\n" +" \"subnet\": \"2001:db8:0::/40\"\n" +" }\n" +" ],\n" +" \"valid-lifetime\": 4000\n" +" }\n", + // CONFIGURATION 33 +"{\n" +" \"interfaces-config\": {\n" +" \"interfaces\": [ \"*\" ],\n" +" \"re-detect\": false\n" +" },\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" +" \"subnet6\": [\n" +" {\n" +" \"pd-pools\": [\n" +" {\n" +" \"client-class\": \"alpha\",\n" +" \"delegated-len\": 64,\n" +" \"prefix\": \"2001:db8:1::\",\n" +" \"prefix-len\": 48\n" +" },\n" +" {\n" +" \"client-class\": \"beta\",\n" +" \"delegated-len\": 64,\n" +" \"prefix\": \"2001:db8:2::\",\n" +" \"prefix-len\": 48\n" +" },\n" +" {\n" +" \"client-class\": \"gamma\",\n" +" \"delegated-len\": 64,\n" +" \"prefix\": \"2001:db8:3::\",\n" +" \"prefix-len\": 48\n" +" },\n" +" {\n" +" \"delegated-len\": 64,\n" +" \"prefix\": \"2001:db8:4::\",\n" +" \"prefix-len\": 48\n" +" }\n" +" ],\n" +" \"subnet\": \"2001:db8::/64\"\n" +" }\n" +" ],\n" +" \"valid-lifetime\": 4000\n" +" }\n", + // CONFIGURATION 34 +"{\n" " \"dhcp-ddns\": {\n" " \"always-include-fqdn\": true,\n" " \"enable-updates\": true,\n" @@ -1052,7 +1126,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 33 + // CONFIGURATION 35 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1139,7 +1213,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 34 + // CONFIGURATION 36 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1179,7 +1253,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 35 + // CONFIGURATION 37 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1192,7 +1266,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"subnet6\": [ ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 36 + // CONFIGURATION 38 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1205,7 +1279,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"subnet6\": [ ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 37 + // CONFIGURATION 39 "{\n" " \"preferred-lifetime\": 3000,\n" " \"rebind-timer\": 2000,\n" @@ -1249,7 +1323,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 38 + // CONFIGURATION 40 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1262,7 +1336,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"subnet6\": [ ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 39 + // CONFIGURATION 41 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1270,7 +1344,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 40 + // CONFIGURATION 42 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1278,7 +1352,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 41 + // CONFIGURATION 43 "{\n" " \"decline-probation-period\": 12345,\n" " \"interfaces-config\": {\n" @@ -1287,7 +1361,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 42 + // CONFIGURATION 44 "{\n" " \"expired-leases-processing\": {\n" " \"flush-reclaimed-timer-wait-time\": 35,\n" @@ -1303,7 +1377,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 43 + // CONFIGURATION 45 "{\n" " \"client-classes\": [\n" " {\n" @@ -1335,7 +1409,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 44 + // CONFIGURATION 46 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1356,7 +1430,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 45 + // CONFIGURATION 47 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1378,7 +1452,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 46 + // CONFIGURATION 48 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1405,7 +1479,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 47 + // CONFIGURATION 49 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1432,7 +1506,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 48 + // CONFIGURATION 50 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1455,7 +1529,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 49 + // CONFIGURATION 51 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1479,7 +1553,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 50 + // CONFIGURATION 52 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1508,7 +1582,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 51 + // CONFIGURATION 53 "{\n" " \"comment\": \"A DHCPv6 server\",\n" " \"client-classes\": [\n" @@ -4468,6 +4542,194 @@ const char* UNPARSED_CONFIGS[] = { "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" +" \"always-include-fqdn\": false,\n" +" \"enable-updates\": false,\n" +" \"generated-prefix\": \"myhost\",\n" +" \"max-queue-size\": 1024,\n" +" \"ncr-format\": \"JSON\",\n" +" \"ncr-protocol\": \"UDP\",\n" +" \"override-client-update\": false,\n" +" \"override-no-update\": false,\n" +" \"qualifying-suffix\": \"\",\n" +" \"replace-client-name\": \"never\",\n" +" \"sender-ip\": \"0.0.0.0\",\n" +" \"sender-port\": 0,\n" +" \"server-ip\": \"127.0.0.1\",\n" +" \"server-port\": 53001\n" +" },\n" +" \"dhcp4o6-port\": 0,\n" +" \"expired-leases-processing\": {\n" +" \"flush-reclaimed-timer-wait-time\": 25,\n" +" \"hold-reclaimed-time\": 3600,\n" +" \"max-reclaim-leases\": 100,\n" +" \"max-reclaim-time\": 250,\n" +" \"reclaim-timer-wait-time\": 10,\n" +" \"unwarned-reclaim-cycles\": 5\n" +" },\n" +" \"hooks-libraries\": [ ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\" ],\n" +" \"interfaces-config\": {\n" +" \"interfaces\": [ \"*\" ],\n" +" \"re-detect\": false\n" +" },\n" +" \"lease-database\": {\n" +" \"type\": \"memfile\"\n" +" },\n" +" \"mac-sources\": [ \"any\" ],\n" +" \"option-data\": [ ],\n" +" \"option-def\": [ ],\n" +" \"relay-supplied-options\": [ \"65\" ],\n" +" \"server-id\": {\n" +" \"enterprise-id\": 0,\n" +" \"htype\": 0,\n" +" \"identifier\": \"\",\n" +" \"persist\": true,\n" +" \"time\": 0,\n" +" \"type\": \"LLT\"\n" +" },\n" +" \"shared-networks\": [ ],\n" +" \"subnet6\": [\n" +" {\n" +" \"id\": 1,\n" +" \"option-data\": [ ],\n" +" \"pd-pools\": [ ],\n" +" \"pools\": [\n" +" {\n" +" \"client-class\": \"alpha\",\n" +" \"option-data\": [ ],\n" +" \"pool\": \"2001:db8:1::/80\"\n" +" },\n" +" {\n" +" \"client-class\": \"beta\",\n" +" \"option-data\": [ ],\n" +" \"pool\": \"2001:db8:2::/80\"\n" +" },\n" +" {\n" +" \"client-class\": \"gamma\",\n" +" \"option-data\": [ ],\n" +" \"pool\": \"2001:db8:3::/80\"\n" +" },\n" +" {\n" +" \"option-data\": [ ],\n" +" \"pool\": \"2001:db8:4::/80\"\n" +" }\n" +" ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rapid-commit\": false,\n" +" \"rebind-timer\": 2000,\n" +" \"relay\": {\n" +" \"ip-address\": \"::\"\n" +" },\n" +" \"renew-timer\": 1000,\n" +" \"reservation-mode\": \"all\",\n" +" \"reservations\": [ ],\n" +" \"subnet\": \"2001:db8::/40\",\n" +" \"valid-lifetime\": 4000\n" +" }\n" +" ]\n" +" }\n", + // CONFIGURATION 33 +"{\n" +" \"decline-probation-period\": 86400,\n" +" \"dhcp-ddns\": {\n" +" \"always-include-fqdn\": false,\n" +" \"enable-updates\": false,\n" +" \"generated-prefix\": \"myhost\",\n" +" \"max-queue-size\": 1024,\n" +" \"ncr-format\": \"JSON\",\n" +" \"ncr-protocol\": \"UDP\",\n" +" \"override-client-update\": false,\n" +" \"override-no-update\": false,\n" +" \"qualifying-suffix\": \"\",\n" +" \"replace-client-name\": \"never\",\n" +" \"sender-ip\": \"0.0.0.0\",\n" +" \"sender-port\": 0,\n" +" \"server-ip\": \"127.0.0.1\",\n" +" \"server-port\": 53001\n" +" },\n" +" \"dhcp4o6-port\": 0,\n" +" \"expired-leases-processing\": {\n" +" \"flush-reclaimed-timer-wait-time\": 25,\n" +" \"hold-reclaimed-time\": 3600,\n" +" \"max-reclaim-leases\": 100,\n" +" \"max-reclaim-time\": 250,\n" +" \"reclaim-timer-wait-time\": 10,\n" +" \"unwarned-reclaim-cycles\": 5\n" +" },\n" +" \"hooks-libraries\": [ ],\n" +" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\" ],\n" +" \"interfaces-config\": {\n" +" \"interfaces\": [ \"*\" ],\n" +" \"re-detect\": false\n" +" },\n" +" \"lease-database\": {\n" +" \"type\": \"memfile\"\n" +" },\n" +" \"mac-sources\": [ \"any\" ],\n" +" \"option-data\": [ ],\n" +" \"option-def\": [ ],\n" +" \"relay-supplied-options\": [ \"65\" ],\n" +" \"server-id\": {\n" +" \"enterprise-id\": 0,\n" +" \"htype\": 0,\n" +" \"identifier\": \"\",\n" +" \"persist\": true,\n" +" \"time\": 0,\n" +" \"type\": \"LLT\"\n" +" },\n" +" \"shared-networks\": [ ],\n" +" \"subnet6\": [\n" +" {\n" +" \"id\": 1,\n" +" \"option-data\": [ ],\n" +" \"pd-pools\": [\n" +" {\n" +" \"client-class\": \"alpha\",\n" +" \"delegated-len\": 64,\n" +" \"option-data\": [ ],\n" +" \"prefix\": \"2001:db8:1::\",\n" +" \"prefix-len\": 48\n" +" },\n" +" {\n" +" \"client-class\": \"beta\",\n" +" \"delegated-len\": 64,\n" +" \"option-data\": [ ],\n" +" \"prefix\": \"2001:db8:2::\",\n" +" \"prefix-len\": 48\n" +" },\n" +" {\n" +" \"client-class\": \"gamma\",\n" +" \"delegated-len\": 64,\n" +" \"option-data\": [ ],\n" +" \"prefix\": \"2001:db8:3::\",\n" +" \"prefix-len\": 48\n" +" },\n" +" {\n" +" \"delegated-len\": 64,\n" +" \"option-data\": [ ],\n" +" \"prefix\": \"2001:db8:4::\",\n" +" \"prefix-len\": 48\n" +" }\n" +" ],\n" +" \"pools\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rapid-commit\": false,\n" +" \"rebind-timer\": 2000,\n" +" \"relay\": {\n" +" \"ip-address\": \"::\"\n" +" },\n" +" \"renew-timer\": 1000,\n" +" \"reservation-mode\": \"all\",\n" +" \"reservations\": [ ],\n" +" \"subnet\": \"2001:db8::/64\",\n" +" \"valid-lifetime\": 4000\n" +" }\n" +" ]\n" +" }\n", + // CONFIGURATION 34 +"{\n" +" \"decline-probation-period\": 86400,\n" +" \"dhcp-ddns\": {\n" " \"always-include-fqdn\": true,\n" " \"enable-updates\": true,\n" " \"generated-prefix\": \"test.prefix\",\n" @@ -4539,7 +4801,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 33 + // CONFIGURATION 35 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -4733,7 +4995,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 34 + // CONFIGURATION 36 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -4831,7 +5093,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 35 + // CONFIGURATION 37 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -4883,7 +5145,7 @@ const char* UNPARSED_CONFIGS[] = { " \"shared-networks\": [ ],\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 36 + // CONFIGURATION 38 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -4935,7 +5197,7 @@ const char* UNPARSED_CONFIGS[] = { " \"shared-networks\": [ ],\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 37 + // CONFIGURATION 39 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5076,7 +5338,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 38 + // CONFIGURATION 40 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5128,7 +5390,7 @@ const char* UNPARSED_CONFIGS[] = { " \"shared-networks\": [ ],\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 39 + // CONFIGURATION 41 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5180,7 +5442,7 @@ const char* UNPARSED_CONFIGS[] = { " \"shared-networks\": [ ],\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 40 + // CONFIGURATION 42 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5232,7 +5494,7 @@ const char* UNPARSED_CONFIGS[] = { " \"shared-networks\": [ ],\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 41 + // CONFIGURATION 43 "{\n" " \"decline-probation-period\": 12345,\n" " \"dhcp-ddns\": {\n" @@ -5284,7 +5546,7 @@ const char* UNPARSED_CONFIGS[] = { " \"shared-networks\": [ ],\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 42 + // CONFIGURATION 44 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5336,7 +5598,7 @@ const char* UNPARSED_CONFIGS[] = { " \"shared-networks\": [ ],\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 43 + // CONFIGURATION 45 "{\n" " \"client-classes\": [\n" " {\n" @@ -5425,7 +5687,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 44 + // CONFIGURATION 46 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5500,7 +5762,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 45 + // CONFIGURATION 47 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5576,7 +5838,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 46 + // CONFIGURATION 48 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5657,7 +5919,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 47 + // CONFIGURATION 49 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5738,7 +6000,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 48 + // CONFIGURATION 50 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5815,7 +6077,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 49 + // CONFIGURATION 51 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5893,7 +6155,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 50 + // CONFIGURATION 52 "{\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" @@ -5976,7 +6238,7 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 51 + // CONFIGURATION 53 "{\n" " \"comment\": \"A DHCPv6 server\",\n" " \"client-classes\": [\n" diff --git a/src/lib/dhcpsrv/alloc_engine.h b/src/lib/dhcpsrv/alloc_engine.h index af5c44da21..ba8d95bc0d 100644 --- a/src/lib/dhcpsrv/alloc_engine.h +++ b/src/lib/dhcpsrv/alloc_engine.h @@ -213,6 +213,7 @@ protected: /// @todo: Implement this method /// /// @param subnet an address will be picked from pool of that subnet + /// @param client_classes list of classes client belongs to /// @param duid Client's DUID (ignored) /// @param hint the last address that was picked (ignored) /// @return a random address from the pool diff --git a/src/lib/dhcpsrv/pool.h b/src/lib/dhcpsrv/pool.h index c7c4aa05db..46423f6fa8 100644 --- a/src/lib/dhcpsrv/pool.h +++ b/src/lib/dhcpsrv/pool.h @@ -97,7 +97,7 @@ public: return (cfg_option_); } - /// @Checks whether this pool supports client that belongs to + /// @brief Checks whether this pool supports client that belongs to /// specified classes. /// /// @todo: currently doing the same than network which @@ -208,7 +208,7 @@ protected: ClientClasses white_list_; /// @brief Last allocated address - /// See @ref isc::dhcp::subnet::last_allocated_ia_ + /// See @ref isc::dhcp::Subnet::last_allocated_ia_ /// Initialized and reset to first isc::asiolink::IOAddress last_allocated_; diff --git a/src/lib/dhcpsrv/subnet.h b/src/lib/dhcpsrv/subnet.h index 5ac4b908c4..52b059a8e1 100644 --- a/src/lib/dhcpsrv/subnet.h +++ b/src/lib/dhcpsrv/subnet.h @@ -315,12 +315,12 @@ protected: /// @throw BadValue if invalid value is used virtual void checkType(Lease::Type type) const = 0; - /// @brief returns a sum of possible leases in all pools + /// @brief Returns a sum of possible leases in all pools /// @param pools list of pools /// @return sum of possible leases uint64_t sumPoolCapacity(const PoolCollection& pools) const; - /// @brief returns a sum of possible leases in all pools allowing classes + /// @brief Returns a sum of possible leases in all pools allowing classes /// @param pools list of pools /// @param client_classes list of classes /// @return sum of possible/allowed leases diff --git a/src/lib/dhcpsrv/tests/pool_unittest.cc b/src/lib/dhcpsrv/tests/pool_unittest.cc index 5662f6a5ce..27960e0254 100644 --- a/src/lib/dhcpsrv/tests/pool_unittest.cc +++ b/src/lib/dhcpsrv/tests/pool_unittest.cc @@ -638,7 +638,7 @@ TEST(Pool6Test, clientClass) { TEST(Pool6Test, clientClasses) { // Create a pool. Pool6 pool(Lease::TYPE_NA, IOAddress("2001:db8::1"), - IOAddress("2001:db8::2")); + IOAddress("2001:db8::2")); // This client does not belong to any class. isc::dhcp::ClientClasses no_class;