2015-07-22 15:46:44 +02:00
|
|
|
#include "or.h"
|
|
|
|
#include "test.h"
|
|
|
|
|
|
|
|
#define DNS_PRIVATE
|
|
|
|
|
|
|
|
#include "dns.h"
|
|
|
|
#include "connection.h"
|
|
|
|
|
2015-09-27 18:51:04 +02:00
|
|
|
#define NS_MODULE dns
|
|
|
|
|
|
|
|
#define NS_SUBMODULE clip_ttl
|
|
|
|
|
2015-07-22 15:46:44 +02:00
|
|
|
static void
|
2015-09-27 18:51:04 +02:00
|
|
|
NS(test_main)(void *arg)
|
2015-07-22 15:46:44 +02:00
|
|
|
{
|
|
|
|
(void)arg;
|
|
|
|
|
|
|
|
uint32_t ttl_mid = MIN_DNS_TTL / 2 + MAX_DNS_TTL / 2;
|
|
|
|
|
|
|
|
tt_int_op(dns_clip_ttl(MIN_DNS_TTL - 1),==,MIN_DNS_TTL);
|
|
|
|
tt_int_op(dns_clip_ttl(ttl_mid),==,ttl_mid);
|
|
|
|
tt_int_op(dns_clip_ttl(MAX_DNS_TTL + 1),==,MAX_DNS_TTL);
|
|
|
|
|
|
|
|
done:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-09-27 18:51:04 +02:00
|
|
|
#undef NS_SUBMODULE
|
|
|
|
|
|
|
|
#define NS_SUBMODULE expiry_ttl
|
|
|
|
|
2015-07-22 15:46:44 +02:00
|
|
|
static void
|
2015-09-27 18:51:04 +02:00
|
|
|
NS(test_main)(void *arg)
|
2015-07-22 15:46:44 +02:00
|
|
|
{
|
|
|
|
(void)arg;
|
|
|
|
|
|
|
|
uint32_t ttl_mid = MIN_DNS_TTL / 2 + MAX_DNS_ENTRY_AGE / 2;
|
|
|
|
|
|
|
|
tt_int_op(dns_get_expiry_ttl(MIN_DNS_TTL - 1),==,MIN_DNS_TTL);
|
|
|
|
tt_int_op(dns_get_expiry_ttl(ttl_mid),==,ttl_mid);
|
|
|
|
tt_int_op(dns_get_expiry_ttl(MAX_DNS_ENTRY_AGE + 1),==,MAX_DNS_ENTRY_AGE);
|
|
|
|
|
|
|
|
done:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-09-27 18:51:04 +02:00
|
|
|
#undef NS_SUBMODULE
|
|
|
|
|
|
|
|
#define NS_SUBMODULE resolve
|
|
|
|
|
2015-07-22 15:46:44 +02:00
|
|
|
static int resolve_retval = 0;
|
|
|
|
static int resolve_made_conn_pending = 0;
|
|
|
|
static char *resolved_name = NULL;
|
|
|
|
static cached_resolve_t *cache_entry = NULL;
|
|
|
|
|
|
|
|
static int n_fake_impl = 0;
|
|
|
|
|
2015-09-28 20:44:05 +02:00
|
|
|
NS_DECL(int, dns_resolve_impl, (edge_connection_t *exitconn, int is_resolve,
|
|
|
|
or_circuit_t *oncirc, char **hostname_out,
|
|
|
|
int *made_connection_pending_out,
|
|
|
|
cached_resolve_t **resolve_out));
|
|
|
|
|
2015-07-22 15:46:44 +02:00
|
|
|
/** This will be our configurable substitute for <b>dns_resolve_impl</b> in
|
|
|
|
* dns.c. It will return <b>resolve_retval</b>,
|
|
|
|
* and set <b>resolve_made_conn_pending</b> to
|
|
|
|
* <b>made_connection_pending_out</b>. It will set <b>hostname_out</b>
|
|
|
|
* to a duplicate of <b>resolved_name</b> and it will set <b>resolve_out</b>
|
|
|
|
* to <b>cache_entry</b>. Lastly, it will increment <b>n_fake_impl</b< by
|
|
|
|
* 1.
|
|
|
|
*/
|
2015-08-26 17:38:04 +02:00
|
|
|
static int
|
2015-09-28 20:44:05 +02:00
|
|
|
NS(dns_resolve_impl)(edge_connection_t *exitconn, int is_resolve,
|
|
|
|
or_circuit_t *oncirc, char **hostname_out,
|
|
|
|
int *made_connection_pending_out,
|
|
|
|
cached_resolve_t **resolve_out)
|
2015-07-22 15:46:44 +02:00
|
|
|
{
|
2015-08-26 17:38:04 +02:00
|
|
|
(void)oncirc;
|
|
|
|
(void)exitconn;
|
|
|
|
(void)is_resolve;
|
|
|
|
|
2015-07-22 15:46:44 +02:00
|
|
|
if (made_connection_pending_out)
|
|
|
|
*made_connection_pending_out = resolve_made_conn_pending;
|
|
|
|
|
|
|
|
if (hostname_out && resolved_name)
|
|
|
|
*hostname_out = tor_strdup(resolved_name);
|
|
|
|
|
|
|
|
if (resolve_out && cache_entry)
|
|
|
|
*resolve_out = cache_entry;
|
|
|
|
|
|
|
|
n_fake_impl++;
|
|
|
|
|
|
|
|
return resolve_retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static edge_connection_t *conn_for_resolved_cell = NULL;
|
|
|
|
|
|
|
|
static int n_send_resolved_cell_replacement = 0;
|
|
|
|
static uint8_t last_answer_type = 0;
|
|
|
|
static cached_resolve_t *last_resolved;
|
|
|
|
|
|
|
|
static void
|
2015-09-28 20:44:05 +02:00
|
|
|
NS(send_resolved_cell)(edge_connection_t *conn, uint8_t answer_type,
|
|
|
|
const cached_resolve_t *resolved)
|
2015-07-22 15:46:44 +02:00
|
|
|
{
|
|
|
|
conn_for_resolved_cell = conn;
|
2015-08-26 17:38:44 +02:00
|
|
|
|
2015-07-22 15:46:44 +02:00
|
|
|
last_answer_type = answer_type;
|
|
|
|
last_resolved = (cached_resolve_t *)resolved;
|
|
|
|
|
|
|
|
n_send_resolved_cell_replacement++;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int n_send_resolved_hostname_cell_replacement = 0;
|
|
|
|
|
|
|
|
static char *last_resolved_hostname = NULL;
|
|
|
|
|
|
|
|
static void
|
2015-09-28 20:44:05 +02:00
|
|
|
NS(send_resolved_hostname_cell)(edge_connection_t *conn,
|
|
|
|
const char *hostname)
|
2015-07-22 15:46:44 +02:00
|
|
|
{
|
|
|
|
conn_for_resolved_cell = conn;
|
|
|
|
|
2015-08-26 17:41:25 +02:00
|
|
|
tor_free(last_resolved_hostname);
|
|
|
|
last_resolved_hostname = tor_strdup(hostname);
|
2015-07-22 15:46:44 +02:00
|
|
|
|
|
|
|
n_send_resolved_hostname_cell_replacement++;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int n_dns_cancel_pending_resolve_replacement = 0;
|
|
|
|
|
|
|
|
static void
|
2015-09-28 20:44:05 +02:00
|
|
|
NS(dns_cancel_pending_resolve)(const char *address)
|
2015-07-22 15:46:44 +02:00
|
|
|
{
|
2015-08-26 17:38:04 +02:00
|
|
|
(void) address;
|
2015-07-22 15:46:44 +02:00
|
|
|
n_dns_cancel_pending_resolve_replacement++;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int n_connection_free = 0;
|
|
|
|
static connection_t *last_freed_conn = NULL;
|
|
|
|
|
|
|
|
static void
|
2015-09-28 20:44:05 +02:00
|
|
|
NS(connection_free)(connection_t *conn)
|
2015-07-22 15:46:44 +02:00
|
|
|
{
|
|
|
|
n_connection_free++;
|
|
|
|
|
|
|
|
last_freed_conn = conn;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-09-27 18:51:04 +02:00
|
|
|
NS(test_main)(void *arg)
|
2015-07-22 15:46:44 +02:00
|
|
|
{
|
2015-08-26 17:38:04 +02:00
|
|
|
(void) arg;
|
2015-07-22 15:46:44 +02:00
|
|
|
int retval;
|
|
|
|
int prev_n_send_resolved_hostname_cell_replacement;
|
|
|
|
int prev_n_send_resolved_cell_replacement;
|
|
|
|
int prev_n_connection_free;
|
|
|
|
cached_resolve_t *fake_resolved = tor_malloc(sizeof(cached_resolve_t));
|
|
|
|
edge_connection_t *exitconn = tor_malloc(sizeof(edge_connection_t));
|
|
|
|
edge_connection_t *nextconn = tor_malloc(sizeof(edge_connection_t));
|
|
|
|
|
|
|
|
or_circuit_t *on_circuit = tor_malloc(sizeof(or_circuit_t));
|
|
|
|
memset(on_circuit,0,sizeof(or_circuit_t));
|
|
|
|
on_circuit->base_.magic = OR_CIRCUIT_MAGIC;
|
|
|
|
|
|
|
|
memset(fake_resolved,0,sizeof(cached_resolve_t));
|
|
|
|
memset(exitconn,0,sizeof(edge_connection_t));
|
|
|
|
memset(nextconn,0,sizeof(edge_connection_t));
|
|
|
|
|
2015-09-28 20:44:05 +02:00
|
|
|
NS_MOCK(dns_resolve_impl);
|
|
|
|
NS_MOCK(send_resolved_cell);
|
|
|
|
NS_MOCK(send_resolved_hostname_cell);
|
2015-07-22 15:46:44 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* CASE 1: dns_resolve_impl returns 1 and sets a hostname. purpose is
|
|
|
|
* EXIT_PURPOSE_RESOLVE.
|
|
|
|
*
|
|
|
|
* We want dns_resolve() to call send_resolved_hostname_cell() for a
|
|
|
|
* given exit connection (represented by edge_connection_t object)
|
|
|
|
* with a hostname it received from _impl.
|
2015-08-26 17:38:44 +02:00
|
|
|
*/
|
2015-07-22 15:46:44 +02:00
|
|
|
|
2015-08-26 17:38:44 +02:00
|
|
|
prev_n_send_resolved_hostname_cell_replacement =
|
2015-07-22 15:46:44 +02:00
|
|
|
n_send_resolved_hostname_cell_replacement;
|
|
|
|
|
|
|
|
exitconn->base_.purpose = EXIT_PURPOSE_RESOLVE;
|
|
|
|
exitconn->on_circuit = &(on_circuit->base_);
|
|
|
|
|
|
|
|
resolve_retval = 1;
|
|
|
|
resolved_name = tor_strdup("www.torproject.org");
|
|
|
|
|
|
|
|
retval = dns_resolve(exitconn);
|
2015-08-26 17:38:44 +02:00
|
|
|
|
2015-07-22 15:46:44 +02:00
|
|
|
tt_int_op(retval,==,1);
|
|
|
|
tt_str_op(resolved_name,==,last_resolved_hostname);
|
|
|
|
tt_assert(conn_for_resolved_cell == exitconn);
|
|
|
|
tt_int_op(n_send_resolved_hostname_cell_replacement,==,
|
|
|
|
prev_n_send_resolved_hostname_cell_replacement + 1);
|
|
|
|
tt_assert(exitconn->on_circuit == NULL);
|
|
|
|
|
2015-08-26 17:41:25 +02:00
|
|
|
tor_free(last_resolved_hostname);
|
|
|
|
// implies last_resolved_hostname = NULL;
|
2015-07-22 15:46:44 +02:00
|
|
|
|
|
|
|
/* CASE 2: dns_resolve_impl returns 1, but does not set hostname.
|
|
|
|
* Instead, it yields cached_resolve_t object.
|
|
|
|
*
|
2015-08-26 17:38:44 +02:00
|
|
|
* We want dns_resolve to call send_resolved_cell on exitconn with
|
2015-07-22 15:46:44 +02:00
|
|
|
* RESOLVED_TYPE_AUTO and the cached_resolve_t object from _impl.
|
|
|
|
*/
|
|
|
|
|
|
|
|
tor_free(resolved_name);
|
|
|
|
resolved_name = NULL;
|
|
|
|
|
|
|
|
exitconn->on_circuit = &(on_circuit->base_);
|
|
|
|
|
|
|
|
cache_entry = fake_resolved;
|
|
|
|
|
|
|
|
prev_n_send_resolved_cell_replacement =
|
|
|
|
n_send_resolved_cell_replacement;
|
|
|
|
|
|
|
|
retval = dns_resolve(exitconn);
|
|
|
|
|
|
|
|
tt_int_op(retval,==,1);
|
|
|
|
tt_assert(conn_for_resolved_cell == exitconn);
|
|
|
|
tt_int_op(n_send_resolved_cell_replacement,==,
|
|
|
|
prev_n_send_resolved_cell_replacement + 1);
|
|
|
|
tt_assert(last_resolved == fake_resolved);
|
|
|
|
tt_int_op(last_answer_type,==,0xff);
|
|
|
|
tt_assert(exitconn->on_circuit == NULL);
|
|
|
|
|
|
|
|
/* CASE 3: The purpose of exit connection is not EXIT_PURPOSE_RESOLVE
|
|
|
|
* and _impl returns 1.
|
2015-08-26 17:38:44 +02:00
|
|
|
*
|
2015-07-22 15:46:44 +02:00
|
|
|
* We want dns_resolve to prepend exitconn to n_streams linked list.
|
|
|
|
* We don't want it to send any cells about hostname being resolved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
exitconn->base_.purpose = EXIT_PURPOSE_CONNECT;
|
|
|
|
exitconn->on_circuit = &(on_circuit->base_);
|
|
|
|
|
|
|
|
on_circuit->n_streams = nextconn;
|
|
|
|
|
|
|
|
prev_n_send_resolved_cell_replacement =
|
|
|
|
n_send_resolved_cell_replacement;
|
|
|
|
|
2015-08-26 17:38:44 +02:00
|
|
|
prev_n_send_resolved_hostname_cell_replacement =
|
2015-07-22 15:46:44 +02:00
|
|
|
n_send_resolved_hostname_cell_replacement;
|
|
|
|
|
|
|
|
retval = dns_resolve(exitconn);
|
|
|
|
|
|
|
|
tt_int_op(retval,==,1);
|
|
|
|
tt_assert(on_circuit->n_streams == exitconn);
|
|
|
|
tt_assert(exitconn->next_stream == nextconn);
|
|
|
|
tt_int_op(prev_n_send_resolved_cell_replacement,==,
|
|
|
|
n_send_resolved_cell_replacement);
|
|
|
|
tt_int_op(prev_n_send_resolved_hostname_cell_replacement,==,
|
|
|
|
n_send_resolved_hostname_cell_replacement);
|
|
|
|
|
2015-08-26 17:38:44 +02:00
|
|
|
/* CASE 4: _impl returns 0.
|
|
|
|
*
|
|
|
|
* We want dns_resolve() to set exitconn state to
|
2015-07-22 15:46:44 +02:00
|
|
|
* EXIT_CONN_STATE_RESOLVING and prepend exitconn to resolving_streams
|
|
|
|
* linked list.
|
2015-08-26 17:38:44 +02:00
|
|
|
*/
|
2015-07-22 15:46:44 +02:00
|
|
|
|
|
|
|
exitconn->on_circuit = &(on_circuit->base_);
|
|
|
|
|
|
|
|
resolve_retval = 0;
|
|
|
|
|
|
|
|
exitconn->next_stream = NULL;
|
|
|
|
on_circuit->resolving_streams = nextconn;
|
|
|
|
|
|
|
|
retval = dns_resolve(exitconn);
|
|
|
|
|
|
|
|
tt_int_op(retval,==,0);
|
|
|
|
tt_int_op(exitconn->base_.state,==,EXIT_CONN_STATE_RESOLVING);
|
|
|
|
tt_assert(on_circuit->resolving_streams == exitconn);
|
|
|
|
tt_assert(exitconn->next_stream == nextconn);
|
|
|
|
|
2015-08-26 17:38:44 +02:00
|
|
|
/* CASE 5: _impl returns -1 when purpose of exitconn is
|
2015-07-22 15:46:44 +02:00
|
|
|
* EXIT_PURPOSE_RESOLVE. We want dns_resolve to call send_resolved_cell
|
|
|
|
* on exitconn with type being RESOLVED_TYPE_ERROR.
|
2015-08-26 17:38:44 +02:00
|
|
|
*/
|
2015-07-22 15:46:44 +02:00
|
|
|
|
2015-09-28 20:44:05 +02:00
|
|
|
NS_MOCK(dns_cancel_pending_resolve);
|
|
|
|
NS_MOCK(connection_free);
|
2015-07-22 15:46:44 +02:00
|
|
|
|
|
|
|
exitconn->on_circuit = &(on_circuit->base_);
|
|
|
|
exitconn->base_.purpose = EXIT_PURPOSE_RESOLVE;
|
|
|
|
|
|
|
|
resolve_retval = -1;
|
|
|
|
|
|
|
|
prev_n_send_resolved_cell_replacement =
|
|
|
|
n_send_resolved_cell_replacement;
|
|
|
|
|
|
|
|
prev_n_connection_free = n_connection_free;
|
|
|
|
|
|
|
|
retval = dns_resolve(exitconn);
|
|
|
|
|
|
|
|
tt_int_op(retval,==,-1);
|
|
|
|
tt_int_op(n_send_resolved_cell_replacement,==,
|
|
|
|
prev_n_send_resolved_cell_replacement + 1);
|
|
|
|
tt_int_op(last_answer_type,==,RESOLVED_TYPE_ERROR);
|
|
|
|
tt_int_op(n_dns_cancel_pending_resolve_replacement,==,1);
|
|
|
|
tt_int_op(n_connection_free,==,prev_n_connection_free + 1);
|
|
|
|
tt_assert(last_freed_conn == TO_CONN(exitconn));
|
|
|
|
|
|
|
|
done:
|
2015-09-28 20:44:05 +02:00
|
|
|
NS_UNMOCK(dns_resolve_impl);
|
|
|
|
NS_UNMOCK(send_resolved_cell);
|
|
|
|
NS_UNMOCK(send_resolved_hostname_cell);
|
|
|
|
NS_UNMOCK(dns_cancel_pending_resolve);
|
|
|
|
NS_UNMOCK(connection_free);
|
2015-07-22 15:46:44 +02:00
|
|
|
tor_free(on_circuit);
|
|
|
|
tor_free(exitconn);
|
|
|
|
tor_free(nextconn);
|
|
|
|
tor_free(resolved_name);
|
|
|
|
tor_free(fake_resolved);
|
2015-08-26 17:41:25 +02:00
|
|
|
tor_free(last_resolved_hostname);
|
2015-07-22 15:46:44 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-09-27 18:51:04 +02:00
|
|
|
#undef NS_SUBMODULE
|
|
|
|
|
2015-10-08 20:27:17 +02:00
|
|
|
/** Create an <b>edge_connection_t</b> instance that is considered a
|
|
|
|
* valid exit connection by asserts in dns_resolve_impl.
|
|
|
|
*/
|
|
|
|
static edge_connection_t *
|
|
|
|
create_valid_exitconn(void)
|
|
|
|
{
|
|
|
|
edge_connection_t *exitconn = tor_malloc_zero(sizeof(edge_connection_t));
|
|
|
|
TO_CONN(exitconn)->type = CONN_TYPE_EXIT;
|
|
|
|
TO_CONN(exitconn)->magic = EDGE_CONNECTION_MAGIC;
|
|
|
|
TO_CONN(exitconn)->purpose = EXIT_PURPOSE_RESOLVE;
|
|
|
|
TO_CONN(exitconn)->state = EXIT_CONN_STATE_RESOLVING;
|
|
|
|
exitconn->base_.s = TOR_INVALID_SOCKET;
|
|
|
|
|
|
|
|
return exitconn;
|
|
|
|
}
|
|
|
|
|
2015-10-07 21:14:48 +02:00
|
|
|
#define NS_SUBMODULE ASPECT(resolve_impl, addr_is_ip_no_need_to_resolve)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Given that <b>exitconn->base_.address</b> is IP address string, we
|
|
|
|
* want dns_resolve_impl() to parse it and store in
|
|
|
|
* <b>exitconn->base_.addr</b>. We expect dns_resolve_impl to return 1.
|
|
|
|
* Lastly, we want it to set the TTL value to default one for DNS queries.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
NS(test_main)(void *arg)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
int made_pending;
|
|
|
|
const tor_addr_t *resolved_addr;
|
|
|
|
tor_addr_t addr_to_compare;
|
|
|
|
|
|
|
|
tor_addr_parse(&addr_to_compare, "8.8.8.8");
|
|
|
|
|
|
|
|
or_circuit_t *on_circ = tor_malloc_zero(sizeof(or_circuit_t));
|
|
|
|
|
2015-10-08 20:27:17 +02:00
|
|
|
edge_connection_t *exitconn = create_valid_exitconn();
|
2015-10-07 21:14:48 +02:00
|
|
|
|
|
|
|
TO_CONN(exitconn)->address = tor_strdup("8.8.8.8");
|
|
|
|
|
|
|
|
retval = dns_resolve_impl(exitconn, 1, on_circ, NULL, &made_pending,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
resolved_addr = &(exitconn->base_.addr);
|
|
|
|
|
|
|
|
tt_int_op(retval,==,1);
|
2015-10-08 20:27:17 +02:00
|
|
|
tt_assert(tor_addr_eq(resolved_addr, (const tor_addr_t *)&addr_to_compare));
|
2015-10-07 21:14:48 +02:00
|
|
|
tt_int_op(exitconn->address_ttl,==,DEFAULT_DNS_TTL);
|
|
|
|
|
|
|
|
done:
|
|
|
|
tor_free(on_circ);
|
|
|
|
tor_free(TO_CONN(exitconn)->address);
|
|
|
|
tor_free(exitconn);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef NS_SUBMODULE
|
|
|
|
|
|
|
|
#define NS_SUBMODULE ASPECT(resolve_impl, non_exit)
|
|
|
|
|
|
|
|
static void
|
|
|
|
NS(test_main)(void *arg)
|
|
|
|
{
|
|
|
|
tt_skip();
|
|
|
|
|
|
|
|
done:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef NS_SUBMODULE
|
|
|
|
|
|
|
|
#define NS_SUBMODULE ASPECT(resolve_impl, addr_is_invalid_dest)
|
|
|
|
|
|
|
|
static void
|
|
|
|
NS(test_main)(void *arg)
|
|
|
|
{
|
|
|
|
tt_skip();
|
|
|
|
|
|
|
|
done:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef NS_SUBMODULE
|
|
|
|
|
|
|
|
#define NS_SUBMODULE ASPECT(resolve_impl, malformed_ptr)
|
|
|
|
|
|
|
|
static void
|
|
|
|
NS(test_main)(void *arg)
|
|
|
|
{
|
|
|
|
tt_skip();
|
|
|
|
|
|
|
|
done:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef NS_SUBMODULE
|
|
|
|
|
|
|
|
#define NS_SUBMODULE ASPECT(resolve_impl, cache_hit_pending)
|
|
|
|
|
|
|
|
static void
|
|
|
|
NS(test_main)(void *arg)
|
|
|
|
{
|
|
|
|
tt_skip();
|
|
|
|
|
|
|
|
done:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef NS_SUBMODULE
|
|
|
|
|
|
|
|
#define NS_SUBMODULE ASPECT(resolve_impl, cache_hit_cached)
|
|
|
|
|
|
|
|
static void
|
|
|
|
NS(test_main)(void *arg)
|
|
|
|
{
|
|
|
|
tt_skip();
|
|
|
|
|
|
|
|
done:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef NS_SUBMODULE
|
|
|
|
|
|
|
|
#define NS_SUBMODULE ASPECT(resolve_impl, cache_miss)
|
|
|
|
|
|
|
|
static void
|
|
|
|
NS(test_main)(void *arg)
|
|
|
|
{
|
|
|
|
tt_skip();
|
|
|
|
|
|
|
|
done:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef NS_SUBMODULE
|
|
|
|
|
2015-07-22 15:46:44 +02:00
|
|
|
struct testcase_t dns_tests[] = {
|
2015-09-27 18:51:04 +02:00
|
|
|
TEST_CASE(clip_ttl),
|
|
|
|
TEST_CASE(expiry_ttl),
|
|
|
|
TEST_CASE(resolve),
|
2015-10-07 21:14:48 +02:00
|
|
|
TEST_CASE_ASPECT(resolve_impl, addr_is_ip_no_need_to_resolve),
|
|
|
|
TEST_CASE_ASPECT(resolve_impl, non_exit),
|
|
|
|
TEST_CASE_ASPECT(resolve_impl, addr_is_invalid_dest),
|
|
|
|
TEST_CASE_ASPECT(resolve_impl, malformed_ptr),
|
|
|
|
TEST_CASE_ASPECT(resolve_impl, cache_hit_pending),
|
|
|
|
TEST_CASE_ASPECT(resolve_impl, cache_hit_cached),
|
|
|
|
TEST_CASE_ASPECT(resolve_impl, cache_miss),
|
2015-07-22 15:46:44 +02:00
|
|
|
END_OF_TESTCASES
|
|
|
|
};
|
|
|
|
|
2015-09-27 18:51:04 +02:00
|
|
|
#undef NS_MODULE
|
|
|
|
|