From fbd9aaa58c32abaeab1bd3ca6943b18ce19ea023 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 9 Sep 2015 16:49:11 +1000 Subject: [PATCH] 4194. [bug] named-checkconf -p failed to properly print a port range. [RT #40634] --- CHANGES | 3 +++ bin/tests/system/checkconf/portrange-good.conf | 9 +++++++++ bin/tests/system/checkconf/tests.sh | 7 +++++++ lib/isccfg/namedconf.c | 7 ++++++- 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 bin/tests/system/checkconf/portrange-good.conf diff --git a/CHANGES b/CHANGES index 0d3f2edc13..5769b16166 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +4194. [bug] named-checkconf -p failed to properly print a port + range. [RT #40634] + 4193. [bug] Handle broken servers that return BADVERS incorrectly. [RT #40427] diff --git a/bin/tests/system/checkconf/portrange-good.conf b/bin/tests/system/checkconf/portrange-good.conf new file mode 100644 index 0000000000..fe25efa62b --- /dev/null +++ b/bin/tests/system/checkconf/portrange-good.conf @@ -0,0 +1,9 @@ +options { + avoid-v4-udp-ports { + 1935; + 2605; + 4321; + 6514; + range 8610 8614; + }; +}; diff --git a/bin/tests/system/checkconf/tests.sh b/bin/tests/system/checkconf/tests.sh index 6a77f7738b..54792f6b57 100644 --- a/bin/tests/system/checkconf/tests.sh +++ b/bin/tests/system/checkconf/tests.sh @@ -247,5 +247,12 @@ grep "zone check-mx-cname/IN: loaded serial" < checkconf.out6 > /dev/null && ret if [ $ret != 0 ]; then echo "I:failed"; ret=1; fi status=`expr $status + $ret` +echo "I: check that named-checkconf -p properly print a port range" +ret=0 +$CHECKCONF -p portrange-good.conf > checkconf.out7 2>&1 || ret=1 +grep "range 8610 8614;" checkconf.out7 > /dev/null || ret=1 +if [ $ret != 0 ]; then echo "I:failed"; ret=1; fi +status=`expr $status + $ret` + echo "I:exit status: $status" exit $status diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c index 12830e0c6a..613961c24f 100644 --- a/lib/isccfg/namedconf.c +++ b/lib/isccfg/namedconf.c @@ -809,13 +809,18 @@ static cfg_type_t cfg_type_serverid = { /*% * Port list. */ +static void +print_porttuple(cfg_printer_t *pctx, const cfg_obj_t *obj) { + cfg_print_cstr(pctx, "range "); + cfg_print_tuple(pctx, obj); +} static cfg_tuplefielddef_t porttuple_fields[] = { { "loport", &cfg_type_uint32, 0 }, { "hiport", &cfg_type_uint32, 0 }, { NULL, NULL, 0 } }; static cfg_type_t cfg_type_porttuple = { - "porttuple", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, + "porttuple", cfg_parse_tuple, print_porttuple, cfg_doc_tuple, &cfg_rep_tuple, porttuple_fields };