summaryrefslogtreecommitdiff
path: root/main/netsock2.c
AgeCommit message (Collapse)Author
2017-12-20Fix Common Typo's.Corey Farrell
Fix instances of: * Retreive * Recieve * other then * different then * Repeated words ("the the", "an an", "and and", etc). * othterwise, teh ASTERISK-24198 #close Change-Id: I3809a9c113b92fd9d0d9f9bac98e9c66dc8b2d31
2017-08-10STUN/netsock2: Fix some valgrind uninitialized memory findings.Richard Mudgett
* netsock2.c: Test the addr->len member first as it may be the only member initialized in the struct. * stun.c:ast_stun_handle_packet(): The combinded[] local array could get used uninitialized by ast_stun_request(). The uninitialized string gets copied to another location and could overflow the destination memory buffer. These valgrind findings were found for ASTERISK_27150 but are not necessarily a fix for the issue. Change-Id: I55f8687ba4ffc0f69578fd850af006a56cbc9a57
2017-05-05netsock2.c: Made get/set addr port avoid potential uninitialized memory.Richard Mudgett
Change-Id: I532052bd7cd95a4b3565485fc01e2a1ea07ee647
2015-03-17Audit ast_sockaddr_resolve() usage for memory leaks.Richard Mudgett
Valgrind found some memory leaks associated with ast_sockaddr_resolve(). Most of the leaks had already been fixed by earlier memory leak hunt patches. This patch performs an audit of ast_sockaddr_resolve() and found one more. * Fix ast_sockaddr_resolve() memory leak in apps/app_externalivr.c:app_exec(). * Made main/netsock2.c:ast_sockaddr_resolve() always set the addrs parameter for safety so the pointer will never be uninitialized on return. The same goes for res/res_pjsip_acl.c:extract_contact_addr(). * Made functions that call ast_sockaddr_resolve() with RAII_VAR() controlling the addrs variable use ast_free instead of ast_free_ptr to provide better MALLOC_DEBUG information. Review: https://reviewboard.asterisk.org/r/4509/ ........ Merged revisions 433056 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433057 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-19pjsip cli: Change Identify to show CIDR notation instead of netmasks.George Joseph
* Added ast_sockaddr_cidr_bits() to count the 1 bits in an ast_sockaddr. * Added ast_ha_join_cidr() which uses ast_sockaddr_cidr_bits() for the netmask instead of ast_sockaddr_stringify_addr. * Changed res_pjsip_endpoint_identifier_ip to call ast_ha_join_cidr() instead of ast_ha_join() for the CLI output. This is a CLI change only. AMI was not affected. Tested by: George Joseph Review: https://reviewboard.asterisk.org/r/3652/ ........ Merged revisions 416737 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416738 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-13chan_sip: Add TLS and SRTP status to CLI command 'sip show channel'Jonathan Rose
ASTERISK-23564 #close Reported by: Patrick Laimbock Review: https://reviewboard.asterisk.org/r/3474/ ........ Merged revisions 413876 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 413877 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413878 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-04Add IPv6 Support To chan_iax2Michael L. Young
This patch adds IPv6 support to chan_iax2. Yay! (closes issue ASTERISK-22025) Patches: iax2-ipv6-v5-reviewboard.diff by Michael L. Young (license 5026) Review: https://reviewboard.asterisk.org/r/2660/ ........ Merged revisions 400567 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400568 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-20Fix NULL pointer segfault in ast_sockaddr_parse()Michael L. Young
While working with ast_parse_arg() to perform a validity check, a segfault occurred. The segfault occurred due to passing a NULL pointer to ast_sockaddr_parse() from ast_parse_arg(). According to the documentation in config.h, "result pointer to the result. NULL is valid here, and can be used to perform only the validity checks." This patch fixes the segfault by checking for a NULL pointer. This patch also adds documentation to netsock2.h about why it is necessary to check for a NULL pointer. (Closes issue ASTERISK-20006) Reported by: Michael L. Young Tested by: Michael L. Young Patches: asterisk-20006-netsock-null-ptr.diff uploaded by Michael L. Young (license 5026) Review: https://reviewboard.asterisk.org/r/1990/ ........ Merged revisions 369108 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 369109 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369110 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-05-18Fix a variety of memory leaksMatthew Jordan
This patch addresses a number of memory leaks in a variety of modules that were found by a static analysis tool. A brief summary of the changes: * app_minivm: free ast_str objects on off nominal paths * app_page: free the ast_dial object if the requested channel technology cannot be appended to the dialing structure * app_queue: if a penalty rule failed to match any existing rule list names, the created rule would not be inserted and its memory would be leaked * app_read: dispose of the created silence detector in the presence of off nominal circumstances * app_voicemail: dispose of an allocated unique ID field for MWI event un-subscribe requests in off nominal paths; dispose of configuration objects when using the secret.conf option * chan_dahdi: dispose of the allocated frame produced by ast_dsp_process * chan_iax2: properly unref peer in CLI command "iax2 unregister" * chan_sip: dispose of the allocated frame produced by sip_rtp_read's call of ast_dsp_process; free memory in parse unit tests * func_dialgroup: properly deref ao2 object grhead in nominal path of dialgroup_read * func_odbc: free resultset in off nominal paths of odbc_read * cli: free match_list in off nominal paths of CLI match completion * config: free comment_buffer/list_buffer when configuration file load is unchanged; free the same buffers any time they were created and config files were processed * data: free XML nodes in various places * enum: free context buffer in off nominal paths * features: free ast_call_feature in off nominal paths of applicationmap config processing * netsock2: users of ast_sockaddr_resolve pass in an ast_sockaddr struct that is allocated by the method. Failures in ast_sockaddr_resolve could result in the users of the method not knowing whether or not the buffer was allocated. The method will now not allocate the ast_sockaddr struct if it will return failure. * pbx: cleanup hash table traversals in off nominal paths; free ignore pattern buffer if it already exists for the specified context * xmldoc: cleanup various nodes when we no longer need them * main/editline: various cleanup of pointers not being freed before being assigned to other memory, cleanup along off nominal paths * menuselect/mxml: cleanup of value buffer for an attribute when that attribute did not specify a value * res_calendar*: responses are allocated via the various *_request method returns and should not be allocated in the various write_event methods; ensure attendee buffer is freed if no data exists in the parsed node; ensure that calendar objects are de-ref'd appropriately * res_jabber: free buffer in off nominal path * res_musiconhold: close the DIR* object in off nominal paths * res_rtp_asterisk: if we run out of ports, close the rtp socket object and free the rtp object * res_srtp: if we fail to create the session in libsrtp, destroy the temporary ast_srtp object (issue ASTERISK-19665) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/1922 ........ Merged revisions 366880 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 366881 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366917 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-08-18Merged revisions 332560 via svnmerge from Terry Wilson
https://origsvn.digium.com/svn/asterisk/branches/10 ................ r332560 | twilson | 2011-08-18 16:34:04 -0500 (Thu, 18 Aug 2011) | 12 lines Merged revisions 332559 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r332559 | twilson | 2011-08-18 16:26:01 -0500 (Thu, 18 Aug 2011) | 5 lines Fix possible error on stringification of IPv4-mapped addrs The FreeBSD netsock2 test has been failing for a while. We were pasing sa->len to getnameinfo instead of sa_tmp->len. ASTERISK-18289 ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@332561 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-06-22Merged revisions 324484 via svnmerge from Terry Wilson
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r324484 | twilson | 2011-06-22 13:52:04 -0500 (Wed, 22 Jun 2011) | 20 lines Stop sending IPv6 link-local scope-ids in SIP messages The idea behind the patch listed below was used, but in a more targeted manner. There are now address stringification functions for addresses that are meant to be sent to a remote party. Link-local scope-ids only make sense on the machine from which they originate and so are stripped in the new functions. There is also a host sanitization function added to chan_sip which is used for when peer and dialog tohost fields or sip_registry hostnames are used to craft a SIP message. Also added are some basic unit tests for netsock2 address parsing. (closes issue ASTERISK-17711) Reported by: ch_djalel Patches: asterisk-1.8.3.2-ipv6_ll_scope.patch uploaded by ch_djalel (license 1251) Review: https://reviewboard.asterisk.org/r/1278/ ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@324487 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-06-14Merged revisions 323392,323394 via svnmerge from Richard Mudgett
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r323392 | rmudgett | 2011-06-14 12:21:24 -0500 (Tue, 14 Jun 2011) | 6 lines Add more strict hostname checking to ast_dnsmgr_lookup(). Change suggested in review. Review: https://reviewboard.asterisk.org/r/1240/ ........ r323394 | rmudgett | 2011-06-14 12:21:39 -0500 (Tue, 14 Jun 2011) | 2 lines Made ast_sockaddr_split_hostport() port warning msgs more meaningful. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@323397 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-26Merged revisions 321100 via svnmerge from Mark Murawki
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r321100 | markm | 2011-05-26 16:09:35 -0400 (Thu, 26 May 2011) | 11 lines ast_sockaddr_resolve() in netsock2.c may deref a null pointer Added a null check in netsock2 ast_sockaddr_resolve() as well as added default initalizers in chan_sip parse_uri_legacy_check() to make sure that invalid uris will make null (and not undefined) user,pass,domain,transport variables (closes issue #19346) Reported by: kobaz Patches: netsock2.patch uploaded by kobaz (license 834) Tested by: kobaz, Marquis ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@321101 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-01-26Merged revisions 304245 via svnmerge from Matthew Nicholson
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r304245 | mnicholson | 2011-01-26 14:43:27 -0600 (Wed, 26 Jan 2011) | 20 lines Merged revisions 304244 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ................ r304244 | mnicholson | 2011-01-26 14:42:16 -0600 (Wed, 26 Jan 2011) | 13 lines Merged revisions 304241 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r304241 | mnicholson | 2011-01-26 14:38:22 -0600 (Wed, 26 Jan 2011) | 6 lines This patch modifies chan_sip to route responses to the address the request came from. It also modifies chan_sip to respect the maddr parameter in the Via header. ABE-2664 Review: https://reviewboard.asterisk.org/r/1059/ ........ ................ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@304246 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-10-18Merged revisions 292188 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r292188 | russell | 2010-10-18 14:50:04 -0500 (Mon, 18 Oct 2010) | 9 lines Resolve some compiler errors in ast_sockaddr_is_any(). These errors came up once this function was used from within netsock2.c. The errors were like the following: netsock2.c:393: error: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules The usage of a union here avoids this problem. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@292189 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-10-18Merged revisions 292155 via svnmerge from David Vossel
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r292155 | dvossel | 2010-10-18 14:16:00 -0500 (Mon, 18 Oct 2010) | 2 lines Fixes build error for systems not supporting IPV6_TCLASS. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@292156 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-10-18Merged revisions 292085 via svnmerge from David Vossel
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r292085 | dvossel | 2010-10-18 11:02:17 -0500 (Mon, 18 Oct 2010) | 7 lines Fixes qos settings for sockets bound to any IPv6 or IPv4 address. (closes issue #18099) Reported by: jamesnet Patches: issues_18099_v3.diff uploaded by dvossel (license 671 ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@292086 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-10-14Merged revisions 291829 via svnmerge from David Vossel
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r291829 | dvossel | 2010-10-14 17:09:32 -0500 (Thu, 14 Oct 2010) | 8 lines Set TCLASS field of IPv6 header when sip qos options are set. (closes issue #18099) Reported by: jamesnet Patches: issues_18099_v2.diff uploaded by dvossel (license 671) Tested by: dvossel, jamesnet ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@291830 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-08-19Merged revisions 282826 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r282826 | tilghman | 2010-08-19 09:44:51 -0500 (Thu, 19 Aug 2010) | 2 lines Only output debugging if the debug level is on. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@282827 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-08-11Merged revisions 281687 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r281687 | simon.perreault | 2010-08-11 09:30:59 -0400 (Wed, 11 Aug 2010) | 9 lines Fix parsing of IPv6 address literals in outboundproxy (closes issue #17757) Reported by: oej Patches: 17757.diff uploaded by sperreault (license 252) sip.conf.diff uploaded by sperreault (license 252) Tested by: oej ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@281688 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-27Merged revisions 279817 via svnmerge from David Vossel
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r279817 | dvossel | 2010-07-27 11:09:15 -0500 (Tue, 27 Jul 2010) | 2 lines fix sip transaction match with authentication, fix confusing log message when using getaddrinfo ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@279818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-19Make ACLs IPv6-capable.Mark Michelson
ACLs can now be configured to match IPv6 networks. This is only relevant for ACLs in chan_sip for now since other channel drivers do not support IPv6 addressing. However, once those channel drivers are outfitted to support IPv6 addressing, the ACLs will already be ready for IPv6 support. https://reviewboard.asterisk.org/r/791 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@277814 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-12Allow netsock2.c to compile on systems that do not define AI_NUMERICSERV.Mark Michelson
(closes issue #17617) Reported by: pprindeville Patches: asterisk-trunk-bugid17617.patch uploaded by pprindeville (license 347) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@275587 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-09Kill some startup warnings and errors and make some messages more helpful in ↵Tilghman Lesher
tracking down the source. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@275105 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-09Sadly we can't dereference a pointer cast and use it as an lvalue without ↵
getting this warning (at least with gcc 4.4.4): netsock2.c:492: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules So we're back to using memcpy()... git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@274909 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-08Add IPv6 to Asterisk.Mark Michelson
This adds a generic API for accommodating IPv6 and IPv4 addresses within Asterisk. While many files have been updated to make use of the API, chan_sip and the RTP code are the files which actually support IPv6 addresses at the time of this commit. The way has been paved for easier upgrading for other files in the near future, though. Big thanks go to Simon Perrault, Marc Blanchet, and Jean-Philippe Dionne for their hard work on this. (closes issue #17565) Reported by: russell Patches: asteriskv6-test-report.pdf uploaded by russell (license 2) Review: https://reviewboard.asterisk.org/r/743 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@274783 65c4cc65-6c06-0410-ace0-fbb531ad65f3