summaryrefslogtreecommitdiff
path: root/agent
Commit message (Collapse)AuthorAgeFilesLines
* interfaces: Only use `ifr_ifindex` if OS supports itOle André Vadla Ravnås2023-01-061-0/+6
| | | | This fixes compilation on e.g. macOS and FreeBSD, where it is missing.
* address: Add introspection-friendly to_string_dupJames Westman2023-01-062-1/+24
| | | | | | nice_address_to_string expects an already-allocated string, which is not great for introspection. Adds nice_address_to_string_dup, which does the same thing, but returns a newly allocated string.
* agent: Allow getting UDP candidates from a TURN server over TCPOlivier Crête2023-01-041-7/+2
| | | | Even if the TCP candidates are disabled.
* agent: Resolve TURN server IP addressesOlivier Crête2023-01-045-28/+277
| | | | | This should enable having servers that do both IPv4 and IPv6. And ideally should make life easier for app developers.
* agent: Resolve STUN server IP addressOlivier Crête2023-01-043-21/+168
| | | | | This should enable having servers that do both IPv4 and IPv6. And ideally should make life easier for app developers.
* candidate: fix assertions caused by API guards in new address APIMathieu Duponchelle2022-11-191-2/+2
| | | | | The checks were reversed, requiring for instance a non-relay candidate for calling nice_candidate_relay_address()
* conncheck: Limit ichecks based on propertyOlivier Crête2022-10-172-10/+18
| | | | | | Limit the number of stored incoming checks based on the property limiting the number of total connectivity checks instead of using the fixed limit on the number of remote candidates.
* interfaces: Add API to find the interface index from a local addressOlivier Crête2022-07-252-0/+166
| | | | | | | This will find some interface that has the address and will not work correctly if multiple interfaces have the same address. But in any case, nothing in libnice expects that and we would need to break the API to make that work.
* candidate: Copy stun_server with candidateOlivier Crête2022-06-011-0/+2
| | | | | | Bug reported and fix suggested by Masato Takahashi Fixes #164
* address: Add Boxed TypeOlivier Crête2022-05-262-0/+7
| | | | This should make the library more easily usable for bindings
* agent: Support adding optional headers to HTTP proxy clientJohan Sternerup2022-05-262-2/+46
| | | | | | 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).
* Conncheck: renomination: set use_candidate for pending check on early ↵Andrey Skryabin2022-05-261-15/+62
| | | | inbound STUN with NOMINATION attr
* Conncheck: always updating remote_consent.last_received for selected pair on ↵Andrey Skryabin2022-05-261-4/+5
| | | | keepalive
* Conncheck: recheck consent timeout overflow fixAndrey Skryabin2022-05-201-1/+1
|
* candidate: Add utility function to get STUN server addressPhilippe Normand2022-05-097-13/+62
| | | | Can be useful to know which STUN server was used to discover the given candidate.
* agent: Initialize variableOlivier Crête2022-05-031-0/+1
| | | | | There is a codepath where it can be used without being filled. Found by coverity.
* candidate: Add utility function to get TURN relay addressPhilippe Normand2022-05-032-0/+24
| | | | Can be useful to know which TURN server is being used as relay server for a given candidate.
* agent: Hold ref while doing async closeOlivier Crête2022-04-201-0/+5
| | | | | | | | | | It's possible that the callback will be called synchronously during the close function, in this case, we need to be ready to the last reference to the agent to be dropped in this callback. This fix was suggested by Fabrice Bellet Fixes #153
* Don't try to use link-local addresses outside local networkJohan Sternerup2022-04-064-3/+56
| | | | | | | | | | If we have gathered a host IP-address that is link-local we should never try to use it for anything else than trying to match it with another link-local address. Some routers seem to have problems with traffic from link-local addresses destined at external IP-addresses. By definition link-local addresses should stay local so there's no reason to access STUN/TURN from it or try to form a candidate with another address that is not link-local.
* agent: Fix warning about required glib versionNirbheek Chauhan2022-03-212-2/+2
| | | | | | | | | | | | | | | ../agent/discovery.c: In function ‘on_refresh_remove_timeout’: ../agent/discovery.c:203:13: warning: Not available before 2.60 203 | G_GNUC_FALLTHROUGH; | ^~~~~~~~~~~~~ ../agent/conncheck.c: In function ‘priv_turn_allocate_refresh_retransmissions_tick_agent_locked’: ../agent/conncheck.c:1656:13: warning: Not available before 2.60 1656 | G_GNUC_FALLTHROUGH; | ^~~~~~~~~~~~~ The comment /* fall through */ is enough to cause GCC and Clang to not emit the implicit-fallthrough warning.
* agent: Convert g_print() to nice_debug()Nirbheek Chauhan2022-03-211-1/+2
| | | | This was probably added by mistake.
* agent: Clear the original message pointer instead of a copyOlivier Crête2021-11-261-2/+2
| | | | | In one case, the message pointer gets replaced by the rfc4571_message one, so it wasn't getting cleared as expected.
* agent: Consume data before removing disconnected socketOle André Vadla Ravnås2021-11-221-2/+3
| | | | This was caught by tests randomly failing (timing out).
* iostream: Implement close() for ICE-TCP alsoOle André Vadla Ravnås2021-11-224-12/+41
|
* component: Clear buffer pointers to avoid potential double freeOle André Vadla Ravnås2021-11-221-0/+2
| | | | In case close() is called more than once.
* agent: Add support for bytestream TCPOle André Vadla Ravnås2021-11-225-158/+415
|
* conncheck: don't ignore local socket errorsFabrice Bellet2021-11-221-2/+8
| | | | | | | | | | | | | | | | | 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.
* agent: Handle failure to create TCP TURN socketOle André Vadla Ravnås2021-11-031-6/+11
| | | | | E.g. if the server address is IPv6 but the local system cannot reach it, so connect() fails right away.
* conncheck: schedule the connection check in most relevant placesFabrice Bellet2021-11-023-15/+10
| | | | | | | The patch invokes the conncheck timer creation where it makes most sense: when a new pair is inserted in the conncheck list, and when a pair is added to the triggered check list (because the conncheck scheduler works on these two lists).
* Remove g_assert_cmp* macros outside of the unit testsOlivier Crête2021-11-016-35/+35
|
* agent: ensure suceeded and discovered pairs fail the same timeFabrice Bellet2021-11-011-0/+22
| | | | | | | | | | This patch ensures that related succeeded-discovered pairs change to state failed simultaneously, to avoid leaving dangling pointers if one is freeed while the other is still in the conncheck list. Such transition is very rare, and only occurs in regular nomination mode, when the network conditions change between the time the pair is initially discovered and the time it is rechecked with the use-candidate flag.
* agent: Unify constructors into nice_agent_new_fullJuan Navarro2021-11-012-14/+4
| | | | | | | | | Instead of having 3 independent implementations, make the simpler versions delegate into the full one. The simplest constructor needs to pass "no option", for which no constant exists in the NiceAgentOption enum. Thus the new NICE_AGENT_OPTION_NONE constant is added to reflect this possibility.
* component: reset the stun agent on ice restartFabrice Bellet2021-10-043-3/+10
| | | | | | | | | The stun agent may contain references to the password previously stored in some remote candidates, freeed by nice_component_restart(), that were used by keep-alive stun requests. These stun replies may arrive later after ice has been restarted. Since the remote candidates are freeed when ice is restarted, the stun agent must be reset to get rid of these related references.
* nice: Bring new symbols to 0.1.19Olivier Crête2021-08-192-3/+3
| | | | It's not released yet and we don't do even/odd in this project.
* nice: Export nice_candidate_transport_to_stringOlivier Crête2021-08-191-1/+1
| | | | Also update the Since to 0.1.19, because it's not really usable now
* nice: Export nice_candidate_type_to_stringOlivier Crête2021-08-191-1/+1
| | | | Also update the Since to 0.1.19, because it's not really usable now
* agent: Simplify accepting state changes to FAILEDOlivier Crête2021-07-201-5/+1
| | | | | The component can go from any state to FAILED, so simplify that and make it explicit.
* agent: Accept any transition back to the gathering stateOlivier Crête2021-07-201-3/+3
| | | | | | | When doing a ICE restart, which can be done from any state, we can always go back into the gathering state. This fixes a regression introduced by b20ac5ba7b731f2cc698f26e8def28a518de058e
* pseudotcp: Disable Nagle algorithm by defaultOle André Vadla Ravnås2021-05-101-1/+1
| | | | To be consistent with what we do for ICE-TCP.
* agent: Remove duplicated early returnOlivier Crête2021-05-031-4/+0
| | | | The type is already checked to not be peer reflexive earlier.
* agent: Avoid leak on programming errorOlivier Crête2021-05-031-1/+3
| | | | | | Even if the agent is invalid, don't leak. This makes coverity a little happier.
* conncheck: Free password in more obvious wayOlivier Crête2021-05-031-5/+5
| | | | | This should make Coverity's job a little easier. And also fix a little leak in the error path.
* agent: avoid leak of all turn refreshes when disposing the agentFabrice Bellet2021-04-202-23/+23
| | | | | | | | | | With this patch we free all outstanding refreshes when the agent dispose method is called, even those that are in the way to be discarded asynchronously, when a stream is removed. We also make the final user callback of the refresh proces synchronous, so we don't have to deal with an heap use-after-free problem. This also requires to order some parts of code.
* discovery: fix asynchronous agent refreshes pruningFabrice Bellet2021-04-201-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | Asynchronous refreshes pruning may occur when the agent async close function is called, but also when a stream is closed. A flag 'discarding' is used in the CandidateRefresh object to determine if a refresh is already on the way to be asynchronously freed. A refresh definitely freed is removed from agent refresh_list. When the agent async close function is called, it is passed a user callback that will be invoked when all refreshes have been freed. This is not exactly how things work currently, because right now, the callback function is also invoked when all CandidateRefresh objects have the discarding flag set, with the test 'data->items_to_free==0'. In that case, clearly not all refreshes have been freed, as some are still there in the refresh_list with the discarding flag set. This is probably not what the user expects from the function nice_agent_close_async(), where the callback is supposed to be invoked after all refreshes have been freed: and including those asynchronously pruned by nice_prune_stream_async(). This patch adds a supplementary timeout when closing the agent async, that waits until the agent refresh list becomes empty.
* agent: avoid leak of turn refreshesFabrice Bellet2021-04-201-0/+9
| | | | | We keep refreshes having the discarding flag set. They may be freed later if the agent main context remains alive after agent deletion.
* agent: warn when closing the agent with alive turn refreshesFabrice Bellet2021-04-201-0/+5
| | | | | | | | | | | | This patch suggests the developer to close its alive reservations on the turn server before disposing the agent. Not removing reservations on the turn server, will make them alive until their default timeout, generally 300 seconds, which is not fair for the turn server resources, but also it may cause a fatal error 437, "Mismatched allocation: wrong transaction ID", when another agent tries to contact the same turn server using the same nat mapping before this delay expires.
* agent: Verify the source before dereferencing the pointerOlivier Crête2021-04-202-7/+14
| | | | | The reason is that the component object could have been destroyed in the mean time.
* agent: don't allocate large arrays on the stackFabrice Bellet2021-04-203-17/+29
|
* agent: keep a track of the candidate refreshes being prunedFabrice Bellet2021-04-205-0/+35
| | | | | | | | Refreshes with zero lifetime sent over tcp transport may cause the removal of the underlying socket when the remote peer closes the connection taking our request into account. These refreshes must be tracked and freeed on our side to avoid retransmission attempt on a closed socket and a heap-use-after-free error in that case.
* interfaces: Skip special interfaces on Apple OSesOle André Vadla Ravnås2021-04-191-0/+25
| | | | Including unused utun devices.