summaryrefslogtreecommitdiff
path: root/socket
Commit message (Collapse)AuthorAgeFilesLines
* tcp-bsd: fix a heap-use-after-freeFabrice Bellet2019-07-041-1/+3
|
* socket: fix a heap use-after-free on the send queueFabrice Bellet2019-07-041-6/+6
|
* Assign source out of the for loopalex2019-06-051-1/+2
|
* Fix regression introduced by ↵alex2019-06-051-0/+1
| | | | https://gitlab.freedesktop.org/libnice/libnice/commit/da41258a21102f63ec5d5b2dc20d303f772eb195. Fix #64.
* turn: Replace magic numbers with defineOlivier Crête2019-01-221-14/+16
|
* udp-turn: Avoid potential integer overflowJakub Adam2019-01-041-2/+2
|
* udp-turn: Fix unaligned memory access on ARMJakub Adam2019-01-041-2/+2
|
* Makefiles: Add meson.build files to tarballOlivier Crête2018-12-271-1/+1
|
* udp-bsd: Fix recv with small buffer on WindowsJakub Adam2018-12-181-2/+4
| | | | | | | | | | | | | | | The underlying GSocket implementation on Windows returns an error when the user-provided buffer isn't large enough to fit the whole datagram received on a message-oriented socket. When this occurs, in order to preserve identical behavior of udp-bsd NiceSocket across platforms, we have to mute the error and set the received message length to the size of the provided NiceInputMessage. Any excess portion of the message gets discarded. Fixed udp-bsd test on Windows. GLib 2.48 is required in order to use G_IO_ERROR_MESSAGE_TOO_LARGE.
* Fix build with MSVCNirbheek Chauhan2018-12-143-0/+3
| | | | Tested inside Cerbero with VS 2017
* Add support for Meson build systemTim-Philipp Müller2018-12-141-0/+18
|
* tcp-passive: Clear connection on child closingOlivier Crête2018-11-214-0/+32
| | | | | | | If this isn't done, then there may be invalid points left inside the passive socket which could be used and cause a crash. Fixes #33
* tcp-bsd: Restore global locksJakub Adam2018-11-201-7/+9
| | | | | | | | Avoids race between socket_send_more() and socket_close() leading either to crash on use of freed NiceSocket, or abort upon attempting to g_mutex_clear() a locked mutex. Akin to what d1611c0c0ba6c5bce500b96a8f61de4fe5f144e9 did to udp-turn.
* udp-turn: Create locked version of realm&nonce cache functionOlivier Crête2018-11-191-6/+13
| | | | To be able to call it from a context that is already locked.
* udp-bsd: Protect the GSocketAddress cache with a mutexOlivier Crête2018-11-161-8/+22
|
* udp-turn: handle multiple RFC4571 frames received in a TCP-TURN messageJakub Adam2018-10-311-1/+87
| | | | | | | | | | There might be multiple RFC4571-framed messages (or fragments thereof) within a single TCP-TURN message. Make sure each NiceInputMessage passed by the user into socket_recv_messages() gets exactly one RFC4571 frame, or remains empty if there aren't any messages to receive. We should keep any data that doesn't fit into the user buffers for the next time socket_recv_messages() gets called with the socket.
* udp-turn: don't re-iterate incoming TURN control messagesJakub Adam2018-10-311-9/+4
| | | | | | | | | | | | After being parsed, a TURN control message turns into a NiceInputMessage with zero length. Such message doesn't increment the iteration counter i and so is re-processed in the next iteration, which detects right away that message->length == 0 and continues to the next element in recv_messages. Thus, n_valid_messages variable serves no real purpose and to achieve the same result we can simply increment the iteration counter after each message.
* udp-turn: Start function with lock instead of unlockOlivier Crête2018-10-311-1/+1
|
* udp-turn: Restore global locksOlivier Crête2018-10-281-17/+119
| | | | | The socket abstraction not being reference counted, we need a global lock for them in the short term.
* udp-turn: Rename misleading function, it's a timeoutOlivier Crête2018-10-281-3/+3
| | | | It's not locked in any way.
* udp-turn: Factor our SendRequest destructionOlivier Crête2018-10-281-27/+15
|
* udp-turn: Restore synchronized seconds timeoutOlivier Crête2018-10-281-6/+23
|
* Use per-agent locks and GWeakRefs in callbacks from timeout sourcesJuan Navarro2018-10-282-77/+27
| | | | | | | | | | | | | | | | | | | | | Work on libnice's bug #1 in Gitlab. This work is composed of multiple merged parts: - "Global lock contention removed" Phabricator D1900: https://phabricator.freedesktop.org/D1900 By @nifigase Opened in GitLab as Merge Request !12 - "agent: properly handle NiceAgent ref in callbacks from timeout sources" Phabricator D1898: https://phabricator.freedesktop.org/D1898 By @mparis This patch was itself based upon a previous version of the work done in D1900. After the switch of hosting, it got lost. On top of these, additions to follow some review comments from @ocrete: - https://phabricator.freedesktop.org/D1900#40412 - https://phabricator.freedesktop.org/D1898#39332
* Fix queue_clear replaced by queue_free errorNicolas Dufresne2018-06-181-1/+2
| | | | | | | | | There was two cases where instead of freeing the queue, we actually clear the queue so it's ready for reused. Notably in nice_socket_free_send_queue(), a missed name function and nicesrc element state change. This regression was introduced by: fa783b1dd727a6ee2b99a111ca24790ae850c2f7
* Fix cast-function-type warning introduced in GCC 8Nicolas Dufresne2018-06-124-17/+11
| | | | | | This is new warning introduced with GCC 8. This is being fixed by using appropriate function, like g_queue_free_full/g_list_free_full or by casting to GCallback before casting to the target function signature. Closes: #46
* udp-turn: Add some const to internal APIsOlivier Crête2017-04-042-8/+9
|
* Make clang-analyzer happyOlivier Crête2017-04-041-3/+2
| | | | Various little things, none of which should make a functional difference.
* Version 0.1.140.1.14Olivier Crête2017-04-031-1/+1
|
* stun: Use unions fix alignment issuesOlivier Crête2017-04-031-4/+7
| | | | This makes clang happy.
* udp-bsd: Log g_socket_send_message() errorsJakub Adam2017-04-031-1/+6
| | | | | | | Those may have previously been silently ignored. Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk> Differential Revision: https://phabricator.freedesktop.org/D1708
* socket: Assert trying to use free'd socketOlivier Crête2016-06-027-57/+38
| | | | | Cleanly returnign makes no sense and may hide worse problems.
* Replace g_malloc/g_new with g_alloca where possibleOlivier Crête2016-05-302-6/+2
| | | | This should reduce the overhead a bit.
* udp-turn: Fix binding timeout leakOlivier Crête2016-05-261-0/+7
|
* udp-turn: Don't expose GSocketOlivier Crête2016-05-261-1/+1
| | | | | | | UDP turn sockets should never be read frm directly. Because they may share the same socket with the non-relay, so the incoming data may not be relayed and then the NiceSocket API doesn't allow returning the base socket as the source.
* turn: Cache the nonce & realm to remove useless round tripsOlivier Crête2016-05-262-48/+67
| | | | | Instead of re-discovering the nonce and realm for every request, cache them in th socket.
* socket: refactor nice_socket_is_base_of()Jakub Adam2016-04-047-34/+41
| | | | | | | | | | | | | | • rename to nice_socket_is_based_on() and swap the order of arguments accordingly; the implementation doesn't have to use the confusing 'return other->is_base_of()' pattern anymore • fix potential NULL dereferences The argument order in agent_recv_message_unlocked() was already wrongly swapped in 1732c7d6 and thus this commit isn't changing it back because that order has become the correct one. Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk> Differential Revision: https://phabricator.freedesktop.org/D866
* socket: fix wrong function called in nice_socket_is_base_of()Jakub Adam2016-04-041-2/+2
| | | | | | | | | | | | | | | | | | | | | We have to call is_base_of "virtual function pointer" of 'other' object, not 'sock', since 'other' is the structure whose base NiceSocket we need to get from its private data. For instance calling nice_socket_is_base_of() with 'sock' and 'other' being respectively pseudo-SSL and UDP-TURN-over-TCP invoked is_base_of variant for pseudo-SSL, casting other->priv into PseudoSSLPriv *, but other->priv is actually TurnTcpPriv *. It must be called the other way around. https://phabricator.freedesktop.org/T7335 https://phabricator.freedesktop.org/T7336 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk> Reviewed-by: José Antonio Santos Cadenas <santoscadenas@gmail.com> Reviewed-by: Philip Withnall <philip@tecnocode.co.uk> Reviewed-by: José Antonio Santos Cadenas <santoscadenas@gmail.com> Differential Revision: https://phabricator.freedesktop.org/D785
* conncheck: add more debug informationPhilip Withnall2016-03-011-1/+6
| | | | | | | | | Add a more debug details, specifically in some places, it is interesting to have the src and dst IP addresses of the pairs being checked, and also to make the difference between log related to different stream ids. Reviewed-by: Philip Withnall <philip@tecnocode.co.uk> Differential Revision: https://phabricator.freedesktop.org/D803
* socket: add nice_socket_is_base_of()Jakub Adam2015-09-117-0/+74
| | | | | | | | This will be used in the next commit. Maniphest Tasks: T114 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk> Differential Revision: https://phabricator.freedesktop.org/D240
* ms-turn: don't wait for a reply to STUN_SEND requestJakub Adam2015-09-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | As per [MS-TURN] Section 2.2.1, TURN message type 0x0104 "Send request response" isn't supported and the TURN server MUST NOT send them. Thus, libnice should not remember Send requests in agent->sent_ids because without replies coming, the number of allowed pending transaction gets quickly exhausted, causing our data packets to be dropped until a request timeout frees some space in the queue. This behavior resulted in choppy reception of our audio on a Lync client when connected via Lync Edge (TURN) Server. Maniphest Tasks: T126 Reviewers: pwithnall Projects: #libnice Reviewed By: pwithnall Subscribers: pwithnall Differential Revision: https://phabricator.freedesktop.org/D223
* Creating TCP sockets with TCP_NODELAY option set to TRUEPhilip Withnall2015-08-293-0/+24
| | | | | | | | | | | | | | | | | | Disable Nagling for underlying TCP sockets used by libnice, because they are typically used for streaming applications, or for pseudo-TCP; the bandwidth in both cases is harmed by Nagling. Based on a patch by Vadim Genkin. Maniphest Tasks: T3317 Reviewers: pwithnall Projects: #libnice Subscribers: pwithnall, vadimgenkin Differential Revision: https://phabricator.freedesktop.org/D230
* socket: Handle ECONNRESET as EWOULDBLOCK on WindowsPhilip Withnall2015-08-191-1/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Some versions of Windows can return ECONNRESET for UDP recvmsg() calls if they would otherwise block. Hence, handle the two equivalently; this should not affect behaviour on Linux, which apparently does not return ECONNRESET for UDP recvmsg() calls at all. https://phabricator.freedesktop.org/T121 Maniphest Tasks: T121 Reviewers: ocrete Projects: #libnice Reviewed By: ocrete Subscribers: stwiname, felixSchl Differential Revision: https://phabricator.freedesktop.org/D227
| * socket: Handle ECONNRESET as EWOULDBLOCK on WindowsPhilip Withnall2015-08-181-1/+4
| | | | | | | | | | | | | | | | | | Some versions of Windows can return ECONNRESET for UDP recvmsg() calls if they would otherwise block. Hence, handle the two equivalently; this should not affect behaviour on Linux, which apparently does not return ECONNRESET for UDP recvmsg() calls at all. https://phabricator.freedesktop.org/T121
* | socket: Close base socket for a TCP passive socket when closing parentPhilip Withnall2015-08-181-0/+6
|/ | | | | | Otherwise the base socket will leak. Spotted by Vadim Genkin. https://phabricator.freedesktop.org/T125
* Split "verbose" on-every-packet messages to a verbose logOlivier Crête2015-06-241-5/+5
| | | | This way, the regular log will only contain connection-time information.
* udp-turn: Don't dereference priv before check that it's validOlivier Crête2014-10-091-2/+2
|
* socket: Fix a leak on the slow TURN packet handling pathPhilip Withnall2014-09-231-0/+1
|
* socket: Return early from socket functions if the socket is closedPhilip Withnall2014-09-027-0/+78
| | | | | | | | Explicitly check whether the socket is closed (universally represented as sock->priv == NULL) before doing anything else in the socket methods. This should safely return from unusual situations where the socket has been closed and part-destroyed but still ends up having send() or recv() called on it.
* socket: Fix return values of socket_send_messages in socks5.cPhilip Withnall2014-09-021-2/+1
| | | | | The return value is the number of messages sent, or -1 on error — not a boolean.
* socket: Gracefully return from send() if the socket is closedPhilip Withnall2014-08-211-0/+4
|