aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/connection_edge.c
AgeCommit message (Collapse)Author
2023-10-29fix memory leak in dos stream for resolve requeststrinity-1686a
2023-10-18remove todostrinity-1686a
2023-10-18add metrics for rejected BEGIN/RESOLVEtrinity-1686a
2023-10-18add rate limit on BEGIN and RESOLVE cell per circuittrinity-1686a
2023-08-05handle invalid exitpolicy when reapplying ittrinity-1686a
2023-07-29add config ReevaluateExitPolicytrinity-1686a
2023-07-29reapply exit policy on reloadtrinity-1686a
2023-05-10hs: Don't expire RP circuits to HS with PoWDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2023-04-06Avoid closing dirty circs with active half-edgesMike Perry
In https://gitlab.torproject.org/tpo/core/tor/-/issues/40623, we changed the DESTROY propogation to ensure memory was freed quickly at relays. This was a good move, but it exacerbates the condition where a stream is closed on a circuit, and then it is immediately closed because it is dirty. This creates a race between the DESTROY and the last data sent on the stream. This race is visible in shadow, and does happen. This could be backported. A better solution to these kinds of problems is to create an ENDED cell, and not close any circuits until the ENDED comes back. But this will also require thinking, since this ENDED cell can also get lost, so some kind of timeout may be needed either way. The ENDED cell could just allow us to have much longer timeouts for this case.
2023-04-06Prop#329 streams: Handle stream usage with confluxMike Perry
This adds utility functions to help stream block decisions, as well as cpath layer_hint checks for stream cell acceptance, and syncing stream lists for conflux circuits. These functions are then called throughout the codebase to properly manage conflux streams.
2023-04-06Prop#329: Add purposes for conflux circuitsMike Perry
Because UNLINKED circuits must never be used for streams, but LINKED circuits can be, we want these separate.
2022-11-09Merge branch 'ticket40674_047_01' into maint-0.4.7David Goulet
2022-11-09dns: Make TTLs fuzzy at exit relaysRasmus Dahlberg
This change mitigates DNS-based website oracles by making the time that a domain name is cached uncertain (+- 4 minutes of what's measurable). Resolves TROVE-2021-009. Fixes #40674
2022-11-03metrics: Add connection socket family to metricsDavid Goulet
Adds either ipv4 or ipv6 to the "tor_relay_connections_total" stats. Closes #40710 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-11-01Clip DNS TTL values once in event callbackRasmus Dahlberg
This change ensures that other parts of the code base always operate on the same clipped TTL values, notably without being aware of clipping.
2022-10-27metrics: Fix naming and documentationDavid Goulet
After nickm's review, minor changes to names and comments. Related to #40194 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-10-26rephist: Track number of streams seen per typeDavid Goulet
Related to #40194 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-10-12relay: Add number of rejected connections to MetricsPortDavid Goulet
Related to #40194 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19hs: v2 address are now considered a bad hostnameDavid Goulet
This means that at this commit, tor will stop logging that v2 is deprecated and treat a v2 address as a bad hostname that we can't use. Part of #40476 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19Merge branch 'maint-0.4.6'David Goulet
2021-10-19Merge branch 'ticket40476_045_01' into ticket40476_046_01David Goulet
2021-10-19hs-v2: Disable SOCKS connection for v2 addressesDavid Goulet
This effectively turns off the ability of tor to use HSv2 as a client by invalidating the v2 onion hostname passed through a SOCKS request. Part of #40476 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-11Remove unused debugging code used for tor#17659Alexander Færøy
See: tpo/core/tor#17659
2021-10-08Merge branch 'tor-gitlab/mr/447'David Goulet
2021-10-06Merge branch 'maint-0.4.6'David Goulet
2021-10-06hs-v2: Only log once the connection warning to v2David Goulet
Closes #40474 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-06hs-v2: Only log once the connection warning to v2David Goulet
Closes #40474 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-04edge: Remove wrong bug warn when processing pending streamsDavid Goulet
The connection_ap_attach_pending() function processes all pending streams in the pending_entry_connections list. It first copy the pointer and then allocates a brand new empty list. It then iterates over that copy pointer to try to attach entry connections onto any fitting circuits using connection_ap_handshake_attach_circuit(). That very function, for onion service, can lead to flagging _all_ streams of the same onion service to be put in state RENDDESC_WAIT from CIRCUIT_WAIT. By doing so, it also tries to remove them from the pending_entry_connections but at that point it is already empty. Problem is that the we are iterating over the previous pending_entry_connections which contains the streams that have just changed state and are no longer in CIRCUIT_WAIT. This lead to this bug warning occuring a lot on busy services: May 01 08:55:43.000 [warn] connection_ap_attach_pending(): Bug: 0x55d8764ae550 is no longer in circuit_wait. Its current state is waiting for rendezvous desc. Why is it on pending_entry_connections? (on Tor 0.4.4.0-alpha-dev ) This fix is minimal and basically allow a state to be not CIRCUIT_WAIT and move on to the next one without logging a warning. Because the pending_entry_connections is emptied before processing, there is no chance for a streams to be stuck there forever thus it is OK to ignore streams not in the right state. Fixes #34083 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-04Support time-based half-closed connection handling.Mike Perry
Since we no longer use stream SENDMEs for congestion control, we must now use time to decide when data should stop arriving on a half-closed stream.
2021-06-29hs: Send back 0xF6 for a v2 onion addressDavid Goulet
Fixes #40421 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-05-07Log warning when connecting to soon-to-be-deprecated v2 onions.George Kadianakis
2021-05-07Add warning when trying to connect to deprecated v2 onions.George Kadianakis
2021-05-05Prepare for #40373: Re-introduce parsing for v2 onion addresses.George Kadianakis
Welcome back ONION_V2_HOSTNAME! :)
2021-03-17warn and reject reentering streams at client tooRoger Dingledine
Clients now check whether their streams are attempting to re-enter the Tor network (i.e. to send Tor traffic over Tor), and they close them preemptively if they think exit relays will refuse them. See bug 2667 for details. Resolves ticket 40271.
2021-03-12Update copyrights to 2021, using "make update-copyright"Nick Mathewson
2021-02-22Fix CID 1473232 in connection_ap_handle_onion().George Kadianakis
Now that v2 is off the table, 'rend_cache_lookup_result' is useless in connection_ap_handle_onion() because it can only take the ENOENT value. Let's remove that helper variable and handle the ENOENT case specifically when we check the cache. Also remove the 'onion_address' helper variable.
2021-02-22Refactoring: Remove 'addresstype' from connection_ap_handle_onion().George Kadianakis
It's all v3 now. Preparation for fixing CID 1473232.
2021-02-19hs-v2: Removal of service and relay supportDavid Goulet
This is unfortunately massive but both functionalities were extremely intertwined and it would have required us to actually change the HSv2 code in order to be able to split this into multiple commits. After this commit, there are still artefacts of v2 in the code but there is no more support for service, intro point and HSDir. The v2 support for rendezvous circuit is still available since that code is the same for the v3 and we will leave it in so if a client is able to rendezvous on v2 then it can still transfer traffic. Once the entire network has moved away from v2, we can remove v2 rendezvous point support. Related to #40266 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-19hs-v2: Remove client supportDavid Goulet
Related to #40266 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-09Fix coverity warnings 1472846 / 1472845.George Kadianakis
2021-02-08Merge branch 'bug40249_squashed'Nick Mathewson
2021-02-08Add stream ID to ADDRMAP control eventNeel Chauhan
2021-02-01Merge branch 'maint-0.4.5'David Goulet
2021-02-01Merge branch 'tor-gitlab/mr/289' into maint-0.4.5David Goulet
2021-02-01relay: Send back CONNECTION_REFUSED on reentryDavid Goulet
The TORPROTOCOL reason causes the client to close the circuit which is not what we want because other valid streams might be on it. Instead, CONNECTION_REFUSED will leave it open but will not allow more streams to be attached to it. The client then open a new circuit to the destination. Closes #40270 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-01node: Move reentry set to use a digestmap_tDavid Goulet
Any lookup now will be certain and not probabilistic as the bloomfilter. Closes #40269 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-01Merge branch 'maint-0.4.5'David Goulet
2021-02-01relay: Follow consensus parameter for network reentryDavid Goulet
Obey the "allow-network-reentry" consensus parameters in order to decide to allow it or not at the Exit. Closes #40268 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-29Merge branch 'maint-0.4.5'David Goulet
2021-01-29exit: Deny re-entry into the networkRoger Dingledine
Exit relays now reject exit attempts to known relay addresses + ORPort and also to authorities on the ORPort and DirPort. Closes #2667 Signed-off-by: David Goulet <dgoulet@torproject.org>