summaryrefslogtreecommitdiff
path: root/main/dns.c
AgeCommit message (Collapse)Author
2016-11-20Add support for older name resolving version libraries like openBSDsnuffy
Fix support of OS's like openBSD that use an older nameser.h, this change reverts the defines to the older style which on other systems is found in nameser_compat.h Tested on openBSD 6.0, Debian 8 ASTERISK-26608 #close Change-Id: Iffb36caab8c5aa9dece0ce2d009041f7b56cc86a
2016-10-27Remove ASTERISK_REGISTER_FILE.Corey Farrell
ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes all traces of it. Previously exported symbols removed: * __ast_register_file * __ast_unregister_file * ast_complete_source_filename This also removes the mtx_prof static variable that was declared when MTX_PROFILE was enabled. This variable was only used in lock.c so it is now initialized in that file only. ASTERISK-26480 #close Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
2016-06-02Fix res_search usageTimo Teräs
Resolver state is not part of res_search API. This fixes compilation error: dns.c:261:8: error: too many arguments to function 'res_search' ret = res_search(&dns_state, Change-Id: Ia600a58557040df83f744da3dde23225293845a5
2015-11-30dns: Change lookup failures from LOG_ERROR to debug 1.George Joseph
dns.c and dns_system_resolver.c were spitting out errors for lookup failures for things like not finding a SRV record even though there was an A record. Those have been changed to debug messages. Logging not finding ANY record is left to the higher level caller. Also, dns_system_resolver was using Windows line endings so I converted them to Unix style. The actual log changes are on lines 156 and 159. Change-Id: I65be16ea15304b96f9dcb4d289dbd3e2286fc094
2015-11-16dns: Fix pointer increment in dns_parse_answer_exGeorge Joseph
When dns_parse_answer_ex was iterating over the answers it wasn't incrementing the answer pointer correctly after the first answer. The result was that no answers after the first were being returned. For results where multiple records should have been sorted by priority, weight, etc., there was nothing to sort so the only the first record was returned even if it wouldn't have been the correct record based on the sort. ASTERISK-25565 #close Reported-by: Daniel Tryba Tested-by George Joseph Change-Id: I8622604fefdcd3c11e2c5609a6382e53b1467b0b
2015-11-06dns: Use ntohl for ans->ttl in dns_parse_answer_exGeorge Joseph
dns_parse_answer_ex was not converting ans->ttl from network by order to host byte order which was causing certain ttls it to go negative. In turn this was causing answer edit checks to fail. ASTERISK-25528 #close Reported-by: Daniel Tryba Tested-by: George Joseph Change-Id: I31505132d6321c46d2f39fd06c20ee808a864037
2015-07-31dns_core: Allow zero-length DNS responses.Mark Michelson
A testsuite test recently failed due to a crash that occurred in the DNS core. The problem was that the test could not resolve an address, did not set a result on the DNS query, and then indicated the query was completed. The DNS core does not handle the case of a query with no result gracefully, and so there is a crash. This changeset makes the DNS system resolver set a result with a zero-length answer in the case that a DNS resolution failure occurs early. The DNS core now also will accept such a response without treating it as invalid input. A unit test was updated to no longer treat setting a zero-length response as off-nominal. Change-Id: Ie56641e22debdaa61459e1c9a042e23b78affbf6
2015-07-07DNS: Create a system-level DNS resolverAshley Sanders
Prior to this patch, the DNS core present in master had no default system-level resolver implementation. Therefore, it was not possible for the DNS core to perform resolutions unless the libunbound library was installed and the res_resolver_unbound module was loaded. This patch introduces a system-level DNS resolver implementation that will register itself with the lowest consideration priority available (to ensure that it is to be used only as a last resort). The resolver relies on low-level DNS search functions to perform a rudimentary DNS search based on a provided query and then supplies the search results to the DNS core. ASTERISK-25146 #close Reported By: Joshua Colp Change-Id: I3b36ea17b889a98df4f8d80d50bb7ee175afa077
2015-04-13git migration: Refactor the ASTERISK_FILE_VERSION macroMatt Jordan
Git does not support the ability to replace a token with a version string during check-in. While it does have support for replacing a token on clone, this is somewhat sub-optimal: the token is replaced with the object hash, which is not particularly easy for human consumption. What's more, in practice, the source file version was often not terribly useful. Generally, when triaging bugs, the overall version of Asterisk is far more useful than an individual SVN version of a file. As a result, this patch removes Asterisk's support for showing source file versions. Specifically, it does the following: * Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and remove passing the version in with the macro. Other facilities than 'core show file version' make use of the file names, such as setting a debug level only on a specific file. As such, the act of registering source files with the Asterisk core still has use. The macro rename now reflects the new macro purpose. * main/asterisk: - Refactor the file_version structure to reflect that it no longer tracks a version field. - Remove the "core show file version" CLI command. Without the file version, it is no longer useful. - Remove the ast_file_version_find function. The file version is no longer tracked. - Rename ast_register_file_version/ast_unregister_file_version to ast_register_file/ast_unregister_file, respectively. * main/manager: Remove value from the Version key of the ModuleCheck Action. The actual key itself has not been removed, as doing so would absolutely constitute a backwards incompatible change. However, since the file version is no longer tracked, there is no need to attempt to include it in the Version key. * UPGRADE: Add notes for: - Modification to the ModuleCheck AMI Action - Removal of the "core show file version" CLI command Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
2014-08-21Clean up files that do not end with newlinesMatthew Jordan
Trivial patch to add new lines to several files missing them. This fixes warnings when compiling with gcc 4.1.2 on CentOS 5. ASTERISK-24245 #close Reported by: Shaun Ruffell patches: 0002-Trivial-addition-of-newlines-at-end-of-three-files.patch uploaded by Shaun Ruffell (License 5417) ........ Merged revisions 421677 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 421678 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421679 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-17res_pjsip: Enable PJSIP DNS client support.Joshua Colp
This change enables DNS client support within PJSIP. System nameservers are automatically discovered using res_init or res_ninit. If this fails then PJSIP will resort to using gethostbyname for resolution. By enabling this support we gain SRV support, failover, and weight support. (closes issue ASTERISK-23435) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/3343/ ........ Merged revisions 410795 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410796 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-14Remove redundant code in dns.cMatthew Jordan
Peter J Philipp pointed out that there are two checks that ensure that len is not less than 0. If len is less than 0, the function returns. Having both of them is clearly redundant. This removes the second and attempts to clarify (slightly) the error condition. (closes issue ASTERISK-21772) Reported by: Peter J Philipp git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394305 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-15Multiple revisions 369001-369002Kevin P. Fleming
........ r369001 | kpfleming | 2012-06-15 10:56:08 -0500 (Fri, 15 Jun 2012) | 11 lines Add support-level indications to many more source files. Since we now have tools that scan through the source tree looking for files with specific support levels, we need to ensure that every file that is a component of a 'core' or 'extended' module (or the main Asterisk binary) is explicitly marked with its support level. This patch adds support-level indications to many more source files in tree, but avoids adding them to third-party libraries that are included in the tree and to source files that don't end up involved in Asterisk itself. ........ r369002 | kpfleming | 2012-06-15 10:57:14 -0500 (Fri, 15 Jun 2012) | 3 lines Add a script to enable finding source files without support-levels defined. ........ Merged revisions 369001-369002 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 369005 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369013 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-22Kill off red blobs in most of main/*Kinsey Moore
Everything still compiled after making these changes, so I assume these whitespace-only changes didn't break anything (and shouldn't have). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360190 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-08Fix a few compilation problems found when building Asterisk against uClibc.Sean Bright
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@205214 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-29incorporates r159808 from branches/1.4:Kevin P. Fleming
------------------------------------------------------------------------ r159808 | kpfleming | 2008-11-29 10:58:29 -0600 (Sat, 29 Nov 2008) | 7 lines update dev-mode compiler flags to match the ones used by default on Ubuntu Intrepid, so all developers will see the same warnings and errors since this branch already had some printf format attributes, enable checking for them and tag functions that didn't have them format attributes in a consistent way ------------------------------------------------------------------------ in addition: move some format attributes from main/utils.c to the header files they belong in, and fix up references to the relevant functions based on new compiler warnings git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@159818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-08Fix a bug in SRV lookups where dnsmgr would discard everything but the Brett Bryant
first SRV result from DNS before processing weights and priorities and dns_parse_answer wouldn't report that there were no records in DNS unless a failure occured. Also fixed a bug where dnsmgr_refresh would report that a entry was being changed when ast_gethostbyname had failed. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@129156 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-01Merged revisions 112138 via svnmerge from Mark Michelson
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r112138 | mmichelson | 2008-04-01 12:21:21 -0500 (Tue, 01 Apr 2008) | 10 lines Initialize the __res_state structure used for dns purposes to all 0's prior to using it. This is due to valgrind's complaints on issue #12284 as well as an excerpt found in "Description" portion of the online man page found here: http://www.iti.cs.tu-bs.de/cgi-bin/UNIXhelp/man-cgi?res_nquery+3RESOLV (pertains to issue #12284 but does not necessarily close it) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@112148 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-04Whitespace changes onlyTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105840 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-21remove a bunch of useless #include "options.h"Luigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89511 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-19another bunch of include removals (errno.h and asterisk/logger.h)Luigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89425 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-17fix breakage induced by previous mistakeLuigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89382 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-16Start untangling header inclusion in a way that does not affectLuigi Rizzo
build times - tested, there is no measureable difference before and after this commit. In this change: use asterisk/compat.h to include a small set of system headers: inttypes.h, unistd.h, stddef.h, stddint.h, sys/types.h, stdarg.h, stdlib.h, alloca.h, stdio.h Where available, the inclusion is conditional on HAVE_FOO_H as determined by autoconf. Normally, source files should not include any of the above system headers, and instead use either "asterisk.h" or "asterisk/compat.h" which does it better. For the time being I have left alone second-level directories (main/db1-ast, etc.). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89333 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-04Merged revisions 81435 via svnmerge from Joshua Colp
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r81435 | file | 2007-09-04 10:10:56 -0300 (Tue, 04 Sep 2007) | 7 lines (closes issue #10610) Reported by: john Patches: dns.c.patch uploaded by john (license 218) Tested by: mvanbaak Don't return a match if no SRV record actually exists. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81436 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-16Merged revisions 75306 via svnmerge from Kevin P. Fleming
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r75306 | kpfleming | 2007-07-16 15:53:24 -0500 (Mon, 16 Jul 2007) | 11 lines Merged revisions 75304 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r75304 | kpfleming | 2007-07-16 15:46:58 -0500 (Mon, 16 Jul 2007) | 3 lines provide proper copyright/license attribution for this structure that was copied from a BSD-licensed header file long, long ago... ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75307 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-10Merged revisions 74388 via svnmerge from Jason Parker
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r74388 | qwell | 2007-07-10 14:10:36 -0500 (Tue, 10 Jul 2007) | 4 lines Don't use #if to check if something is defined - use #ifdef instead. Pointed out by kpfleming ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@74390 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-10Merged revisions 74374 via svnmerge from Jason Parker
https://origsvn.digium.com/svn/asterisk/branches/1.4 (closes issue #10133) ................ r74374 | qwell | 2007-07-10 13:39:30 -0500 (Tue, 10 Jul 2007) | 13 lines Merged revisions 74373 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r74373 | qwell | 2007-07-10 13:37:23 -0500 (Tue, 10 Jul 2007) | 5 lines Use res_ndestroy on systems that have it. Otherwise, use res_nclose. This prevents a memleak on NetBSD - and possibly others. Issue 10133, patch by me, reported and tested by scw ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@74375 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-14Add a massive set of changes for converting to use the ast_debug() macro.Russell Bryant
(issue #9957, patches from mvanbaak, caio1982, critch, and dimas) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@69327 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-02-21Return trunk to a state where it compiles under Darwin. The byte order stuff ↵Joshua Colp
is ugly, if anyone wants to clean it up... by all means do so. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@55763 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-03bug #8076 check option_debug before printing to debug channel.Matt O'Gorman
patch provided in bugnote, with minor changes. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44253 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-08-21merge new_loader_completion branch, including (at least):Kevin P. Fleming
- restructured build tree and makefiles to eliminate recursion problems - support for embedded modules - support for static builds - simpler cross-compilation support - simpler module/loader interface (no exported symbols) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@40722 65c4cc65-6c06-0410-ace0-fbb531ad65f3