summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-06-08Fix unsafe uses of ast_context pointers.Corey Farrell
Although ast_context_find, ast_context_find_or_create and ast_context_destroy perform locking of the contexts table, any context pointer can become invalid at any time that the contexts table is unlocked. This change adds locking around all complete operations involving these functions. Places where ast_context_find was followed by ast_context_destroy have been replaced with calls ast_context_destroy_by_name. ASTERISK-25094 #close Reported by: Corey Farrell Change-Id: I1866b6787730c9c4f3f836b6133ffe9c820734fa
2015-06-05Merge "test_sorcery_memory_cache_thrash: Add unit tests for thrashing the ↵Matt Jordan
memory cache."
2015-06-05Merge "res_sorcery_memory_cache: Implement expire_on_reload option."Matt Jordan
2015-06-05Fixes for OS XDavid M. Lee
* Add some type casting so tv_usec can really be a long, instead of some strange platform specific type. * Add some .dylib style files to .gitignore. * Switch from using -Xlinker to -Wl,. For [reasons unknown][], newer versions of GCC, when compiling the Homebrew formula for Asterisk, are not properly passing the -Xlinker options to the linker. Given that -Wl, does exactly the [same thing][], and does it properly, this patch changes the -Xlinker options to use -Wl, instead. [reasons unknown]: http://bit.ly/1SUbEYx [same thing]: https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html Change-Id: Id5e6b3c6cc86282ea5fca630dc3991137c5bf4dd
2015-06-05CLI: Cosmetic issue - core show uptimeibercom
Show uptime information ends with an unnecessary space. Now NEEDCOMMA is better defined. Change-Id: I11b360504a0703309ff51772ff8f672287f3c5a1
2015-06-04res_sorcery_memory_cache: Implement expire_on_reload option.Joshua Colp
This change implements the expire_on_reload option for memory caches. If enabled and a reload is performed all objects within the cache will be expired and the cache emptied. ASTERISK-25067 Reported by: Matt Jordan Change-Id: Id46aa1957d660556700e689e195eed57c989b85e
2015-06-04test_sorcery_memory_cache_thrash: Add unit tests for thrashing the memory cache.Joshua Colp
This change adds a CLI command which can perform memory cache thrashing as well as unit tests which perform thrashing under the following configurations: 1. Low number of unique objects that go stale after 1 second 2. Low number of unique objects that expire after 1 second 3. Low number of unique objects which are constantly updated 4. Large number of unique objects which exceed a defined cache size 5. Large number of unique objects which exceed a defined cache size that also expire and go stale rapidly 6. Large number of unique objects which expire and go stale rapidly 7. Large number of unique objects For all of the above there are a large number of threads constantly attempting to retrieve random objects and each test runs for a few seconds. ASTERISK-25067 Reported by: Matt Jordan Change-Id: I8c8ceff977332c80ed4a31f10d694d48552b2f78
2015-06-04Merge "res_sorcery_memory_cache: Add test event when a refresh occurs."Mark Michelson
2015-06-04Merge "Remove const cast from leaf functions."Matt Jordan
2015-06-04res_sorcery_memory_cache: Add test event when a refresh occurs.Joshua Colp
This change adds a testsuite event for when a refresh occurs. This is useful as it provides a guaranteed mechanism of knowing when it has occurred instead of waiting an arbitrary amount of time. ASTERISK-25067 Reported by: Matt Jordan Change-Id: Iaa6b8d2d6bab7f99ee08e1c8908b8272a8987e65
2015-06-03res_pjsip: Prevent access of NULL channels.Mark Michelson
It is possible to receive incoming requests or responses after the channel on an ast_sip_session has been destroyed and NULLed out. Handlers of these sorts of requests or responses need to be prepared for the possibility that the channel is NULL or else they could cause a crash. While several places have been amended to deal with NULL channels, there were still a couple of places that needed updating. res_pjsip_dtmf_info.c: When handling incoming INFO requests, we need to return early if there is no channel on the session. res_pjsip_session.c: When handling a 302 response, we need to stop the redirecting attempt if there is no channel on the session. ASTERISK-25148 #close reported by Mark Michelson Change-Id: Id1a75ffc3d0eaa168b0b28188fb54d6cf9fc47a9
2015-06-03res_pjsip/location: Fix ref leak in contact_apply_handlerGeorge Joseph
contact_apply_handler calls ast_res_pjsip_find_or_create_contact_status to force the creation of a contact_status object whenever a new contact is added but it didn't unref the returned object. Added an ao2_cleanup(status) to plug the leak. ASTERISK-25141 Change-Id: Icc1401cae142855a1abc86ab5179dfb3ee861c40 Reported-by: Corey Farrell
2015-06-02res_pjsip: Remove outgoing authentication code no longer needed.Richard Mudgett
Associated with ASTERISK-25131 Change-Id: Iefa3b2066cfd8b108a90d2dd4a64d92c3a195d33
2015-06-02res_pjsip_session: Fix cherry pick to master compile error.Richard Mudgett
ASTERISK-25131 Reported by: Richard Mudgett Change-Id: I87c9c96ae4a8fe2bc8a0ddea6958a2ad9cefd8e3
2015-06-02Remove const cast from leaf functions.Joerg Sonnenberger
app_control_register_rule and app_control_unregister_rule lock/unlock the queue, which is a mutating operation according to the ao2_lock/_unlock prototype. Depending on the specific (implicit) casts in SCOPED_LOCK and RAII_VAR, the compiler may warn or not. As the only callers of those functions do not have the const, get consistent results by just dropping it. Change-Id: Ib9e6296155a39bc5d627142a3828180c3cfe8fbb
2015-06-02Merge "tcptls.c: Don't use OpenSSL functions when no SSL support is present."Matt Jordan
2015-06-02Merge "cdr/cdr_csv.c: Set file name for csv master to the module when ↵Matt Jordan
(re)loaded."
2015-06-02tcptls.c: Don't use OpenSSL functions when no SSL support is present.Joerg Sonnenberger
Change-Id: I68a85a7fcbdb282140ff333c6274b6763d5f82a3
2015-06-02Merge "res_pjsip_session: Fix in-dialog authentication."Matt Jordan
2015-06-01Merge "Fix buffer overflow in slin sample frames generation."Mark Michelson
2015-06-01cdr/cdr_csv.c: Set file name for csv master to the module when (re)loaded.Rodrigo Ramírez Norambuena
Compute the location for the csv master file when the module is loaded or reload. Before it was calculated every time a log entry was written. Change-Id: I3ed9f6a8f965308099db70b71128f43d4d3f5585
2015-06-01Merge "res_sorcery_memory_cache: Add CLI commands and AMI actions."Mark Michelson
2015-06-01Merge "res_sorcery_memory_cache: Add support for refreshing stale objects."Joshua Colp
2015-06-01res_pjsip_session: Fix in-dialog authentication.Richard Mudgett
When the remote peer requires authentication for in-dialog requests then re-INVITEs to the peer cause the call to be disconnected and other in-dialog requests to the peer like MESSAGE just don't go through. * Made session_inv_on_tsx_state_changed() handle in-dialog authentication for re-INVITEs and other methods. Initial INVITEs cannot be handled here because the INVITE transaction must be restarted earlier. * Pulled needed code from res/res_pjsip/pjsip_outbound_auth.c in preparation for removing the file. The generic outbound authentication code did not work as well as anticipated. * Created outbound_invite_auth() to only handle initial outbound INVITEs. Re-INVITEs cannot be handled here. The re-INVITE transaction is still in progress and the PJSIP library cannot handle the overlapping INVITE transactions. Other method types should not be handled here as this code only works on outgoing calls and we need to handle incoming and outgoing calls. ASTERISK-25131 #close Reported by: Richard Mudgett Change-Id: I12bdd7ddccc819b4ce4b091e826d1e26334601b0
2015-06-01pjsip_configuration: Fix leak in persistent_endpoint_update_state.Corey Farrell
The loop to find the first available contact of an endpoint grabbed contact from the iterator, then checked for offline state. This caused the first contact after the state was found to leak a reference. ASTERISK-25141 Change-Id: Id0f1d87410fc63742db0594eb4b18b36e99aec08
2015-05-31Fix buffer overflow in slin sample frames generation.Ivan Poddubny
The length of frames retured by sample functions was twice as large as real, what caused global buffer overflow caught by AddressSanitizer. ASTERISK-24717 #close Reported by: Badalian Vyacheslav Change-Id: Iec2fe682aef13e556684912f906bedf7c18229c6
2015-05-29res_pjsip/location: Fix memory leak in permanent_uri_handlerGeorge Joseph
When permanent_uri_handler was creating the contact status object for each contact, it wasn't unreffing it at the end of the loop. ASTERISK-25141 #close Reported-by: Corey Farrell Change-Id: I7bb127994677bb3d459f87952f8425c9b9967b12
2015-05-29Merge "Revert "endpoint/stasis: Eliminate duplicate events on endpoint ↵Joshua Colp
status change""
2015-05-29Revert "endpoint/stasis: Eliminate duplicate events on endpoint status change"George Joseph
This reverts commit 6fca75bb628dfff2ab112e80b0228cf3ac0b8a05. Change-Id: Ifee026cc63e22c5ac5717c37867a9f036373ae5a
2015-05-29res_sorcery_memory_cache: Add CLI commands and AMI actions.Joshua Colp
This change adds the following CLI commands and AMI actions: sorcery memory cache show sorcery memory cache dump sorcery memory cache expire sorcery memory cache stale SorceryMemoryCacheExpire SorceryMemoryCacheExpireObject SorceryMemoryCacheStale SorceryMemoryCacheStaleObject These allow both examination and manipulation of sorcery memory caches from external sources. Cached objects can be explicitly expired from a cache or marked as stale. If expired they are immediately removed. If marked as stale they will be background refreshed when next retrieved. ASTERISK-25067 Reported by Matt Jordan Change-Id: I68e03cfd8c34b5e07f4b6ee4fd93a3f4a00a3d9e
2015-05-29Merge "res/res_config_pgsql.c: Use PQescapeStringConn for escaping names."Matt Jordan
2015-05-27endpoint/stasis: Eliminate duplicate events on endpoint status changeGeorge Joseph
When an endpoint was created, it's messages were being forwarded to both the tech endpoint topic and the all endpoints topic. Since the tech topic was also forwarded to all, this was resulting in duplicate messages whenever an endpoint published. This patch causes the endpoint to only forward to the tech topic and lets the tech topic forward to all. To accomplish this, the existing stasis_cp_single_create function (which both creates and forwards) was cloned and split into 2 functions, one that creates the topic and one that sets up the forwarding. This allows endpoint_internal_create to create the topic from the endpoint_all cache without forwarding it there, then allows it to do the forward to the tech's topic. ASTERISK-25137 #close Reported-by: Vitezslav Novy ASTERISK-25116 #close Reported-by: George Joseph <george.joseph@fairview5.com> Tested-by: George Joseph <george.joseph@fairview5.com> Change-Id: I26d7d4926a0861748fd3bdffe316b75b549a801c
2015-05-27res_sorcery_memory_cache: Add support for refreshing stale objects.Mark Michelson
This change introduces a check of object_lifetime_stale when retrieving cached objects. If the amount of time the object has been in the cache exceeds the lifetime, then a task is scheduled to update the cached object based on an object retrieved from other sorcery wizards instead. To prevent the cached object from being retrieved during a refresh, thread-local storage is used to mark the thread as being a stale object update. This results in the cache returning no object, leading to sorcery querying other wizards for the object instead. A test has been added for stale objects as well. This test ensures that stale objects are retrieved the same as freshly-cached objects. The test also ensures that after an object is stale, changes in the backend are reflected in the cache, to include if the object has been deleted from the backend. ASTERISK-25067 Reported by Matt Jordan Change-Id: I9bd7c049adf6939bfe2899f393c2bfbbf412d217
2015-05-26res_pjsip: Add AMI events for chan_pjsip contact lifecycle changesGeorge Joseph
Add a new ContactStatus AMI event. Publish the following status/state changes: Created Removed Reachable Unreachable Unknown Contact URI, new status/state, aor and endpoint names, and the last qualify rtt result are included in the event. ASTERISK-25114 #close Change-Id: Id25aae5f7122facba183273efb3e8f36c20fb61e Reported-by: George Joseph <george.joseph@fairview5.com> Tested-by: George Joseph <george.joseph@fairview5.com>
2015-05-26Merge "Astobj2: Correctly treat hash_fn returning INT_MIN"Joshua Colp
2015-05-26res/res_config_pgsql.c: Use PQescapeStringConn for escaping names.Rodrigo Ramírez Norambuena
Use function PQescapeStringConn for escaping the name of the table and schema instead of doing it manually. ASTERISK-25132 #close Reported By: Rodrigo Ramírez Norambuena <decipher.hk@gmail.com> Change-Id: I302a263f7210d20925f14716b508b081998b7608
2015-05-26sorcery: Fix cache creation callback.Joshua Colp
The cache creation callback function expects to receive a sorcery_details structure and not just a standalone object. Change-Id: I3e4a5a137cb25292eb52d7a14cbb6daa09213450
2015-05-25Astobj2: Correctly treat hash_fn returning INT_MINIvan Poddubny
The code in astobj2_hash.c wrongly assumed that abs(int) is always > 0. However, abs(INT_MIN) = INT_MIN and is still negative, as well as abs(INT_MIN) % num_buckets, and as a result this led to a crash. One way to trigger the bug is using host=::80 or 0.0.0.128 in peer configuration section in chan_sip or chan_iax. This patch takes the remainder before applying abs, so that bucket number is always in range. ASTERISK-25100 #close Reported by: Mark Petersen Change-Id: Id6981400ad526f47e10bcf7b847b62bd2785e899
2015-05-24Merge "Stasis: Fix unsafe use of stasis_unsubscribe in modules."Matt Jordan
2015-05-24Merge "res_pjsip_transport_websocket: Fix crash on receiving large SIP packets"Matt Jordan
2015-05-23res_pjsip_transport_websocket: Fix crash on receiving large SIP packetsIvan Poddubny
Incoming SIP packets larger than PJSIP_MAX_PKT_LEN were themselves truncated before passing to pjsip_tpmgr_receive_packet, but the length was passed unaltered, thus causing memory corruption and segfault. ASTERISK-25122 #close Change-Id: I608a6b6b7f229eacc33a0a7d771d18e27e5b08ab
2015-05-22Stasis: Fix unsafe use of stasis_unsubscribe in modules.Corey Farrell
Many uses of stasis_unsubscribe in modules can be reached through unload. These have been switched to stasis_unsubscribe_and_join. Some subscription callbacks do nothing, for these I've created a noop callback function in stasis.c. This is used by some modules that monitor MWI topics in order to enable cache, since the callback does not become invalid after dlclose it is safe to use stasis_unsubscribe on these, even during module unload. ASTERISK-25121 #close Change-Id: Ifc2549fbd8eef7d703c222978e8f452e2972189c
2015-05-22Astobj2: Run weakproxy subscription callbacks in reverse order.Corey Farrell
Modify ao2_weakproxy_subscribe so each new subscription is added to the head of the list. This ensures that when other objects are allocated and use a subscription to the weakproxy for cleanup, cleanup will occur in the correct order. ASTERISK-25120 #close Change-Id: Ie0476f08ec21330de1b3f5a2dd3d9eb683df3d3d
2015-05-22res/res_pjsip_pubsub: Note that 'dialog' is also a valid event type for RLSMatt Jordan
In addition to specifying lists of 'presence' and 'message-summary', users can also create lists of type 'dialog'. These should be treated in the same fashion as 'presence'. Change-Id: I583bb69cd9f88b0b29bf09ddaddeac4e84189f6e
2015-05-22res/res_pjsip_exten_state: Fix confusing NOTICE messageMatt Jordan
When a SUBSCRIBE request is made to a dialplan hint that doesn't exist, the current NOTICE message informing users of this swaps the context and extension parameters. This can cause a bit of confusion. Thanks to CptBurger in #asterisk for helping to point this out. Change-Id: Ie584d1a58ae217385c87a450ca25b55ca0e36e43
2015-05-22Merge "res_sorcery_memory_cache: Add support for object_lifetime_maximum."Mark Michelson
2015-05-22res/ari: Register Stasis application on WebSocket attemptMatt Jordan
Prior to this patch, when a WebSocket connection is made, ARI would not be informed of the connection until after the WebSocket layer had accepted the connection. This created a brief race condition where the ARI client would be notified that it was connected, a channel would be sent into the Stasis dialplan application, but ARI would not yet have registered the Stasis application presented in the HTTP request that established the WebSocket. This patch resolves this issue by doing the following: * When a WebSocket attempt is made, a callback is made into the ARI application layer, which verifies and registers the apps presented in the HTTP request. Because we do not yet have a WebSocket, we cannot have an event session for the corresponding applications. Some defensive checks were thus added to make the application objects tolerant to a NULL event session. * When a WebSocket connection is made, the registered application is updated with the newly created event session that wraps the WebSocket connection. ASTERISK-24988 #close Reported by: Joshua Colp Change-Id: Ia5dc60dc2b6bee76cd5aff0f69dd53b36e83f636
2015-05-22Merge "res_sorcery_memory_cache: Add support for maximum_objects."Matt Jordan
2015-05-22Merge "res_pjsip: Refactor endpt_send_transaction (qualify_timeout)"Joshua Colp
2015-05-22Merge "res_pjsip_outbound_registration: Check request URI for line."Mark Michelson