Skip to content
GitLab
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
3867312e
Commit
3867312e
authored
Sep 13, 2014
by
Mark Andrews
Browse files
3951. [func] Add the ability to set yet-to-be-defined EDNS flags
to dig (+ednsflags=#). [RT #37142]
parent
c25602ed
Changes
10
Hide whitespace changes
Inline
Side-by-side
CHANGES
View file @
3867312e
3951. [func] Add the ability to set yet-to-be-defined EDNS flags
to dig (+ednsflags=#). [RT #37142]
3950. [port] Changed the bin/python Makefile to work around a
bmake bug in FreeBSD 10 and NetBSD 6. [RT #36993]
...
...
bin/dig/dig.c
View file @
3867312e
...
...
@@ -192,6 +192,7 @@ help(void) {
" +ndots=### (Set NDOTS value)
\n
"
" +subnet=addr (Set edns-client-subnet option)
\n
"
" +[no]edns[=###] (Set EDNS version) [0]
\n
"
" +ednsflags=### (Set EDNS flag bits)
\n
"
" +ednsopt=###[:value] (Send specified EDNS option)
\n
"
" +noednsopt (Clear list of +ednsopt options)
\n
"
" +[no]search (Set whether to use searchlist)
\n
"
...
...
@@ -960,6 +961,25 @@ plus_option(char *option, isc_boolean_t is_batchfile,
"edns"
);
lookup
->
edns
=
num
;
break
;
case
'f'
:
FULLCHECK
(
"ednsflags"
);
if
(
!
state
)
{
lookup
->
ednsflags
=
0
;
break
;
}
if
(
value
==
NULL
)
{
lookup
->
ednsflags
=
0
;
break
;
}
result
=
parse_xint
(
&
num
,
value
,
0xffff
,
"ednsflags"
);
if
(
result
!=
ISC_R_SUCCESS
)
fatal
(
"Couldn't parse "
"ednsflags"
);
lookup
->
ednsflags
=
num
;
break
;
case
'o'
:
FULLCHECK
(
"ednsopt"
);
if
(
!
state
)
{
...
...
bin/dig/dig.docbook
View file @
3867312e
...
...
@@ -578,6 +578,18 @@
</listitem>
</varlistentry>
<varlistentry>
<term><option>
+[no]ednsflags[=#]
</option></term>
<listitem>
<para>
Set the must-be-zero EDNS flags bits (Z bits) to the
specified value. Decimal, hex and octal encodings are
accepted. Setting a named flag (e.g. DO) will silently be
ignored. By default, no Z bits are set.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>
+[no]ednsopt[=code[:value]]
</option></term>
<listitem>
...
...
bin/dig/dighost.c
View file @
3867312e
...
...
@@ -782,6 +782,7 @@ make_empty_lookup(void) {
looknew
->
servfail_stops
=
ISC_TRUE
;
looknew
->
besteffort
=
ISC_TRUE
;
looknew
->
dnssec
=
ISC_FALSE
;
looknew
->
ednsflags
=
0
;
looknew
->
expire
=
ISC_FALSE
;
looknew
->
nsid
=
ISC_FALSE
;
#ifdef ISC_PLATFORM_USESIT
...
...
@@ -876,6 +877,7 @@ clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
looknew
->
servfail_stops
=
lookold
->
servfail_stops
;
looknew
->
besteffort
=
lookold
->
besteffort
;
looknew
->
dnssec
=
lookold
->
dnssec
;
looknew
->
ednsflags
=
lookold
->
ednsflags
;
looknew
->
expire
=
lookold
->
expire
;
looknew
->
nsid
=
lookold
->
nsid
;
#ifdef ISC_PLATFORM_USESIT
...
...
@@ -1012,11 +1014,11 @@ setup_text_key(void) {
isc_buffer_free
(
&
namebuf
);
}
isc_result_t
parse_uint
(
isc_uint32_t
*
uip
,
const
char
*
value
,
isc_uint32_t
max
,
const
char
*
desc
)
{
static
isc_result_t
parse_uint
_helper
(
isc_uint32_t
*
uip
,
const
char
*
value
,
isc_uint32_t
max
,
const
char
*
desc
,
int
base
)
{
isc_uint32_t
n
;
isc_result_t
result
=
isc_parse_uint32
(
&
n
,
value
,
10
);
isc_result_t
result
=
isc_parse_uint32
(
&
n
,
value
,
base
);
if
(
result
==
ISC_R_SUCCESS
&&
n
>
max
)
result
=
ISC_R_RANGE
;
if
(
result
!=
ISC_R_SUCCESS
)
{
...
...
@@ -1028,6 +1030,18 @@ parse_uint(isc_uint32_t *uip, const char *value, isc_uint32_t max,
return
(
ISC_R_SUCCESS
);
}
isc_result_t
parse_uint
(
isc_uint32_t
*
uip
,
const
char
*
value
,
isc_uint32_t
max
,
const
char
*
desc
)
{
return
(
parse_uint_helper
(
uip
,
value
,
max
,
desc
,
10
));
}
isc_result_t
parse_xint
(
isc_uint32_t
*
uip
,
const
char
*
value
,
isc_uint32_t
max
,
const
char
*
desc
)
{
return
(
parse_uint_helper
(
uip
,
value
,
max
,
desc
,
0
));
}
static
isc_uint32_t
parse_bits
(
char
*
arg
,
const
char
*
desc
,
isc_uint32_t
max
)
{
isc_result_t
result
;
...
...
@@ -1549,15 +1563,12 @@ save_opt(dig_lookup_t *lookup, char *code, char *value) {
*/
static
void
add_opt
(
dns_message_t
*
msg
,
isc_uint16_t
udpsize
,
isc_uint16_t
edns
,
isc_boolean_t
dnssec
,
dns_ednsopt_t
*
ednsopts
,
size_t
count
)
unsigned
int
flags
,
dns_ednsopt_t
*
ednsopts
,
size_t
count
)
{
dns_rdataset_t
*
rdataset
=
NULL
;
isc_result_t
result
;
unsigned
int
flags
=
0
;
debug
(
"add_opt()"
);
if
(
dnssec
)
flags
|=
DNS_MESSAGEEXTFLAG_DO
;
result
=
dns_message_buildopt
(
msg
,
&
rdataset
,
edns
,
udpsize
,
flags
,
ednsopts
,
count
);
check_result
(
result
,
"dns_message_buildopt"
);
...
...
@@ -2451,6 +2462,7 @@ setup_lookup(dig_lookup_t *lookup) {
lookup
->
edns
>
-
1
||
lookup
->
ecs_addr
!=
NULL
)
{
dns_ednsopt_t
opts
[
EDNSOPTS
+
DNS_EDNSOPTIONS
];
unsigned
int
flags
;
int
i
=
0
;
if
(
lookup
->
udpsize
==
0
)
...
...
@@ -2543,8 +2555,12 @@ setup_lookup(dig_lookup_t *lookup) {
i
+=
lookup
->
ednsoptscnt
;
}
flags
=
lookup
->
ednsflags
;
flags
&=
~
DNS_MESSAGEEXTFLAG_DO
;
if
(
lookup
->
dnssec
)
flags
|=
DNS_MESSAGEEXTFLAG_DO
;
add_opt
(
lookup
->
sendmsg
,
lookup
->
udpsize
,
lookup
->
edns
,
lookup
->
dnssec
,
opts
,
i
);
lookup
->
edns
,
flags
,
opts
,
i
);
}
result
=
dns_message_rendersection
(
lookup
->
sendmsg
,
...
...
bin/dig/include/dig/dig.h
View file @
3867312e
...
...
@@ -196,6 +196,7 @@ isc_boolean_t sigchase;
dns_ednsopt_t
*
ednsopts
;
unsigned
int
ednsoptscnt
;
isc_dscp_t
dscp
;
unsigned
int
ednsflags
;
};
/*% The dig_query structure */
...
...
@@ -351,6 +352,10 @@ isc_result_t
parse_uint
(
isc_uint32_t
*
uip
,
const
char
*
value
,
isc_uint32_t
max
,
const
char
*
desc
);
isc_result_t
parse_xint
(
isc_uint32_t
*
uip
,
const
char
*
value
,
isc_uint32_t
max
,
const
char
*
desc
);
isc_result_t
parse_netprefix
(
isc_sockaddr_t
**
sap
,
const
char
*
value
);
...
...
bin/tests/system/conf.sh.in
View file @
3867312e
...
...
@@ -66,15 +66,15 @@ RANDFILE=$TOP/bin/tests/system/random.data
# v6synth
SUBDIRS
=
"acl additional allow_query addzone autosign builtin
cacheclean case checkconf @CHECKDS@ checknames checkzone
@COVERAGE@ database dlv dlvauto dlz dlzexternal
dname dns64
dnssec dsdigest dscp ecdsa e
mptyzones filter-aaaa
formerr forward geoip glue gost ixfr inline
limits logfileconfig
lwresd masterfile masterformat metadata
notify nslookup nsupdate
pending @PKCS11_TEST@
redirect
resolver rndc rpz rrl rrchecker rrsetorder rsabigexponent
sit sfcache smartsign sortlist spf staticstub statistics
stub
tkey tsig tsiggss unknown upforwd verify
views wildcard
xfer xferquota zero zonechecks"
@COVERAGE@ database dlv dlvauto dlz dlzexternal
dname dns64
dnssec dsdigest dscp ecdsa e
dnscompliance emptyzones
filter-aaaa
formerr forward geoip glue gost ixfr inline
limits logfileconfig
lwresd masterfile masterformat metadata
notify nslookup nsupdate
pending @PKCS11_TEST@
redirect
resolver rndc rpz rrl rrchecker rrsetorder rsabigexponent
sit sfcache smartsign sortlist spf staticstub statistics
stub
tkey tsig tsiggss unknown upforwd verify
views wildcard
xfer xferquota zero zonechecks"
# Use the CONFIG_SHELL detected by configure for tests
SHELL
=
@SHELL@
...
...
bin/tests/system/ednscompliance/clean.sh
0 → 100644
View file @
3867312e
#!/bin/sh
#
# Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
rm
-f
dig.out
*
bin/tests/system/ednscompliance/ns1/named.conf
0 → 100644
View file @
3867312e
/*
*
Copyright
(
C
)
2014
Internet
Systems
Consortium
,
Inc
. (
"ISC"
)
*
*
Permission
to
use
,
copy
,
modify
,
and
/
or
distribute
this
software
for
any
*
purpose
with
or
without
fee
is
hereby
granted
,
provided
that
the
above
*
copyright
notice
and
this
permission
notice
appear
in
all
copies
.
*
*
THE
SOFTWARE
IS
PROVIDED
"AS IS"
AND
ISC
DISCLAIMS
ALL
WARRANTIES
WITH
*
REGARD
TO
THIS
SOFTWARE
INCLUDING
ALL
IMPLIED
WARRANTIES
OF
MERCHANTABILITY
*
AND
FITNESS
.
IN
NO
EVENT
SHALL
ISC
BE
LIABLE
FOR
ANY
SPECIAL
,
DIRECT
,
*
INDIRECT
,
OR
CONSEQUENTIAL
DAMAGES
OR
ANY
DAMAGES
WHATSOEVER
RESULTING
FROM
*
LOSS
OF
USE
,
DATA
OR
PROFITS
,
WHETHER
IN
AN
ACTION
OF
CONTRACT
,
NEGLIGENCE
*
OR
OTHER
TORTIOUS
ACTION
,
ARISING
OUT
OF
OR
IN
CONNECTION
WITH
THE
USE
OR
*
PERFORMANCE
OF
THIS
SOFTWARE
.
*/
controls
{ /*
empty
*/ };
options
{
query
-
source
address
10
.
53
.
0
.
1
;
notify
-
source
10
.
53
.
0
.
1
;
transfer
-
source
10
.
53
.
0
.
1
;
port
5300
;
pid
-
file
"named.pid"
;
listen
-
on
{
10
.
53
.
0
.
1
; };
listen
-
on
-
v6
{
none
; };
recursion
no
;
};
zone
"."
{
type
master
;
file
"root.db"
;
};
bin/tests/system/ednscompliance/ns1/root.db
0 → 100644
View file @
3867312e
; Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
;
; Permission to use, copy, modify, and/or distribute this software for any
; purpose with or without fee is hereby granted, provided that the above
; copyright notice and this permission notice appear in all copies.
;
; THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
; AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
; PERFORMANCE OF THIS SOFTWARE.
$TTL 300
. IN SOA marka.isc.org. a.root.servers.nil. (
2010 ; serial
600 ; refresh
600 ; retry
1200 ; expire
600 ; minimum
)
. NS a.root-servers.nil.
a.root-servers.nil. A 10.53.0.6
bin/tests/system/ednscompliance/tests.sh
0 → 100644
View file @
3867312e
#!/bin/sh
#
# Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
SYSTEMTESTTOP
=
..
.
$SYSTEMTESTTOP
/conf.sh
status
=
0
n
=
0
zone
=
.
n
=
`
expr
$n
+ 1
`
echo
"I:check +edns=100 sets version 100 (
$n
)"
ret
=
0
reason
=
$DIG
-p
5300 @10.53.0.1 +qr +norec +edns
=
100 soa
$zone
>
dig.out
$n
grep
"EDNS: version: 100,"
dig.out
$n
>
/dev/null
||
{
ret
=
1
;
reason
=
"version"
;
}
if
[
$ret
!=
0
]
;
then
echo
"I:failed
$reason
"
;
fi
status
=
`
expr
$status
+
$ret
`
n
=
`
expr
$n
+ 1
`
ret
=
0
reason
=
echo
"I:check +ednsopt=100 adds option 100 (
$n
)"
$DIG
-p
5300 @10.53.0.1 +qr +norec +ednsopt
=
100 soa
$zone
>
dig.out
$n
grep
"; OPT=100"
dig.out
$n
>
/dev/null
||
{
ret
=
1
;
reason
=
"option"
;
}
if
[
$ret
!=
0
]
;
then
echo
"I:failed
$reason
"
;
fi
status
=
`
expr
$status
+
$ret
`
n
=
`
expr
$n
+ 1
`
echo
"I:check +ednsflags=0x80 sets flags to 0080 (
$n
)"
ret
=
0
reason
=
$DIG
-p
5300 @10.53.0.1 +qr +norec +ednsflags
=
0x80 soa
$zone
>
dig.out
$n
grep
"MBZ: 0080"
dig.out
$n
>
/dev/null
||
{
ret
=
1
;
reason
=
"flags"
;
}
if
[
$ret
!=
0
]
;
then
echo
"I:failed
$reason
"
;
fi
status
=
`
expr
$status
+
$ret
`
n
=
`
expr
$n
+ 1
`
echo
"I:Unknown EDNS version (
$n
)"
ret
=
0
reason
=
$DIG
-p
5300 @10.53.0.1 +norec +edns
=
100 soa
$zone
>
dig.out
$n
grep
"status: BADVERS,"
dig.out
$n
>
/dev/null
||
{
ret
=
1
;
reason
=
"status"
;
}
grep
"EDNS: version: 0,"
dig.out
$n
>
/dev/null
||
{
ret
=
1
;
reason
=
"version"
;
}
grep
"IN.SOA."
dig.out
$n
>
/dev/null
&&
{
ret
=
1
;
reaons
=
"soa"
;
}
if
[
$ret
!=
0
]
;
then
echo
"I:failed
$reason
"
;
fi
status
=
`
expr
$status
+
$ret
`
n
=
`
expr
$n
+ 1
`
echo
"I:Unknown EDNS option (
$n
)"
ret
=
0
reason
=
$DIG
-p
5300 @10.53.0.1 +norec +ednsopt
=
100 soa
$zone
>
dig.out
$n
grep
"status: NOERROR,"
dig.out
$n
>
/dev/null
||
{
ret
=
1
;
reason
=
"status"
;
}
grep
"EDNS: version: 0,"
dig.out
$n
>
/dev/null
||
{
ret
=
1
;
reason
=
"version"
;
}
grep
"; OPT=100"
dig.out
$n
>
/dev/null
&&
{
ret
=
1
;
reason
=
"option"
;
}
grep
"IN.SOA."
dig.out
$n
>
/dev/null
||
{
ret
=
1
;
reason
=
"nosoa"
;
}
if
[
$ret
!=
0
]
;
then
echo
"I:failed
$reason
"
;
fi
status
=
`
expr
$status
+
$ret
`
n
=
`
expr
$n
+ 1
`
echo
"I:Unknown EDNS version + option (
$n
)"
ret
=
0
reason
=
$DIG
-p
5300 @10.53.0.1 +norec +edns
=
100 +ednsopt
=
100 soa
$zone
>
dig.out
$n
grep
"status: BADVERS,"
dig.out
$n
>
/dev/null
||
{
ret
=
1
;
reason
=
"status"
;
}
grep
"EDNS: version: 0,"
dig.out
$n
>
/dev/null
||
{
ret
=
1
;
reason
=
"version"
;
}
grep
"; OPT=100"
dig.out
$n
>
/dev/null
&&
{
ret
=
1
;
reason
=
"option"
;
}
grep
"IN.SOA."
dig.out
$n
>
/dev/null
&&
{
ret
=
1
;
reason
=
"soa"
;
}
if
[
$ret
!=
0
]
;
then
echo
"I:failed:
$reason
"
;
fi
status
=
`
expr
$status
+
$ret
`
n
=
`
expr
$n
+ 1
`
echo
"I:Unknown EDNS flag (
$n
)"
ret
=
0
reason
=
$DIG
-p
5300 @10.53.0.1 +norec +ednsflags
=
0x80 soa
$zone
>
dig.out
$n
grep
"status: NOERROR,"
dig.out
$n
>
/dev/null
||
{
ret
=
1
;
reason
=
"status"
;
}
grep
"EDNS: version: 0,"
dig.out
$n
>
/dev/null
||
{
ret
=
1
;
reason
=
"version"
;
}
grep
"EDNS:.*MBZ"
dig.out
$n
>
/dev/null
>
/dev/null
&&
{
ret
=
1
;
reason
=
"mbz"
;
}
grep
".IN.SOA."
dig.out
$n
>
/dev/null
||
{
ret
=
1
;
reason
=
"nosoa"
;
}
if
[
$ret
!=
0
]
;
then
echo
"I:failed
$reason
"
;
fi
status
=
`
expr
$status
+
$ret
`
n
=
`
expr
$n
+ 1
`
echo
"I:Unknown EDNS version + flag (
$n
)"
ret
=
0
reason
=
$DIG
-p
5300 @10.53.0.1 +norec +edns
=
100 +ednsflags
=
0x80 soa
$zone
>
dig.out
$n
grep
"status: BADVERS,"
dig.out
$n
>
/dev/null
||
{
ret
=
1
;
reason
=
"status"
;
}
grep
"EDNS: version: 0,"
dig.out
$n
>
/dev/null
||
{
ret
=
1
;
reason
=
"version"
;
}
grep
"EDNS:.*MBZ"
dig.out
$n
>
/dev/null
>
/dev/null
&&
{
ret
=
1
;
reason
=
"mbz"
;
}
grep
"IN.SOA."
dig.out
$n
>
/dev/null
&&
{
ret
=
1
;
reason
=
"soa"
;
}
if
[
$ret
!=
0
]
;
then
echo
"I:failed
$reason
"
;
fi
status
=
`
expr
$status
+
$ret
`
n
=
`
expr
$n
+ 1
`
echo
"I:exit status:
$status
"
exit
$status
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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