summaryrefslogtreecommitdiff
path: root/main/srv.c
AgeCommit message (Collapse)Author
2017-02-07srv: Fix crash when ast_srv_lookup is used and 0 records are returned.Joshua Colp
When performing an SRV lookup using the ast_srv_lookup function it did not properly handle the situation where 0 records are returned. If this happened it would wrongly assume that at least one record was present. This change fixes the code so it will exit early if an error occurs or if 0 records are returned. ASTERISK-26772 patches: srv_lookup.patch submitted by nappsoft (license 6822) Change-Id: I09b19081c74e0ad11c12bf54a257243b1bcb2351
2013-05-08Removed #if checks for crazy old versions of OS X.David M. Lee
The <arpa/nameser_compat.h> was introduced way back in OS X Panther, which itself was end-of-lifed back in 2007. We can assume that any OS X machine we build on will need that header file :-) Why bother removing it? The flag we're checking (__APPLE_CC__) is actually Apple's build number. Self-compiled versions of GCC (such as installing the latest version of GCC from homebrew) sets the value to 0, making it useless for this sort of compile flaggery. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388045 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-04-12Convert SRV lookup message to debug levelPaul Belanger
This helps clean up the Asterisk CLI by converting the log message from verbose to debug git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362043 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
2011-05-27Merged revisions 321392 via svnmerge fromRichard Mudgett
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r321392 | rmudgett | 2011-05-27 18:45:41 -0500 (Fri, 27 May 2011) | 12 lines Crash when using hagi and no servers are available. When none of the servers returned by the SRV querey respond, asterisk crashes. The problem is that if the loop over all the SRV entries finishes then the srv_context has already been cleaned up. * Make ast_srv_cleanup() check to see if the context is already cleaned up. (closes issue #19256) Reported by: byronclark ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@321393 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-16Formatting changesOlle Johansson
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@277102 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-09func_srv and explicit specification of a remote IP for SIP.Mark Michelson
From Review Board: There are two interrelated changes here. First, there is the introduction of func_srv. This adds two new read-only dialplan functions, SRVQUERY and SRVRESULT. They work very similarly to the ENUMQUERY and ENUMRESULT functions, except that this allows one to query SRV records instead. In order to facilitate this work, I added a couple of new API calls to srv.h. ast_srv_get_record_count tells the number of records returned by an SRV lookup. This number is calculated at the time of the SRV lookup. ast_srv_get_nth_record allows one to get a numbered SRV record. Second, there is the modification to chan_sip that allows one to specify a hostname or IP address (along with a port) to send an outgoing INVITE to when dialing a SIP peer. This goes hand-in-hand with func_srv. You can query SRV records and then use the host and port from the results to dial via a specific host instead of what is configured in sip.conf. Review: https://reviewboard.asterisk.org/r/608 SWP-1200 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256485 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-19Create iterative method for querying SRV results, and use that for finding ↵Tilghman Lesher
AGI servers. (closes issue #14775) Reported by: _brent_ Patches: 20091215__issue14775.diff.txt uploaded by tilghman (license 14) hagi-5.patch uploaded by brent (license 388) Tested by: _brent_ Reviewboard: https://reviewboard.asterisk.org/r/378/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@241188 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-12bump the verbosity of a message in srv.c up by one. It used to beMark Michelson
at this level prior to a large patch merge which converted ast_verbose calls to ast_verb (closes issue #14221) Reported by: jcovert Patches: srv.c.patch uploaded by jcovert (license 551) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168523 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
2007-12-14Convert ast_verbose to ast_verb.Tilghman Lesher
Reported by: snuffy Patch by: snuffy (Closes issue #11547) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@92913 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-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-11-14Merged revisions 89260 via svnmerge from Joshua Colp
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r89260 | file | 2007-11-13 21:15:12 -0400 (Tue, 13 Nov 2007) | 4 lines Return the proper value when the srv_callback function executes properly. (closes issue #11240) Reported by: jtodd ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89262 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-08Merged revisions 89105 via svnmerge from Kevin P. Fleming
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r89105 | kpfleming | 2007-11-08 00:26:47 -0500 (Thu, 08 Nov 2007) | 2 lines fix a glaring bug in the new SRV record handling that would cause incorrect weight sorting ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89107 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-08improve linked-list macros in two ways:Kevin P. Fleming
- the *_CURRENT macros no longer need the list head pointer argument - add AST_LIST_MOVE_CURRENT to encapsulate the remove/add operation when moving entries between lists git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89106 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-05Merged revisions 88719 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r88719 | russell | 2007-11-05 14:40:01 -0600 (Mon, 05 Nov 2007) | 7 lines Merge changes from asterisk/team/kpfleming/SRV-priority-handling Previously, the SRV record support in Asterisk was broken. There was no guarantee on what record Asterisk would choose to actually use. This set of changes improves the situation by ensuring that Asterisk will choose the highest priority record. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@88740 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-26Do a massive conversion for using the ast_verb() macroRussell Bryant
(closes issue #10277, patches by mvanbaak) Basically, this changes ... if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3, "Something\n"); to ... ast_verb(3, "Something\n"); git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77299 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-02-18add -Wundef to the --enable-dev-mode flags, so that mistyped macro names in ↵Kevin P. Fleming
#if expressions will be caught convert various #if expressions to #ifdef for macros that may not be defined (and where the value is not important) Note: two of these changes are in bison generated files which is going to be inconvenient when they are regenerated git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@55329 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