summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2022-10-16 20:01:38 +0200
committerFrancis Dupont <fdupont@isc.org>2022-10-18 22:59:06 +0200
commit0df3f28db34f66114132c4d62210ded6a42e639c (patch)
tree7da1a6919a14b19138ce7a7e74a353c6e93c1a94
parent[2595] regen flex/bison (diff)
downloadkea-0df3f28db34f66114132c4d62210ded6a42e639c.tar.xz
kea-0df3f28db34f66114132c4d62210ded6a42e639c.zip
[#2595] Checkpoint: v6 tests and doc
-rw-r--r--src/bin/dhcp4/tests/get_config_unittest.cc351
-rw-r--r--src/bin/dhcp6/tests/get_config_unittest.cc356
-rw-r--r--src/lib/dhcpsrv/dhcpsrv_messages.cc8
-rw-r--r--src/lib/dhcpsrv/dhcpsrv_messages.h4
-rw-r--r--src/lib/dhcpsrv/dhcpsrv_messages.mes16
-rw-r--r--src/lib/dhcpsrv/lease_mgr.cc604
-rw-r--r--src/lib/dhcpsrv/lease_mgr.h15
-rw-r--r--src/lib/dhcpsrv/tests/lease_mgr_unittest.cc273
-rw-r--r--src/lib/dhcpsrv/tests/sanity_checks_unittest.cc520
-rw-r--r--src/lib/dhcpsrv/tests/srv_config_unittest.cc3
-rw-r--r--src/lib/util/tests/strutil_unittest.cc4
11 files changed, 1398 insertions, 756 deletions
diff --git a/src/bin/dhcp4/tests/get_config_unittest.cc b/src/bin/dhcp4/tests/get_config_unittest.cc
index 68941a66a5..5894223669 100644
--- a/src/bin/dhcp4/tests/get_config_unittest.cc
+++ b/src/bin/dhcp4/tests/get_config_unittest.cc
@@ -2318,35 +2318,6 @@ const char* EXTRACTED_CONFIGS[] = {
" \"thread-pool-size\": 48\n"
" },\n"
" \"subnet4\": [ ]\n"
-" }\n",
- // CONFIGURATION 76
-"{\n"
-" \"interfaces-config\": {\n"
-" \"interfaces\": [ \"*\" ],\n"
-" \"re-detect\": false\n,"
-" \"service-sockets-require-all\": true\n"
-" },\n"
-" \"subnet4\": [ ]\n"
-" }\n",
- // CONFIGURATION 77
-"{\n"
-" \"interfaces-config\": {\n"
-" \"interfaces\": [ \"*\" ],\n"
-" \"re-detect\": false,\n"
-" \"service-sockets-max-retries\": 10\n"
-" },\n"
-" \"subnet4\": [ ]\n"
-" }\n",
- // CONFIGURATION 78
-"{\n"
-" \"interfaces-config\": {\n"
-" \"interfaces\": [ \"*\" ],\n"
-" \"re-detect\": false,\n"
-" \"service-sockets-max-retries\": 10,\n"
-" \"service-sockets-require-all\": true,\n"
-" \"service-sockets-retry-wait-time\": 1000\n"
-" },\n"
-" \"subnet4\": [ ]\n"
" }\n"
};
@@ -2421,6 +2392,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -2502,6 +2474,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -2610,6 +2583,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -2721,6 +2695,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -2831,6 +2806,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -3022,6 +2998,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -3213,6 +3190,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"foo\",\n"
@@ -3323,6 +3301,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -3436,6 +3415,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"nohost\",\n"
@@ -3549,6 +3529,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -3659,6 +3640,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -3769,6 +3751,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -3908,6 +3891,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -4046,6 +4030,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -4185,6 +4170,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -4325,6 +4311,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -4435,6 +4422,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -4580,6 +4568,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -4698,6 +4687,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -4788,6 +4778,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -4887,6 +4878,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -4977,6 +4969,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -5067,6 +5060,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -5157,6 +5151,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -5247,6 +5242,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -5346,6 +5342,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -5456,6 +5453,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -5610,6 +5608,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -5756,6 +5755,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -5891,6 +5891,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -6010,6 +6011,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -6137,6 +6139,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -6292,6 +6295,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -6419,6 +6423,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -6568,6 +6573,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -6714,6 +6720,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -6840,6 +6847,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -6965,6 +6973,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -7094,6 +7103,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -7204,6 +7214,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -7286,6 +7297,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -7368,6 +7380,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -7478,6 +7491,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -7588,6 +7602,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -7698,6 +7713,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -7808,6 +7824,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -7918,6 +7935,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -8112,6 +8130,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -8237,6 +8256,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -8514,6 +8534,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -8644,6 +8665,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -8932,6 +8954,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": true,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -9070,6 +9093,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -9150,6 +9174,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -9230,6 +9255,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -9310,6 +9336,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -9392,6 +9419,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -9502,6 +9530,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -9612,6 +9641,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -9722,6 +9752,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -9832,6 +9863,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -9968,6 +10000,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -10097,6 +10130,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -10205,6 +10239,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -10315,6 +10350,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -10426,6 +10462,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -10541,6 +10578,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -10670,6 +10708,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -10822,6 +10861,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -11038,6 +11078,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -11173,6 +11214,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -11348,6 +11390,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -11485,6 +11528,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -11622,6 +11666,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -11702,6 +11747,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
@@ -11782,252 +11828,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
-" \"lease-checks\": \"warn\"\n"
-" },\n"
-" \"server-hostname\": \"\",\n"
-" \"server-tag\": \"\",\n"
-" \"shared-networks\": [ ],\n"
-" \"statistic-default-sample-age\": 0,\n"
-" \"statistic-default-sample-count\": 20,\n"
-" \"store-extended-info\": false,\n"
-" \"subnet4\": [ ],\n"
-" \"t1-percent\": 0.5,\n"
-" \"t2-percent\": 0.875,\n"
-" \"valid-lifetime\": 7200\n"
-" }\n",
- // CONFIGURATION 76
-"{\n"
-" \"authoritative\": false,\n"
-" \"boot-file-name\": \"\",\n"
-" \"calculate-tee-times\": false,\n"
-" \"ddns-generated-prefix\": \"myhost\",\n"
-" \"ddns-override-client-update\": false,\n"
-" \"ddns-override-no-update\": false,\n"
-" \"ddns-qualifying-suffix\": \"\",\n"
-" \"ddns-replace-client-name\": \"never\",\n"
-" \"ddns-send-updates\": true,\n"
-" \"ddns-update-on-renew\": false,\n"
-" \"ddns-use-conflict-resolution\": true,\n"
-" \"decline-probation-period\": 86400,\n"
-" \"dhcp-ddns\": {\n"
-" \"enable-updates\": false,\n"
-" \"max-queue-size\": 1024,\n"
-" \"ncr-format\": \"JSON\",\n"
-" \"ncr-protocol\": \"UDP\",\n"
-" \"sender-ip\": \"0.0.0.0\",\n"
-" \"sender-port\": 0,\n"
-" \"server-ip\": \"127.0.0.1\",\n"
-" \"server-port\": 53001\n"
-" },\n"
-" \"dhcp-queue-control\": {\n"
-" \"capacity\": 64,\n"
-" \"enable-queue\": false,\n"
-" \"queue-type\": \"kea-ring4\"\n"
-" },\n"
-" \"dhcp4o6-port\": 0,\n"
-" \"early-global-reservations-lookup\": false,\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"
-" \"hostname-char-replacement\": \"\",\n"
-" \"hostname-char-set\": \"[^A-Za-z0-9.-]\",\n"
-" \"interfaces-config\": {\n"
-" \"interfaces\": [ \"*\" ],\n"
-" \"re-detect\": false,\n"
-" \"service-sockets-require-all\": true\n"
-" },\n"
-" \"ip-reservations-unique\": true,\n"
-" \"lease-database\": {\n"
-" \"type\": \"memfile\"\n"
-" },\n"
-" \"match-client-id\": true,\n"
-" \"multi-threading\": {\n"
-" \"enable-multi-threading\": false,\n"
-" \"packet-queue-size\": 64,\n"
-" \"thread-pool-size\": 0\n"
-" },\n"
-" \"next-server\": \"0.0.0.0\",\n"
-" \"option-data\": [ ],\n"
-" \"option-def\": [ ],\n"
-" \"parked-packet-limit\": 256,\n"
-" \"reservations-global\": false,\n"
-" \"reservations-in-subnet\": true,\n"
-" \"reservations-lookup-first\": false,\n"
-" \"reservations-out-of-pool\": false,\n"
-" \"sanity-checks\": {\n"
-" \"lease-checks\": \"warn\"\n"
-" },\n"
-" \"server-hostname\": \"\",\n"
-" \"server-tag\": \"\",\n"
-" \"shared-networks\": [ ],\n"
-" \"statistic-default-sample-age\": 0,\n"
-" \"statistic-default-sample-count\": 20,\n"
-" \"store-extended-info\": false,\n"
-" \"subnet4\": [ ],\n"
-" \"t1-percent\": 0.5,\n"
-" \"t2-percent\": 0.875,\n"
-" \"valid-lifetime\": 7200\n"
-" }\n",
- // CONFIGURATION 77
-"{\n"
-" \"authoritative\": false,\n"
-" \"boot-file-name\": \"\",\n"
-" \"calculate-tee-times\": false,\n"
-" \"ddns-generated-prefix\": \"myhost\",\n"
-" \"ddns-override-client-update\": false,\n"
-" \"ddns-override-no-update\": false,\n"
-" \"ddns-qualifying-suffix\": \"\",\n"
-" \"ddns-replace-client-name\": \"never\",\n"
-" \"ddns-send-updates\": true,\n"
-" \"ddns-update-on-renew\": false,\n"
-" \"ddns-use-conflict-resolution\": true,\n"
-" \"decline-probation-period\": 86400,\n"
-" \"dhcp-ddns\": {\n"
-" \"enable-updates\": false,\n"
-" \"max-queue-size\": 1024,\n"
-" \"ncr-format\": \"JSON\",\n"
-" \"ncr-protocol\": \"UDP\",\n"
-" \"sender-ip\": \"0.0.0.0\",\n"
-" \"sender-port\": 0,\n"
-" \"server-ip\": \"127.0.0.1\",\n"
-" \"server-port\": 53001\n"
-" },\n"
-" \"dhcp-queue-control\": {\n"
-" \"capacity\": 64,\n"
-" \"enable-queue\": false,\n"
-" \"queue-type\": \"kea-ring4\"\n"
-" },\n"
-" \"dhcp4o6-port\": 0,\n"
-" \"early-global-reservations-lookup\": false,\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"
-" \"hostname-char-replacement\": \"\",\n"
-" \"hostname-char-set\": \"[^A-Za-z0-9.-]\",\n"
-" \"interfaces-config\": {\n"
-" \"interfaces\": [ \"*\" ],\n"
-" \"re-detect\": false,\n"
-" \"service-sockets-max-retries\": 10,\n"
-" \"service-sockets-retry-wait-time\": 5000\n"
-" },\n"
-" \"ip-reservations-unique\": true,\n"
-" \"lease-database\": {\n"
-" \"type\": \"memfile\"\n"
-" },\n"
-" \"match-client-id\": true,\n"
-" \"multi-threading\": {\n"
-" \"enable-multi-threading\": false,\n"
-" \"packet-queue-size\": 64,\n"
-" \"thread-pool-size\": 0\n"
-" },\n"
-" \"next-server\": \"0.0.0.0\",\n"
-" \"option-data\": [ ],\n"
-" \"option-def\": [ ],\n"
-" \"parked-packet-limit\": 256,\n"
-" \"reservations-global\": false,\n"
-" \"reservations-in-subnet\": true,\n"
-" \"reservations-lookup-first\": false,\n"
-" \"reservations-out-of-pool\": false,\n"
-" \"sanity-checks\": {\n"
-" \"lease-checks\": \"warn\"\n"
-" },\n"
-" \"server-hostname\": \"\",\n"
-" \"server-tag\": \"\",\n"
-" \"shared-networks\": [ ],\n"
-" \"statistic-default-sample-age\": 0,\n"
-" \"statistic-default-sample-count\": 20,\n"
-" \"store-extended-info\": false,\n"
-" \"subnet4\": [ ],\n"
-" \"t1-percent\": 0.5,\n"
-" \"t2-percent\": 0.875,\n"
-" \"valid-lifetime\": 7200\n"
-" }\n",
- // CONFIGURATION 78
-"{\n"
-" \"authoritative\": false,\n"
-" \"boot-file-name\": \"\",\n"
-" \"calculate-tee-times\": false,\n"
-" \"ddns-generated-prefix\": \"myhost\",\n"
-" \"ddns-override-client-update\": false,\n"
-" \"ddns-override-no-update\": false,\n"
-" \"ddns-qualifying-suffix\": \"\",\n"
-" \"ddns-replace-client-name\": \"never\",\n"
-" \"ddns-send-updates\": true,\n"
-" \"ddns-update-on-renew\": false,\n"
-" \"ddns-use-conflict-resolution\": true,\n"
-" \"decline-probation-period\": 86400,\n"
-" \"dhcp-ddns\": {\n"
-" \"enable-updates\": false,\n"
-" \"max-queue-size\": 1024,\n"
-" \"ncr-format\": \"JSON\",\n"
-" \"ncr-protocol\": \"UDP\",\n"
-" \"sender-ip\": \"0.0.0.0\",\n"
-" \"sender-port\": 0,\n"
-" \"server-ip\": \"127.0.0.1\",\n"
-" \"server-port\": 53001\n"
-" },\n"
-" \"dhcp-queue-control\": {\n"
-" \"capacity\": 64,\n"
-" \"enable-queue\": false,\n"
-" \"queue-type\": \"kea-ring4\"\n"
-" },\n"
-" \"dhcp4o6-port\": 0,\n"
-" \"early-global-reservations-lookup\": false,\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"
-" \"hostname-char-replacement\": \"\",\n"
-" \"hostname-char-set\": \"[^A-Za-z0-9.-]\",\n"
-" \"interfaces-config\": {\n"
-" \"interfaces\": [ \"*\" ],\n"
-" \"re-detect\": false,\n"
-" \"service-sockets-max-retries\": 10,\n"
-" \"service-sockets-require-all\": true,\n"
-" \"service-sockets-retry-wait-time\": 1000\n"
-" },\n"
-" \"ip-reservations-unique\": true,\n"
-" \"lease-database\": {\n"
-" \"type\": \"memfile\"\n"
-" },\n"
-" \"match-client-id\": true,\n"
-" \"multi-threading\": {\n"
-" \"enable-multi-threading\": false,\n"
-" \"packet-queue-size\": 64,\n"
-" \"thread-pool-size\": 0\n"
-" },\n"
-" \"next-server\": \"0.0.0.0\",\n"
-" \"option-data\": [ ],\n"
-" \"option-def\": [ ],\n"
-" \"parked-packet-limit\": 256,\n"
-" \"reservations-global\": false,\n"
-" \"reservations-in-subnet\": true,\n"
-" \"reservations-lookup-first\": false,\n"
-" \"reservations-out-of-pool\": false,\n"
-" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-hostname\": \"\",\n"
diff --git a/src/bin/dhcp6/tests/get_config_unittest.cc b/src/bin/dhcp6/tests/get_config_unittest.cc
index 60306c9cc8..0b617a3536 100644
--- a/src/bin/dhcp6/tests/get_config_unittest.cc
+++ b/src/bin/dhcp6/tests/get_config_unittest.cc
@@ -1826,8 +1826,6 @@ const char* EXTRACTED_CONFIGS[] = {
" \"interfaces-config\": {\n"
" \"interfaces\": [ \"*\" ],\n"
" \"re-detect\": false,\n"
-" \"service-sockets-max-retries\": 0,\n"
-" \"service-sockets-require-all\": false,\n"
" \"user-context\": {\n"
" \"comment\": \"Use wildcard\"\n"
" }\n"
@@ -2045,35 +2043,6 @@ const char* EXTRACTED_CONFIGS[] = {
" \"subnet\": \"2001:db8:1::/64\"\n"
" }\n"
" ]\n"
-" }\n",
- // CONFIGURATION 64
-"{\n"
-" \"interfaces-config\": {\n"
-" \"interfaces\": [ \"*\" ],\n"
-" \"re-detect\": false\n,"
-" \"service-sockets-require-all\": true\n"
-" },\n"
-" \"subnet6\": [ ]\n"
-" }\n",
- // CONFIGURATION 65
-"{\n"
-" \"interfaces-config\": {\n"
-" \"interfaces\": [ \"*\" ],\n"
-" \"re-detect\": false,\n"
-" \"service-sockets-max-retries\": 10\n"
-" },\n"
-" \"subnet6\": [ ]\n"
-" }\n",
- // CONFIGURATION 66
-"{\n"
-" \"interfaces-config\": {\n"
-" \"interfaces\": [ \"*\" ],\n"
-" \"re-detect\": false,\n"
-" \"service-sockets-max-retries\": 10,\n"
-" \"service-sockets-require-all\": true,\n"
-" \"service-sockets-retry-wait-time\": 1000\n"
-" },\n"
-" \"subnet6\": [ ]\n"
" }\n"
};
@@ -2146,6 +2115,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -2237,6 +2207,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -2354,6 +2325,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -2558,6 +2530,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -2762,6 +2735,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -2970,6 +2944,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -3087,6 +3062,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -3205,6 +3181,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -3323,6 +3300,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -3477,6 +3455,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -3594,6 +3573,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -3713,6 +3693,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -3834,6 +3815,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -3970,6 +3952,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -4097,6 +4080,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -4192,6 +4176,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -4296,6 +4281,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -4391,6 +4377,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -4486,6 +4473,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -4590,6 +4578,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -4707,6 +4696,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -4868,6 +4858,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -5021,6 +5012,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -5161,6 +5153,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -5278,6 +5271,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -5442,6 +5436,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -5627,6 +5622,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -5763,6 +5759,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -5880,6 +5877,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -5967,6 +5965,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -6054,6 +6053,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -6171,6 +6171,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -6288,6 +6289,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -6495,6 +6497,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -6627,6 +6630,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -6767,6 +6771,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -6884,6 +6889,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -7001,6 +7007,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -7118,6 +7125,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -7378,6 +7386,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -7508,6 +7517,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -7595,6 +7605,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -7682,6 +7693,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -7989,6 +8001,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": true,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -8138,6 +8151,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -8223,6 +8237,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -8308,6 +8323,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -8393,6 +8409,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -8478,6 +8495,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -8579,6 +8597,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -8696,6 +8715,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -8813,6 +8833,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -8931,6 +8952,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -9054,6 +9076,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -9177,6 +9200,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -9296,6 +9320,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -9416,6 +9441,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -9555,6 +9581,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -9700,6 +9727,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -9935,6 +9963,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -10100,6 +10129,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -10185,6 +10215,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -10270,6 +10301,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -10371,6 +10403,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"reservations-lookup-first\": false,\n"
" \"reservations-out-of-pool\": false,\n"
" \"sanity-checks\": {\n"
+" \"extended-info-checks\": \"fix\",\n"
" \"lease-checks\": \"warn\"\n"
" },\n"
" \"server-id\": {\n"
@@ -10418,267 +10451,6 @@ const char* UNPARSED_CONFIGS[] = {
" \"t1-percent\": 0.5,\n"
" \"t2-percent\": 0.8,\n"
" \"valid-lifetime\": 7200\n"
-" }\n",
- // CONFIGURATION 64
-"{\n"
-" \"calculate-tee-times\": true,\n"
-" \"ddns-generated-prefix\": \"myhost\",\n"
-" \"ddns-override-client-update\": false,\n"
-" \"ddns-override-no-update\": false,\n"
-" \"ddns-qualifying-suffix\": \"\",\n"
-" \"ddns-replace-client-name\": \"never\",\n"
-" \"ddns-send-updates\": true,\n"
-" \"ddns-update-on-renew\": false,\n"
-" \"ddns-use-conflict-resolution\": true,\n"
-" \"decline-probation-period\": 86400,\n"
-" \"dhcp-ddns\": {\n"
-" \"enable-updates\": false,\n"
-" \"max-queue-size\": 1024,\n"
-" \"ncr-format\": \"JSON\",\n"
-" \"ncr-protocol\": \"UDP\",\n"
-" \"sender-ip\": \"0.0.0.0\",\n"
-" \"sender-port\": 0,\n"
-" \"server-ip\": \"127.0.0.1\",\n"
-" \"server-port\": 53001\n"
-" },\n"
-" \"dhcp-queue-control\": {\n"
-" \"capacity\": 64,\n"
-" \"enable-queue\": false,\n"
-" \"queue-type\": \"kea-ring6\"\n"
-" },\n"
-" \"dhcp4o6-port\": 0,\n"
-" \"early-global-reservations-lookup\": false,\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"
-" \"hostname-char-replacement\": \"\",\n"
-" \"hostname-char-set\": \"[^A-Za-z0-9.-]\",\n"
-" \"interfaces-config\": {\n"
-" \"interfaces\": [ \"*\" ],\n"
-" \"re-detect\": false,\n"
-" \"service-sockets-require-all\": true\n"
-" },\n"
-" \"ip-reservations-unique\": true,\n"
-" \"lease-database\": {\n"
-" \"type\": \"memfile\"\n"
-" },\n"
-" \"mac-sources\": [ \"any\" ],\n"
-" \"multi-threading\": {\n"
-" \"enable-multi-threading\": false,\n"
-" \"packet-queue-size\": 64,\n"
-" \"thread-pool-size\": 0\n"
-" },\n"
-" \"option-data\": [ ],\n"
-" \"option-def\": [ ],\n"
-" \"parked-packet-limit\": 256,\n"
-" \"preferred-lifetime\": 3600,\n"
-" \"relay-supplied-options\": [ \"65\" ],\n"
-" \"reservations-global\": false,\n"
-" \"reservations-in-subnet\": true,\n"
-" \"reservations-lookup-first\": false,\n"
-" \"reservations-out-of-pool\": false,\n"
-" \"sanity-checks\": {\n"
-" \"lease-checks\": \"warn\"\n"
-" },\n"
-" \"server-id\": {\n"
-" \"enterprise-id\": 0,\n"
-" \"htype\": 0,\n"
-" \"identifier\": \"\",\n"
-" \"persist\": true,\n"
-" \"time\": 0,\n"
-" \"type\": \"LLT\"\n"
-" },\n"
-" \"server-tag\": \"\",\n"
-" \"shared-networks\": [ ],\n"
-" \"statistic-default-sample-age\": 0,\n"
-" \"statistic-default-sample-count\": 20,\n"
-" \"store-extended-info\": false,\n"
-" \"subnet6\": [ ],\n"
-" \"t1-percent\": 0.5,\n"
-" \"t2-percent\": 0.8,\n"
-" \"valid-lifetime\": 7200\n"
-" }\n",
- // CONFIGURATION 65
-"{\n"
-" \"calculate-tee-times\": true,\n"
-" \"ddns-generated-prefix\": \"myhost\",\n"
-" \"ddns-override-client-update\": false,\n"
-" \"ddns-override-no-update\": false,\n"
-" \"ddns-qualifying-suffix\": \"\",\n"
-" \"ddns-replace-client-name\": \"never\",\n"
-" \"ddns-send-updates\": true,\n"
-" \"ddns-update-on-renew\": false,\n"
-" \"ddns-use-conflict-resolution\": true,\n"
-" \"decline-probation-period\": 86400,\n"
-" \"dhcp-ddns\": {\n"
-" \"enable-updates\": false,\n"
-" \"max-queue-size\": 1024,\n"
-" \"ncr-format\": \"JSON\",\n"
-" \"ncr-protocol\": \"UDP\",\n"
-" \"sender-ip\": \"0.0.0.0\",\n"
-" \"sender-port\": 0,\n"
-" \"server-ip\": \"127.0.0.1\",\n"
-" \"server-port\": 53001\n"
-" },\n"
-" \"dhcp-queue-control\": {\n"
-" \"capacity\": 64,\n"
-" \"enable-queue\": false,\n"
-" \"queue-type\": \"kea-ring6\"\n"
-" },\n"
-" \"dhcp4o6-port\": 0,\n"
-" \"early-global-reservations-lookup\": false,\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"
-" \"hostname-char-replacement\": \"\",\n"
-" \"hostname-char-set\": \"[^A-Za-z0-9.-]\",\n"
-" \"interfaces-config\": {\n"
-" \"interfaces\": [ \"*\" ],\n"
-" \"re-detect\": false,\n"
-" \"service-sockets-max-retries\": 10,\n"
-" \"service-sockets-retry-wait-time\": 5000\n"
-" },\n"
-" \"ip-reservations-unique\": true,\n"
-" \"lease-database\": {\n"
-" \"type\": \"memfile\"\n"
-" },\n"
-" \"mac-sources\": [ \"any\" ],\n"
-" \"multi-threading\": {\n"
-" \"enable-multi-threading\": false,\n"
-" \"packet-queue-size\": 64,\n"
-" \"thread-pool-size\": 0\n"
-" },\n"
-" \"option-data\": [ ],\n"
-" \"option-def\": [ ],\n"
-" \"parked-packet-limit\": 256,\n"
-" \"preferred-lifetime\": 3600,\n"
-" \"relay-supplied-options\": [ \"65\" ],\n"
-" \"reservations-global\": false,\n"
-" \"reservations-in-subnet\": true,\n"
-" \"reservations-lookup-first\": false,\n"
-" \"reservations-out-of-pool\": false,\n"
-" \"sanity-checks\": {\n"
-" \"lease-checks\": \"warn\"\n"
-" },\n"
-" \"server-id\": {\n"
-" \"enterprise-id\": 0,\n"
-" \"htype\": 0,\n"
-" \"identifier\": \"\",\n"
-" \"persist\": true,\n"
-" \"time\": 0,\n"
-" \"type\": \"LLT\"\n"
-" },\n"
-" \"server-tag\": \"\",\n"
-" \"shared-networks\": [ ],\n"
-" \"statistic-default-sample-age\": 0,\n"
-" \"statistic-default-sample-count\": 20,\n"
-" \"store-extended-info\": false,\n"
-" \"subnet6\": [ ],\n"
-" \"t1-percent\": 0.5,\n"
-" \"t2-percent\": 0.8,\n"
-" \"valid-lifetime\": 7200\n"
-" }\n",
- // CONFIGURATION 66
-"{\n"
-" \"calculate-tee-times\": true,\n"
-" \"ddns-generated-prefix\": \"myhost\",\n"
-" \"ddns-override-client-update\": false,\n"
-" \"ddns-override-no-update\": false,\n"
-" \"ddns-qualifying-suffix\": \"\",\n"
-" \"ddns-replace-client-name\": \"never\",\n"
-" \"ddns-send-updates\": true,\n"
-" \"ddns-update-on-renew\": false,\n"
-" \"ddns-use-conflict-resolution\": true,\n"
-" \"decline-probation-period\": 86400,\n"
-" \"dhcp-ddns\": {\n"
-" \"enable-updates\": false,\n"
-" \"max-queue-size\": 1024,\n"
-" \"ncr-format\": \"JSON\",\n"
-" \"ncr-protocol\": \"UDP\",\n"
-" \"sender-ip\": \"0.0.0.0\",\n"
-" \"sender-port\": 0,\n"
-" \"server-ip\": \"127.0.0.1\",\n"
-" \"server-port\": 53001\n"
-" },\n"
-" \"dhcp-queue-control\": {\n"
-" \"capacity\": 64,\n"
-" \"enable-queue\": false,\n"
-" \"queue-type\": \"kea-ring6\"\n"
-" },\n"
-" \"dhcp4o6-port\": 0,\n"
-" \"early-global-reservations-lookup\": false,\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"
-" \"hostname-char-replacement\": \"\",\n"
-" \"hostname-char-set\": \"[^A-Za-z0-9.-]\",\n"
-" \"interfaces-config\": {\n"
-" \"interfaces\": [ \"*\" ],\n"
-" \"re-detect\": false,\n"
-" \"service-sockets-max-retries\": 10,\n"
-" \"service-sockets-require-all\": true,\n"
-" \"service-sockets-retry-wait-time\": 1000\n"
-" },\n"
-" \"ip-reservations-unique\": true,\n"
-" \"lease-database\": {\n"
-" \"type\": \"memfile\"\n"
-" },\n"
-" \"mac-sources\": [ \"any\" ],\n"
-" \"multi-threading\": {\n"
-" \"enable-multi-threading\": false,\n"
-" \"packet-queue-size\": 64,\n"
-" \"thread-pool-size\": 0\n"
-" },\n"
-" \"option-data\": [ ],\n"
-" \"option-def\": [ ],\n"
-" \"parked-packet-limit\": 256,\n"
-" \"preferred-lifetime\": 3600,\n"
-" \"relay-supplied-options\": [ \"65\" ],\n"
-" \"reservations-global\": false,\n"
-" \"reservations-in-subnet\": true,\n"
-" \"reservations-lookup-first\": false,\n"
-" \"reservations-out-of-pool\": false,\n"
-" \"sanity-checks\": {\n"
-" \"lease-checks\": \"warn\"\n"
-" },\n"
-" \"server-id\": {\n"
-" \"enterprise-id\": 0,\n"
-" \"htype\": 0,\n"
-" \"identifier\": \"\",\n"
-" \"persist\": true,\n"
-" \"time\": 0,\n"
-" \"type\": \"LLT\"\n"
-" },\n"
-" \"server-tag\": \"\",\n"
-" \"shared-networks\": [ ],\n"
-" \"statistic-default-sample-age\": 0,\n"
-" \"statistic-default-sample-count\": 20,\n"
-" \"store-extended-info\": false,\n"
-" \"subnet6\": [ ],\n"
-" \"t1-percent\": 0.5,\n"
-" \"t2-percent\": 0.8,\n"
-" \"valid-lifetime\": 7200\n"
" }\n"
};
diff --git a/src/lib/dhcpsrv/dhcpsrv_messages.cc b/src/lib/dhcpsrv/dhcpsrv_messages.cc
index c7de9c5514..aaf9b1c286 100644
--- a/src/lib/dhcpsrv/dhcpsrv_messages.cc
+++ b/src/lib/dhcpsrv/dhcpsrv_messages.cc
@@ -64,6 +64,10 @@ extern const isc::log::MessageID DHCPSRV_HOOK_LEASE6_EXTEND_SKIP = "DHCPSRV_HOOK
extern const isc::log::MessageID DHCPSRV_HOOK_LEASE6_RECOVER_SKIP = "DHCPSRV_HOOK_LEASE6_RECOVER_SKIP";
extern const isc::log::MessageID DHCPSRV_HOOK_LEASE6_SELECT_SKIP = "DHCPSRV_HOOK_LEASE6_SELECT_SKIP";
extern const isc::log::MessageID DHCPSRV_INVALID_ACCESS = "DHCPSRV_INVALID_ACCESS";
+extern const isc::log::MessageID DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL = "DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL";
+extern const isc::log::MessageID DHCPSRV_LEASE4_EXTENDED_INFO_UPGRADED = "DHCPSRV_LEASE4_EXTENDED_INFO_UPGRADED";
+extern const isc::log::MessageID DHCPSRV_LEASE6_EXTENDED_INFO_SANITY_FAIL = "DHCPSRV_LEASE6_EXTENDED_INFO_SANITY_FAIL";
+extern const isc::log::MessageID DHCPSRV_LEASE6_EXTENDED_INFO_UPGRADED = "DHCPSRV_LEASE6_EXTENDED_INFO_UPGRADED";
extern const isc::log::MessageID DHCPSRV_LEASE_SANITY_FAIL = "DHCPSRV_LEASE_SANITY_FAIL";
extern const isc::log::MessageID DHCPSRV_LEASE_SANITY_FAIL_DISCARD = "DHCPSRV_LEASE_SANITY_FAIL_DISCARD";
extern const isc::log::MessageID DHCPSRV_LEASE_SANITY_FIXED = "DHCPSRV_LEASE_SANITY_FIXED";
@@ -305,6 +309,10 @@ const char* values[] = {
"DHCPSRV_HOOK_LEASE6_RECOVER_SKIP", "DHCPv6 lease %1 was not recovered from declined state because a callout set the skip status.",
"DHCPSRV_HOOK_LEASE6_SELECT_SKIP", "Lease6 (non-temporary) creation was skipped, because of callout skip flag.",
"DHCPSRV_INVALID_ACCESS", "invalid database access string: %1",
+ "DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL", "extended info for lease %1 failed checks (%2)",
+ "DHCPSRV_LEASE4_EXTENDED_INFO_UPGRADED", "extended info for lease %1 was upgraded",
+ "DHCPSRV_LEASE6_EXTENDED_INFO_SANITY_FAIL", "extended info for lease %1 failed checks (%2)",
+ "DHCPSRV_LEASE6_EXTENDED_INFO_UPGRADED", "extended info for lease %1 was upgraded",
"DHCPSRV_LEASE_SANITY_FAIL", "The lease %1 with subnet-id %2 failed subnet-id checks (%3).",
"DHCPSRV_LEASE_SANITY_FAIL_DISCARD", "The lease %1 with subnet-id %2 failed subnet-id checks (%3) and was dropped.",
"DHCPSRV_LEASE_SANITY_FIXED", "The lease %1 with subnet-id %2 failed subnet-id checks, but was corrected to subnet-id %3.",
diff --git a/src/lib/dhcpsrv/dhcpsrv_messages.h b/src/lib/dhcpsrv/dhcpsrv_messages.h
index cc17421a4a..b2c8af5d96 100644
--- a/src/lib/dhcpsrv/dhcpsrv_messages.h
+++ b/src/lib/dhcpsrv/dhcpsrv_messages.h
@@ -65,6 +65,10 @@ extern const isc::log::MessageID DHCPSRV_HOOK_LEASE6_EXTEND_SKIP;
extern const isc::log::MessageID DHCPSRV_HOOK_LEASE6_RECOVER_SKIP;
extern const isc::log::MessageID DHCPSRV_HOOK_LEASE6_SELECT_SKIP;
extern const isc::log::MessageID DHCPSRV_INVALID_ACCESS;
+extern const isc::log::MessageID DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL;
+extern const isc::log::MessageID DHCPSRV_LEASE4_EXTENDED_INFO_UPGRADED;
+extern const isc::log::MessageID DHCPSRV_LEASE6_EXTENDED_INFO_SANITY_FAIL;
+extern const isc::log::MessageID DHCPSRV_LEASE6_EXTENDED_INFO_UPGRADED;
extern const isc::log::MessageID DHCPSRV_LEASE_SANITY_FAIL;
extern const isc::log::MessageID DHCPSRV_LEASE_SANITY_FAIL_DISCARD;
extern const isc::log::MessageID DHCPSRV_LEASE_SANITY_FIXED;
diff --git a/src/lib/dhcpsrv/dhcpsrv_messages.mes b/src/lib/dhcpsrv/dhcpsrv_messages.mes
index ab271d7d38..2dcd42454f 100644
--- a/src/lib/dhcpsrv/dhcpsrv_messages.mes
+++ b/src/lib/dhcpsrv/dhcpsrv_messages.mes
@@ -343,6 +343,22 @@ and the attempt ended in error. The access string in question - which
should be of the form 'keyword=value keyword=value...' is included in
the message.
+% DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL extended info for lease %1 failed checks (%2)
+This debug message is printed when a lease extended info failed to
+pass sanity checks. The detail of the found problem was displayed and
+the extended info deleted from the lease user context.
+
+% DHCPSRV_LEASE4_EXTENDED_INFO_UPGRADED extended info for lease %1 was upgraded
+This debug message is printed when a lease extended info was upgraded.
+
+% DHCPSRV_LEASE6_EXTENDED_INFO_SANITY_FAIL extended info for lease %1 failed checks (%2)
+This debug message is printed when a lease extended info failed to
+pass sanity checks. The detail of the found problem was displayed and
+the extended info deleted from the lease user context.
+
+% DHCPSRV_LEASE6_EXTENDED_INFO_UPGRADED extended info for lease %1 was upgraded
+This debug message is printed when a lease extended info was upgraded.
+
% DHCPSRV_LEASE_SANITY_FAIL The lease %1 with subnet-id %2 failed subnet-id checks (%3).
This warning message is printed when the lease being loaded does not match the
configuration. Due to lease-checks value, the lease will be loaded, but
diff --git a/src/lib/dhcpsrv/lease_mgr.cc b/src/lib/dhcpsrv/lease_mgr.cc
index dd3ee18592..749ed7ba77 100644
--- a/src/lib/dhcpsrv/lease_mgr.cc
+++ b/src/lib/dhcpsrv/lease_mgr.cc
@@ -376,7 +376,8 @@ LeaseMgr::setExtendedInfoTablesEnabled(const DatabaseConnection::ParameterMap& p
}
bool
-LeaseMgr::upgradeLease4ExtendedInfo(const Lease4Ptr& lease) {
+LeaseMgr::upgradeLease4ExtendedInfo(const Lease4Ptr& lease,
+ CfgConsistency::ExtendedInfoSanity check) {
static OptionDefinitionPtr rai_def;
bool changed = false;
@@ -384,18 +385,12 @@ LeaseMgr::upgradeLease4ExtendedInfo(const Lease4Ptr& lease) {
return (changed);
}
- ConstElementPtr user_context = lease->getContext();
- if (!user_context || (user_context->getType() != Element::map)) {
- return (changed);
- }
-
- ConstElementPtr isc = user_context->get("ISC");
- if (!isc || (isc->getType() != Element::map)) {
+ if (check == CfgConsistency::EXTENDED_INFO_CHECK_NONE) {
return (changed);
}
- ConstElementPtr extended_info = isc->get("relay-agent-info");
- if (!extended_info || (extended_info->getType() != Element::string)) {
+ ConstElementPtr user_context = lease->getContext();
+ if (!user_context) {
return (changed);
}
@@ -410,149 +405,560 @@ LeaseMgr::upgradeLease4ExtendedInfo(const Lease4Ptr& lease) {
isc_throw(Unexpected, "can't find RAI option definition?!");
}
- changed = true;
- ElementPtr mutable_isc = boost::const_pointer_cast<Element>(isc);
- if (!mutable_isc) {
- // Should not happen...
- mutable_isc = Element::createMap();
- ElementPtr mutable_user_context =
+ ConstElementPtr isc;
+ ConstElementPtr extended_info;
+ ElementPtr mutable_user_context;
+ ElementPtr mutable_isc;
+ string verifying = "";
+ bool removed_extended_info = false;
+
+ try {
+ verifying = "user context";
+ if (user_context->getType() != Element::map) {
+ isc_throw(BadValue, "user context is not a map");
+ }
+ if (user_context->empty()) {
+ changed = true;
+ lease->setContext(ConstElementPtr());
+ return (changed);
+ }
+
+ verifying = "isc";
+ isc = user_context->get("ISC");
+ if (!isc) {
+ return (changed);
+ }
+ mutable_user_context =
boost::const_pointer_cast<Element>(user_context);
if (!mutable_user_context) {
// Should not happen...
- mutable_user_context = Element::createMap();
+ mutable_user_context = copy(user_context, 0);
lease->setContext(mutable_user_context);
}
- mutable_user_context->set("ISC", mutable_isc);
- }
- ElementPtr upgraded = Element::createMap();
- upgraded->set("sub-options", extended_info);
- mutable_isc->set("relay-agent-info", upgraded);
- // Try to decode sub-options.
- string rai_hex = extended_info->stringValue();
- try {
- vector<uint8_t> rai_data;
- encode::decodeHex(rai_hex, rai_data);
- OptionCustomPtr rai(new OptionCustom(*rai_def, Option::V4, rai_data));
- if (!rai) {
+ if (isc->getType() != Element::map) {
+ isc_throw(BadValue, "ISC entry is not a map");
+ }
+ if (isc->empty()) {
+ changed = true;
+ mutable_user_context->remove("ISC");
+ if (mutable_user_context->empty()) {
+ lease->setContext(ConstElementPtr());
+ }
+ return (changed);
+ }
+
+ verifying = "relay-agent-info";
+ extended_info = isc->get("relay-agent-info");
+ if (!extended_info) {
+ return (changed);
+ }
+ mutable_isc = boost::const_pointer_cast<Element>(isc);
+ if (!mutable_isc) {
+ // Should not happen...
+ mutable_isc = copy(isc, 0);
+ mutable_user_context->set("ISC", mutable_isc);
+ }
+
+ if (extended_info->getType() == Element::string) {
+ // Upgrade
+ changed = true;
+ ElementPtr upgraded = Element::createMap();
+ upgraded->set("sub-options", extended_info);
+ mutable_isc->set("relay-agent-info", upgraded);
+
+ // Try to decode sub-options.
+ verifying = "rai";
+ string rai_hex = extended_info->stringValue();
+ vector<uint8_t> rai_data;
+ str::decodeFormattedHexString(rai_hex, rai_data);
+ OptionCustomPtr rai(new OptionCustom(*rai_def, Option::V4, rai_data));
+ if (!rai) {
+ isc_throw(BadValue, "can't create RAI option");
+ }
+
+ OptionPtr remote_id = rai->getOption(RAI_OPTION_REMOTE_ID);
+ if (remote_id) {
+ vector<uint8_t> bytes = remote_id->toBinary(false);
+ if (bytes.size() > 0) {
+ upgraded->set("remote-id",
+ Element::create(encode::encodeHex(bytes)));
+ }
+ }
+
+ OptionPtr relay_id = rai->getOption(RAI_OPTION_RELAY_ID);
+ if (relay_id) {
+ vector<uint8_t> bytes = relay_id->toBinary(false);
+ if (bytes.size() > 0) {
+ upgraded->set("relay-id",
+ Element::create(encode::encodeHex(bytes)));
+ }
+ }
+
+ LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE,
+ DHCPSRV_LEASE4_EXTENDED_INFO_UPGRADED)
+ .arg(lease->addr_.toText());
+ return (changed);
+ } else if (extended_info->getType() != Element::map) {
+ mutable_isc->remove("relay-agent-info");
+ removed_extended_info = true;
+ isc_throw(BadValue, "relay-agent-info is not a map or a string");
+ }
+
+ if (check == CfgConsistency::EXTENDED_INFO_CHECK_FIX) {
return (changed);
}
- OptionPtr remote_id = rai->getOption(RAI_OPTION_REMOTE_ID);
+ // Try to decode sub-options.
+ ConstElementPtr sub_options = extended_info->get("sub-options");
+ if (sub_options) {
+ verifying = "sub-options";
+ if (sub_options->getType() != Element::string) {
+ mutable_isc->remove("relay-agent-info");
+ removed_extended_info = true;
+ isc_throw(BadValue, "sub-options is not a string");
+ }
+ string rai_hex = sub_options->stringValue();
+ vector<uint8_t> rai_data;
+ str::decodeFormattedHexString(rai_hex, rai_data);
+ }
+
+ ConstElementPtr remote_id = extended_info->get("remote-id");
if (remote_id) {
- vector<uint8_t> bytes = remote_id->toBinary(false);
- if (bytes.size() > 0) {
- upgraded->set("remote-id",
- Element::create(encode::encodeHex(bytes)));
+ verifying = "remote-id";
+ if (remote_id->getType() != Element::string) {
+ mutable_isc->remove("relay-agent-info");
+ removed_extended_info = true;
+ isc_throw(BadValue, "remote-id is not a string");
+ }
+ string remote_id_hex = remote_id->stringValue();
+ vector<uint8_t> remote_id_data;
+ encode::decodeHex(remote_id_hex, remote_id_data);
+ if (remote_id_data.empty()) {
+ mutable_isc->remove("relay-agent-info");
+ removed_extended_info = true;
+ isc_throw(BadValue, "remote-id is empty");
}
}
- OptionPtr relay_id = rai->getOption(RAI_OPTION_RELAY_ID);
+ ConstElementPtr relay_id = extended_info->get("relay-id");
if (relay_id) {
- vector<uint8_t> bytes = relay_id->toBinary(false);
- if (bytes.size() > 0) {
- upgraded->set("relay-id",
- Element::create(encode::encodeHex(bytes)));
+ verifying = "relay-id";
+ if (relay_id->getType() != Element::string) {
+ mutable_isc->remove("relay-agent-info");
+ removed_extended_info = true;
+ isc_throw(BadValue, "relay-id is not a string");
+ }
+ string relay_id_hex = relay_id->stringValue();
+ vector<uint8_t> relay_id_data;
+ encode::decodeHex(relay_id_hex, relay_id_data);
+ if (relay_id_data.empty()) {
+ mutable_isc->remove("relay-agent-info");
+ removed_extended_info = true;
+ isc_throw(BadValue, "relay-id is empty");
+ }
+ }
+
+ if (check != CfgConsistency::EXTENDED_INFO_CHECK_PEDANTIC) {
+ return (changed);
+ }
+
+ verifying = "relay-agent-info";
+ for (auto elem : extended_info->mapValue()) {
+ if ((elem.first != "sub-options") &&
+ (elem.first != "remote-id") &&
+ (elem.first != "relay-id") &&
+ (elem.first != "comment")) {
+ mutable_isc->remove("relay-agent-info");
+ removed_extended_info = true;
+ isc_throw(BadValue, "spurious '" << elem.first <<
+ "' entry in relay-agent-info");
}
}
return (changed);
- } catch (...) {
+ } catch (const exception& ex) {
+ ostringstream err;
+ err << "in " << verifying << " a problem was found: " << ex.what();
+ LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE,
+ DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL)
+ .arg(lease->addr_.toText())
+ .arg(err.str());
+
+ changed = true;
+ if (verifying == "user context") {
+ lease->setContext(ConstElementPtr());
+ } else if (verifying == "isc") {
+ mutable_user_context->remove("ISC");
+ if (mutable_user_context->empty()) {
+ lease->setContext(ConstElementPtr());
+ }
+ } else {
+ if (!removed_extended_info) {
+ mutable_isc->remove("relay-agent-info");
+ }
+ if (mutable_isc->empty()) {
+ mutable_user_context->remove("ISC");
+ if (mutable_user_context->empty()) {
+ lease->setContext(ConstElementPtr());
+ }
+ }
+ }
return (changed);
}
}
bool
-LeaseMgr::upgradeLease6ExtendedInfo(const Lease6Ptr& lease) {
+LeaseMgr::upgradeLease6ExtendedInfo(const Lease6Ptr& lease,
+ CfgConsistency::ExtendedInfoSanity check) {
bool changed = false;
if (!lease) {
return (changed);
}
- ConstElementPtr user_context = lease->getContext();
- if (!user_context || (user_context->getType() != Element::map)) {
+ if (check == CfgConsistency::EXTENDED_INFO_CHECK_NONE) {
return (changed);
}
- ConstElementPtr isc = user_context->get("ISC");
- if (!isc || (isc->getType() != Element::map)) {
+ ConstElementPtr user_context = lease->getContext();
+ if (!user_context) {
return (changed);
}
- ConstElementPtr extended_info = isc->get("relays");
- if (!extended_info || (extended_info->getType() != Element::list)) {
- return (changed);
- }
+ ConstElementPtr isc;
+ ConstElementPtr relay_info;
+ ElementPtr mutable_user_context;
+ ElementPtr mutable_isc;
+ string verifying = "";
+ bool removed_relay_info = false;
+ bool upgraded = false;
+ bool have_both = false;
+ int i = -1;
- changed = true;
- ElementPtr mutable_isc = boost::const_pointer_cast<Element>(isc);
- if (!mutable_isc) {
- // Should not happen...
- mutable_isc = Element::createMap();
- ElementPtr mutable_user_context =
+ try {
+ verifying = "user context";
+ if (user_context->getType() != Element::map) {
+ isc_throw(BadValue, "user context is not a map");
+ }
+ if (user_context->empty()) {
+ changed = true;
+ lease->setContext(ConstElementPtr());
+ return (changed);
+ }
+
+ verifying = "isc";
+ isc = user_context->get("ISC");
+ if (!isc) {
+ return (changed);
+ }
+ mutable_user_context =
boost::const_pointer_cast<Element>(user_context);
if (!mutable_user_context) {
// Should not happen...
- mutable_user_context = Element::createMap();
+ mutable_user_context = copy(user_context, 0);
lease->setContext(mutable_user_context);
}
- mutable_user_context->set("ISC", mutable_isc);
- }
- ElementPtr upgraded = copy(extended_info, 0);
- mutable_isc->set("relay-info", upgraded);
- mutable_isc->remove("relays");
- for (int i = 0; i < upgraded->size(); ++i) {
- ElementPtr relay = upgraded->getNonConst(i);
- if (!relay || (relay->getType() != Element::map)) {
- // Junk entry so just return instead continue...
+ if (isc->getType() != Element::map) {
+ isc_throw(BadValue, "ISC entry is not a map");
+ }
+ if (isc->empty()) {
+ changed = true;
+ mutable_user_context->remove("ISC");
+ if (mutable_user_context->empty()) {
+ lease->setContext(ConstElementPtr());
+ }
return (changed);
}
-
- // Try to decode options.
- ConstElementPtr options = relay->get("options");
- if (!options) {
- continue;
+ mutable_isc = boost::const_pointer_cast<Element>(isc);
+ if (!mutable_isc) {
+ // Should not happen...
+ mutable_isc = copy(isc, 0);
+ mutable_user_context->set("ISC", mutable_isc);
}
- if (options->getType() != Element::string) {
- return (changed);
+
+ verifying = "relay-info";
+ relay_info = mutable_isc->get("relays");
+ if (relay_info && isc->contains("relay-info")) {
+ changed = true;
+ mutable_isc->remove("relays");
+ have_both = true;
+ relay_info.reset();
}
- string options_hex = options->stringValue();
- try {
- vector<uint8_t> options_data;
- encode::decodeHex(options_hex, options_data);
- OptionCollection opts;
- LibDHCP::unpackOptions6(options_data, DHCP6_OPTION_SPACE, opts);
-
- auto remote_id_it = opts.find(D6O_REMOTE_ID);
- if (remote_id_it != opts.end()) {
- OptionPtr remote_id = remote_id_it->second;
- if (remote_id) {
- vector<uint8_t> bytes = remote_id->toBinary(false);
- if (bytes.size() > 0) {
- relay->set("remote-id",
- Element::create(encode::encodeHex(bytes)));
+ if (relay_info) {
+ // Upgrade
+ changed = true;
+ upgraded = true;
+ mutable_isc->set("relay-info", relay_info);
+ mutable_isc->remove("relays");
+
+ if (relay_info->getType() != Element::list) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "relays is not a list");
+ }
+ if (relay_info->empty()) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "relays is empty");
+ }
+
+ verifying = "relay";
+ for (i = 0; i < relay_info->size(); ++i) {
+ ElementPtr relay = relay_info->getNonConst(i);
+ if (!relay) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "null relay#" << i);
+ }
+ if (relay->getType() != Element::map) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "relay#" << i << " is not a map");
+ }
+
+ // Try to decode options.
+ ConstElementPtr options = relay->get("options");
+ if (!options) {
+ continue;
+ }
+
+ verifying = "options";
+ if (options->getType() != Element::string) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "options is not a string");
+ }
+ string options_hex = options->stringValue();
+ vector<uint8_t> options_data;
+ str::decodeFormattedHexString(options_hex, options_data);
+ OptionCollection opts;
+ LibDHCP::unpackOptions6(options_data, DHCP6_OPTION_SPACE, opts);
+
+ auto remote_id_it = opts.find(D6O_REMOTE_ID);
+ if (remote_id_it != opts.end()) {
+ OptionPtr remote_id = remote_id_it->second;
+ if (remote_id) {
+ vector<uint8_t> bytes = remote_id->toBinary(false);
+ if (bytes.size() > 0) {
+ relay->set("remote-id",
+ Element::create(encode::encodeHex(bytes)));
+ }
}
}
- }
- auto relay_id_it = opts.find(D6O_RELAY_ID);
- if (relay_id_it != opts.end()) {
- OptionPtr relay_id = relay_id_it->second;
- if (relay_id) {
- vector<uint8_t> bytes = relay_id->toBinary(false);
- if (bytes.size() > 0) {
- relay->set("relay-id",
- Element::create(encode::encodeHex(bytes)));
+ auto relay_id_it = opts.find(D6O_RELAY_ID);
+ if (relay_id_it != opts.end()) {
+ OptionPtr relay_id = relay_id_it->second;
+ if (relay_id) {
+ vector<uint8_t> bytes = relay_id->toBinary(false);
+ if (bytes.size() > 0) {
+ relay->set("relay-id",
+ Element::create(encode::encodeHex(bytes)));
+ }
}
}
}
- } catch (...) {
+ }
+
+ verifying = (upgraded ? "relays" : "relay-info");
+ i = -1;
+ relay_info = mutable_isc->get("relay-info");
+ if (!relay_info) {
return (changed);
}
- }
+ if (!upgraded && (relay_info->getType() != Element::list)) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "relay-info is not a list");
+ }
+ if (!upgraded && relay_info->empty()) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "relay-info empty");
+ }
+
+ verifying = "relay";
+ for (i = 0; i < relay_info->size(); ++i) {
+ ElementPtr relay = relay_info->getNonConst(i);
+ if (!upgraded && !relay) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "null relay#" << i);
+ }
+ if (!upgraded && (relay->getType() != Element::map)) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "relay#" << i << " is not a map");
+ }
+
+ ConstElementPtr options = relay->get("options");
+ if (!upgraded && options) {
+ // Try to decode options.
+ verifying = "options";
+ if (options->getType() != Element::string) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "options is not a string");
+ }
+ string options_hex = options->stringValue();
+ vector<uint8_t> options_data;
+ str::decodeFormattedHexString(options_hex, options_data);
+ OptionCollection opts;
+ LibDHCP::unpackOptions6(options_data, DHCP6_OPTION_SPACE, opts);
+ }
+ if (check == CfgConsistency::EXTENDED_INFO_CHECK_FIX) {
+ continue;
+ }
+
+ verifying = "link";
+ ConstElementPtr link_addr = relay->get("link");
+ if (!link_addr) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "no link");
+ }
+ if (link_addr->getType() != Element::string) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "link is not a string");
+ }
+ IOAddress laddr(link_addr->stringValue());
+ if (!laddr.isV6()) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "link is not an IPv6 address");
+ }
- return (changed);
+ ConstElementPtr remote_id = relay_info->get("remote-id");
+ if (!upgraded && remote_id) {
+ verifying = "remote-id";
+ if (remote_id->getType() != Element::string) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "remote-id is not a string");
+ }
+ string remote_id_hex = remote_id->stringValue();
+ vector<uint8_t> remote_id_data;
+ encode::decodeHex(remote_id_hex, remote_id_data);
+ if (remote_id_data.empty()) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "remote-id is empty");
+ }
+ }
+
+ ConstElementPtr relay_id = relay_info->get("relay-id");
+ if (!upgraded && relay_id) {
+ verifying = "relay-id";
+ if (relay_id->getType() != Element::string) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "relay-id is not a string");
+ }
+ string relay_id_hex = relay_id->stringValue();
+ vector<uint8_t> relay_id_data;
+ encode::decodeHex(relay_id_hex, relay_id_data);
+ if (relay_id_data.empty()) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "relay-id is empty");
+ }
+ }
+
+ if (check != CfgConsistency::EXTENDED_INFO_CHECK_PEDANTIC) {
+ continue;
+ }
+
+ verifying = "peer";
+ ConstElementPtr peer_addr = relay->get("peer");
+ if (!peer_addr) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "no peer");
+ }
+ if (peer_addr->getType() != Element::string) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "peer is not a string");
+ }
+ IOAddress paddr(peer_addr->stringValue());
+ if (!paddr.isV6()) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "peer is not an IPv6 address");
+ }
+
+ verifying = "hop";
+ ConstElementPtr hop = relay->get("hop");
+ if (!hop) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "no hop");
+ }
+ if (hop->getType() != Element::integer) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "hop is not an integer");
+ }
+
+ verifying = (upgraded ? "relays" : "relay-info");
+ for (auto elem : relay_info->mapValue()) {
+ if ((elem.first != "hop") &&
+ (elem.first != "link") &&
+ (elem.first != "peer") &&
+ (elem.first != "options") &&
+ (elem.first != "remote-id") &&
+ (elem.first != "relay-id") &&
+ (elem.first != "comment")) {
+ mutable_isc->remove("relay-info");
+ removed_relay_info = true;
+ isc_throw(BadValue, "spurious '" << elem.first << "' entry");
+ }
+ }
+ }
+
+ if (upgraded) {
+ LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE,
+ DHCPSRV_LEASE6_EXTENDED_INFO_UPGRADED)
+ .arg(lease->addr_.toText());
+ }
+
+ return (changed);
+ } catch (const exception& ex) {
+ ostringstream err;
+ err << "in " << verifying;
+ if (i >= 0) {
+ err << " [relay#" << i << "]";
+ }
+ err << " a problem was found: " << ex.what();
+ LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE,
+ DHCPSRV_LEASE6_EXTENDED_INFO_SANITY_FAIL)
+ .arg(lease->addr_.toText())
+ .arg(err.str());
+
+ changed = true;
+ have_both = !have_both;
+ if (verifying == "user context") {
+ lease->setContext(ConstElementPtr());
+ } else if (verifying == "isc") {
+ mutable_user_context->remove("ISC");
+ if (mutable_user_context->empty()) {
+ lease->setContext(ConstElementPtr());
+ }
+ } else {
+ if (!removed_relay_info) {
+ mutable_isc->remove("relay-info");
+ }
+ if (mutable_isc->empty()) {
+ mutable_user_context->remove("ISC");
+ if (mutable_user_context->empty()) {
+ lease->setContext(ConstElementPtr());
+ }
+ }
+ }
+ return (changed);
+ }
}
} // namespace isc::dhcp
diff --git a/src/lib/dhcpsrv/lease_mgr.h b/src/lib/dhcpsrv/lease_mgr.h
index b1fd51548c..ea783a0775 100644
--- a/src/lib/dhcpsrv/lease_mgr.h
+++ b/src/lib/dhcpsrv/lease_mgr.h
@@ -15,6 +15,7 @@
#include <dhcp/duid.h>
#include <dhcp/option.h>
#include <dhcp/hwaddr.h>
+#include <dhcpsrv/cfg_consistency.h>
#include <dhcpsrv/lease.h>
#include <dhcpsrv/subnet.h>
@@ -821,6 +822,7 @@ public:
/// @brief Upgrade a V4 lease user context to the new extended info entry.
///
/// In details:
+ /// - perform sanity checks according to check level.
/// - change the "ISC" / "relay-agent-info" to a map.
/// - move the "relay-agent-info" string to the "sub-options" entry of
/// the map.
@@ -829,20 +831,29 @@ public:
/// entries of the map.
///
/// @param lease Pointer to the lease to be updated.
+ /// @param check Sanity/consistency check level.
/// @return True if the lease user context was updated, false otherwise.
- static bool upgradeLease4ExtendedInfo(const Lease4Ptr& lease);
+ static bool
+ upgradeLease4ExtendedInfo(const Lease4Ptr& lease,
+ CfgConsistency::ExtendedInfoSanity check =
+ CfgConsistency::EXTENDED_INFO_CHECK_FIX);
/// @brief Upgrade a V6 lease user context to the new extended info entry.
///
/// In details:
+ /// - perform sanity checks according to check level.
/// - change the "ISC" / "relays" list entry to "relay-info".
/// - decode remote-id and relay-id from each relay options and
/// add the raw value in hexadecimal in "remote-id" and/or "relay-id"
/// in the relay item of the list.
///
/// @param lease Pointer to the lease to be updated.
+ /// @param check Sanity/consistency check level.
/// @return True if the lease user context was updated, false otherwise.
- static bool upgradeLease6ExtendedInfo(const Lease6Ptr& lease);
+ static bool
+ upgradeLease6ExtendedInfo(const Lease6Ptr& lease,
+ CfgConsistency::ExtendedInfoSanity check =
+ CfgConsistency::EXTENDED_INFO_CHECK_FIX);
/// @brief Returns existing IPv4 leases with a given relay-id.
///
diff --git a/src/lib/dhcpsrv/tests/lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/lease_mgr_unittest.cc
index 8414ca5aca..8549252c30 100644
--- a/src/lib/dhcpsrv/tests/lease_mgr_unittest.cc
+++ b/src/lib/dhcpsrv/tests/lease_mgr_unittest.cc
@@ -641,30 +641,47 @@ TEST(Lease4ExtendedInfoTest, basic) {
// Not map user context.
ElementPtr user_context = Element::createList();
lease->setContext(user_context);
- EXPECT_FALSE(LeaseMgr::upgradeLease4ExtendedInfo(lease));
+ EXPECT_TRUE(LeaseMgr::upgradeLease4ExtendedInfo(lease));
+ EXPECT_FALSE(lease->getContext());
// No ISC.
user_context = Element::createMap();
+ user_context->set("foo", Element::create(string("bar")));
lease->setContext(user_context);
EXPECT_FALSE(LeaseMgr::upgradeLease4ExtendedInfo(lease));
- // Not map user context.
+ // Not a map ISC.
+ user_context = Element::createMap();
+ lease->setContext(user_context);
ElementPtr isc = Element::create(string("..."));
user_context->set("ISC", isc);
- EXPECT_FALSE(LeaseMgr::upgradeLease4ExtendedInfo(lease));
+ EXPECT_TRUE(LeaseMgr::upgradeLease4ExtendedInfo(lease));
+ EXPECT_FALSE(lease->getContext());
// No relay agent info.
+ user_context = Element::createMap();
+ lease->setContext(user_context);
isc = Element::createMap();
user_context->set("ISC", isc);
+ isc->set("foo", Element::create(string("bar")));
EXPECT_FALSE(LeaseMgr::upgradeLease4ExtendedInfo(lease));
- // Not string relay agent info.
+ // Not string or map relay agent info.
+ user_context = Element::createMap();
+ lease->setContext(user_context);
+ isc = Element::createMap();
+ user_context->set("ISC", isc);
ElementPtr rai = Element::createMap();
+ rai->set("foo", Element::create(string("bar")));
isc->set("relay-agent-info", rai);
EXPECT_FALSE(LeaseMgr::upgradeLease4ExtendedInfo(lease));
// Positive case.
- rai = Element::create(string("foo"));
+ user_context = Element::createMap();
+ lease->setContext(user_context);
+ isc = Element::createMap();
+ user_context->set("ISC", isc);
+ rai = Element::create(string("0xAA01BB"));
isc->set("relay-agent-info", rai);
EXPECT_TRUE(LeaseMgr::upgradeLease4ExtendedInfo(lease));
@@ -675,7 +692,7 @@ TEST(Lease4ExtendedInfoTest, basic) {
ConstElementPtr new_rai = new_isc->get("relay-agent-info");
ASSERT_TRUE(new_rai);
ASSERT_EQ(Element::map, new_rai->getType());
- ASSERT_EQ("{ \"sub-options\": \"foo\" }", new_rai->str());
+ ASSERT_EQ("{ \"sub-options\": \"0xAA01BB\" }", new_rai->str());
}
// Verify Lease4 user context upgrade complex operations.
@@ -685,76 +702,89 @@ TEST(Lease4ExtendedInfoTest, upgradeLease4ExtendedInfo) {
string description_; // test description.
string orig_; // original user context.
string expected_; // expected user context.
- bool exp_ret_; // expected returned value.
};
// Test scenarios.
vector<Scenario> scenarios {
{
- "no context",
- "",
+ "no user context",
"",
- false
+ ""
},
{
- "context is not a map",
+ "user context is not a map",
"[ ]",
- "[ ]",
- false
+ ""
},
{
"no ISC entry",
"{ }",
- "{ }",
- false
+ ""
+ },
+ {
+ "no ISC entry but not empty",
+ "{ \"foo\": true }",
+ "{ \"foo\": true }"
},
{
"ISC entry is not a map",
"{ \"ISC\": true }",
- "{ \"ISC\": true }",
- false
+ ""
+ },
+ {
+ "ISC entry is not a map, user context not empty",
+ "{ \"foo\": true, \"ISC\": true }",
+ "{ \"foo\": true }"
},
{
"no relay agent info",
"{ \"ISC\": { } }",
- "{ \"ISC\": { } }",
- false
+ ""
+ },
+ {
+ "no relay agent info, ISC not empty",
+ "{ \"ISC\": { \"foo\": true } }",
+ "{ \"ISC\": { \"foo\": true } }"
+ },
+ {
+ "relay agent info is not a string or a map",
+ "{ \"ISC\": { \"relay-agent-info\": false } }",
+ ""
},
{
- "relay agent info is not a string",
- "{ \"ISC\": { \"relay-agent-info\": { } } }",
- "{ \"ISC\": { \"relay-agent-info\": { } } }",
- false
+ "relay agent info is not a string or a map, ISC not empty",
+ "{ \"ISC\": { \"foo\": true, \"relay-agent-info\": false } }",
+ "{ \"ISC\": { \"foo\": true } }"
},
{
"relay agent info has a junk value",
"{ \"ISC\": { \"relay-agent-info\": \"foobar\" } }",
- "{ \"ISC\": { \"relay-agent-info\": { \"sub-options\":"
- " \"foobar\" } } }",
- true
+ ""
+ },
+ {
+ "relay agent info has a junk value, ISC not empty",
+ "{ \"ISC\": { \"foo\": true, \"relay-agent-info\": \"foobar\" } }",
+ "{ \"ISC\": { \"foo\": true } }"
},
{
"relay agent info has a rai without ids",
"{ \"ISC\": { \"relay-agent-info\": \"0x0104AABBCCDD\" } }",
"{ \"ISC\": { \"relay-agent-info\": { \"sub-options\":"
- " \"0x0104AABBCCDD\" } } }",
- true
+ " \"0x0104AABBCCDD\" } } }"
},
{
"relay agent info with other entries",
"{ \"foo\": 123, \"ISC\": { \"bar\": 456,"
" \"relay-agent-info\": \"0x0104AABBCCDD\" } }",
"{ \"ISC\": { \"relay-agent-info\": { \"sub-options\":"
- " \"0x0104AABBCCDD\" }, \"bar\": 456 }, \"foo\": 123 }",
- true
+ " \"0x0104AABBCCDD\" }, \"bar\": 456 }, \"foo\": 123 }"
},
{
"relay agent info has a rai with ids",
"{ \"ISC\": { \"relay-agent-info\": \"0x02030102030C03AABBCC\" } }",
"{ \"ISC\": { \"relay-agent-info\": { \"sub-options\":"
" \"0x02030102030C03AABBCC\", \"remote-id\": \"010203\","
- " \"relay-id\": \"AABBCC\" } } }",
- true
+ " \"relay-id\": \"AABBCC\" } } }"
}
};
@@ -769,7 +799,8 @@ TEST(Lease4ExtendedInfoTest, upgradeLease4ExtendedInfo) {
orig_context.reset();
} else {
ASSERT_NO_THROW(orig_context = Element::fromJSON(scenario.orig_))
- << "invalid original context, test is broken";
+ << "invalid original context, test " << scenario.description_
+ << " is broken";
}
// Create the expected user context from JSON.
@@ -782,16 +813,28 @@ TEST(Lease4ExtendedInfoTest, upgradeLease4ExtendedInfo) {
// Perform the test.
lease->setContext(orig_context);
+ ConstElementPtr before;
+ if (orig_context) {
+ before = isc::data::copy(orig_context);
+ }
bool ret = LeaseMgr::upgradeLease4ExtendedInfo(lease);
- EXPECT_EQ(scenario.exp_ret_, ret);
+ ConstElementPtr after = lease->getContext();
+ if (!before && !after) {
+ EXPECT_FALSE(ret) << "null before and null after";
+ } else if ((before && !after) || (!before && after)) {
+ EXPECT_TRUE(ret) << "only one of before and after is null";
+ } else if (before->equals(*after)) {
+ EXPECT_FALSE(ret) << "before == after";
+ } else {
+ EXPECT_TRUE(ret) << "before != after";
+ }
if (!exp_context) {
- EXPECT_FALSE(lease->getContext());
+ EXPECT_FALSE(after) << "expected null, got " << *after;
} else {
- ConstElementPtr context = lease->getContext();
- ASSERT_TRUE(context);
- EXPECT_TRUE(exp_context->equals(*context))
+ ASSERT_TRUE(after) << "expected not null, got null";
+ EXPECT_TRUE(exp_context->equals(*after))
<< "expected: " << *exp_context << std::endl
- << "actual: " << *context << std::endl;
+ << "actual: " << *after << std::endl;
}
}
}
@@ -813,33 +856,73 @@ TEST(Lease6ExtendedInfoTest, basic) {
// Not map user context.
ElementPtr user_context = Element::createList();
lease->setContext(user_context);
- EXPECT_FALSE(LeaseMgr::upgradeLease6ExtendedInfo(lease));
+ EXPECT_TRUE(LeaseMgr::upgradeLease6ExtendedInfo(lease));
+ EXPECT_FALSE(lease->getContext());
// No ISC.
user_context = Element::createMap();
+ user_context->set("foo", Element::create(string("bar")));
lease->setContext(user_context);
EXPECT_FALSE(LeaseMgr::upgradeLease6ExtendedInfo(lease));
- // Not map user context.
+ // Not map ISC.
+ user_context = Element::createMap();
+ lease->setContext(user_context);
ElementPtr isc = Element::create(string("..."));
user_context->set("ISC", isc);
- EXPECT_FALSE(LeaseMgr::upgradeLease6ExtendedInfo(lease));
+ EXPECT_TRUE(LeaseMgr::upgradeLease6ExtendedInfo(lease));
+ EXPECT_FALSE(lease->getContext());
// No relays.
+ user_context = Element::createMap();
+ lease->setContext(user_context);
isc = Element::createMap();
user_context->set("ISC", isc);
+ isc->set("foo", Element::create(string("bar")));
EXPECT_FALSE(LeaseMgr::upgradeLease6ExtendedInfo(lease));
// Not list relays.
+ user_context = Element::createMap();
+ lease->setContext(user_context);
+ isc = Element::createMap();
+ user_context->set("ISC", isc);
ElementPtr relays = Element::create(string("foo"));
isc->set("relays", relays);
- EXPECT_FALSE(LeaseMgr::upgradeLease6ExtendedInfo(lease));
+ EXPECT_TRUE(LeaseMgr::upgradeLease6ExtendedInfo(lease));
+ EXPECT_FALSE(lease->getContext());
- // Positive case.
+ // Empty relays.
+ user_context = Element::createMap();
+ lease->setContext(user_context);
+ isc = Element::createMap();
+ user_context->set("ISC", isc);
+ relays = Element::createList();
+ isc->set("relays", relays);
+ EXPECT_TRUE(LeaseMgr::upgradeLease6ExtendedInfo(lease));
+ EXPECT_FALSE(lease->getContext());
+
+ // Not map relay.
+ user_context = Element::createMap();
+ lease->setContext(user_context);
+ isc = Element::createMap();
+ user_context->set("ISC", isc);
relays = Element::createList();
isc->set("relays", relays);
relays->add(Element::create(string("foo")));
EXPECT_TRUE(LeaseMgr::upgradeLease6ExtendedInfo(lease));
+ EXPECT_FALSE(lease->getContext());
+
+ // Positive case.
+ user_context = Element::createMap();
+ lease->setContext(user_context);
+ isc = Element::createMap();
+ user_context->set("ISC", isc);
+ relays = Element::createList();
+ isc->set("relays", relays);
+ ElementPtr relay = Element::createMap();
+ relays->add(relay);
+ relay->set("foo", Element::create(string("bar")));
+ EXPECT_TRUE(LeaseMgr::upgradeLease6ExtendedInfo(lease));
ConstElementPtr new_user_context = lease->getContext();
ASSERT_TRUE(new_user_context);
@@ -850,7 +933,7 @@ TEST(Lease6ExtendedInfoTest, basic) {
ConstElementPtr relay_info = new_isc->get("relay-info");
ASSERT_TRUE(relay_info);
ASSERT_EQ(Element::list, relay_info->getType());
- ASSERT_EQ("[ \"foo\" ]", relay_info->str());
+ ASSERT_EQ("[ { \"foo\": \"bar\" } ]", relay_info->str());
}
// Verify Lease6 user context upgrade complex operations.
@@ -860,65 +943,79 @@ TEST(Lease6ExtendedInfoTest, upgradeLease6ExtendedInfo) {
string description_; // test description.
string orig_; // original user context.
string expected_; // expected user context.
- bool exp_ret_; // expected returned value.
};
// Test scenarios.
vector<Scenario> scenarios {
{
- "no context",
+ "no user context",
"",
- "",
- false
+ ""
},
{
- "context is not a map",
- "[ ]",
+ "user context is not a map",
"[ ]",
- false
+ ""
},
{
"no ISC entry",
"{ }",
- "{ }",
- false
+ ""
+ },
+ {
+ "no ISC entry but not empty",
+ "{ \"foo\": true }",
+ "{ \"foo\": true }"
},
{
"ISC entry is not a map",
"{ \"ISC\": true }",
- "{ \"ISC\": true }",
- false
+ ""
+ },
+ {
+ "ISC entry is not a map, user context not empty",
+ "{ \"foo\": true, \"ISC\": true }",
+ "{ \"foo\": true }"
},
{
"no relays",
"{ \"ISC\": { } }",
- "{ \"ISC\": { } }",
- false
+ ""
+ },
+ {
+ "no relays, ISC not empty",
+ "{ \"ISC\": { \"foo\": true } }",
+ "{ \"ISC\": { \"foo\": true } }"
},
{
"relays is not a list",
"{ \"ISC\": { \"relays\": { } } }",
- "{ \"ISC\": { \"relays\": { } } }",
- false
+ ""
+ },
+ {
+ "relays is not a list, ISC not empty",
+ "{ \"ISC\": { \"foo\": true, \"relays\": { } } }",
+ "{ \"ISC\": { \"foo\": true } }"
},
{
"relays is empty",
"{ \"ISC\": { \"relays\": [ ] } }",
- "{ \"ISC\": { \"relay-info\": [ ] } }",
- true
+ ""
},
{
- "relays with other entries",
- "{ \"foo\": 123, \"ISC\": { \"relays\": [ ], \"bar\": 456 } }",
- "{ \"foo\": 123, \"ISC\": { \"relay-info\": [ ],"
- " \"bar\": 456 } }",
- true
+ "relays is empty, ISC not empty",
+ "{ \"ISC\": { \"foo\": true, \"relays\": [ ] } }",
+ "{ \"ISC\": { \"foo\": true } }"
},
{
- "relays has a junk value",
+ "relay is not a map",
"{ \"ISC\": { \"relays\": [ \"foobar\" ] } }",
- "{ \"ISC\": { \"relay-info\": [ \"foobar\" ] } }",
- true
+ ""
+ },
+ {
+ "relay has other values",
+ "{ \"ISC\": { \"relays\": [ { \"foo\": \"bar\" } ] } }",
+ "{ \"ISC\": { \"relay-info\": [ { \"foo\": \"bar\" } ] } }"
},
{
"one relay with no ids",
@@ -927,8 +1024,7 @@ TEST(Lease6ExtendedInfoTest, upgradeLease6ExtendedInfo) {
" \"options\": \"0x00C800080102030405060708\" } ] } }",
"{ \"ISC\": { \"relay-info\": [ { \"hop\": 33,"
" \"link\": \"2001:db8::1\", \"peer\": \"2001:db8::2\","
- " \"options\": \"0x00C800080102030405060708\" } ] } }",
- true
+ " \"options\": \"0x00C800080102030405060708\" } ] } }"
},
{
"one relay with remote and relay ids",
@@ -939,8 +1035,7 @@ TEST(Lease6ExtendedInfoTest, upgradeLease6ExtendedInfo) {
" \"options\": \"0x00250006010203040506003500086464646464646464\","
" \"link\": \"2001:db8::5\", \"peer\": \"2001:db8::6\","
" \"remote-id\": \"010203040506\","
- " \"relay-id\": \"6464646464646464\" } ] } }",
- true
+ " \"relay-id\": \"6464646464646464\" } ] } }"
},
{
"two relays",
@@ -955,8 +1050,7 @@ TEST(Lease6ExtendedInfoTest, upgradeLease6ExtendedInfo) {
" \"options\": \"0x00250006010203040506003500086464646464646464\","
" \"link\": \"2001:db8::5\", \"peer\": \"2001:db8::6\","
" \"remote-id\": \"010203040506\","
- " \"relay-id\": \"6464646464646464\" } ] } }",
- true
+ " \"relay-id\": \"6464646464646464\" } ] } }"
}
};
@@ -971,7 +1065,8 @@ TEST(Lease6ExtendedInfoTest, upgradeLease6ExtendedInfo) {
orig_context.reset();
} else {
ASSERT_NO_THROW(orig_context = Element::fromJSON(scenario.orig_))
- << "invalid original context, test is broken";
+ << "invalid original context, test " << scenario.description_
+ << " is broken";
}
// Create the expected user context from JSON.
@@ -984,16 +1079,28 @@ TEST(Lease6ExtendedInfoTest, upgradeLease6ExtendedInfo) {
// Perform the test.
lease->setContext(orig_context);
+ ConstElementPtr before;
+ if (orig_context) {
+ before = isc::data::copy(orig_context);
+ }
bool ret = LeaseMgr::upgradeLease6ExtendedInfo(lease);
- EXPECT_EQ(scenario.exp_ret_, ret);
+ ConstElementPtr after = lease->getContext();
+ if (!before && !after) {
+ EXPECT_FALSE(ret) << "null before and null after";
+ } else if ((before && !after) || (!before && after)) {
+ EXPECT_TRUE(ret) << "only one of before and after is null";
+ } else if (before->equals(*after)) {
+ EXPECT_FALSE(ret) << "before == after";
+ } else {
+ EXPECT_TRUE(ret) << "before != after";
+ }
if (!exp_context) {
- EXPECT_FALSE(lease->getContext());
+ EXPECT_FALSE(after) << "expected null, got " << *after;
} else {
- ConstElementPtr context = lease->getContext();
- ASSERT_TRUE(context);
- EXPECT_TRUE(exp_context->equals(*context))
+ ASSERT_TRUE(after) << "expected not null, got null";
+ EXPECT_TRUE(exp_context->equals(*after))
<< "expected: " << *exp_context << std::endl
- << "actual: " << *context << std::endl;
+ << "actual: " << *after << std::endl;
}
}
}
diff --git a/src/lib/dhcpsrv/tests/sanity_checks_unittest.cc b/src/lib/dhcpsrv/tests/sanity_checks_unittest.cc
index f20a7d6181..524da590a4 100644
--- a/src/lib/dhcpsrv/tests/sanity_checks_unittest.cc
+++ b/src/lib/dhcpsrv/tests/sanity_checks_unittest.cc
@@ -14,6 +14,7 @@
#include <dhcpsrv/subnet.h>
#include <dhcpsrv/sanity_checker.h>
#include <dhcpsrv/testutils/test_utils.h>
+#include <testutils/log_utils.h>
#include <util/range_utilities.h>
#include <cc/data.h>
#include <gtest/gtest.h>
@@ -64,7 +65,7 @@ public:
vector<uint8_t> clientid(1);
- time_t timestamp = time(0) - 86400 + random()%86400;
+ time_t timestamp = time(0) - 86400 + random() % 86400;
// Return created lease.
return (Lease4Ptr(new Lease4(address, hwaddr,
@@ -126,7 +127,7 @@ public:
// Reset to defaults.
cfg.getConsistency()->setLeaseSanityCheck(CfgConsistency::LEASE_CHECK_NONE);
cfg.getConsistency()->setExtendedInfoSanityCheck(CfgConsistency::EXTENDED_INFO_CHECK_FIX);
-
+
SanityChecksParser parser;
ElementPtr json;
@@ -438,3 +439,518 @@ TEST_F(SanityChecksTest, guardOnly6) {
ASSERT_TRUE(lease);
EXPECT_EQ(subnet->getID(), lease->subnet_id_);
}
+
+class ExtendedInfoChecksTest : public LogContentTest {
+public:
+
+ /// @brief Generates a simple IPv4 lease.
+ ///
+ /// The HW address is randomly generated, user context is specified.
+ ///
+ /// @param address Lease address.
+ /// @param user_context User context to use.
+ ///
+ /// @return new lease with random content.
+ Lease4Ptr newLease4(const IOAddress& address,
+ ConstElementPtr user_context) {
+
+ // Randomize HW address.
+ vector<uint8_t> mac(6);
+ isc::util::fillRandom(mac.begin(), mac.end());
+ HWAddrPtr hwaddr(new HWAddr(mac, HTYPE_ETHER));
+
+ vector<uint8_t> clientid(1);
+
+ time_t timestamp = time(0) - 86400 + random() % 86400;
+
+ // Return created lease.
+ Lease4Ptr lease(new Lease4(address, hwaddr,
+ &clientid[0], 0, // no client-id
+ 1200, // valid
+ timestamp, 1, false, false, ""));
+ lease->setContext(user_context);
+ return(lease);
+ }
+
+ /// @brief Generates a simple IPv6 lease.
+ ///
+ /// The DUID and IAID are randomly generated, user context is specified.
+ ///
+ /// @param address Lease address.
+ /// @param user_context User context to use.
+ ///
+ /// @return new lease with random content.
+ Lease6Ptr newLease6(const IOAddress& address,
+ ConstElementPtr user_context) {
+ // Let's generate DUID of random length.
+ std::vector<uint8_t> duid_vec(8 + random()%20);
+ // And then fill it with random value.
+ isc::util::fillRandom(duid_vec.begin(), duid_vec.end());
+ DuidPtr duid(new DUID(duid_vec));
+
+ Lease::Type lease_type = Lease::TYPE_NA;
+ uint32_t iaid = 1 + random()%100;
+
+ std::ostringstream hostname;
+ hostname << "hostname" << (random() % 2048);
+
+ // Return created lease.
+ Lease6Ptr lease(new Lease6(lease_type, address, duid, iaid,
+ 1000, 1200, // pref, valid
+ 1, false, false, ""));
+ lease->setContext(user_context);
+ return(lease);
+ }
+
+ /// @brief Check IPv4 scenario.
+ ///
+ /// @brief original Original user context.
+ /// @brief expected Expected user context.
+ /// @brief sanity Extended info sanity level.
+ /// @break logs Expected log messages.
+ void check4(string description, string original, string expected,
+ CfgConsistency::ExtendedInfoSanity sanity,
+ vector<string> logs = {}) {
+ ElementPtr orig_context;
+ if (!original.empty()) {
+ ASSERT_NO_THROW(orig_context = Element::fromJSON(original))
+ << "invalid original user context, test " << description
+ << " is broken";
+ }
+ ElementPtr exp_context;
+ if (!expected.empty()) {
+ ASSERT_NO_THROW(exp_context = Element::fromJSON(expected))
+ << "invalid expected user context, test " << description
+ << " is broken";
+ }
+
+ Lease4Ptr lease = newLease4(IOAddress("2001::1"), orig_context);
+ ConstElementPtr before;
+ if (orig_context) {
+ before = isc::data::copy(orig_context);
+ }
+ for (const string& log : logs) {
+ addString(log);
+ }
+
+ bool ret = LeaseMgr::upgradeLease4ExtendedInfo(lease, sanity);
+ ConstElementPtr after = lease->getContext();
+ if (!before && !after) {
+ EXPECT_FALSE(ret) << "null before and null after";
+ } else if ((before && !after) || (!before && after)) {
+ EXPECT_TRUE(ret) << "only one of before and after is null";
+ } else if (before->equals(*after)) {
+ EXPECT_FALSE(ret) << "before == after";
+ } else {
+ EXPECT_TRUE(ret) << "before != after";
+ }
+ if (!exp_context) {
+ EXPECT_FALSE(after) << "expected null, got " << *after;
+ } else {
+ ASSERT_TRUE(after) << "expected not null, got null";
+ EXPECT_TRUE(exp_context->equals(*after))
+ << "expected: " << *exp_context << std::endl
+ << "actual: " << *after << std::endl;
+ }
+ EXPECT_TRUE(checkFile());
+ }
+};
+
+// No user context is right for any sanity check level including the highest.
+TEST_F(ExtendedInfoChecksTest, noUserContext4) {
+ string description = "no user context, pedantic";
+ check4(description, "", "", CfgConsistency::EXTENDED_INFO_CHECK_PEDANTIC);
+}
+
+// User context with a bad type is right only when no check is done.
+TEST_F(ExtendedInfoChecksTest, badTypeUserContext4none) {
+ string description = "user context not a map, none";
+ check4(description, "1", "1", CfgConsistency::EXTENDED_INFO_CHECK_NONE);
+}
+
+// User context with a bad type is refused by all not none sanity check levels.
+TEST_F(ExtendedInfoChecksTest, badTypeUserContext4) {
+ string description = "user context not a map, fix";
+ check4(description, "1", "", CfgConsistency::EXTENDED_INFO_CHECK_FIX,
+ { "DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL"
+ " extended info for lease 2001::1 failed checks"
+ " (in user context a problem was found:"
+ " user context is not a map)" });
+}
+
+// Empty user context is right only when no check is done.
+TEST_F(ExtendedInfoChecksTest, emptyTypeUserContext4none) {
+ string description = "empty user context, none";
+ check4(description, "{ }", "{ }",
+ CfgConsistency::EXTENDED_INFO_CHECK_NONE);
+}
+
+// Empty user context is dropped by all not none sanity check levels.
+TEST_F(ExtendedInfoChecksTest, emptyTypeUserContext4) {
+ string description = "empty user context, fix";
+ check4(description, "{ }", "", CfgConsistency::EXTENDED_INFO_CHECK_FIX);
+}
+
+// No ISC entry is right in all cases.
+TEST_F(ExtendedInfoChecksTest, noISC4) {
+ string description = "no ISC entry, pedantic";
+ check4(description, "{ \"foo\": 1 }", "{ \"foo\": 1 }",
+ CfgConsistency::EXTENDED_INFO_CHECK_PEDANTIC);
+}
+
+// ISC entry with a bad type is right only when no check is done.
+TEST_F(ExtendedInfoChecksTest, badTypeISC4none) {
+ string description = "ISC entry no a map, none";
+ check4(description, "{ \"ISC\": 1 }", "{ \"ISC\": 1 }",
+ CfgConsistency::EXTENDED_INFO_CHECK_NONE);
+}
+
+// ISC entry with a bad type is dropped by all not none sanity check levels.
+TEST_F(ExtendedInfoChecksTest, badTypeISC4) {
+ string description = "ISC entry no a map, fix";
+ check4(description, "{ \"ISC\": 1 }", "",
+ CfgConsistency::EXTENDED_INFO_CHECK_FIX,
+ { "DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL"
+ " extended info for lease 2001::1 failed checks"
+ " (in isc a problem was found:"
+ " ISC entry is not a map)" });
+}
+
+// When the ISC entry is dropped other entries are kept.
+TEST_F(ExtendedInfoChecksTest, badTypeISC4other) {
+ string description = "ISC entry no a map with others, fix";
+ check4(description, "{ \"ISC\": 1, \"foo\": 2 }", "{ \"foo\": 2 }",
+ CfgConsistency::EXTENDED_INFO_CHECK_FIX,
+ { "DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL"
+ " extended info for lease 2001::1 failed checks"
+ " (in isc a problem was found:"
+ " ISC entry is not a map)" });
+}
+
+// Empty ISC entry is kept only when no check is done.
+TEST_F(ExtendedInfoChecksTest, emptyISC4none) {
+ string description = "empty ISC entry, none";
+ check4(description, "{ \"ISC\": { } }", "{ \"ISC\": { } }",
+ CfgConsistency::EXTENDED_INFO_CHECK_NONE);
+}
+
+// Empty ISC entry is dropped by all not none sanity check levels.
+TEST_F(ExtendedInfoChecksTest, emptyISC4) {
+ string description = "empty ISC entry, fix";
+ check4(description, "{ \"ISC\": { } }", "",
+ CfgConsistency::EXTENDED_INFO_CHECK_FIX);
+}
+
+// No relay-agent-info entry is right at all sanity levels.
+TEST_F(ExtendedInfoChecksTest, noRAI) {
+ string description = "no RAI, pedantic";
+ check4(description, "{ \"ISC\": { \"foo\": 1 } }",
+ "{ \"ISC\": { \"foo\": 1 } }",
+ CfgConsistency::EXTENDED_INFO_CHECK_PEDANTIC);
+}
+
+// relay-agent-info entry with a bad type is right only when no check is done.
+TEST_F(ExtendedInfoChecksTest, badTypeRAInone) {
+ string description = "RAI is not a string or a map, none";
+ check4(description, "{ \"ISC\": { \"relay-agent-info\": true } }",
+ "{ \"ISC\": { \"relay-agent-info\": true } }",
+ CfgConsistency::EXTENDED_INFO_CHECK_NONE);
+}
+
+// relay-agent-info entry with a bad type is dropped by all not none sanity
+// check levels.
+TEST_F(ExtendedInfoChecksTest, badTypeRAI) {
+ string description = "RAI is not a string or a map, fix";
+ check4(description, "{ \"ISC\": { \"relay-agent-info\": true } }", "",
+ CfgConsistency::EXTENDED_INFO_CHECK_FIX,
+ { "DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL"
+ " extended info for lease 2001::1 failed checks"
+ " (in relay-agent-info a problem was found:"
+ " relay-agent-info is not a map or a string)" });
+}
+
+// When relay-agent-info entry is dropped other entries are kept.
+TEST_F(ExtendedInfoChecksTest, badTypeRAIother) {
+ string description = "RAI is not a string or a map with others, fix";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": true, \"foo\": 1 } }",
+ "{ \"ISC\": { \"foo\": 1 } }",
+ CfgConsistency::EXTENDED_INFO_CHECK_FIX,
+ { "DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL"
+ " extended info for lease 2001::1 failed checks"
+ " (in relay-agent-info a problem was found:"
+ " relay-agent-info is not a map or a string)" });
+}
+
+// String relay-agent-info entry which can't be decoded is right
+// only when no check is done.
+TEST_F(ExtendedInfoChecksTest, badEncodingStringRAInone) {
+ string description = "string RAI with a junk value, none";
+ check4(description, "{ \"ISC\": { \"relay-agent-info\": \"foo\" } }",
+ "{ \"ISC\": { \"relay-agent-info\": \"foo\" } }",
+ CfgConsistency::EXTENDED_INFO_CHECK_NONE);
+}
+
+// String relay-agent-info entry which can't be decoded is dropped
+// by all not none sanity check levels.
+TEST_F(ExtendedInfoChecksTest, badEncodingStringRAI) {
+ string description = "string RAI with a junk value, fix";
+ check4(description, "{ \"ISC\": { \"relay-agent-info\": \"foo\" } }", "",
+ CfgConsistency::EXTENDED_INFO_CHECK_FIX,
+ { "DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL"
+ " extended info for lease 2001::1 failed checks"
+ " (in rai a problem was found:"
+ " 'foo' is not a valid string of hexadecimal digits)" });
+}
+
+// String relay-agent-info entry for an empty option is dropped
+// by all not none sanity check levels (this should not happen).
+TEST_F(ExtendedInfoChecksTest, emptyStringRAI) {
+ string description = "string RAI with empty content, fix";
+ check4(description, "{ \"ISC\": { \"relay-agent-info\": \"0x\" } }", "",
+ CfgConsistency::EXTENDED_INFO_CHECK_FIX,
+ { "DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL"
+ " extended info for lease 2001::1 failed checks"
+ " (in rai a problem was found:"
+ " '0x' is not a valid string of hexadecimal digits)" });
+}
+
+// Valid string relay-agent-info entry is upgraded by all not none
+// sanity check levels.
+TEST_F(ExtendedInfoChecksTest, upgradedRAI) {
+ string description = "valid string RAI, fix";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": \"0x0104AABBCCDD\" } }",
+ "{ \"ISC\": { \"relay-agent-info\": { \"sub-options\":"
+ " \"0x0104AABBCCDD\" } } }",
+ CfgConsistency::EXTENDED_INFO_CHECK_FIX,
+ { "DHCPSRV_LEASE4_EXTENDED_INFO_UPGRADED"
+ " extended info for lease 2001::1 was upgraded" });
+}
+
+// Upgraded string relay-agent-info entry with ids.
+TEST_F(ExtendedInfoChecksTest, upgradedRAIwithIds) {
+ string description = "valid string RAI with ids, fix";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": \"0x02030102030C03AABBCC\" } }",
+ "{ \"ISC\": { \"relay-agent-info\": { \"sub-options\":"
+ " \"0x02030102030C03AABBCC\", \"remote-id\": \"010203\","
+ " \"relay-id\": \"AABBCC\" } } }",
+ CfgConsistency::EXTENDED_INFO_CHECK_FIX,
+ { "DHCPSRV_LEASE4_EXTENDED_INFO_UPGRADED"
+ " extended info for lease 2001::1 was upgraded" });
+}
+
+// sub-options entry with a bad type is right up to the fix sanity level.
+TEST_F(ExtendedInfoChecksTest, badTypeSubOptionsfix) {
+ string description = "sub-options not a string, fix";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": { \"sub-options\": 1 } } }",
+ "{ \"ISC\": { \"relay-agent-info\": { \"sub-options\": 1 } } }",
+ CfgConsistency::EXTENDED_INFO_CHECK_FIX);
+}
+
+// sub-options entry with a bad type is dropped at strict or higher
+// sanity levels.
+TEST_F(ExtendedInfoChecksTest, badTypeSubOptionsstrict) {
+ string description = "sub-options not a string, strict";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": { \"sub-options\": 1 } } }", "",
+ CfgConsistency::EXTENDED_INFO_CHECK_STRICT,
+ { "DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL"
+ " extended info for lease 2001::1 failed checks"
+ " (in sub-options a problem was found:"
+ " sub-options is not a string)" });
+}
+
+// sub-options entry which can't be decoded is right up to the fix
+// sanity level.
+TEST_F(ExtendedInfoChecksTest, badEncodingSubOptionsfix) {
+ string description = "sub-options with a junk value, fix";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": { \"sub-options\":"
+ " \"foo\" } } }",
+ "{ \"ISC\": { \"relay-agent-info\": { \"sub-options\":"
+ " \"foo\" } } }",
+ CfgConsistency::EXTENDED_INFO_CHECK_FIX);
+}
+
+// sub-options entry which can't be decoded is dropped at strict or higher
+// sanity levels.
+TEST_F(ExtendedInfoChecksTest, badEncodingSubOptionsstrict) {
+ string description = "sub-options with a junk value, strict";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": { \"sub-options\":"
+ " \"foo\" } } }", "",
+ CfgConsistency::EXTENDED_INFO_CHECK_STRICT,
+ { "DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL"
+ " extended info for lease 2001::1 failed checks"
+ " (in sub-options a problem was found:"
+ " 'foo' is not a valid string of hexadecimal digits)" });
+}
+
+// remote-id entry with a bad type is right up to the fix sanity level.
+TEST_F(ExtendedInfoChecksTest, badTypeRemoteId4fix) {
+ string description = "remote-id not a string, fix";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": { \"remote-id\": 1 } } }",
+ "{ \"ISC\": { \"relay-agent-info\": { \"remote-id\": 1 } } }",
+ CfgConsistency::EXTENDED_INFO_CHECK_FIX);
+}
+
+// remote-id entry with a bad type is dropped at strict or higher
+// sanity levels.
+TEST_F(ExtendedInfoChecksTest, badTypeRemoteId4strict) {
+ string description = "remote-id not a string, strict";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": { \"remote-id\": 1 } } }", "",
+ CfgConsistency::EXTENDED_INFO_CHECK_STRICT,
+ { "DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL"
+ " extended info for lease 2001::1 failed checks"
+ " (in remote-id a problem was found:"
+ " remote-id is not a string)" });
+}
+
+// remote-id entry which can't be decoded is right up to the fix sanity level.
+TEST_F(ExtendedInfoChecksTest, badEncodingRemoteId4fix) {
+ string description = "remote-id with a junk value, fix";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": { \"remote-id\":"
+ " \"foo\" } } }",
+ "{ \"ISC\": { \"relay-agent-info\": { \"remote-id\":"
+ " \"foo\" } } }",
+ CfgConsistency::EXTENDED_INFO_CHECK_FIX);
+}
+
+// remote-id entry which can't be decoded is dropped at strict or higher
+// sanity levels.
+TEST_F(ExtendedInfoChecksTest, badEncodingRemoteId4strict) {
+ string description = "remote-id with a junk value, strict";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": { \"remote-id\":"
+ " \"foo\" } } }", "",
+ CfgConsistency::EXTENDED_INFO_CHECK_STRICT,
+ { "DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL"
+ " extended info for lease 2001::1 failed checks"
+ " (in remote-id a problem was found:"
+ " attempt to decode a value not in base16 char set)" });
+}
+
+// Empty remote-id entry is right up to the fix sanity level.
+TEST_F(ExtendedInfoChecksTest, emptyRemoteId4fix) {
+ string description = "empty remote-id, fix";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": { \"remote-id\": \"\" } } }",
+ "{ \"ISC\": { \"relay-agent-info\": { \"remote-id\": \"\" } } }",
+ CfgConsistency::EXTENDED_INFO_CHECK_FIX);
+}
+
+// Empty remote-id entry is dropped at strict or higher sanity levels.
+TEST_F(ExtendedInfoChecksTest, emptyRemoteId4strict) {
+ string description = "empty remote-id, strict";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": { \"remote-id\": \"\" } } }",
+ "", CfgConsistency::EXTENDED_INFO_CHECK_STRICT,
+ { "DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL"
+ " extended info for lease 2001::1 failed checks"
+ " (in remote-id a problem was found:"
+ " remote-id is empty)" });
+}
+
+// relay-id entry with a bad type is right up to the fix sanity level.
+TEST_F(ExtendedInfoChecksTest, badTypeRelayId4fix) {
+ string description = "relay-id not a string, fix";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": { \"relay-id\": 1 } } }",
+ "{ \"ISC\": { \"relay-agent-info\": { \"relay-id\": 1 } } }",
+ CfgConsistency::EXTENDED_INFO_CHECK_FIX);
+}
+
+// relay-id entry with a bad type is dropped at strict or higher
+// sanity levels.
+TEST_F(ExtendedInfoChecksTest, badTypeRelayId4strict) {
+ string description = "relay-id not a string, strict";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": { \"relay-id\": 1 } } }", "",
+ CfgConsistency::EXTENDED_INFO_CHECK_STRICT,
+ { "DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL"
+ " extended info for lease 2001::1 failed checks"
+ " (in relay-id a problem was found:"
+ " relay-id is not a string)" });
+}
+
+// relay-id entry which can't be decoded is right up to the fix sanity level.
+TEST_F(ExtendedInfoChecksTest, badEncodingRelayId4fix) {
+ string description = "relay-id with a junk value, fix";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": { \"relay-id\":"
+ " \"foo\" } } }",
+ "{ \"ISC\": { \"relay-agent-info\": { \"relay-id\":"
+ " \"foo\" } } }",
+ CfgConsistency::EXTENDED_INFO_CHECK_FIX);
+}
+
+// relay-id entry which can't be decoded is dropped at strict or higher
+// sanity levels.
+TEST_F(ExtendedInfoChecksTest, badEncodingRelayId4strict) {
+ string description = "relay-id with a junk value, strict";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": { \"relay-id\":"
+ " \"foo\" } } }", "",
+ CfgConsistency::EXTENDED_INFO_CHECK_STRICT,
+ { "DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL"
+ " extended info for lease 2001::1 failed checks"
+ " (in relay-id a problem was found:"
+ " attempt to decode a value not in base16 char set)" });
+}
+
+// Empty relay-id entry is right up to the fix sanity level.
+TEST_F(ExtendedInfoChecksTest, emptyRelayId4fix) {
+ string description = "empty relay-id, fix";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": { \"relay-id\": \"\" } } }",
+ "{ \"ISC\": { \"relay-agent-info\": { \"relay-id\": \"\" } } }",
+ CfgConsistency::EXTENDED_INFO_CHECK_FIX);
+}
+
+// Empty relay-id entry is dropped at strict or higher sanity levels.
+TEST_F(ExtendedInfoChecksTest, emptyRelayId4strict) {
+ string description = "empty relay-id, strict";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": { \"relay-id\": \"\" } } }",
+ "", CfgConsistency::EXTENDED_INFO_CHECK_STRICT,
+ { "DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL"
+ " extended info for lease 2001::1 failed checks"
+ " (in relay-id a problem was found:"
+ " relay-id is empty)" });
+}
+
+// Junk entries are right up to the strict sanity level.
+TEST_F(ExtendedInfoChecksTest, junk4strict) {
+ string description = "junk entry, strict";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": { \"foo\": 1 } } }",
+ "{ \"ISC\": { \"relay-agent-info\": { \"foo\": 1 } } }",
+ CfgConsistency::EXTENDED_INFO_CHECK_STRICT);
+}
+
+// Junk entries are dropped at the pedantic level.
+TEST_F(ExtendedInfoChecksTest, junk4pedantic) {
+ string description = "junk entry, pedantic";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": { \"foo\": 1 } } }", "",
+ CfgConsistency::EXTENDED_INFO_CHECK_PEDANTIC,
+ { "DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL"
+ " extended info for lease 2001::1 failed checks"
+ " (in relay-agent-info a problem was found:"
+ " spurious 'foo' entry in relay-agent-info)" });
+}
+
+// comment is not considered as a junk entry.
+TEST_F(ExtendedInfoChecksTest, comment4) {
+ string description = "comment entry, pedantic";
+ check4(description,
+ "{ \"ISC\": { \"relay-agent-info\": { \"comment\": \"good\" } } }",
+ "{ \"ISC\": { \"relay-agent-info\": { \"comment\": \"good\" } } }",
+ CfgConsistency::EXTENDED_INFO_CHECK_PEDANTIC);
+}
diff --git a/src/lib/dhcpsrv/tests/srv_config_unittest.cc b/src/lib/dhcpsrv/tests/srv_config_unittest.cc
index 1e90ae916b..d6b28938a8 100644
--- a/src/lib/dhcpsrv/tests/srv_config_unittest.cc
+++ b/src/lib/dhcpsrv/tests/srv_config_unittest.cc
@@ -560,7 +560,8 @@ TEST_F(SrvConfigTest, unparse) {
defaults += "\"lease-database\": { \"type\": \"memfile\" },\n";
defaults += "\"hooks-libraries\": [ ],\n";
defaults += "\"sanity-checks\": {\n";
- defaults += " \"lease-checks\": \"none\"\n";
+ defaults += " \"lease-checks\": \"none\",\n";
+ defaults += " \"extended-info-checks\": \"fix\"\n";
defaults += " },\n";
defaults += "\"dhcp-ddns\": \n";
diff --git a/src/lib/util/tests/strutil_unittest.cc b/src/lib/util/tests/strutil_unittest.cc
index 8b5f78a83c..912b40f0d8 100644
--- a/src/lib/util/tests/strutil_unittest.cc
+++ b/src/lib/util/tests/strutil_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2022 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
@@ -452,7 +452,7 @@ TEST(StringUtilTest, decodeFormattedHexString) {
EXPECT_THROW(decodeFormattedHexString("0a ", decoded),
isc::BadValue);
// '0x' prefix and spaces.
- EXPECT_THROW(decodeFormattedHexString("x01 02", decoded),
+ EXPECT_THROW(decodeFormattedHexString("0x01 02", decoded),
isc::BadValue);
// '0x' prefix and colons.
EXPECT_THROW(decodeFormattedHexString("0x01:02", decoded),