Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
BIND
Commits
d8798098
Commit
d8798098
authored
Dec 06, 2018
by
Mark Andrews
Committed by
Evan Hunt
May 06, 2019
Browse files
support printing AAAA in expanded form
parent
6bb57c77
Changes
7
Hide whitespace changes
Inline
Side-by-side
bin/dig/dig.c
View file @
d8798098
...
...
@@ -187,6 +187,7 @@ help(void) {
" +[no]ednsnegotiation (Set EDNS version negotiation)
\n
"
" +ednsopt=###[:value] (Send specified EDNS option)
\n
"
" +noednsopt (Clear list of +ednsopt options)
\n
"
" +[no]expandaaaa (Expand AAAA records)
\n
"
" +[no]expire (Request time to expire)
\n
"
" +[no]fail (Don't try next server on SERVFAIL)
\n
"
" +[no]header-only (Send query without a question section)
\n
"
...
...
@@ -473,6 +474,8 @@ printmessage(dig_query_t *query, dns_message_t *msg, bool headers) {
styleflags
|=
DNS_STYLEFLAG_NO_CLASS
;
if
(
query
->
lookup
->
nocrypto
)
styleflags
|=
DNS_STYLEFLAG_NOCRYPTO
;
if
(
query
->
lookup
->
expandaaaa
)
styleflags
|=
DNS_STYLEFLAG_EXPANDAAAA
;
if
(
query
->
lookup
->
multiline
)
{
styleflags
|=
DNS_STYLEFLAG_OMIT_OWNER
;
styleflags
|=
DNS_STYLEFLAG_OMIT_CLASS
;
...
...
@@ -1034,8 +1037,24 @@ plus_option(char *option, bool is_batchfile,
}
break
;
case
'x'
:
FULLCHECK
(
"expire"
);
lookup
->
expire
=
state
;
switch
(
cmd
[
2
])
{
case
'p'
:
switch
(
cmd
[
3
])
{
case
'a'
:
FULLCHECK
(
"expandaaaa"
);
lookup
->
expandaaaa
=
state
;
break
;
case
'i'
:
FULLCHECK
(
"expire"
);
lookup
->
expire
=
state
;
break
;
default:
goto
invalid_option
;
}
break
;
default:
goto
invalid_option
;
}
break
;
default:
goto
invalid_option
;
...
...
bin/dig/dig.docbook
View file @
d8798098
...
...
@@ -747,6 +747,16 @@
</listitem>
</varlistentry>
<varlistentry>
<term><option>
+[no]expandaaaa
</option></term>
<listitem>
<para>
When printing AAAA record print all zero nibbles rather
than the default RFC 5952 preferred presentation format.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>
+[no]fail
</option></term>
<listitem>
...
...
bin/dig/dighost.c
View file @
d8798098
...
...
@@ -621,6 +621,7 @@ make_empty_lookup(void) {
looknew
->
nocrypto
=
false
;
looknew
->
ttlunits
=
false
;
looknew
->
ttlunits
=
false
;
looknew
->
expandaaaa
=
false
;
looknew
->
qr
=
false
;
#ifdef HAVE_LIBIDN2
looknew
->
idnin
=
isatty
(
1
)
?
(
getenv
(
"IDN_DISABLE"
)
==
NULL
)
:
false
;
...
...
@@ -769,6 +770,7 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
looknew
->
use_usec
=
lookold
->
use_usec
;
looknew
->
nocrypto
=
lookold
->
nocrypto
;
looknew
->
ttlunits
=
lookold
->
ttlunits
;
looknew
->
expandaaaa
=
lookold
->
expandaaaa
;
looknew
->
qr
=
lookold
->
qr
;
looknew
->
idnin
=
lookold
->
idnin
;
looknew
->
idnout
=
lookold
->
idnout
;
...
...
bin/dig/include/dig/dig.h
View file @
d8798098
...
...
@@ -140,6 +140,7 @@ struct dig_lookup {
ttlunits
,
idnin
,
idnout
,
expandaaaa
,
qr
;
char
textname
[
MXNAME
];
/*% Name we're going to be looking up */
char
cmdline
[
MXNAME
];
...
...
bin/tests/system/digdelv/tests.sh
View file @
d8798098
...
...
@@ -636,6 +636,30 @@ if [ -x "$DIG" ] ; then
[
`
grep
"communications error.*end of file"
dig.out.test
$n
|
wc
-l
`
-eq
1
]
||
ret
=
1
if
[
$ret
-ne
0
]
;
then
echo_i
"failed"
;
fi
status
=
$((
status+ret
))
n
=
$((
n+1
))
echo_i
"check that dig +expandaaaa works (
$n
)"
ret
=
0
dig_with_opts @10.53.0.3 +expandaaaa AAAA ns2.example
>
dig.out.test
$n
2>&1
||
ret
=
1
grep
"ns2.example.*fd92:7065:0b8e:ffff:0000:0000:0000:0002"
dig.out.test
$n
>
/dev/null
||
ret
=
1
if
[
$ret
-ne
0
]
;
then
echo_i
"failed"
;
fi
status
=
$((
status+ret
))
n
=
$((
n+1
))
echo_i
"check that dig +noexpandaaaa works (
$n
)"
ret
=
0
dig_with_opts @10.53.0.3 +noexpandaaaa AAAA ns2.example
>
dig.out.test
$n
2>&1
||
ret
=
1
grep
"ns2.example.*fd92:7065:b8e:ffff::2"
dig.out.test
$n
>
/dev/null
||
ret
=
1
if
[
$ret
-ne
0
]
;
then
echo_i
"failed"
;
fi
status
=
$((
status+ret
))
n
=
$((
n+1
))
echo_i
"check that dig default for +[no]expandaaa (+noexpandaaaa) works (
$n
)"
ret
=
0
dig_with_opts @10.53.0.3 AAAA ns2.example
>
dig.out.test
$n
2>&1
||
ret
=
1
grep
"ns2.example.*fd92:7065:b8e:ffff::2"
dig.out.test
$n
>
/dev/null
||
ret
=
1
if
[
$ret
-ne
0
]
;
then
echo_i
"failed"
;
fi
status
=
$((
status+ret
))
else
echo_i
"
$DIG
is needed, so skipping these dig tests"
fi
...
...
lib/dns/include/dns/rdata.h
View file @
d8798098
...
...
@@ -172,6 +172,9 @@ struct dns_rdata {
/*% Output textual RR type and RDATA in RFC 3597 unknown format */
#define DNS_STYLEFLAG_UNKNOWNFORMAT 0x00000010ULL
/*% Print AAAA record fully expanded */
#define DNS_STYLEFLAG_EXPANDAAAA 0x00000020ULL
#define DNS_RDATA_DOWNCASE DNS_NAME_DOWNCASE
#define DNS_RDATA_CHECKNAMES DNS_NAME_CHECKNAMES
#define DNS_RDATA_CHECKNAMESFAIL DNS_NAME_CHECKNAMESFAIL
...
...
lib/dns/rdata/in_1/aaaa_28.c
View file @
d8798098
...
...
@@ -50,12 +50,29 @@ static inline isc_result_t
totext_in_aaaa
(
ARGS_TOTEXT
)
{
isc_region_t
region
;
UNUSED
(
tctx
);
REQUIRE
(
rdata
->
type
==
dns_rdatatype_aaaa
);
REQUIRE
(
rdata
->
rdclass
==
dns_rdataclass_in
);
REQUIRE
(
rdata
->
length
==
16
);
if
((
tctx
->
flags
&
DNS_STYLEFLAG_EXPANDAAAA
)
!=
0
)
{
char
buf
[
5
*
8
];
const
char
*
sep
=
""
;
int
i
,
n
;
unsigned
int
len
=
0
;
for
(
i
=
0
;
i
<
16
;
i
+=
2
)
{
INSIST
(
len
<
sizeof
(
buf
));
n
=
snprintf
(
buf
+
len
,
sizeof
(
buf
)
-
len
,
"%s%02x%02x"
,
sep
,
rdata
->
data
[
i
],
rdata
->
data
[
i
+
1
]);
if
(
n
<
0
)
{
return
(
ISC_R_FAILURE
);
}
len
+=
n
;
sep
=
":"
;
}
return
(
str_totext
(
buf
,
target
));
}
dns_rdata_toregion
(
rdata
,
&
region
);
return
(
inet_totext
(
AF_INET6
,
&
region
,
target
));
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment