mirror of https://github.com/getdnsapi/getdns.git
Merge pull request #123 from saradickinson/bugfix/call_debugging_and_transports
Fix bug with call_debugging reporting of UDP and add a getter for tls…
This commit is contained in:
commit
dace6f2453
|
@ -2603,6 +2603,7 @@ _get_context_settings(getdns_context* context) {
|
|||
}
|
||||
r |= getdns_dict_set_list(result, "dns_transport_list", transports);
|
||||
}
|
||||
r |= getdns_dict_set_int(result, "tls_authentication", context->tls_auth);
|
||||
}
|
||||
if (context->namespace_count > 0) {
|
||||
/* create a namespace list */
|
||||
|
@ -2848,6 +2849,15 @@ getdns_context_get_dns_transport_list(getdns_context *context,
|
|||
return GETDNS_RETURN_GOOD;
|
||||
}
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_get_tls_authentication(getdns_context *context,
|
||||
getdns_tls_authentication_t* value) {
|
||||
RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
|
||||
RETURN_IF_NULL(value, GETDNS_RETURN_INVALID_PARAMETER);
|
||||
*value = context->tls_auth;
|
||||
return GETDNS_RETURN_GOOD;
|
||||
}
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_get_limit_outstanding_queries(getdns_context *context,
|
||||
uint16_t* value) {
|
||||
|
|
|
@ -996,7 +996,8 @@ getdns_pp_dict(gldns_buffer * buf, size_t indent,
|
|||
strcmp(item->node.key, "append_name") == 0 ||
|
||||
strcmp(item->node.key, "follow_redirects") == 0 ||
|
||||
strcmp(item->node.key, "transport") == 0 ||
|
||||
strcmp(item->node.key, "resolution_type") == 0) &&
|
||||
strcmp(item->node.key, "resolution_type") == 0 ||
|
||||
strcmp(item->node.key, "tls_authentication") == 0 ) &&
|
||||
(strval =
|
||||
_getdns_get_const_info(item->i.data.n)->name)) {
|
||||
if (gldns_buffer_printf(buf, " %s", strval) < 0)
|
||||
|
|
|
@ -385,6 +385,10 @@ getdns_return_t
|
|||
getdns_context_set_tls_authentication(
|
||||
getdns_context *context, getdns_tls_authentication_t value);
|
||||
|
||||
getdns_return_t
|
||||
getdns_context_get_tls_authentication(getdns_context *context,
|
||||
getdns_tls_authentication_t* value);
|
||||
|
||||
|
||||
/* WARNING! Do not use the constants below. They will be removed from future
|
||||
* releases. Please use the getdns_context_set_dns_transport_list with the
|
||||
|
|
|
@ -13,6 +13,7 @@ getdns_context_get_dnssec_allowed_skew
|
|||
getdns_context_get_dnssec_trust_anchors
|
||||
getdns_context_get_dns_transport
|
||||
getdns_context_get_dns_transport_list
|
||||
getdns_context_get_tls_authentication
|
||||
getdns_context_get_edns_client_subnet_private
|
||||
getdns_context_get_edns_do_bit
|
||||
getdns_context_get_edns_extended_rcode
|
||||
|
|
|
@ -136,6 +136,7 @@ network_req_init(getdns_network_req *net_req, getdns_dns_req *owner,
|
|||
net_req->debug_start_time = 0;
|
||||
net_req->debug_end_time = 0;
|
||||
net_req->debug_tls_auth_status = 0;
|
||||
net_req->debug_udp = 0;
|
||||
|
||||
net_req->wire_data_sz = wire_data_sz;
|
||||
if (max_query_sz) {
|
||||
|
|
|
@ -694,6 +694,7 @@ stub_tcp_write(int fd, getdns_tcp_state *tcp, getdns_network_req *netreq)
|
|||
if (q != 0)
|
||||
return q;
|
||||
|
||||
netreq->debug_udp = 0;
|
||||
/* Do we have remaining data that we could not write before? */
|
||||
if (! tcp->write_buf) {
|
||||
/* No, this is an initial write. Try to send
|
||||
|
@ -1302,6 +1303,7 @@ stub_udp_write_cb(void *userarg)
|
|||
GETDNS_CLEAR_EVENT(dnsreq->loop, &netreq->event);
|
||||
|
||||
netreq->debug_start_time = _getdns_get_time_as_uintt64();
|
||||
netreq->debug_udp = 1;
|
||||
netreq->query_id = arc4random();
|
||||
GLDNS_ID_SET(netreq->query, netreq->query_id);
|
||||
if (netreq->opt) {
|
||||
|
@ -1390,6 +1392,7 @@ stub_tcp_write_cb(void *userarg)
|
|||
return;
|
||||
|
||||
default:
|
||||
netreq->debug_udp = 0;
|
||||
netreq->query_id = (uint16_t) q;
|
||||
GETDNS_CLEAR_EVENT(dnsreq->loop, &netreq->event);
|
||||
GETDNS_SCHEDULE_EVENT(
|
||||
|
|
|
@ -230,6 +230,7 @@ typedef struct getdns_network_req
|
|||
uint64_t debug_start_time;
|
||||
uint64_t debug_end_time;
|
||||
size_t debug_tls_auth_status;
|
||||
size_t debug_udp;
|
||||
|
||||
/* When more space is needed for the wire_data response than is
|
||||
* available in wire_data[], it will be allocated seperately.
|
||||
|
|
|
@ -714,11 +714,17 @@ _getdns_create_call_debugging_dict(
|
|||
_getdns_sockaddr_to_dict(
|
||||
context, &netreq->upstream->addr, &address_debug);
|
||||
|
||||
if (getdns_dict_set_dict(netreq_debug, "query_to", address_debug) ||
|
||||
getdns_dict_set_int( netreq_debug, "transport"
|
||||
, netreq->upstream->transport)) {
|
||||
|
||||
if (getdns_dict_set_dict(netreq_debug, "query_to", address_debug)) {
|
||||
getdns_dict_destroy(address_debug);
|
||||
return NULL;
|
||||
}
|
||||
getdns_transport_list_t transport = netreq->upstream->transport;
|
||||
/* Same upstream is used for UDP and TCP, so netreq keeps track of what
|
||||
was actually used for the last successful query.*/
|
||||
if (transport == GETDNS_TRANSPORT_TCP && netreq->debug_udp == 1) {
|
||||
transport = GETDNS_TRANSPORT_UDP;
|
||||
}
|
||||
if (getdns_dict_set_int( netreq_debug, "transport", transport)) {
|
||||
getdns_dict_destroy(netreq_debug);
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue