diff options
author | Francis Dupont <fdupont@isc.org> | 2017-11-13 00:43:06 +0100 |
---|---|---|
committer | Francis Dupont <fdupont@isc.org> | 2018-11-29 16:42:20 +0100 |
commit | 79cb51acba68855ad123a0674d4491c96ea23956 (patch) | |
tree | f366c768f846662cd90af7e3a7a9a88d97c27386 /keama | |
parent | b173defa3b91545d4b12b28731ba35bbaa69647e (diff) | |
download | isc-dhcp-79cb51acba68855ad123a0674d4491c96ea23956.tar.gz |
Fixed bad checks
Diffstat (limited to 'keama')
29 files changed, 91 insertions, 60 deletions
diff --git a/keama/doc.txt b/keama/doc.txt index cc56a742..c37aab07 100644 --- a/keama/doc.txt +++ b/keama/doc.txt @@ -528,5 +528,4 @@ TODO: - shared network 5306, 5307 - vendor/site 5073 - always-send 5241 - - fix badcheck - add command line argument for library path diff --git a/keama/parse.c b/keama/parse.c index 009317b4..4ae1eeea 100644 --- a/keama/parse.c +++ b/keama/parse.c @@ -34,6 +34,7 @@ static void config_valid_lifetime(struct element *, struct parse *); static void config_file(struct element *, struct parse *); static void config_sname(struct element *, struct parse *); static void config_next_server(struct element *, struct parse *); +static struct element *default_qualifying_suffix(void); static void config_qualifying_suffix(struct element *, struct parse *); static void config_enable_updates(struct element *, struct parse *); static void config_ddns_update_style(struct element *, struct parse *); @@ -1221,8 +1222,14 @@ parse_option_code_definition(struct parse *cfile, struct option *option) "Arrays of encapsulations don't make sense."); if (arrayp) appendString(format, (arrayp > recordp) ? "a" : "A"); - if (is_array || arrayp) - mapSet(def, createBool(ISC_TRUE), "array"); + if (is_array || arrayp) { + struct element *array_def; + + array_def = createBool(ISC_TRUE); + if (not_supported) + array_def->skip = ISC_TRUE; + mapSet(def, array_def, "array"); + } if (not_supported) { struct element *type_def; @@ -5063,6 +5070,23 @@ config_next_server(struct element *config, struct parse *cfile) mapSet(cfile->stack[scope], value, "next-server"); } +static struct element * +default_qualifying_suffix(void) +{ + struct element *qs; + struct comment *comment; + + qs = createString(makeString(-1, "")); + comment = createComment("/// Unspecified ddns-domainname (default " + "domain-name option value)"); + TAILQ_INSERT_TAIL(&qs->comments, comment); + comment = createComment("/// Kea requires a qualifying-suffix"); + TAILQ_INSERT_TAIL(&qs->comments, comment); + comment = createComment("/// Initialized to \"\": please put a value"); + TAILQ_INSERT_TAIL(&qs->comments, comment); + return qs; +} + static void config_qualifying_suffix(struct element *config, struct parse *cfile) { @@ -5092,7 +5116,8 @@ config_qualifying_suffix(struct element *config, struct parse *cfile) d2 = createMap(); mapSet(d2, createBool(ISC_FALSE), "enable-updates"); mapSet(cfile->stack[1], d2, "dhcp-ddns"); - } + } else if (mapContains(d2, "qualifying-suffix")) + mapRemove(d2, "qualifying-suffix"); mapSet(d2, value, "qualifying-suffix"); } } @@ -5125,6 +5150,12 @@ config_enable_updates(struct element *config, struct parse *cfile) if (d2 == NULL) { d2 = createMap(); mapSet(cfile->stack[1], d2, "dhcp-ddns"); + if (boolValue(value)) { + struct element *qs; + + qs = default_qualifying_suffix(); + mapSet(d2, qs, "qualifying-suffix"); + } } else if (mapContains(d2, "enable-updates")) mapRemove(d2, "enable-updates"); mapSet(d2, value, "enable-updates"); @@ -5182,6 +5213,12 @@ config_ddns_update_style(struct element *config, struct parse *cfile) if (d2 == NULL) { d2 = createMap(); mapSet(cfile->stack[1], d2, "dhcp-ddns"); + if (boolValue(value)) { + struct element *qs; + + qs = default_qualifying_suffix(); + mapSet(d2, qs, "qualifying-suffix"); + } } else if (mapContains(d2, "enable-updates")) mapRemove(d2, "enable-updates"); mapSet(d2, value, "enable-updates"); diff --git a/keama/tests/README b/keama/tests/README index 4cc3627a..499b6522 100644 --- a/keama/tests/README +++ b/keama/tests/README @@ -20,3 +20,13 @@ runone.sh xyz.ext -> run the xyz test runall.sh -> run all tests + +Check output syntax with kea-dhcp4 and kea-dhcp6 + +Set KEA4 and KEA6 environment variables to kea-dhcp4 and kea-dhcp6 +The en0 interface is supposed to exist (or replace "en0" in all files) + +checkone.sh xyz.out + -> check the syntax of xyz.out +checkall.sh + -> check the syntax of all .out files diff --git a/keama/tests/badcheck b/keama/tests/badcheck deleted file mode 100644 index ba040bae..00000000 --- a/keama/tests/badcheck +++ /dev/null @@ -1,23 +0,0 @@ -ddnsupdstyle6.out -enableupdates6.out - parameter 'qualifying-suffix' is required when updates are enabled - -groupsubnet4.out -groupsubnet6.out - interface 'bar' - -optiondecl4.out -optiondecl6.out -optiondeclBat4.out - (bug) array of binary values - -pool42.out -prefix62.out -range6.out -shareone4.out -shareone6.out -subnet4noauth.out -subnet6auth.out -subnet6one.out - interface 'foo' - diff --git a/keama/tests/ddnsupdstyle6.out b/keama/tests/ddnsupdstyle6.out index 50198ed2..218cefc6 100644 --- a/keama/tests/ddnsupdstyle6.out +++ b/keama/tests/ddnsupdstyle6.out @@ -5,6 +5,10 @@ /// Reference Kea #5256 "Dhcp6": { "dhcp-ddns": { + /// Unspecified ddns-domainname (default domain-name option value) + /// Kea requires a qualifying-suffix + /// Initialized to "": please put a value + "qualifying-suffix": "", "enable-updates": true }, "subnet6": [ diff --git a/keama/tests/enableupdates6.out b/keama/tests/enableupdates6.out index 16f02bf6..21e8d114 100644 --- a/keama/tests/enableupdates6.out +++ b/keama/tests/enableupdates6.out @@ -3,6 +3,10 @@ # authoritative is mandatory "Dhcp6": { "dhcp-ddns": { + /// Unspecified ddns-domainname (default domain-name option value) + /// Kea requires a qualifying-suffix + /// Initialized to "": please put a value + "qualifying-suffix": "", "enable-updates": true }, "client-classes": [ diff --git a/keama/tests/groupsubnet4.in4 b/keama/tests/groupsubnet4.in4 index a738f997..ecdaea5f 100644 --- a/keama/tests/groupsubnet4.in4 +++ b/keama/tests/groupsubnet4.in4 @@ -21,7 +21,7 @@ group foobar { pool { range 10.5.5.5 10.5.5.10; } - interface "bar"; + interface "en0"; default-lease-time 1800; } } diff --git a/keama/tests/groupsubnet4.out b/keama/tests/groupsubnet4.out index 6724873b..70f63c3e 100644 --- a/keama/tests/groupsubnet4.out +++ b/keama/tests/groupsubnet4.out @@ -5,7 +5,7 @@ "valid-lifetime": 1200, "interfaces-config": { "interfaces": [ - "bar" + "en0" ] }, "subnet4": [ @@ -18,7 +18,7 @@ "pool": "10.5.5.5 - 10.5.5.10" } ], - "interface": "bar", + "interface": "en0", "valid-lifetime": 1800, "option-data": [ # option diff --git a/keama/tests/groupsubnet6.in6 b/keama/tests/groupsubnet6.in6 index 72ca335b..bc3f9ffd 100644 --- a/keama/tests/groupsubnet6.in6 +++ b/keama/tests/groupsubnet6.in6 @@ -20,7 +20,7 @@ group foobar { pool6 { range6 2001::100 2001::200; } - interface "bar"; + interface "en0"; default-lease-time 1800; option dhcp6.lq-relay-data 2001::1 "foobar"; } diff --git a/keama/tests/groupsubnet6.out b/keama/tests/groupsubnet6.out index 6240e7c2..49c924bd 100644 --- a/keama/tests/groupsubnet6.out +++ b/keama/tests/groupsubnet6.out @@ -5,7 +5,7 @@ "valid-lifetime": 1200, "interfaces-config": { "interfaces": [ - "bar" + "en0" ] }, "subnet6": [ @@ -18,7 +18,7 @@ "pool": "2001::100 - 2001::200" } ], - "interface": "bar", + "interface": "en0", "valid-lifetime": 1800, "option-data": [ { diff --git a/keama/tests/optiondecl4.out b/keama/tests/optiondecl4.out index 4428154f..b3c4bf1a 100644 --- a/keama/tests/optiondecl4.out +++ b/keama/tests/optiondecl4.out @@ -133,7 +133,7 @@ "space": "foobar", "name": "fmt-Ia", "code": 150, - "array": true, +// "array": true, // "definition": "{ uint32, array of boolean}", /// Option definition is not compatible with Kea /// Fallback to full binary diff --git a/keama/tests/optiondecl6.out b/keama/tests/optiondecl6.out index 2d6dd3d8..9f5640f0 100644 --- a/keama/tests/optiondecl6.out +++ b/keama/tests/optiondecl6.out @@ -127,7 +127,7 @@ "space": "foobar", "name": "fmt-Lfa", "code": 150, - "array": true, +// "array": true, // "definition": "{ uint32, array of boolean}", /// Option definition is not compatible with Kea /// Fallback to full binary diff --git a/keama/tests/optiondeclBat4.out b/keama/tests/optiondeclBat4.out index 204b5281..e671dcfa 100644 --- a/keama/tests/optiondeclBat4.out +++ b/keama/tests/optiondeclBat4.out @@ -7,7 +7,7 @@ "space": "foobar", "name": "fmt-Bat", "code": 1, - "array": true, +// "array": true, // "definition": "{ array of uint8, string}", /// Option definition is not compatible with Kea /// Fallback to full binary diff --git a/keama/tests/pool42.in4 b/keama/tests/pool42.in4 index e2ce953b..07d05b3e 100644 --- a/keama/tests/pool42.in4 +++ b/keama/tests/pool42.in4 @@ -14,5 +14,5 @@ subnet 10.5.5.0 netmask 255.255.255.224 { range 10.5.5.11 10.5.5.12; } # interface - interface "foo"; + interface "en0"; } diff --git a/keama/tests/pool42.out b/keama/tests/pool42.out index 0e357281..6a2bd474 100644 --- a/keama/tests/pool42.out +++ b/keama/tests/pool42.out @@ -36,12 +36,12 @@ "pool": "10.5.5.11 - 10.5.5.12" } ], - "interface": "foo" + "interface": "en0" } ], "interfaces-config": { "interfaces": [ - "foo" + "en0" ] } } diff --git a/keama/tests/prefix62.in6 b/keama/tests/prefix62.in6 index 943aa9c8..8050b51c 100644 --- a/keama/tests/prefix62.in6 +++ b/keama/tests/prefix62.in6 @@ -9,5 +9,5 @@ subnet6 2001::/64 { option dhcp6.domain-search "example.com", "example.org"; default-lease-time 1800; prefix6 2001:0:0:1:: 2001:0:0:3:: / 64; - interface "foo"; + interface "en0"; } diff --git a/keama/tests/prefix62.out b/keama/tests/prefix62.out index 8c1d3151..31f289bc 100644 --- a/keama/tests/prefix62.out +++ b/keama/tests/prefix62.out @@ -24,12 +24,12 @@ // "prefix-highest": "2001:0:0:3::" // } ], - "interface": "foo" + "interface": "en0" } ], "interfaces-config": { "interfaces": [ - "foo" + "en0" ] } } diff --git a/keama/tests/range6.in6 b/keama/tests/range6.in6 index 4dcb6595..349555f4 100644 --- a/keama/tests/range6.in6 +++ b/keama/tests/range6.in6 @@ -10,5 +10,5 @@ subnet6 2001::/64 { default-lease-time 1800; range6 2001::100 2001::200; range6 2001::1000/116; - interface "foo"; + interface "en0"; } diff --git a/keama/tests/range6.out b/keama/tests/range6.out index 7ce3a7b3..f02405b9 100644 --- a/keama/tests/range6.out +++ b/keama/tests/range6.out @@ -25,12 +25,12 @@ "pool": "2001::1000/116" } ], - "interface": "foo" + "interface": "en0" } ], "interfaces-config": { "interfaces": [ - "foo" + "en0" ] } } diff --git a/keama/tests/shareone4.in4 b/keama/tests/shareone4.in4 index 430f7531..1987b9bc 100644 --- a/keama/tests/shareone4.in4 +++ b/keama/tests/shareone4.in4 @@ -6,7 +6,7 @@ authoritative; # shared-network declaration shared-network "foobar" { # interface - interface "foo"; + interface "en0"; # option option domain-search "example.com", "example.org"; # parameter diff --git a/keama/tests/shareone4.out b/keama/tests/shareone4.out index 8c20393e..ef583231 100644 --- a/keama/tests/shareone4.out +++ b/keama/tests/shareone4.out @@ -4,7 +4,7 @@ "Dhcp4": { "interfaces-config": { "interfaces": [ - "foo" + "en0" ] }, "subnet4": [ @@ -29,7 +29,7 @@ "data": "example.com, example.org" } ], - "interface": "foo", + "interface": "en0", "pools": [ # pool (must be after the subnet) { diff --git a/keama/tests/shareone6.in6 b/keama/tests/shareone6.in6 index 8ac35056..d16ff8e1 100644 --- a/keama/tests/shareone6.in6 +++ b/keama/tests/shareone6.in6 @@ -6,7 +6,7 @@ authoritative; # shared-network declaration shared-network "foobar" { # interface - interface "foo"; + interface "en0"; # option option dhcp6.domain-search "example.com", "example.org"; # parameter diff --git a/keama/tests/shareone6.out b/keama/tests/shareone6.out index 659776d1..9d875677 100644 --- a/keama/tests/shareone6.out +++ b/keama/tests/shareone6.out @@ -4,7 +4,7 @@ "Dhcp6": { "interfaces-config": { "interfaces": [ - "foo" + "en0" ] }, "subnet6": [ @@ -18,7 +18,7 @@ "pool": "2001::1000 - 2001::2000" } ], - "interface": "foo", + "interface": "en0", "option-data": [ # interface # option diff --git a/keama/tests/subnet4noauth.in4 b/keama/tests/subnet4noauth.in4 index c528284e..2a1cc5ef 100644 --- a/keama/tests/subnet4noauth.in4 +++ b/keama/tests/subnet4noauth.in4 @@ -14,7 +14,7 @@ subnet 10.5.5.0 netmask 255.255.255.224 { } option domain-search "example.com", "example.org"; default-lease-time 3600; - interface "foo"; + interface "en0"; ignore-client-uids false; } diff --git a/keama/tests/subnet4noauth.out b/keama/tests/subnet4noauth.out index 8ac3d1f9..08370357 100644 --- a/keama/tests/subnet4noauth.out +++ b/keama/tests/subnet4noauth.out @@ -26,13 +26,13 @@ // } // ], // "valid-lifetime": 3600, -// "interface": "foo", +// "interface": "en0", // "match-client-id": true // } ], "interfaces-config": { "interfaces": [ - "foo" + "en0" ] } } diff --git a/keama/tests/subnet6auth.in6 b/keama/tests/subnet6auth.in6 index 010af70b..22ef0f1c 100644 --- a/keama/tests/subnet6auth.in6 +++ b/keama/tests/subnet6auth.in6 @@ -16,7 +16,7 @@ subnet6 2001::/64 { authoritative; option dhcp6.domain-search "example.com", "example.org"; default-lease-time 3600; - interface "foo"; + interface "en0"; pool6 { prefix6 2001:0:0:10:: 2001:0:0:1f:: /64; } diff --git a/keama/tests/subnet6auth.out b/keama/tests/subnet6auth.out index c4eff7b5..8e1c867b 100644 --- a/keama/tests/subnet6auth.out +++ b/keama/tests/subnet6auth.out @@ -23,7 +23,7 @@ } ], "valid-lifetime": 3600, - "interface": "foo", + "interface": "en0", "pd-pools": [ { "prefix": "2001:0:0:10::", @@ -35,7 +35,7 @@ ], "interfaces-config": { "interfaces": [ - "foo" + "en0" ] } } diff --git a/keama/tests/subnet6one.in6 b/keama/tests/subnet6one.in6 index 302a242f..ec43da21 100644 --- a/keama/tests/subnet6one.in6 +++ b/keama/tests/subnet6one.in6 @@ -16,6 +16,6 @@ subnet6 2001::/64 { } option dhcp6.domain-search "example.com", "example.org"; default-lease-time 3600; - interface "foo"; + interface "en0"; } diff --git a/keama/tests/subnet6one.out b/keama/tests/subnet6one.out index 648b49a3..6e877d3a 100644 --- a/keama/tests/subnet6one.out +++ b/keama/tests/subnet6one.out @@ -32,12 +32,12 @@ } ], "valid-lifetime": 3600, - "interface": "foo" + "interface": "en0" } ], "interfaces-config": { "interfaces": [ - "foo" + "en0" ] } } |