Skip to content

Commit

Permalink
Merge branch 'release/v0.5.1' of github.com:getdnsapi/getdns into rel…
Browse files Browse the repository at this point in the history
…ease/v0.5.1
  • Loading branch information
wtoorop committed Nov 15, 2015
2 parents afe5db6 + dace6f2 commit 95618bb
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 5 deletions.
10 changes: 10 additions & 0 deletions src/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion src/dict.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions src/getdns/getdns_extra.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/libgetdns.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/request-internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions src/stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions src/types-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 10 additions & 4 deletions src/util-internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 95618bb

Please sign in to comment.