Show dns_root_servers setting in API information

This commit is contained in:
Willem Toorop 2020-03-27 10:11:26 +01:00
parent 73cee29f55
commit 563b2b113a
2 changed files with 28 additions and 4 deletions

View File

@ -3896,6 +3896,14 @@ _get_context_settings(const getdns_context* context)
getdns_list_destroy(list);
goto error;
}
if (getdns_context_get_dns_root_servers(context, &list))
; /* pass */
else if (list && _getdns_dict_set_this_list(
result, "dns_root_servers", list)) {
getdns_list_destroy(list);
goto error;
}
if (context->dns_transport_count > 0) {
/* create a namespace list */
if (!(list = getdns_list_create_with_context(context)))

View File

@ -892,6 +892,7 @@ getdns_pp_list(gldns_buffer *buf, size_t indent, const getdns_list *list,
struct getdns_bindata *bindata_item;
uint32_t int_item;
const char *strval;
char abuf[80];
if (list == NULL)
return 0;
@ -933,7 +934,21 @@ getdns_pp_list(gldns_buffer *buf, size_t indent, const getdns_list *list,
if (getdns_list_get_bindata(list, i, &bindata_item) !=
GETDNS_RETURN_GOOD)
return -1;
if (getdns_pp_bindata(
if (for_literals && (bindata_item->size == 4 ||
bindata_item->size == 16 )) {
if (gldns_buffer_printf(buf,
(json ? "\"%s\"" : " <bindata for %s>"),
inet_ntop(( bindata_item->size == 4
? AF_INET : AF_INET6)
, bindata_item->data
, abuf
, sizeof(abuf) - 1
)) < 0)
return -1;
} else if (getdns_pp_bindata(
buf, bindata_item, 0, json) < 0)
return -1;
break;
@ -1164,7 +1179,7 @@ getdns_pp_dict(gldns_buffer * buf, size_t indent,
, 40
)) < 0)
return -1;
} else if (!json &&
(strcmp(item->node.key, "pin-sha256") == 0 ||
strcmp(item->node.key, "value") == 0) &&
@ -1199,8 +1214,9 @@ getdns_pp_dict(gldns_buffer * buf, size_t indent,
if (getdns_pp_list(buf, indent, item->i.data.list,
(strcmp(item->node.key, "namespaces") == 0 ||
strcmp(item->node.key, "dns_transport_list") == 0
|| strcmp(item->node.key, "bad_dns") == 0),
json) < 0)
|| strcmp(item->node.key, "bad_dns") == 0 ||
strcmp(item->node.key, "dns_root_servers") == 0
), json) < 0)
return -1;
break;