Detect dnsmasq and skip the unit test that fails with it

This actually resolves issue #300
Thanks Tim Rühsen and Konomi Kitten
This commit is contained in:
Willem Toorop 2017-12-21 16:21:10 +01:00
parent aa419a88d0
commit 9aa1d067d2
2 changed files with 16 additions and 3 deletions

View File

@ -1,6 +1,6 @@
* 2017-12-??: Version 1.3.0 * 2017-12-??: Version 1.3.0
* Skip unit tests that fail with dnsmasq when the SKIP_DNSMASQ_ISSUE * Bugfix #300: Detect dnsmasq and skip unit test that fails with it.
variable is set. Thanks Konomi Kitten Thanks Tim Rühsen and Konomi Kitten
* Specify default available cipher suites for authenticated TLS * Specify default available cipher suites for authenticated TLS
upstreams with getdns_context_set_tls_ciphers_list() upstreams with getdns_context_set_tls_ciphers_list()
An upstream specific available cipher suite may also be given An upstream specific available cipher suite may also be given

View File

@ -144,6 +144,8 @@
uint16_t payload_size; uint16_t payload_size;
uint8_t do_bit; uint8_t do_bit;
getdns_transport_t trans; getdns_transport_t trans;
int upstream_is_dnsmasq = 0;
getdns_bindata *version_str = NULL;
/* Note that stricly this test just establishes that the requested transport /* Note that stricly this test just establishes that the requested transport
and the reported transport are consistent, it does not guarentee which and the reported transport are consistent, it does not guarentee which
@ -155,6 +157,17 @@
GETDNS_RETURN_GOOD, "Return code from getdns_context_set_resolution_type()"); GETDNS_RETURN_GOOD, "Return code from getdns_context_set_resolution_type()");
ASSERT_RC(getdns_dict_set_int(extensions,"return_call_reporting", GETDNS_EXTENSION_TRUE), ASSERT_RC(getdns_dict_set_int(extensions,"return_call_reporting", GETDNS_EXTENSION_TRUE),
GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_int()"); GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_int()");
ASSERT_RC(getdns_dict_set_int(extensions,"specify_class", GETDNS_RRCLASS_CH),
GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_int()");
ASSERT_RC(getdns_general_sync(context, "version.bind.", GETDNS_RRTYPE_TXT, extensions, &response),
GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()");
(void) getdns_dict_get_bindata(response, "/replies_tree/0/answer/0/rdata/txt_strings/0", &version_str);
upstream_is_dnsmasq = version_str && version_str->size > 7 &&
strncmp((char *)version_str->data, "dnsmasq", 7) == 0;
ASSERT_RC(getdns_dict_set_int(extensions,"specify_class", GETDNS_RRCLASS_IN),
GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_int()");
/* Request a response that should be truncated over UDP */ /* Request a response that should be truncated over UDP */
ASSERT_RC(getdns_context_set_dns_transport(context, GETDNS_TRANSPORT_UDP_ONLY), ASSERT_RC(getdns_context_set_dns_transport(context, GETDNS_TRANSPORT_UDP_ONLY),
@ -187,7 +200,7 @@
ASSERT_RC(type, GETDNS_RESOLUTION_STUB, "Query did not use stub mode"); ASSERT_RC(type, GETDNS_RESOLUTION_STUB, "Query did not use stub mode");
ASSERT_RC(getdns_dict_get_int(response, "/replies_tree/0/header/tc", &tc), ASSERT_RC(getdns_dict_get_int(response, "/replies_tree/0/header/tc", &tc),
GETDNS_RETURN_GOOD, "Failed to extract \"tc\""); GETDNS_RETURN_GOOD, "Failed to extract \"tc\"");
if (!getenv("SKIP_DNSMASQ_ISSUE")) { if (!upstream_is_dnsmasq) {
ASSERT_RC(tc, 1, "Packet not truncated as expected"); ASSERT_RC(tc, 1, "Packet not truncated as expected");
/* Re-do over TCP */ /* Re-do over TCP */