From 96c7ddbc7e8a38385fa0f7b5d810d0bf8bdf6990 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Thu, 22 Dec 2016 12:37:42 -0500 Subject: [PATCH 1/2] circuit: Change close reasons from uint16_t to int When marking for close a circuit, the reason value, a integer, was assigned to a uint16_t converting any negative reasons (internal) to the wrong value. On the HS side, this was causing the client to flag introduction points to be unreachable as the internal reason was wrongfully converted to a positive 16bit value leading to flag 2 out of 3 intro points to be unreachable. Fixes #20307 and partially fixes #21056 Signed-off-by: David Goulet --- changes/bug20307 | 7 +++++++ src/or/or.h | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 changes/bug20307 diff --git a/changes/bug20307 b/changes/bug20307 new file mode 100644 index 000000000..6036b9951 --- /dev/null +++ b/changes/bug20307 @@ -0,0 +1,7 @@ + o Minor bugfixes (circuit, hidden service) + - When closing a circuit, the reason for doing so was assigned from a int + value to a uint16_t which is quite a problem for negative value that are + our internal reasons (ex: END_CIRC_REASON_IP_NOW_REDUNDANT). On the HS + side, this was causing introduction point to be flagged as unusable + because the reason wasn't the right one due to the bad conversion. + Partially fixes #21056 and fixes #20307; Bugfix on tor-0.2.8.1-alpha. diff --git a/src/or/or.h b/src/or/or.h index 66717792b..b7c67baf9 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -2964,11 +2964,11 @@ typedef struct circuit_t { /** For what reason (See END_CIRC_REASON...) is this circuit being closed? * This field is set in circuit_mark_for_close and used later in * circuit_about_to_free. */ - uint16_t marked_for_close_reason; + int marked_for_close_reason; /** As marked_for_close_reason, but reflects the underlying reason for * closing this circuit. */ - uint16_t marked_for_close_orig_reason; + int marked_for_close_orig_reason; /** Unique ID for measuring tunneled network status requests. */ uint64_t dirreq_id; From bcbb2d111bb08a9578d31e0240a24af8137dc766 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Fri, 13 Jan 2017 18:09:50 -0500 Subject: [PATCH 2/2] clean up grammar on bug20307 changes file pointed out by toralf on irc --- changes/bug20307 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/changes/bug20307 b/changes/bug20307 index 6036b9951..9112c9c78 100644 --- a/changes/bug20307 +++ b/changes/bug20307 @@ -1,7 +1,7 @@ o Minor bugfixes (circuit, hidden service) - - When closing a circuit, the reason for doing so was assigned from a int - value to a uint16_t which is quite a problem for negative value that are + - When closing a circuit, the reason for doing so was assigned from an int + value to a uint16_t which is quite a problem for negative values that are our internal reasons (ex: END_CIRC_REASON_IP_NOW_REDUNDANT). On the HS - side, this was causing introduction point to be flagged as unusable + side, this was causing introduction points to be flagged as unusable because the reason wasn't the right one due to the bad conversion. - Partially fixes #21056 and fixes #20307; Bugfix on tor-0.2.8.1-alpha. + Partially fixes bug 21056 and fixes bug 20307; Bugfix on 0.2.8.1-alpha.