Skip to content
Snippets Groups Projects
  1. Oct 13, 2018
    • Corey Farrell's avatar
      threadpool: Eliminate pointless AO2 usage. · f06de690
      Corey Farrell authored
      thread_worker_pair, set_size_data and task_pushed_data structures are
      allocated with AO2 objects, passed to a taskprocessor, then released.
      They never have multiple owners or use locking so AO2 only adds
      overhead.
      
      Change-Id: I2204d2615d9d952670fcb48e0a9c0dd1a6ba5036
      f06de690
  2. Oct 12, 2018
    • Corey Farrell's avatar
      main/astfd: Fix GCC8 format-truncation warning. · 675d8a46
      Corey Farrell authored
      The field used to store call arguments was not large enough to hold the
      arguments string that can be constructed for 'open'.  Expand it to
      prevent this warning/error.
      
      Change-Id: I514927f256481bc84df10a51b19d5b5fb1bc387e
      675d8a46
  3. Oct 05, 2018
    • neutrino88's avatar
      core/frame: generate correct T.140 payload in ast_sendtext_data() · 17f4e6ad
      neutrino88 authored
      ast_sendtext_data() would create an incorrect T.140 text frame which
      length include the null terminator byte. It causes ultimately RTP
      packets to be send with this trailing 0. The proposed fix just set the
      correct length to the text frame
      
      ASTERISK-28089
      Reported by: Emmanuel BUU
      Tested by: Emmanuel BUU
      
      Change-Id: I7ab1b9ed1e21683b2b667ea0a59d9aba3c77dd96
      17f4e6ad
  4. Oct 04, 2018
    • Corey Farrell's avatar
      loader: Flag module as declined in all cases where it fails to load. · c8ee1a18
      Corey Farrell authored
      This has no effect on startup since AST_MODULE_LOAD_FAILURE aborts
      startup, but it's possible for this code to be returned on manual load
      of a module after startup.
      
      It is an error for a module to not have a load callback but this is not
      a fatal system error.  In this case flag the module as declined, return
      AST_MODULE_LOAD_FAILURE only if a required module is broken.
      
      Expand doxygen documentation for AST_MODULE_LOAD_*.
      
      Change-Id: I3c030bb917f6e5a0dfd9d91491a4661b348cabf8
      Unverified
      c8ee1a18
  5. Oct 03, 2018
    • Corey Farrell's avatar
      astobj2: Comment on OBJ_NOLOCK in ao2_container_clone. · 932d0a40
      Corey Farrell authored
      The test for OBJ_NOLOCK looks wrong but it isn't.  Add comments to
      prevent confusion.
      
      Change-Id: I9662b82eb39e7627a1f1944fd18f967a2b987344
      932d0a40
    • Sean Bright's avatar
      http.c: Reload TLS even if http.conf hasn't changed · 286339aa
      Sean Bright authored
      There is currently no way to indicate to Asterisk that TLS certificates
      and/or keys have been updated other than by modifying http.conf or
      restarting Asterisk.
      
      There is already code in main/tcptls.c that determines if a reload is
      actually necessary based on the hashes of the certicate and dependent
      files, so this change merely gives us a way to request a reload without
      explicitly modifying http.conf.
      
      Change-Id: Ie795420dcc7eb3d91336820688a29adbcc321276
      286339aa
  6. Oct 02, 2018
    • Corey Farrell's avatar
      core: Disable astobj2 locking for some common objects. · cacbe325
      Corey Farrell authored
      * ACO options
      * Indications
      * Module loader ref_debug object
      * Media index info and variants
      * xmldoc items
      
      These allocation locations were identified using reflocks.py on the
      master branch.
      
      Change-Id: Ie999b9941760be3d1946cdb6e30cb85fd97504d8
      Unverified
      cacbe325
    • Corey Farrell's avatar
      loader: Fix result of module reload error. · b25a261a
      Corey Farrell authored
      When a module reload fails we never set AST_MODULE_RELOAD_ERROR.  This
      caused reload failures to incorrectly report 'No module found'.
      
      Change-Id: I5f3953e0f7d135e53ec797f24c97ee3f73f232e7
      Unverified
      b25a261a
    • Corey Farrell's avatar
      loader: Improve error handling. · e4cf513f
      Corey Farrell authored
      * Display list of unavailable dependencies when they cause another
        module to fail loading.
      * When a module declines to load find all modules which depend on it so
        they can be declined and listed together.
      * Prevent retry of declined modules during startup.
      * When a module fails to dlopen try loading it with RTLD_LAZY so we can
        attempt to display the list of missing dependencies.
      
      These changes are meant to reduce logger spam that is caused when a
      module has many dependencies and declines to load.  This also fixes some
      error paths which failed to recognize required modules.
      
      Module load/start errors are delayed until the end of loader startup.
      
      Change-Id: I046052c71331c556c09d39f47a3b92975f3e1758
      Unverified
      e4cf513f
    • neutrino88's avatar
      core/frame: Fix ast_frdup() and ast_frisolate() for empty text frames · 24cece66
      neutrino88 authored
      If a channel creates an AST_TEXT_FRAME with datalen == 0, the ast_frdup()
      and ast_frisolate() functions could create a clone frame with an invalid
      data.ptr which would cause a crash.  The proposed fix is to make sure that
      for such empty text frames, ast_frdup() and ast_frisolate() return cloned
      text frames with a valid data.ptr.
      
      ASTERISK-28076
      Reported by: Emmanuel BUU
      Tested by: Emmanuel BUU
      
      Change-Id: Ib882dd028598f13c4c233edbfdd7e54ad44a68e9
      24cece66
    • Corey Farrell's avatar
      astobj2: Record lock usage to refs log when DEBUG_THREADS is enabled. · 13df7452
      Corey Farrell authored
      When DEBUG_THREADS is enabled we can know if the astobj2 mutex / rwlock
      was ever used, so it can be recorded in the REF_DEBUG destructor entry.
      
      Create contrib/scripts/reflocks.py to process locking used by
      allocator.  This can be used to identify places where
      AO2_ALLOC_OPT_LOCK_NOLOCK should be used to reduce memory usage.
      
      Change-Id: I2e3cd23336a97df2692b545f548fd79b14b53bf4
      Unverified
      13df7452
  7. Sep 28, 2018
    • Corey Farrell's avatar
      lock: Improve performance of DEBUG_THREADS. · 205c6be8
      Corey Farrell authored
      Add a volatile flag to lock tracking structures so we only need to use
      the global lock when first initializing tracking.
      
      Additionally add support for DEBUG_THREADS_LOOSE_ABI.  This is used by
      astobj2.c to eliminate storage for tracking fields when DEBUG_THREADS is
      not defined.
      
      Change-Id: Iabd650908901843e9fff47ef1c539f0e1b8cb13b
      Unverified
      205c6be8
  8. Sep 27, 2018
    • Corey Farrell's avatar
      astobj2: Reduce memory overhead. · 62a0db2d
      Corey Farrell authored
      Reduce options to 2-bit field, magic to 30 bit field.  Move ref_counter
      next to options and explicitly use int32_t so the fields will pack.
      
      This reduces memory overhead for every ao2 object by 8 bytes on x86_64.
      
      Change-Id: Idc1baabb35ec3b3d8de463c4fa3011eaf7fcafb5
      Unverified
      62a0db2d
    • Sean Bright's avatar
      config.c: Cleanup AST_INCLUDE_GLOB · ac23e5ad
      Sean Bright authored
      * In main/config.c, AST_INCLUDE_GLOB is fixed to '1' making the #ifdefs
        pointless.
      
      * In utils/extconf.c, AST_INCLUDE_GLOB is never defined so there is a
        lot of dead code.
      
      Change-Id: I1bad1a46d7466ddf90d52cc724e997195495226c
      ac23e5ad
    • Corey Farrell's avatar
      astobj2: Fix shutdown order. · 39bf9881
      Corey Farrell authored
      When REF_DEBUG and AO2_DEBUG are both enabled we closed the refs log
      before we shutdown astobj2_container.  This caused the AO2_DEBUG
      container registration container to be reported as a leak.
      
      Change-Id: If9111c4c21c68064b22c546d5d7a41fac430430e
      Unverified
      39bf9881
  9. Sep 24, 2018
    • Corey Farrell's avatar
      jansson: Backport fixes to bundled, use json_vsprintf if available. · adf539b2
      Corey Farrell authored
      Use json_vsprintf from versions which contain fix for va_copy leak.
      
      Apply fixes from jansson master:
      * va_copy leak fix.
      * Avoid potential invalid memory read in json_pack.
      * Rename variable that shadowed another.
      
      Change-Id: I7522e462d2a52f53010ffa1e7d705c666ec35539
      adf539b2
    • Corey Farrell's avatar
      json: Take advantage of new API's. · 93777faf
      Corey Farrell authored
      * Use "o*" format specifier for optional fields in ast_json_party_id.
      * Stop using ast_json_deep_copy on immutable objects, it is now thread
        safe to just use ast_json_ref.
      
      Additional changes to ast_json_pack calls in the vicinity:
      * Use "O" when an object needs to be bumped.  This was previously
        avoided as it was not thread safe.
      * Use "o?" and "O?" to replace NULL with ast_json_null().  The
        "?" is a new feature of ast_json_pack starting with Asterisk 16.
      
      Change-Id: I8382d28d7d83ee0ce13334e51ae45dbc0bdaef48
      Unverified
      93777faf
    • George Joseph's avatar
      app_voicemail: Cleanup mailbox topic and cache · 06c0676d
      George Joseph authored
      app_voicemail wasn't properly cleaning up the stasis cache or the
      mwi topic pool when the module was unloaded or when a user was
      deleted as a result of a reload.  This resulted in leaks in both
      areas.
      
      * app_voicemail now calls ast_delete_mwi_state_full when it frees
        a user structure and ast_delete_mwi_state_full in turn now calls
        the new stasis_topic_pool_delete_topic function to clear the topic
        from the pool.
      
      Change-Id: Ide23144a4a810e7e0faad5a8e988d15947965df8
      06c0676d
  10. Sep 21, 2018
    • Kevin Harwell's avatar
      rtp_engine: rtcp_report_to_json can overflow the ssrc integer value · 31fba4e8
      Kevin Harwell authored
      When writing an RTCP report to json the code attempts to pack the "ssrc" and
      "source_ssrc" unsigned integer values as a signed int value type. This of course
      means if the ssrc's unsigned value is greater than that which can fit into a
      signed integer value it gets converted to a negative number. Subsequently, the
      negative value goes out in the json report.
      
      This patch now packs the value as a json_int_t, which is the widest integer type
      available on a given system. This should make it so the value no longer
      overflows.
      
      Note, this was caught by two failing tests hep/rtcp-receiver/ and
      hep/rtcp-sender.
      
      Change-Id: I2af275286ee5e795b79f0c3d450d9e4b28e958b0
      Unverified
      31fba4e8
    • George Joseph's avatar
      channel.c: Address stack overflow in does_id_conflict() · 4d51a8e0
      George Joseph authored
      does_id_conflict() was passing a pointer to an int to a callback
      that expected a pointer to a size_t.
      
      Found by the Address Sanitizer.
      
      Change-Id: I0ff542067eef63a14a60301654d65d34fe2ad503
      4d51a8e0
  11. Sep 20, 2018
    • George Joseph's avatar
      stasis: Add function to delete topic from pool · d277db4a
      George Joseph authored
      There's been a long standing leak when using topic pools.  The
      topics in the pool get cleaned up when the last pool reference is
      released but you can't remove a topic specifically.  If you reloaded
      app_voicemail for instance, and mailboxes went away, their topics
      were left in the pool.
      
      * Added stasis_topic_pool_delete_topic() so modules can clean up
        topics from pools.
      * Registered the topic pool containers so it can be examined from
        the CLI when AO2_DEBUG is enabled.  They'll be named
        "<topic_pool_name>-pool".
      
      Change-Id: Ib7957951ee5c9b9b4482af7b9b4349112d62bc25
      d277db4a
  12. Sep 19, 2018
    • Richard Mudgett's avatar
      stasis: No need to keep a stasis type ref in a stasis msg or cache object. · c99a9b22
      Richard Mudgett authored
      Stasis message types are global ao2 objects and we make stasis messages
      and cache entries hold references to them.  Since there are currently
      situations where cache objects are never deleted, the reference count on
      the types can exceed 100000 and generate a FRACK assertion message.  The
      stasis message cache could conceivably also have that many messages
      legitimately on large systems.
      
      The only down side to not holding the message type ref in the stasis
      message is it only makes a crash either at shutdown or when manually
      unloading a busy module slightly more likely.  However, this is more
      exposing a pre-existing stasis shutdown ordering issue than a problem with
      not holding a message type ref in stasis messages.
      
      * Made stasis messages and cache entries no longer hold a ref to the
      message type.
      
      Change-Id: Ibaa28efa8d8ad3836f0c65957192424c7f561707
      c99a9b22
  13. Sep 18, 2018
    • Richard Mudgett's avatar
      stasis_message.c: Don't create immutable stasis objects with locks. · 79e3becc
      Richard Mudgett authored
      * Create the stasis message object without a lock as it is immutable.
      * Create the stasis message type object without a lock as it is immutable.
      * Creating the stasis message type could crash if the passed in type name
      is NULL and REF_DEBUG is enabled.  Added missing NULL check when passing
      the ao2 object tag string.
      
      Change-Id: I28763c58bb9f0b427c11971d0103bf94055e7b32
      79e3becc
  14. Sep 14, 2018
  15. Sep 12, 2018
    • lvl's avatar
      manager: Set AMI event "Newexten" to the EVENT_FLAG_DIALPLAN class · 012272a1
      lvl authored
      The documentation already specified EVENT_FLAG_DIALPLAN for this
      event, but the implementation was using EVENT_FLAG_CALL.
      
      Using EVENT_FLAG_DIALPLAN allows AMI clients to opt out of receiving
      this highly verbose event.
      
      ASTERISK-28033
      
      Change-Id: I45b3119f30e4dbc17b49831f2b1a4f2c1beadafe
      012272a1
  16. Sep 06, 2018
    • Joshua Colp's avatar
      core: Don't stop generators when writing RTCP frames. · f97d92bd
      Joshua Colp authored
      Generators provide such functionality as tone generation or
      silence generation. RTCP frames provide RTCP information and
      should not stop generators from operating.
      
      ASTERISK-28005
      
      Change-Id: Ieadada07b068a7aa426e8763f1b73a18e1ac34a9
      f97d92bd
  17. Sep 05, 2018
    • George Joseph's avatar
      stasis_cache: Prune stasis_subscription_change messages · 0dd8ab35
      George Joseph authored
      The stasis cache provides a way to reconstruct the current state
      of topic subscribers.  Unfortunately, since every subscribe and
      unsubscribe is cached, the cache continues to grow unabated while
      asterisk is running.  This patch removes subscribe messages from
      the cache when the corresponding unsubscribe is received.
      
      This patch also registers the cache containers with ao2 so that if
      AO2_DEBUG is turned on, you can list the container and get its
      stats from the CLI.
      
      ASTERISK-27121
      
      Change-Id: I3d18905e477f3721815da91f30da8d3fbb2d4f56
      0dd8ab35
  18. Aug 30, 2018
  19. Aug 23, 2018
    • Jaco Kroon's avatar
      AMI: be less verbose when adding HTTP headers to AMI/HTTP messages. · a74f8e51
      Jaco Kroon authored
      All HTTP/AMI message headers are being sent to the verbose channel.
      There are multiple places this is happening.  Consolidate the loop into
      a function.  Drop the debug/verbose message.
      
      Convert to using ast_asprintf to perform the length calculation, memory
      allocation and snprintf all in one step.
      
      Change-Id: Ic45e673fde05bd544be95ad5cdbc69518207c1a1
      a74f8e51
  20. Aug 20, 2018
  21. Aug 06, 2018
    • Joshua Colp's avatar
      stasis: Reduce calculation of stasis message type hash. · 455ca109
      Joshua Colp authored
      When the stasis cache is used a hash is calculated for
      retrieving or inserting messages. This change calculates
      a hash when the message type is initialized that is then
      used each time needed. This ensures that the hash is
      calculated only once for the message type.
      
      Change-Id: I4fe6bfdafb55bf5c322dd313fbd8c32cce73ef37
      455ca109
  22. Aug 01, 2018
    • Corey Farrell's avatar
      Build System: Improve ccache matching for different menuselect options. · a10a3aff
      Corey Farrell authored
      Changing any Menuselect option in the `Compiler Flags` section causes a
      full rebuild of the Asterisk source tree.  Every enabled option causes
      a #define to be added to buildopts.h, thus breaking ccache caching for
      every source file that includes "asterisk.h".  In most cases each option
      only applies to one or two files.  Now we only define those options for
      the specific sources which use them, this causes much better cache
      matching when working with multiple builds.  For example testing code
      with an without MALLOC_DEBUG will now use just over half the ccache
      size, only main/astmm.o will have two builds cached instead of every
      file.
      
      Reorder main/Makefile so _ASTCFLAGS set on specific object files are all
      together, sorted by filename.  Stop adding -DMALLOC_DEBUG to CFLAGS of
      bundled pjproject, this define is no longer used by any header so only
      serves to break cache.
      
      The only code change is a slight adjustment to how main/astmm.c is
      initialized.  Initialization functions always exist so main/asterisk.c
      can call them unconditionally.  Additionally rename the astmm
      initialization functions so they are not exported.
      
      Change-Id: Ie2085237a964f6e1e6fff55ed046e2afff83c027
      a10a3aff
  23. Jul 26, 2018
    • Corey Farrell's avatar
      loader: Process dependencies for built-in modules. · 709f4b81
      Corey Farrell authored
      With the new module loader it was missed that built-in modules never
      parsed dependencies from mod->info into vectors of mod.  This caused
      manager to be initialized before acl (named_acl).  If manager.conf
      used any named ACL's they would not be found and result in no ACL being
      applied to the AMI user.
      
      In addition to the manager ACL fix this adds "extconfig" to all builtin
      modules which support realtime configuration.  This only matters if one
      of the builtin modules is configured with 'preload', depending on
      "extconfig" will cause config.c to automatically be initialize during
      the preload stage.
      
      Change-Id: I482ed6bca6c1064b05bb538d7861cd7a4f02d9fc
      709f4b81
  24. Jul 25, 2018
    • Kevin Harwell's avatar
      json.c: improve ast_json_to_ast_variables performance · 783bff06
      Kevin Harwell authored
      When converting from a json object to an ast variables list the conversion
      algorithm was doing a complete traversal of the entire variables list for
      every item appended from the json structure.
      
      This patch makes it so the list is no longer traversed for each new ast
      variable being appended.
      
      Change-Id: I8bf496a1fc449485150d6db36bfc0354934a3977
      783bff06
    • Joshua Colp's avatar
      devicestate: Don't create topic when change isn't cached. · 66f58131
      Joshua Colp authored
      When publishing a device state the change can be marked as being
      cachable or not. If it is not cached the change is just published
      to all interested and not stored away for later query. This was not
      fully taken into account when publishing in stasis. The act of
      publishing would create a topic for the device even if it may be
      ephemeral.
      
      This change makes it so messages which are not cached won't create
      a topic for the device. If a topic does already exist it will be
      published to but otherwise the change will only be published to
      the device state all topic.
      
      ASTERISK-27591
      
      Change-Id: I18da0e8cbb18e79602e731020c46ba4101e59f0a
      66f58131
  25. Jul 23, 2018
    • Richard Mudgett's avatar
      asterisk.c: Make displayed copyright always consistent · 0f8657aa
      Richard Mudgett authored
      Change-Id: I4f5499486e8ec90d7c7ffeebc659ceda1db6d5b5
      0f8657aa
    • George Joseph's avatar
      xmldoc.c: Fix dump of xml document · ba8f2c40
      George Joseph authored
      The "xmldoc dump" cli command was simply concatenating xml documents
      into the output file.  The resulting file had multiple "xml"
      processing instructions and multiple root elements which is illegal.
      Normally this isn't an issue because Asterisk has only 1 main xml
      documentation file but codec_opus has its own file so if it's
      downloaded and you do "xmldoc dump", the result is invalid.
      
      * Added 2 new functions to xml.c:
          ast_xml_copy_node_list creates a copy of a list of children.
          ast_xml_add_child_list adds a list to an existing list.
      
      * Modified handle_dump_docs to create a new output document and
        add to it the children from each input file.  It then dumps the
        new document to the output file.
      
      Change-Id: I3f182d38c75776aee76413dadd2d489d54a85c07
      ba8f2c40
  26. Jul 22, 2018
    • Joshua Colp's avatar
      sched: Make ABI compatible between dev mode and non-dev mode. · 33f855bb
      Joshua Colp authored
      In the past there was an assertion in the ast_sched_del function
      and in order to ensure it was useful the calling function name,
      line number, and filename had to be passed in. This cause the ABI
      to be different between dev mode and non-dev mode.
      
      This assertion is no longer present so the special logic can be
      removed to make it the same between them both.
      
      Change-Id: Icbc69c801e357d7004efc5cf2ab936d9b83b6ab8
      33f855bb
  27. Jul 20, 2018
Loading