Skip to content

Commit 95618bb

Browse files
committed
Merge branch 'release/v0.5.1' of github.com:getdnsapi/getdns into release/v0.5.1
2 parents afe5db6 + dace6f2 commit 95618bb

8 files changed

Lines changed: 32 additions & 5 deletions

File tree

src/context.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2603,6 +2603,7 @@ _get_context_settings(getdns_context* context) {
26032603
}
26042604
r |= getdns_dict_set_list(result, "dns_transport_list", transports);
26052605
}
2606+
r |= getdns_dict_set_int(result, "tls_authentication", context->tls_auth);
26062607
}
26072608
if (context->namespace_count > 0) {
26082609
/* create a namespace list */
@@ -2848,6 +2849,15 @@ getdns_context_get_dns_transport_list(getdns_context *context,
28482849
return GETDNS_RETURN_GOOD;
28492850
}
28502851

2852+
getdns_return_t
2853+
getdns_context_get_tls_authentication(getdns_context *context,
2854+
getdns_tls_authentication_t* value) {
2855+
RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
2856+
RETURN_IF_NULL(value, GETDNS_RETURN_INVALID_PARAMETER);
2857+
*value = context->tls_auth;
2858+
return GETDNS_RETURN_GOOD;
2859+
}
2860+
28512861
getdns_return_t
28522862
getdns_context_get_limit_outstanding_queries(getdns_context *context,
28532863
uint16_t* value) {

src/dict.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,8 @@ getdns_pp_dict(gldns_buffer * buf, size_t indent,
996996
strcmp(item->node.key, "append_name") == 0 ||
997997
strcmp(item->node.key, "follow_redirects") == 0 ||
998998
strcmp(item->node.key, "transport") == 0 ||
999-
strcmp(item->node.key, "resolution_type") == 0) &&
999+
strcmp(item->node.key, "resolution_type") == 0 ||
1000+
strcmp(item->node.key, "tls_authentication") == 0 ) &&
10001001
(strval =
10011002
_getdns_get_const_info(item->i.data.n)->name)) {
10021003
if (gldns_buffer_printf(buf, " %s", strval) < 0)

src/getdns/getdns_extra.h.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,10 @@ getdns_return_t
385385
getdns_context_set_tls_authentication(
386386
getdns_context *context, getdns_tls_authentication_t value);
387387

388+
getdns_return_t
389+
getdns_context_get_tls_authentication(getdns_context *context,
390+
getdns_tls_authentication_t* value);
391+
388392

389393
/* WARNING! Do not use the constants below. They will be removed from future
390394
* releases. Please use the getdns_context_set_dns_transport_list with the

src/libgetdns.symbols

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ getdns_context_get_dnssec_allowed_skew
1313
getdns_context_get_dnssec_trust_anchors
1414
getdns_context_get_dns_transport
1515
getdns_context_get_dns_transport_list
16+
getdns_context_get_tls_authentication
1617
getdns_context_get_edns_client_subnet_private
1718
getdns_context_get_edns_do_bit
1819
getdns_context_get_edns_extended_rcode

src/request-internal.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ network_req_init(getdns_network_req *net_req, getdns_dns_req *owner,
136136
net_req->debug_start_time = 0;
137137
net_req->debug_end_time = 0;
138138
net_req->debug_tls_auth_status = 0;
139+
net_req->debug_udp = 0;
139140

140141
net_req->wire_data_sz = wire_data_sz;
141142
if (max_query_sz) {

src/stub.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,7 @@ stub_tcp_write(int fd, getdns_tcp_state *tcp, getdns_network_req *netreq)
694694
if (q != 0)
695695
return q;
696696

697+
netreq->debug_udp = 0;
697698
/* Do we have remaining data that we could not write before? */
698699
if (! tcp->write_buf) {
699700
/* No, this is an initial write. Try to send
@@ -1302,6 +1303,7 @@ stub_udp_write_cb(void *userarg)
13021303
GETDNS_CLEAR_EVENT(dnsreq->loop, &netreq->event);
13031304

13041305
netreq->debug_start_time = _getdns_get_time_as_uintt64();
1306+
netreq->debug_udp = 1;
13051307
netreq->query_id = arc4random();
13061308
GLDNS_ID_SET(netreq->query, netreq->query_id);
13071309
if (netreq->opt) {
@@ -1390,6 +1392,7 @@ stub_tcp_write_cb(void *userarg)
13901392
return;
13911393

13921394
default:
1395+
netreq->debug_udp = 0;
13931396
netreq->query_id = (uint16_t) q;
13941397
GETDNS_CLEAR_EVENT(dnsreq->loop, &netreq->event);
13951398
GETDNS_SCHEDULE_EVENT(

src/types-internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ typedef struct getdns_network_req
230230
uint64_t debug_start_time;
231231
uint64_t debug_end_time;
232232
size_t debug_tls_auth_status;
233+
size_t debug_udp;
233234

234235
/* When more space is needed for the wire_data response than is
235236
* available in wire_data[], it will be allocated seperately.

src/util-internal.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -714,11 +714,17 @@ _getdns_create_call_debugging_dict(
714714
_getdns_sockaddr_to_dict(
715715
context, &netreq->upstream->addr, &address_debug);
716716

717-
if (getdns_dict_set_dict(netreq_debug, "query_to", address_debug) ||
718-
getdns_dict_set_int( netreq_debug, "transport"
719-
, netreq->upstream->transport)) {
720-
717+
if (getdns_dict_set_dict(netreq_debug, "query_to", address_debug)) {
721718
getdns_dict_destroy(address_debug);
719+
return NULL;
720+
}
721+
getdns_transport_list_t transport = netreq->upstream->transport;
722+
/* Same upstream is used for UDP and TCP, so netreq keeps track of what
723+
was actually used for the last successful query.*/
724+
if (transport == GETDNS_TRANSPORT_TCP && netreq->debug_udp == 1) {
725+
transport = GETDNS_TRANSPORT_UDP;
726+
}
727+
if (getdns_dict_set_int( netreq_debug, "transport", transport)) {
722728
getdns_dict_destroy(netreq_debug);
723729
return NULL;
724730
}

0 commit comments

Comments
 (0)