2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-28 21:17:54 +00:00

3895. [func] Add the ability to set the DSCP code point to dig.

[RT #36546]
This commit is contained in:
Mark Andrews 2014-07-15 23:27:14 +10:00
parent 71ec6d0940
commit 2064e46209
5 changed files with 34 additions and 0 deletions

View File

@ -1,3 +1,6 @@
3895. [func] Add the ability to set the DSCP code point to dig.
[RT #36546]
3894. [bug] Buffers in isc_print_vsnprintf were not properly
initialized leading to potential overflows when
printing out quad values. [RT #36505]

View File

@ -243,6 +243,7 @@ help(void) {
" +[no]multiline (Print records in an expanded format)\n"
" +[no]onesoa (AXFR prints only one soa record)\n"
" +[no]keepopen (Keep the TCP socket open between queries)\n"
" +[no]dscp[=###] (Set the DSCP value to ### [0..63])\n"
" global d-opts and servers (before host name) affect all queries.\n"
" local d-opts and servers (after host name) affect only that lookup.\n"
" -h (print help and exit)\n"
@ -920,6 +921,19 @@ plus_option(char *option, isc_boolean_t is_batchfile,
strncpy(domainopt, value, sizeof(domainopt));
domainopt[sizeof(domainopt)-1] = '\0';
break;
case 's': /* dscp */
FULLCHECK("dscp");
if (!state) {
lookup->dscp = -1;
break;
}
if (value == NULL)
goto need_value;
result = parse_uint(&num, value, 0x3f, "DSCP");
if (result != ISC_R_SUCCESS)
fatal("Couldn't parse DSCP value");
lookup->dscp = num;
break;
default:
goto invalid_option;
}

View File

@ -555,6 +555,16 @@
</listitem>
</varlistentry>
<varlistentry>
<term><option>+dscp=value</option></term> <listitem>
<para>
Set the DSCP code point to be used when sending the
query. Valid DSCP code points are in the range
[0..63]. By default no code point is explictly set.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]edns[=#]</option></term>
<listitem>

View File

@ -813,6 +813,7 @@ make_empty_lookup(void) {
#endif
looknew->ednsopts = NULL;
looknew->ednsoptscnt = 0;
looknew->dscp = -1;
dns_fixedname_init(&looknew->fdomain);
ISC_LINK_INIT(looknew, link);
ISC_LIST_INIT(looknew->q);
@ -898,6 +899,7 @@ clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
looknew->tsigctx = NULL;
looknew->need_search = lookold->need_search;
looknew->done_as_is = lookold->done_as_is;
looknew->dscp = lookold->dscp;
if (lookold->ecs_addr != NULL) {
size_t len = sizeof(isc_sockaddr_t);
@ -2781,6 +2783,8 @@ send_tcp_connect(dig_query_t *query) {
check_result(result, "isc_socket_create");
sockcount++;
debug("sockcount=%d", sockcount);
if (query->lookup->dscp != -1)
isc_socket_dscp(query->sock, query->lookup->dscp);
if (specified_source)
result = isc_socket_bind(query->sock, &bind_address,
ISC_SOCKET_REUSEADDRESS);
@ -2857,6 +2861,8 @@ send_udp(dig_query_t *query) {
check_result(result, "isc_socket_create");
sockcount++;
debug("sockcount=%d", sockcount);
if (query->lookup->dscp != -1)
isc_socket_dscp(query->sock, query->lookup->dscp);
if (specified_source) {
result = isc_socket_bind(query->sock, &bind_address,
ISC_SOCKET_REUSEADDRESS);

View File

@ -195,6 +195,7 @@ isc_boolean_t sigchase;
#endif
dns_ednsopt_t *ednsopts;
unsigned int ednsoptscnt;
isc_dscp_t dscp;
};
/*% The dig_query structure */