Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dnsperf
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
dnsperf
Commits
3b0a0dfc
Commit
3b0a0dfc
authored
Sep 09, 2016
by
Mukund Sivaraman
Committed by
Ondřej Surý
Aug 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for sending EDNS CLIENT-SUBNET option in queries to dnsperf and resperf (#42899)
parent
c8aa3758
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
7 deletions
+100
-7
dns.c
dns.c
+63
-3
dns.h
dns.h
+2
-0
dnsperf.c
dnsperf.c
+19
-2
resperf.c
resperf.c
+16
-2
No files found.
dns.c
View file @
3b0a0dfc
...
...
@@ -301,7 +301,10 @@ perf_dns_destroytsigkey(perf_dnstsigkey_t **tsigkeyp)
* Appends an OPT record to the packet.
*/
static
isc_result_t
add_edns
(
isc_buffer_t
*
packet
,
bool
dnssec
)
{
add_edns
(
isc_buffer_t
*
packet
,
bool
dnssec
,
bool
ecs_zero
,
bool
ecs_fixed
,
bool
ecs_random
)
{
unsigned
char
*
base
;
if
(
isc_buffer_availablelength
(
packet
)
<
EDNSLEN
)
{
...
...
@@ -320,7 +323,62 @@ add_edns(isc_buffer_t *packet, bool dnssec) {
isc_buffer_putuint16
(
packet
,
0x8000
);
else
isc_buffer_putuint16
(
packet
,
0
);
isc_buffer_putuint16
(
packet
,
0
);
/* rdlen */
if
(
!
ecs_zero
&&
!
ecs_fixed
&&
!
ecs_random
)
{
isc_buffer_putuint16
(
packet
,
0
);
/* rdlen */
}
else
{
if
(
ecs_zero
)
{
/* rdlen */
isc_buffer_putuint16
(
packet
,
8
);
/* CLIENT-SUBNET option code */
isc_buffer_putuint16
(
packet
,
0x0008
);
/* CLIENT-SUBNET option length */
isc_buffer_putuint16
(
packet
,
4
);
/* FAMILY=IPv4 */
isc_buffer_putuint16
(
packet
,
0x0001
);
/* SOURCE PREFIX-LENGTH=0 */
isc_buffer_putuint8
(
packet
,
0
);
/* SCOPE PREFIX-LENGTH=0 */
isc_buffer_putuint8
(
packet
,
0
);
}
else
if
(
ecs_fixed
)
{
/* rdlen */
isc_buffer_putuint16
(
packet
,
11
);
/* CLIENT-SUBNET option code */
isc_buffer_putuint16
(
packet
,
0x0008
);
/* CLIENT-SUBNET option length */
isc_buffer_putuint16
(
packet
,
7
);
/* FAMILY=IPv4 */
isc_buffer_putuint16
(
packet
,
0x0001
);
/* SOURCE PREFIX-LENGTH=24 */
isc_buffer_putuint8
(
packet
,
24
);
/* SCOPE PREFIX-LENGTH=0 */
isc_buffer_putuint8
(
packet
,
0
);
isc_buffer_putuint8
(
packet
,
149
);
isc_buffer_putuint8
(
packet
,
20
);
isc_buffer_putuint8
(
packet
,
64
);
}
else
{
unsigned
long
r
;
/* rdlen */
isc_buffer_putuint16
(
packet
,
11
);
/* CLIENT-SUBNET option code */
isc_buffer_putuint16
(
packet
,
0x0008
);
/* CLIENT-SUBNET option length */
isc_buffer_putuint16
(
packet
,
7
);
/* FAMILY=IPv4 */
isc_buffer_putuint16
(
packet
,
0x0001
);
/* SOURCE PREFIX-LENGTH=24 */
isc_buffer_putuint8
(
packet
,
24
);
/* SCOPE PREFIX-LENGTH=0 */
isc_buffer_putuint8
(
packet
,
0
);
r
=
(
unsigned
long
)
random
();
isc_buffer_putuint8
(
packet
,
r
&
0xff
);
r
>>=
8
;
isc_buffer_putuint8
(
packet
,
r
&
0xff
);
r
>>=
8
;
isc_buffer_putuint8
(
packet
,
r
&
0xff
);
}
}
base
[
11
]
++
;
/* increment record count */
...
...
@@ -805,6 +863,8 @@ isc_result_t
perf_dns_buildrequest
(
perf_dnsctx_t
*
ctx
,
const
isc_textregion_t
*
record
,
uint16_t
qid
,
bool
edns
,
bool
dnssec
,
bool
ecs_zero
,
bool
ecs_fixed
,
bool
ecs_random
,
perf_dnstsigkey_t
*
tsigkey
,
isc_buffer_t
*
msg
)
{
unsigned
int
flags
;
...
...
@@ -832,7 +892,7 @@ perf_dns_buildrequest(perf_dnsctx_t *ctx, const isc_textregion_t *record,
return
(
result
);
if
(
edns
)
{
result
=
add_edns
(
msg
,
dnssec
);
result
=
add_edns
(
msg
,
dnssec
,
ecs_zero
,
ecs_fixed
,
ecs_random
);
if
(
result
!=
ISC_R_SUCCESS
)
return
(
result
);
}
...
...
dns.h
View file @
3b0a0dfc
...
...
@@ -64,6 +64,8 @@ isc_result_t
perf_dns_buildrequest
(
perf_dnsctx_t
*
ctx
,
const
isc_textregion_t
*
record
,
uint16_t
qid
,
bool
edns
,
bool
dnssec
,
bool
ecs_zero
,
bool
ecs_fixed
,
bool
ecs_random
,
perf_dnstsigkey_t
*
tsigkey
,
isc_buffer_t
*
msg
);
#endif
dnsperf.c
View file @
3b0a0dfc
...
...
@@ -103,6 +103,9 @@ typedef struct {
uint32_t
bufsize
;
bool
edns
;
bool
dnssec
;
bool
ecs_zero
;
bool
ecs_fixed
;
bool
ecs_random
;
perf_dnstsigkey_t
*
tsigkey
;
uint32_t
max_outstanding
;
uint32_t
max_qps
;
...
...
@@ -446,6 +449,15 @@ setup(int argc, char **argv, config_t *config)
perf_opt_add
(
'D'
,
perf_opt_boolean
,
NULL
,
"set the DNSSEC OK bit (implies EDNS)"
,
NULL
,
&
config
->
dnssec
);
perf_opt_add
(
'X'
,
perf_opt_boolean
,
NULL
,
"send 0/0 in EDNS CLIENT-SUBNET option"
,
NULL
,
&
config
->
ecs_zero
);
perf_opt_add
(
'Y'
,
perf_opt_boolean
,
NULL
,
"send 149.20.64.0/24 in EDNS CLIENT-SUBNET option"
,
NULL
,
&
config
->
ecs_fixed
);
perf_opt_add
(
'Z'
,
perf_opt_boolean
,
NULL
,
"send random/24 in EDNS CLIENT-SUBNET option"
,
NULL
,
&
config
->
ecs_random
);
perf_opt_add
(
'y'
,
perf_opt_string
,
"[alg:]name:secret"
,
"the TSIG algorithm, name and secret"
,
NULL
,
&
tsigkey
);
...
...
@@ -481,7 +493,8 @@ setup(int argc, char **argv, config_t *config)
config
->
maxruns
=
1
;
perf_datafile_setmaxruns
(
input
,
config
->
maxruns
);
if
(
config
->
dnssec
)
if
(
config
->
dnssec
||
config
->
ecs_zero
||
config
->
ecs_fixed
||
config
->
ecs_random
)
config
->
edns
=
true
;
if
(
tsigkey
!=
NULL
)
...
...
@@ -645,7 +658,11 @@ do_send(void *arg)
result
=
perf_dns_buildrequest
(
tinfo
->
dnsctx
,
(
isc_textregion_t
*
)
&
used
,
qid
,
config
->
edns
,
config
->
dnssec
,
config
->
tsigkey
,
config
->
dnssec
,
config
->
ecs_zero
,
config
->
ecs_fixed
,
config
->
ecs_random
,
config
->
tsigkey
,
&
msg
);
if
(
result
!=
ISC_R_SUCCESS
)
{
LOCK
(
&
tinfo
->
lock
);
...
...
resperf.c
View file @
3b0a0dfc
...
...
@@ -110,6 +110,9 @@ static int *socks;
static
uint64_t
query_timeout
;
static
bool
edns
;
static
bool
dnssec
;
static
bool
ecs_zero
;
static
bool
ecs_fixed
;
static
bool
ecs_random
;
static
perf_datafile_t
*
input
;
...
...
@@ -271,6 +274,15 @@ setup(int argc, char **argv)
"enable EDNS 0"
,
NULL
,
&
edns
);
perf_opt_add
(
'D'
,
perf_opt_boolean
,
NULL
,
"set the DNSSEC OK bit (implies EDNS)"
,
NULL
,
&
dnssec
);
perf_opt_add
(
'X'
,
perf_opt_boolean
,
NULL
,
"send 0/0 in EDNS CLIENT-SUBNET option"
,
NULL
,
&
ecs_zero
);
perf_opt_add
(
'Y'
,
perf_opt_boolean
,
NULL
,
"send 149.20.64.0/24 in EDNS CLIENT-SUBNET option"
,
NULL
,
&
ecs_fixed
);
perf_opt_add
(
'Z'
,
perf_opt_boolean
,
NULL
,
"send random/24 in EDNS CLIENT-SUBNET option"
,
NULL
,
&
ecs_random
);
perf_opt_add
(
'y'
,
perf_opt_string
,
"[alg:]name:secret"
,
"the TSIG algorithm, name and secret"
,
NULL
,
&
tsigkey_str
);
...
...
@@ -329,7 +341,7 @@ setup(int argc, char **argv)
input
=
perf_datafile_open
(
mctx
,
filename
);
if
(
dnssec
)
if
(
dnssec
||
ecs_zero
||
ecs_fixed
||
ecs_random
)
edns
=
true
;
if
(
tsigkey_str
!=
NULL
)
...
...
@@ -476,7 +488,9 @@ do_one_line(isc_buffer_t *lines, isc_buffer_t *msg) {
isc_buffer_clear
(
msg
);
result
=
perf_dns_buildrequest
(
NULL
,
(
isc_textregion_t
*
)
&
used
,
qid
,
edns
,
dnssec
,
tsigkey
,
msg
);
qid
,
edns
,
dnssec
,
ecs_zero
,
ecs_fixed
,
ecs_random
,
tsigkey
,
msg
);
if
(
result
!=
ISC_R_SUCCESS
)
return
(
result
);
...
...
Write
Preview
Markdown
is supported
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