summaryrefslogtreecommitdiff
path: root/socket
Commit message (Collapse)AuthorAgeFilesLines
* udp-bsd: Explicitly bind to the interface when creating a socketOlivier Crête2022-07-291-0/+28
|
* agent: Support adding optional headers to HTTP proxy clientJohan Sternerup2022-05-262-15/+30
| | | | | | One use case for this is adding an ALPN header which is a MUST requirement when a HTTP proxy is used in WebRTC (see RFC8835, section 3.4).
* tcp-active: Fix use-after-free in error caseOlivier Crête2021-11-261-10/+30
| | | | Fixes issue found by Coverity
* conncheck: don't ignore local socket errorsFabrice Bellet2021-11-223-17/+52
| | | | | | | | | | | | | | | | | With this patch we ensure that local socket errors during connection establishment are properly transmitted to the connection check layer, so the related pair can be put in state failed when needed. The local socket errors we are interested in, are those occuring when the local source address cannot be bound anymore, because the underlying interface vanished for example. In particular, we don't ignore errors coming from g_socket_bind() with tcp active sockets, that perform a bind to *whatever* local address is available, in case it cannot bind to the specified address. This behaviour was demonstrated with the test-tcp example, that tried to bind to the IPv4 loopback address on a socket initially created for the IPv6 loopback.
* Remove g_assert_cmp* macros outside of the unit testsOlivier Crête2021-11-013-6/+6
|
* tcp-bsd: Handle send before connect() completesOle André Vadla Ravnås2021-05-101-0/+1
|
* udp-turn: Remove request before freeing itOlivier Crête2021-05-031-1/+1
| | | | | As removing the request from the queue looks into the SendRequest, one needs to unqueue it before freeing it.
* udp-turn: don't allocate large arrays on the stackFabrice Bellet2021-04-201-4/+11
|
* agent: report duplicated port in udp bsd sockets tooFabrice Bellet2020-12-072-4/+4
| | | | | | | | | | | | | | | | | | This patch fixes cases, where the range is full, some ports fail with HOST_CANDIDATE_CANT_CREATE_SOCKET, other fail with HOST_CANDIDATE_DUPLICATE_PORT, the value of res we keep when leaving the loop is randomly the one of the last iteration of the loop. CANT_CREATE_SOCKET still happens when trying to create an udp bsd socket with the same address and port than one of another component, so it is also a case of duplicate port in fact. To be homogeneous, we add a gerror for nice_udp_bsd_socket_new(), like we did in nice_tcp_passive_socket_new(), and we can catch the same G_IO_ERROR_ADDRESS_IN_USE there too, when failing to get free available udp ports. This patch is a complement to merge request !158
* agent: Actually fail gathering on UDP port unavailabilityOlivier Crête2020-08-182-4/+5
| | | | | | | This will make it fail if either our test of UDP port clash fails or if the kernel rejects the new socket because there is a port clash. Also include a unit test for this.
* Use g_alloca instead of g_malloc_n in socket_send_messagesLorenzo Miniero2020-08-041-2/+1
|
* Changed type of variable to signedLorenzo Miniero2020-08-041-1/+1
|
* Fixed wrong return value in socket_send_messages for n_messages=1Lorenzo Miniero2020-08-041-0/+2
|
* Refactored UDP socket_send_messages to use g_socket_send_messagesLorenzo Miniero2020-08-041-35/+27
|
* Remove autotools buildTim-Philipp Müller2020-05-221-45/+0
| | | | | | Remove dist check on the CI, since it doesn't really add anything in the Meson case (tarball is based on files checked into git and srcdir != builddir).
* Use g_assert_cmp.int() to get better debug logs on crashOlivier Crête2020-05-053-5/+5
|
* conncheck: refactor local and remote candidates validationFabrice Bellet2020-03-022-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | The same code to get and validate local and remote candidates from an incoming stun is shared between regular inbound stun, early checks replay, and partially in the local peer-reflexive discovery function. The selection of the matching local and remote candidate from an incoming stun sometimes requires more information than just the local socket, and the sender address and port. It happens more frequently when the port range is reduced, and when the conncheck handles both tcp and udp candidates. To help to disambiguate such situations, we add supplementary checks when two candidates in the list have the same address and and port number: * the type of the socket must compatible with the candidate transport. A socket for a tcp candidate may be active of passive, but also of type "tcp-bsd" when the parent active or passive socket is replaced after a bind() or accept(). It gives several cases. * the remote candidate transport and the local candidate transport must be compatible
* udp-bsd: Check all return valueOlivier Crête2020-02-121-4/+10
| | | | Errors found by coverity
* udp-udp: Make coverity happy by giving it the whole unionOlivier Crête2020-02-121-4/+4
|
* udp-bsd: Use sockaddr_storage union to ensure big enough socketOlivier Crête2019-07-281-5/+8
| | | | | The IPv6 struct sockaddr variant is bigger than the IPv4 one, so use the storage struct to ensure that the size is big enough.
* udp-bsd: log source and destination addresses on GSocket send errorJakub Adam2019-07-191-4/+24
|
* 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.