diff options
author | Taylor Yu <catalyst@torproject.org> | 2019-03-20 20:51:12 -0500 |
---|---|---|
committer | teor <teor@torproject.org> | 2019-03-25 14:13:45 +1000 |
commit | 5d2f5e482e9985ad00f517ac3725b2336fbb930b (patch) | |
tree | eb5d8503585e62543e240e8c97079cf5d15dec9d /src/core/or/connection_or.c | |
parent | ebc7556dd0af1b7cc3e12ecc04d1db567d348b2e (diff) | |
download | tor-5d2f5e482e9985ad00f517ac3725b2336fbb930b.tar.gz tor-5d2f5e482e9985ad00f517ac3725b2336fbb930b.zip |
Correctly report PT vs proxy during bootstrap
Previously, or_connection_t did not record whether or not the
connection uses a pluggable transport. Instead, it stored the
underlying proxy protocol of the pluggable transport in
proxy_type. This made bootstrap reporting treat pluggable transport
connections as plain proxy connections.
Store a separate bit indicating whether a pluggable transport is in
use, and decode this during bootstrap reporting.
Fixes bug 28925; bugfix on 0.4.0.1-alpha.
Diffstat (limited to 'src/core/or/connection_or.c')
-rw-r--r-- | src/core/or/connection_or.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/core/or/connection_or.c b/src/core/or/connection_or.c index 55047da167..debf482cb3 100644 --- a/src/core/or/connection_or.c +++ b/src/core/or/connection_or.c @@ -437,7 +437,15 @@ connection_or_state_publish(const or_connection_t *conn, uint8_t state) msg.type = ORCONN_MSGTYPE_STATE; msg.u.state.gid = conn->base_.global_identifier; - msg.u.state.proxy_type = conn->proxy_type; + if (conn->is_pt) { + /* Do extra decoding because conn->proxy_type indicates the proxy + * protocol that tor uses to talk with the transport plugin, + * instead of PROXY_PLUGGABLE. */ + tor_assert_nonfatal(conn->proxy_type != PROXY_NONE); + msg.u.state.proxy_type = PROXY_PLUGGABLE; + } else { + msg.u.state.proxy_type = conn->proxy_type; + } msg.u.state.state = state; if (conn->chan) { msg.u.state.chan = TLS_CHAN_TO_BASE(conn->chan)->global_identifier; @@ -1472,7 +1480,7 @@ connection_or_connect, (const tor_addr_t *_addr, uint16_t port, int r; tor_addr_t proxy_addr; uint16_t proxy_port; - int proxy_type; + int proxy_type, is_pt = 0; tor_assert(_addr); tor_assert(id_digest); @@ -1516,13 +1524,15 @@ connection_or_connect, (const tor_addr_t *_addr, uint16_t port, conn->is_outgoing = 1; /* If we are using a proxy server, find it and use it. */ - r = get_proxy_addrport(&proxy_addr, &proxy_port, &proxy_type, TO_CONN(conn)); + r = get_proxy_addrport(&proxy_addr, &proxy_port, &proxy_type, &is_pt, + TO_CONN(conn)); if (r == 0) { conn->proxy_type = proxy_type; if (proxy_type != PROXY_NONE) { tor_addr_copy(&addr, &proxy_addr); port = proxy_port; conn->base_.proxy_state = PROXY_INFANT; + conn->is_pt = is_pt; } connection_or_change_state(conn, OR_CONN_STATE_CONNECTING); connection_or_event_status(conn, OR_CONN_EVENT_LAUNCHED, 0); |