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