aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/connection_edge.c
AgeCommit message (Collapse)Author
2020-08-03Merge remote-tracking branch 'tor-github/pr/1986/head'Nick Mathewson
2020-07-31Code simplifications for AP_CONN_STATE_CONTROLLER_WAITNeel Chauhan
2020-07-16Define new CONST_TO_*_CONN() functions for const-to-const castsNick Mathewson
These names are analogous to the CONST_TO_*_CIRC() functions we have for circuits. Part of #40046.
2020-07-16Improve documentation for our TO_*_CONN() cast functions.Nick Mathewson
Preliminary work for #40046.
2020-07-16Collapse channel_get_*_remote_addr() into a single function.Nick Mathewson
Since we can list the real address and the canonical one in a human-readable format we don't need to pick.
2020-07-16Remove "ADDR_ONLY" mode from channel_get_*_remote_descr.Nick Mathewson
This mode was only used in one place, and it caused a dangerous mingling of functionality. The method is supposed to _describe_ the peer's address, not give its actual address. We already had a function to get the actual address.
2020-07-16Use connection_describe() for log messages.Nick Mathewson
2020-07-09Merge branch 'maint-0.4.4'David Goulet
2020-07-08Send a control port event when a stream enters the ↵Neel Chauhan
AP_CONN_STATE_CONTROLLER_WAIT state
2020-07-08socks: Returns 0xF6 only if BAD_HOSTNAMEGuinness
This commit modifies the behavior of `parse_extended_address` in such a way that if it fails, it will always return a `BAD_HOSTNAME` value, which is then used to return the 0xF6 extended error code. This way, in any case that is not a valid v2 address, we return the 0xF6 error code, which is the expected behavior. Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-02Add a function for comparing the orport on an extendinfo.Nick Mathewson
2020-05-21Check for NULL from tor_dup_ip()rl1987
2020-05-06Merge branch 'maint-0.4.3'Nick Mathewson
2020-05-06Fix a boolean logic error when logging about invalid hostnames.Nick Mathewson
Fixes bug 34131; bugfix on 0.4.3.1-alpha.
2020-05-06Merge branch 'maint-0.4.3'Nick Mathewson
Amazingly, this time we had no merge conflicts with "falls through" comments.
2020-05-06Use __attribute__((fallthrough)) rather than magic GCC comments.Nick Mathewson
GCC added an implicit-fallthrough warning a while back, where it would complain if you had a nontrivial "case:" block that didn't end with break, return, or something like that. Clang recently added the same thing. GCC, however, would let you annotate a fall-through as intended by any of various magic "/* fall through */" comments. Clang, however, only seems to like "__attribute__((fallthrough))". Fortunately, GCC accepts that too. A previous commit in this branch defined a FALLTHROUGH macro to do the right thing if GNUC is defined; here we replace all of our "fall through" comments with uses of that macro. This is an automated commit, made with the following perl one-liner: #!/usr/bin/perl -i -p s#/\* *falls? ?thr.*?\*/#FALLTHROUGH;#i; (In order to avoid conflicts, I'm applying this script separately to each maint branch. This is the 0.4.3 version.)
2020-04-30net: Make all address bytes functions take uint8_t *teor
Part of 33817.
2020-02-18Move DNS TTL manipulation code to src/core/orNick Mathewson
This removes a dependency from the client code on feature/relay.
2020-02-18Replace identifiers related to clipping DNS ttls.Nick Mathewson
This is an automated commit, generated by this command: ./scripts/maint/rename_c_identifier.py \ MIN_DNS_TTL_AT_EXIT MIN_DNS_TTL \ MAX_DNS_TTL_AT_EXIT MAX_DNS_TTL \ dns_clip_ttl clip_dns_ttl
2020-01-08It's 2020. Update the copyright dates with "make update-copyright"Nick Mathewson
2019-11-21hs-v3: Return bad address SOCKS5 extended errorDavid Goulet
If ExtendedErrors is set for the SocksPort, an invalid .onion address now returns the 0xF6 error code per prop304. Closes #30022 Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18hs-v3: Set extended error if .onion is invalidDavid Goulet
In order to achieve this, the parse_extended_hostname() had to be refactored to return either success or failure and setting the hostname type in the given parameter. The reason for that is so it can detect invalid onion addresses that is having a ".onion", the right length but just not passing validation. That way, we can send back the prop304 ExtendedError "X'F1' Onion Service Descriptor Is Invalid" to notify the SOCKS connection of the invalid onion address. Part of #30382 Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-17socks: Send back extended error code if setDavid Goulet
This commit defines the new extended error codes. It also flags the socks request object that it can use them. Part of #30382 Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-02Merge branch 'tor-github/pr/1344'David Goulet
2019-09-30Re-run "make autostyle" with improved annotate_ifdef_directivesNick Mathewson
2019-09-18Merge branch 'bug31466_035' into bug31466_042Nick Mathewson
2019-09-18Merge branch 'bug31466_029' into bug31466_035_tmpNick Mathewson
2019-09-17Merge branch 'tor-github/pr/1323'George Kadianakis
2019-09-12Merge branch 'ticket31687_035' into ticket31687_040Nick Mathewson
2019-09-10pf: when extracting an IPv6 address, make sure we got an IPv6 addressNick Mathewson
Our code assumes that when we're configured to get IPv6 addresses out of a TRANS_PF transparent proxy connection, we actually will. But we didn't check that, and so FreeBSD started warning us about a potential NULL pointer dereference. Fixes part of bug 31687; bugfix on 0.2.3.4-alpha when this code was added.
2019-06-28begin_cell_parse(): Add an assertion to please coverity.Nick Mathewson
Coverity doesn't understand that if begin_cell_parse() returns 0 and sets is_begindir to 0, its address field will always be set. Fixes bug 30126; bugfix on 0.2.4.7-alpha; Fixes CID 1447296.
2019-05-15fix typos, whitespace, commentsRoger Dingledine
2019-04-29sendme: Always close stream if deliver window is negativeDavid Goulet
Previously, we would only close the stream when our deliver window was negative at the circuit-level but _not_ at the stream-level when receiving a DATA cell. This commit adds an helper function connection_edge_end_close() which sends an END and then mark the stream for close for a given reason. That function is now used both in case the deliver window goes below zero for both circuit and stream level. Part of #26840 Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-04-29sendme: Move code to the new files sendme.{c|h}David Goulet
Take apart the SENDME cell specific code and put it in sendme.{c|h}. This is part of prop289 that implements authenticated SENDMEs. Creating those new files allow for the already huge relay.c to not grow in LOC and makes it easier to handle and test the SENDME cells in an isolated way. This commit only moves code. No behavior change. Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-04-17connection_edge: remove an extra ;teor
2019-04-17connection_edge: Return a web page when HTTPTunnelPort is misconfiguredteor
Return an informative web page when the HTTPTunnelPort is used as an HTTP proxy. Closes ticket 27821, patch by "eighthave".
2019-03-25Split all controller events code into a new control_events.cNick Mathewson
Also, split the formatting code shared by control.c and control_events.c into controller_fmt.c.
2019-01-16Bump copyright date to 2019Nick Mathewson
2019-01-16Bump copyright date to 2019.Nick Mathewson
2019-01-14Merge remote-tracking branch 'asn-github/adaptive_padding-final'Nick Mathewson
2019-01-11Merge branch 'maint-0.3.5'Nick Mathewson
2019-01-11Merge remote-tracking branch 'tor-github/pr/563' into maint-0.3.5Nick Mathewson
2019-01-09Merge branch 'maint-0.3.5'Nick Mathewson
2019-01-09Fix (and make consistent) the use of OpenBSD preprocessor macro testsKris Katterjohn
Prior to this commit, the testsuite was failing on OpenBSD. After this commit the testsuite runs fine on OpenBSD. It was previously decided to test for the OpenBSD macro (rather than __OpenBSD__, etc.) because OpenBSD forks seem to have the former macro defined. sys/param.h must be included for the OpenBSD macro definition; however, many files tested for the OpenBSD macro without having this header included. This commit includes sys/param.h in the files where the OpenBSD macro is used (and sys/param.h is not already included), and it also changes some instances of the __OpenBSD__ macro to OpenBSD. See commit 27df23abb675ffeb198bf0c1cc85c4baed77a988 which changed everything to use OpenBSD instead of __OpenBSD__ or OPENBSD. See also tickets #6982 and #20980 (the latter ticket is where it was decided to use the OpenBSD macro). Signed-off-by: Kris Katterjohn <katterjohn@gmail.com>
2019-01-02Circuit padding machine creation events.Mike Perry
These event callbacks allow circuit padding to decide when to attempt to launch and negotiate new padding machines, and when to tear old ones down. Co-authored-by: George Kadianakis <desnacked@riseup.net>
2018-12-05Merge remote-tracking branch 'tor-github/pr/508'Nick Mathewson
2018-12-04conn: Add an helper to mark a connection as waiting for an HS descriptorDavid Goulet
The transition for a connection to either become or go back in AP_CONN_STATE_RENDDESC_WAIT state must make sure that the entry connection is _not_ in the waiting for circuit list. This commit implements the helper function connection_ap_mark_as_waiting_for_renddesc() that removes the entry connection from the pending list and then change its state. This code pattern is used in many places in the code where next commit will remove this code duplication to use this new helper function. Part of #28669 Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-11-26Add options to control dormant-client feature.Nick Mathewson
The DormantClientTimeout option controls how long Tor will wait before going dormant. It also provides a way to disable the feature by setting DormantClientTimeout to e.g. "50 years". The DormantTimeoutDisabledByIdleStreams option controls whether open but inactive streams count as "client activity". To implement it, I had to make it so that reading or writing on a client stream *always* counts as activity. Closes ticket 28429.
2018-11-14Move buffers.c out of lib/containers to resolve a circularity.Nick Mathewson
2018-10-14Merge branch 'bug27772_squashed'Nick Mathewson