Skip to content
Snippets Groups Projects
  1. Aug 08, 2015
    • David M. Lee's avatar
      Replace htobe64 with htonll · 06b464ab
      David M. Lee authored
      We don't have a compatability function to fill in a missing htobe64; but
      we already have one for the identical htonll.
      
      Change-Id: Ic0a95db1c5b0041e14e6b127432fb533b97e4cac
      06b464ab
  2. Jul 29, 2015
    • Mark Michelson's avatar
      res_http_websocket: Properly encode 64 bit payload · f2089dce
      Mark Michelson authored
      A test agent was continuously failing all ARI tests when run against
      Asterisk 13. As it turns out, the reason for this is that on those test
      runs, for some reason we decided to use the super extended 64 bit
      payload length for websocket text frames instead of the extended 16 bit
      payload length. For 64-bit payloads, the expected byte order over the
      network is
      
      7, 6, 5, 4, 3, 2, 1, 0
      
      However, we were sending the payload as
      
      3, 2, 1, 0, 7, 6, 5, 4
      
      This meant that we were saying to expect an absolutely MASSIVE payload
      to arrive. Since we did not follow through on this expected payload
      size, the client would sit patiently waiting for the rest of the payload
      to arrive until the test would time out.
      
      With this change, we use the htobe64() function instead of htonl() so
      that a 64-bit byte-swap is performed instead of a 32 bit byte-swap.
      
      Change-Id: Ibcd8552392845fbcdd017a8c8c1043b7fe35964a
      f2089dce
  3. Feb 25, 2015
    • David M. Lee's avatar
      Increase WebSocket frame size and improve large read handling · 551b35e8
      David M. Lee authored
      Some WebSocket applications, like [chan_respoke][], require a larger
      frame size than the default 8k; this patch bumps the default to 16k.
      This patch also fixes some problems exacerbated by large frames.
      
      The sanity counter was decremented on every fread attempt in
      ws_safe_read(), regardless of whether data was read from the socket or
      not. For large frames, this could result in loss of sanity prior to
      reading the entire frame. (16k frame / 1448 bytes per segment = 12
      segments).
      
      This patch changes the sanity counter so that it only decrements when
      fread() doesn't read any bytes. This more closely matches the original
      intention of ws_safe_read(), given that the error message is
      "Websocket seems unresponsive".
      
      This patch also properly logs EOF conditions, so disconnects are no
      longer confused with unresponsive connections.
      
       [chan_respoke]: https://github.com/respoke/chan_respoke
      
      Review: https://reviewboard.asterisk.org/r/4431/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432236 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      551b35e8
  4. Feb 11, 2015
  5. Dec 19, 2014
  6. Dec 10, 2014
  7. Oct 27, 2014
  8. Jun 26, 2014
    • Matthew Jordan's avatar
      res_http_websocket: Close websocket correctly and use careful fwrite · 32d684ee
      Matthew Jordan authored
      When a client takes a long time to process information received from Asterisk,
      a write operation using fwrite may fail to write all information. This causes
      the underlying file stream to be in an unknown state, such that the socket
      must be disconnected. Unfortunately, there are two problems with this in
      Asterisk's existing websocket code:
      1. Periodically, during the read loop, Asterisk must write to the connected
         websocket to respond to pings. As such, Asterisk maintains a reference to
         the session during the loop. When ast_http_websocket_write fails, it may
         cause the session to decrement its ref count, but this in and of itself
         does not break the read loop. The read loop's write, on the other hand,
         does not break the loop if it fails. This causes the socket to get in a
         'stuck' state, preventing the client from reconnecting to the server.
      2. More importantly, however, is that the fwrite in ast_http_websocket_write
         fails with a large volume of data when the client takes awhile to process
         the information. When it does fail, it fails writing only a portion of
         the bytes. With some debugging, it was shown that this was failing in a
         similar fashion to ASTERISK-12767. Switching this over to ast_careful_fwrite
         with a long enough timeout solved the problem.
      
      ASTERISK-23917 #close
      Reported by: Matt Jordan
      
      Review: https://reviewboard.asterisk.org/r/3624/
      
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@417310 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      32d684ee
  9. Jun 12, 2014
    • Richard Mudgett's avatar
      AST-2014-007: Fix DOS by consuming the number of allowed HTTP connections. · df686c50
      Richard Mudgett authored
      Simply establishing a TCP connection and never sending anything to the
      configured HTTP port in http.conf will tie up a HTTP connection.  Since
      there is a maximum number of open HTTP sessions allowed at a time you can
      block legitimate connections.
      
      A similar problem exists if a HTTP request is started but never finished.
      
      * Added http.conf session_inactivity timer option to close HTTP
      connections that aren't doing anything.  Defaults to 30000 ms.
      
      * Removed the undocumented manager.conf block-sockets option.  It
      interferes with TCP/TLS inactivity timeouts.
      
      * AMI and SIP TLS connections now have better authentication timeout
      protection.  Though I didn't remove the bizzare TLS timeout polling code
      from chan_sip.
      
      * chan_sip can now handle SSL certificate renegotiations in the middle of
      a session.  It couldn't do that before because the socket was non-blocking
      and the SSL calls were not restarted as documented by the OpenSSL
      documentation.
      
      * Fixed an off nominal leak of the ssl struct in
      handle_tcptls_connection() if the FILE stream failed to open and the SSL
      certificate negotiations failed.
      
      The patch creates a custom FILE stream handler to give the created FILE
      streams inactivity timeout and timeout after a specific moment in time
      capability.  This approach eliminates the need for code using the FILE
      stream to be redesigned to deal with the timeouts.
      
      This patch indirectly fixes most of ASTERISK-18345 by fixing the usage of
      the SSL_read/SSL_write operations.
      
      ASTERISK-23673 #close
      Reported by: Richard Mudgett
      ........
      
      Merged revisions 415841 from http://svn.asterisk.org/svn/asterisk/branches/1.8
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@415854 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      df686c50
  10. May 09, 2014
  11. Apr 30, 2014
  12. Mar 05, 2014
  13. Jun 12, 2013
    • David M. Lee's avatar
      Fix segfault for certain invalid WebSocket input. · 7e0ebaa2
      David M. Lee authored
      The WebSocket code would allocate, on the stack, a string large enough
      to hold a key provided by the client, and the WEBSOCKET_GUID. If the key
      is NULL, this causes a segfault. If the key is too large, it could
      overflow the stack.
      
      This patch checks the key for NULL and checks the length of the key to
      avoid stack smashing nastiness.
      
      (closes issue ASTERISK-21825)
      Reported by: Alfred Farrugia
      Tested by: Alfred Farrugia, David M. Lee
      Patches:
          issueA21825_check_if_key_is_sent.patch uploaded by Walter Doekes (license 5674)
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@391560 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      7e0ebaa2
  14. Nov 20, 2012
  15. Sep 27, 2012
  16. Jul 31, 2012
  17. Jul 16, 2012
  18. Jun 02, 2012
Loading