Commit f5b7359c authored by Mark Andrews's avatar Mark Andrews

Allow nsupdate to report which types it knows the internal structure to.

parent a26e1cac
......@@ -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;
}
......
......@@ -71,6 +71,8 @@
<arg><option>-r <replaceable class="parameter">udpretries</replaceable></option></arg>
<arg><option>-R <replaceable class="parameter">randomdev</replaceable></option></arg>
<arg><option>-v</option></arg>
<arg><option>-T</option></arg>
<arg><option>-P</option></arg>
<arg>filename</arg>
</cmdsynopsis>
</refsynopsisdiv>
......@@ -237,6 +239,21 @@
<filename>keyboard</filename> indicates that keyboard input
should be used. This option may be specified multiple times.
</para>
<para>
The <option>-T</option> and <option>-P</option> print out a
lists of non-meta types for which the type specific presentation
format is known. <option>-T</option> prints out the list of
assigned types. <option>-P</option> prints out the list of
private types. These options may be combined. nsupdate will
exit after the lists are printed.
</para>
<para>
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,
(&lt;backslash&gt; &lt;hash&gt; &lt;space&gt; &lt;length&gt;
&lt;space&gt; &lt;hexstring&gt;).
</para>
</refsect1>
<refsect1>
......
......@@ -36,3 +36,4 @@ rm -f ns3/K*
rm -f dig.out.*
rm -f jp.out.ns3.*
rm -f Kxxx.*
rm -f typelist.out.*
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment