aboutsummaryrefslogtreecommitdiff
path: root/src/core/mainloop/connection.c
AgeCommit message (Collapse)Author
2023-04-06Fix cases where edge connections can stall.David Goulet
We discovered two cases where edge connections can stall during testing: 1. Due to final data sitting in the edge inbuf when it was resumed 2. Due to flag synchronization between the token bucket and XON/XOFF The first issue has always existed in C-Tor, but we were able to tickle it in scp testing. If the last data from the protocol is able to fit in the inbuf, but not large enough to send, if an XOFF or connection block comes in at exactly that point, when the edge connection resumes, there will be no data to read from the socket, but the inbuf can just sit there, never draining. We noticed the second issue along the way to finding the first. It seems wrong, but it didn't seem to affect anything in practice. These are extremely rare in normal operation, but with conflux, XON/XOFF activity is more common, so we hit these. Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-12-20Fix duplicate code after tor-gitlab/mr/671 forward mergeDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-12-20Merge branch 'maint-0.4.7'David Goulet
2022-12-20Enable IP_BIND_ADDRESS_NO_PORT if supportedAlex Xu (Hello71)
Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-12-11Replace socket_failed_from_resource_exhaustion() by ↵qontinuum
socket_failed_from_fd_exhaustion()
2022-12-11Isolate warn_about_resource_exhaution()qontinuum
2022-11-25Rely on kernel errno when logging resource exhaustionqontinuum
Signed-off-by: qontinuum <qontinuum@monaco.mc>
2022-11-08Merge branch 'maint-0.4.7'David Goulet
2022-11-08Merge branch 'tor-gitlab/mr/651' into maint-0.4.7David Goulet
2022-11-08relay: Remove unused conn->ext_or_conn_idDavid Goulet
This also incidently removes a use of uninitialized stack data from the connection_or_set_ext_or_identifier() function. Fixes #40648 Signed-off-by: David Goulet <dgoulet@torproject.org>
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-10-31Merge branch 'tor-gitlab/mr/579'David Goulet
2022-10-12Merge branch 'maint-0.4.7'David Goulet
2022-10-12relay: Add number of rejected connections to MetricsPortDavid Goulet
Related to #40194 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-10-12conn: Keep stats of opened and closed connectionsDavid Goulet
Related to #40194 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-07-26relay: Remove unused conn->ext_or_conn_idDavid Goulet
This also incidently removes a use of uninitialized stack data from the connection_or_set_ext_or_identifier() function. Fixes #40648 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-06-15Enable IP_BIND_ADDRESS_NO_PORT if supportedAlex Xu (Hello71)
2022-05-21Trigger OOS on bind failures (fixes #40597)Alex Xu (Hello71)
2021-10-04Prop#324: Hook up flow controlMike Perry
2021-10-04Support rate limiting of edge connections reads.David Goulet
We only need to rate limit reading on edges for flow control, as per the rate that comes in the XON from the other side. When we rate limit reading from the edge source to this rate, we will only deliver that fast to the other side, thus satisfying its rate request. Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-07-30Make inbuf and outbuf len check params constMike Perry
2021-05-17Merge branch 'maint-0.4.6'Nick Mathewson
2021-05-17Merge branch 'maint-0.4.5' into maint-0.4.6Nick Mathewson
2021-05-12conn: MetricsPort listener is a listener portDavid Goulet
The connection type for the listener part was missing from the "is connection a listener" function. This lead to our periodic event that retries our listeners to keep trying to bind() again on an already opened MetricsPort. Closes #40370 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-05-12relay: Add TCP port exhaustion metricsDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-03-24fix some tiny typosRoger Dingledine
2021-03-17Merge branch 'mr/334'George Kadianakis
2021-03-17Implement rate limiting metrics.George Kadianakis
2021-03-17Implement port/file-descriptor exhaustion metric.George Kadianakis
This uses a heuristic that came up after a discussion with David. I'm leaving this as a separate commit so that it can be discussed further if needed.
2021-03-12Update copyrights to 2021, using "make update-copyright"Nick Mathewson
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-19Merge remote-tracking branch 'tor-gitlab/mr/308'George Kadianakis
2021-02-17metrics: Handle the connection finished flushing eventDavid Goulet
Turns out, we forgot to add the METRICS connection type fo the finished flushing handler. Fixes #40295 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-08Merge branch 'maint-0.4.5'Nick Mathewson
2021-02-08conn: Properly close MetricsPort socket on EOFDavid Goulet
Handle the EOF situation for a metrics connection. Furthermore, if we failed to fetch the data from the inbuf properly, mark the socket as closed because the caller, connection_process_inbuf(), assumes that we did so on error. Fixes #40257 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-27src/core/mainloop: Put brackets around IPv6 addresses in log messagesNeel Chauhan
2020-12-18Merge remote-tracking branch 'tor-gitlab/mr/207'Alexander Færøy
2020-11-12Remove orconn_ext_or_id_map and related functionsNeel Chauhan
2020-10-27Stop forcing IPv4 and IPv6 traffic on non-SOCKSPortsNeel Chauhan
2020-10-27hs: Collect service traffic metricsDavid Goulet
Related to #40063 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27conn: New Metrics listener portDavid Goulet
If MetricsPort is defined, listen on it and handle the incoming request. Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-15Also, include ed25519 identities in connection_describe().Nick Mathewson
Related to #22668.
2020-10-06Rename `OUTBOUND_ADDR_EXIT_AND_OR` to `OUTBOUND_ADDR_ANY`.Alexander Færøy
This patch renames the enumeration value in `outbound_addr_t` from `OUTBOUND_ADDR_EXIT_AND_OR` to `OUTBOUND_ADDR_ANY` since with the arrival of `OUTBOUND_ADDR_PT` it no longer makes sense to call the fallback value for "Exit and OR". Instead we rename it to "any". See: https://bugs.torproject.org/5304
2020-09-18Merge remote-tracking branch 'tor-gitlab/mr/137'Alexander Færøy
2020-09-01conn: Remove assert on new listener connection when retryingDavid Goulet
Opening a new listener connection can fail in many ways like a bind() permission denied on a low port for instance. And thus, we should expect to handle an error when creating a new one instead of assert() on it. To hit the removed assert: ORPort 80 KeepBindCapabilities 0 Start tor. Then edit torrc: ORPort <some-IP>:80 HUP tor and the assert is hit. Fixes #40073 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-08-25Merge remote-tracking branch 'tor-gitlab/mr/115'George Kadianakis
2020-08-11Merge remote-tracking branch 'tor-gitlab/mr/111'George Kadianakis
2020-08-11Merge branch 'maint-0.4.4'George Kadianakis
2020-08-11Merge remote-tracking branch 'tor-gitlab/mr/102' into maint-0.4.4George Kadianakis