From f5b7359c5730d39ff6eff24ae87c9c74a04c2e5c Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 5 Mar 2012 11:38:07 +1100 Subject: [PATCH 1/2] Allow nsupdate to report which types it knows the internal structure to. --- bin/nsupdate/nsupdate.c | 29 ++++++++++++++++++++++++++++- bin/nsupdate/nsupdate.docbook | 17 +++++++++++++++++ bin/tests/system/nsupdate/clean.sh | 1 + bin/tests/system/nsupdate/tests.sh | 20 ++++++++++++++++++++ 4 files changed, 66 insertions(+), 1 deletion(-) diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c index e0d1af0105..8777dd2c90 100644 --- a/bin/nsupdate/nsupdate.c +++ b/bin/nsupdate/nsupdate.c @@ -934,11 +934,14 @@ get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr) { INSIST(count == 1); } -#define PARSE_ARGS_FMT "dDML:y:ghlovk:p:rR::t:u:" +#define PARSE_ARGS_FMT "dDML:y:ghlovk:p:PrR::t:Tu:" static void pre_parse_args(int argc, char **argv) { + dns_rdatatype_t t; int ch; + char buf[100]; + isc_boolean_t doexit = ISC_FALSE; while ((ch = isc_commandline_parse(argc, argv, PARSE_ARGS_FMT)) != -1) { switch (ch) { @@ -960,10 +963,34 @@ pre_parse_args(int argc, char **argv) { "[-v] [filename]\n"); exit(1); + case 'P': + for (t = 0xff00; t <= 0xfffe; t++) { + if (dns_rdatatype_ismeta(t)) + continue; + dns_rdatatype_format(t, buf, sizeof(buf)); + if (strncmp(buf, "TYPE", 4) != 0) + fprintf(stdout, "%s\n", buf); + } + doexit = ISC_TRUE; + break; + + case 'T': + for (t = 1; t <= 0xfeff; t++) { + if (dns_rdatatype_ismeta(t)) + continue; + dns_rdatatype_format(t, buf, sizeof(buf)); + if (strncmp(buf, "TYPE", 4) != 0) + fprintf(stdout, "%s\n", buf); + } + doexit = ISC_TRUE; + break; + default: break; } } + if (doexit) + exit(0); isc_commandline_reset = ISC_TRUE; isc_commandline_index = 1; } diff --git a/bin/nsupdate/nsupdate.docbook b/bin/nsupdate/nsupdate.docbook index 8b7254c32b..6c2c794616 100644 --- a/bin/nsupdate/nsupdate.docbook +++ b/bin/nsupdate/nsupdate.docbook @@ -71,6 +71,8 @@ + + filename @@ -237,6 +239,21 @@ keyboard indicates that keyboard input should be used. This option may be specified multiple times. + + The and print out a + lists of non-meta types for which the type specific presentation + format is known. prints out the list of + assigned types. prints out the list of + private types. These options may be combined. nsupdate will + exit after the lists are printed. + + + Other types can be entered using "TYPEXXXXX" where "XXXXX" is the + decimal value of the type with no leading zeros. The rdata, + if present, will be parsed using the UNKNOWN rdata format, + (<backslash> <hash> <space> <length> + <space> <hexstring>). + diff --git a/bin/tests/system/nsupdate/clean.sh b/bin/tests/system/nsupdate/clean.sh index 0801da96de..ac21e5d16e 100644 --- a/bin/tests/system/nsupdate/clean.sh +++ b/bin/tests/system/nsupdate/clean.sh @@ -36,3 +36,4 @@ rm -f ns3/K* rm -f dig.out.* rm -f jp.out.ns3.* rm -f Kxxx.* +rm -f typelist.out.* diff --git a/bin/tests/system/nsupdate/tests.sh b/bin/tests/system/nsupdate/tests.sh index 2374b61874..a48df5ca9a 100644 --- a/bin/tests/system/nsupdate/tests.sh +++ b/bin/tests/system/nsupdate/tests.sh @@ -461,5 +461,25 @@ if [ $ret -ne 0 ]; then status=1 fi +n=`expr $n + 1` +ret=0 +echo "I:check type list options ($n)" +$NSUPDATE -T > typelist.out.T.${n} || { ret=1; echo "I: nsupdate -T failed"; } +$NSUPDATE -P > typelist.out.P.${n} || { ret=1; echo "I: nsupdate -P failed"; } +$NSUPDATE -TP > typelist.out.TP.${n} || { ret=1; echo "I: nsupdate -TP failed"; } +grep ANY typelist.out.T.${n} > /dev/null && { ret=1; echo "I: failed: ANY found (-T)"; } +grep ANY typelist.out.P.${n} > /dev/null && { ret=1; echo "I: failed: ANY found (-P)"; } +grep ANY typelist.out.TP.${n} > /dev/null && { ret=1; echo "I: failed: ANY found (-TP)"; } +grep KEYDATA typelist.out.T.${n} > /dev/null && { ret=1; echo "I: failed: KEYDATA found (-T)"; } +grep KEYDATA typelist.out.P.${n} > /dev/null || { ret=1; echo "I: failed: KEYDATA not found (-P)"; } +grep KEYDATA typelist.out.TP.${n} > /dev/null || { ret=1; echo "I: failed: KEYDATA not found (-TP)"; } +grep AAAA typelist.out.T.${n} > /dev/null || { ret=1; echo "I: failed: AAAA not found (-T)"; } +grep AAAA typelist.out.P.${n} > /dev/null && { ret=1; echo "I: failed: AAAA found (-P)"; } +grep AAAA typelist.out.TP.${n} > /dev/null || { ret=1; echo "I: failed: AAAA not found (-TP)"; } +if [ $ret -ne 0 ]; then + echo "I:failed" + status=1 +fi + echo "I:exit status: $status" exit $status From 4e59bd3433cee5442c275cde7264040d58615b75 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 5 Mar 2012 12:10:06 +1100 Subject: [PATCH 2/2] add new files --- .gitignore | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.gitignore b/.gitignore index 750c3b3908..09977ff4b2 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,37 @@ autom4te.cache *.la *_test timestamp +named.run +gen.dSYM/ +.libs/ +.deps/ +.dirstamp +unit/atf-src/atf-c++/atf-c++.pc +unit/atf-src/atf-c/atf-c.pc +unit/atf-src/atf-c/defs.h +unit/atf-src/atf-c/detail/process_helpers +unit/atf-src/atf-config/atf-config +unit/atf-src/atf-report/atf-report +unit/atf-src/atf-report/fail_helper +unit/atf-src/atf-report/misc_helpers +unit/atf-src/atf-report/pass_helper +unit/atf-src/atf-run/atf-run +unit/atf-src/atf-run/bad_metadata_helper +unit/atf-src/atf-run/expect_helpers +unit/atf-src/atf-run/misc_helpers +unit/atf-src/atf-run/pass_helper +unit/atf-src/atf-run/several_tcs_helper +unit/atf-src/atf-run/zero_tcs_helper +unit/atf-src/atf-sh/atf-check +unit/atf-src/atf-sh/atf-sh +unit/atf-src/atf-sh/misc_helpers +unit/atf-src/atf-version/atf-version +unit/atf-src/atf-version/revision.h +unit/atf-src/atf-version/revision.h.stamp +unit/atf-src/bconfig.h +unit/atf-src/bootstrap/atconfig +unit/atf-src/doc/atf.7 +unit/atf-src/stamp-h1 +unit/atf-src/test-programs/c_helpers +unit/atf-src/test-programs/cpp_helpers +unit/atf-src/test-programs/sh_helpers