Commit Graph

6 Commits

Author SHA1 Message Date
snuffy 3b6e6cd01c tests_dns: Make DNS tests older nameser.h compatible
Fix the tests for DNS to use older style nameser.h as
in ASTERISK-26608.

Tested on: OpenBSD 6.0, Debian 8

ASTERISK-26647 #close

Change-Id: I285913c44202537c04b3ed09c015efa6e5f9052d
2016-12-08 07:22:33 +11:00
David M. Lee 40caf0ad9b Replaces clock_gettime() with ast_tsnow()
clock_gettime() is, unfortunately, not portable. But I did like that
over our usual `ts.tv_nsec = tv.tv_usec * 1000` copy/paste code we
usually do when we want a timespec and all we have is ast_tvnow().

This patch adds ast_tsnow(), which mimics ast_tvnow(), but returns a
timespec. If clock_gettime() is available, it will use that. Otherwise
ast_tsnow() falls back to using ast_tvnow().

Change-Id: Ibb1ee67ccf4826b9b76d5a5eb62e90b29b6c456e
2015-08-07 19:35:13 -05:00
Richard Mudgett b23f33e7e5 DNS: Fix some corner cases.
* Fix query_set destruction before we are done kicking the queries off.

* Fixed no queries requested handling.

* Add empty queries request unit test.

* Added missing allocation check in ast_dns_query_set_add().

* Made initial pjsip resolving query vector slightly larger.

ASTERISK-25115
Reported by: John Bigelow

Change-Id: Ie8be8347d0992e93946d72b6e7b1299727b038f2
2015-06-10 18:06:15 -05:00
Richard Mudgett ae589da466 DNS: Remove trailing newline from summary and descriptions.
Those trailing newlines mess up test formatting.

Change-Id: I5e3f3a55b82c9d7acb9661201d4993d1958f1185
2015-06-10 18:06:14 -05:00
Joshua Colp 7216e3c608 dns: Make query sets hold on to queries for their lifetime.
The query set documentation states that upon completion queries can be
retrieved for the lifetime of the query set. This is a reasonable
expectation but does not currently occur. This was originally done
to resolve a circular reference between queries and query sets, but
in practice the query can be kept.

This change makes it so a query does not have a reference to the
query set until it begins resolving. It also makes it so that the
reference is given up upon the query being completed. This allows
the queries to remain for the lifetime of the query set. As the
query set on the query is only useful to the query set functionality
and only for the lifetime that the query is resolving this is safe
to do.

ASTERISK-24994 #close
Reported by: Joshua Colp

Change-Id: I54e09c0cb45475896654e7835394524e816d1aa0
2015-04-22 13:28:09 -03:00
Joshua Colp a3cec44a0a res_pjsip: Add external PJSIP resolver implementation using core DNS API.
This change adds the following:

1. A query set implementation. This is an API that allows queries to be executed in parallel and once all have completed a callback is invoked.
2. Unit tests for the query set implementation.
3. An external PJSIP resolver which uses the DNS core API to do NAPTR, SRV, AAAA, and A lookups.

For the resolver it will do NAPTR, SRV, and AAAA/A lookups in parallel. If NAPTR or SRV
are available it will then do more queries. And so on. Preference is NAPTR > SRV > AAAA/A,
with IPv6 preferred over IPv4. For transport it will prefer TLS > TCP > UDP if no explicit
transport has been provided. Configured transports on the system are taken into account to
eliminate resolved addresses which have no hope of completing.

ASTERISK-24947 #close
Reported by: Joshua Colp

Change-Id: I56cb03ce4f9d3d600776f36928e0b3e379b5d71e
2015-04-15 10:47:53 -03:00