mirror of https://github.com/getdnsapi/getdns.git
Address few minor bugs pointed out by willem
This commit is contained in:
parent
9a7bfdd45b
commit
3ac5e660f9
|
@ -1564,10 +1564,10 @@ getdns_context_set_upstream_recursive_servers(struct getdns_context *context,
|
|||
if (port == GETDNS_PORT_ZERO)
|
||||
continue;
|
||||
|
||||
/* TODO[TLS]:Respect the user port for TCP and STARTTLS, but for
|
||||
* now hardcode the TLS port */
|
||||
if (base_transport != GETDNS_BASE_TRANSPORT_TLS)
|
||||
(void) getdns_dict_get_int(dict, "port", &port);
|
||||
else
|
||||
(void) getdns_dict_get_int(dict, "tls-port", &port);
|
||||
(void) snprintf(portstr, 1024, "%d", (int)port);
|
||||
|
||||
if (getaddrinfo(addrstr, portstr, &hints, &ai))
|
||||
|
@ -1811,10 +1811,8 @@ ub_setup_stub(struct ub_ctx *ctx, getdns_context *context)
|
|||
* used. All other cases must currently fallback to TCP for libunbound.*/
|
||||
if (context->dns_base_transports[0] == GETDNS_BASE_TRANSPORT_TLS &&
|
||||
context->dns_base_transports[1] == GETDNS_BASE_TRANSPORT_NONE &&
|
||||
upstream_port(upstream) != GETDNS_PORT_DNS_OVER_TLS)
|
||||
upstream->dns_base_transport != GETDNS_BASE_TRANSPORT_TLS)
|
||||
continue;
|
||||
else if (upstream_port(upstream) != GETDNS_PORT_DNS)
|
||||
continue;
|
||||
upstream_ntop_buf(upstream, addr, 1024);
|
||||
ub_ctx_set_fwd(ctx, addr);
|
||||
}
|
||||
|
|
|
@ -399,6 +399,10 @@ stub_next_upstream(getdns_network_req *netreq)
|
|||
if (! --netreq->upstream->to_retry)
|
||||
netreq->upstream->to_retry = -(netreq->upstream->back_off *= 2);
|
||||
|
||||
/*[TLS]:TODO - This works because the next message won't try the exact
|
||||
* same upstream (and the next message may not use the same transport),
|
||||
* but the next message will find the next matching one thanks to logic in
|
||||
* upstream_select, but this could be better */
|
||||
if (++dnsreq->upstreams->current > dnsreq->upstreams->count)
|
||||
dnsreq->upstreams->current = 0;
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ ipaddr_dict(getdns_context *context, char *ipstr)
|
|||
getdns_dict *r = getdns_dict_create_with_context(context);
|
||||
char *s = strchr(ipstr, '%'), *scope_id_str = "";
|
||||
char *p = strchr(ipstr, '@'), *portstr = "";
|
||||
char *t = strchr(ipstr, '#'), *tls_portstr = "";
|
||||
uint8_t buf[sizeof(struct in6_addr)];
|
||||
getdns_bindata addr;
|
||||
|
||||
|
@ -68,6 +69,10 @@ ipaddr_dict(getdns_context *context, char *ipstr)
|
|||
*p = 0;
|
||||
portstr = p + 1;
|
||||
}
|
||||
if (t) {
|
||||
*t = 0;
|
||||
tls_portstr = t + 1;
|
||||
}
|
||||
if (strchr(ipstr, ':')) {
|
||||
getdns_dict_util_set_string(r, "address_type", "IPv6");
|
||||
addr.size = 16;
|
||||
|
@ -86,6 +91,8 @@ ipaddr_dict(getdns_context *context, char *ipstr)
|
|||
getdns_dict_set_bindata(r, "address_data", &addr);
|
||||
if (*portstr)
|
||||
getdns_dict_set_int(r, "port", (int32_t)atoi(portstr));
|
||||
if (*tls_portstr)
|
||||
getdns_dict_set_int(r, "tls-port", (int32_t)atoi(tls_portstr));
|
||||
if (*scope_id_str)
|
||||
getdns_dict_util_set_string(r, "scope_id", scope_id_str);
|
||||
|
||||
|
|
Loading…
Reference in New Issue