[tor-commits] [webwml/master] Bug 25847: remove boklm's old key from the signing-keys page

2018-05-09 Thread boklm
commit 5462c6d64523557f4c834623abb0fe572f718d98
Author: Nicolas Vigier 
Date:   Wed May 9 20:36:31 2018 +0200

Bug 25847: remove boklm's old key from the signing-keys page
---
 docs/en/signing-keys.wml | 4 
 1 file changed, 4 deletions(-)

diff --git a/docs/en/signing-keys.wml b/docs/en/signing-keys.wml
index 0b24d553..4bd3e350 100644
--- a/docs/en/signing-keys.wml
+++ b/docs/en/signing-keys.wml
@@ -117,10 +117,6 @@
 sub   rsa4096/0x5778071EE2DE675B 2017-09-11 [expires: 2018-09-11]
 sub   rsa4096/0x72E841BB93148AD2 2017-09-11 [expires: 2018-09-11]
 
-pub   4096R/D0220E4B 2014-03-19
-  Key fingerprint = 4A90 646C 0BAE D9D4 56AB  3111 E5B8 1856 D022 0E4B
-uid  Nicolas Vigier (TBB Builds Signing Key) 

-
 pub   4096R/3E39CEABFC69F6F7 2015-09-24
   Key fingerprint = 6AB6 AEE9 776E 7827 23C8  ACE8 3E39 CEAB FC69 F6F7
 uid   [ unknown] Nicolas Vigier (boklm) 




___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [webwml/master] Add new Tor Browser version: 8.0a7

2018-05-09 Thread boklm
commit 12390d45b8a6d034f6c22d4fc91526e161222f08
Author: Nicolas Vigier 
Date:   Wed May 9 22:29:33 2018 +0200

Add new Tor Browser version: 8.0a7
---
 include/versions.wmi   | 4 ++--
 projects/torbrowser/RecommendedTBBVersions | 6 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/versions.wmi b/include/versions.wmi
index cb255f72..634fb233 100644
--- a/include/versions.wmi
+++ b/include/versions.wmi
@@ -22,8 +22,8 @@
 ../dist/torbrowser//tor-win32-.zip
 
 # *** tor browser beta/alpha ***
-8.0a6
-2018-04-21
+8.0a7
+2018-05-09
 0.0.16
 
 # If all platforms are on the same version, you only need to update
diff --git a/projects/torbrowser/RecommendedTBBVersions 
b/projects/torbrowser/RecommendedTBBVersions
index 3f39fa3e..10bd6be0 100644
--- a/projects/torbrowser/RecommendedTBBVersions
+++ b/projects/torbrowser/RecommendedTBBVersions
@@ -14,5 +14,9 @@
 "8.0a6",
 "8.0a6-MacOS",
 "8.0a6-Linux",
-"8.0a6-Windows"
+"8.0a6-Windows",
+"8.0a7",
+"8.0a7-MacOS",
+"8.0a7-Linux",
+"8.0a7-Windows"
 ]

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [webwml/master] fixup! Add new Tor Browser version: 7.5.4

2018-05-09 Thread boklm
commit 440e0b0441c2d8e23e8f2e9979e1128de9757407
Author: Nicolas Vigier 
Date:   Wed May 9 20:33:20 2018 +0200

fixup! Add new Tor Browser version: 7.5.4
---
 projects/torbrowser/RecommendedTBBVersions | 4 
 1 file changed, 4 insertions(+)

diff --git a/projects/torbrowser/RecommendedTBBVersions 
b/projects/torbrowser/RecommendedTBBVersions
index 2fefb90c..3f39fa3e 100644
--- a/projects/torbrowser/RecommendedTBBVersions
+++ b/projects/torbrowser/RecommendedTBBVersions
@@ -3,6 +3,10 @@
 "7.5.3-MacOS",
 "7.5.3-Linux",
 "7.5.3-Windows",
+"7.5.4",
+"7.5.4-MacOS",
+"7.5.4-Linux",
+"7.5.4-Windows",
 "8.0a5",
 "8.0a5-MacOS",
 "8.0a5-Linux",

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Merge branch 'ticket26016'

2018-05-09 Thread nickm
commit d972a8a9440d89143d58b5d0bd57155c38651ee6
Merge: f684b48b5 b0e575771
Author: Nick Mathewson 
Date:   Wed May 9 14:04:30 2018 -0400

Merge branch 'ticket26016'

 changes/ticket26016 |  4 
 src/or/main.c   | 33 ++---
 2 files changed, 14 insertions(+), 23 deletions(-)

diff --cc src/or/main.c
index 2497c277a,849101906..c4a42569d
--- a/src/or/main.c
+++ b/src/or/main.c
@@@ -2495,73 -2493,8 +2495,70 @@@ hs_service_callback(time_t now, const o
  
  /** Timer: used to invoke second_elapsed_callback() once per second. */
  static periodic_timer_t *second_timer = NULL;
- /** Number of libevent errors in the last second: we die if we get too many. 
*/
- static int n_libevent_errors = 0;
- 
 -/** Last time that second_elapsed_callback was called. */
 +/** Last time that update_current_time was called. */
  static time_t current_second = 0;
 +/** Last time that update_current_time updated current_second. */
 +static monotime_coarse_t current_second_last_changed;
 +
 +/**
 + * Set the current time to "now", which should be the value returned by
 + * time().  Check for clock jumps and track the total number of seconds we
 + * have been running.
 + */
 +void
 +update_current_time(time_t now)
 +{
 +  if (PREDICT_LIKELY(now == current_second)) {
 +/* We call this function a lot.  Most frequently, the current second
 + * will not have changed, so we just return. */
 +return;
 +  }
 +
 +  const time_t seconds_elapsed = current_second ? (now - current_second) : 0;
 +
 +  /* Check the wall clock against the monotonic clock, so we can
 +   * better tell idleness from clock jumps and/or other shenanigans. */
 +  monotime_coarse_t last_updated;
 +  memcpy(&last_updated, ¤t_second_last_changed, sizeof(last_updated));
 +  monotime_coarse_get(¤t_second_last_changed);
 +
 +  /** How much clock jumping do we tolerate? */
 +#define NUM_JUMPED_SECONDS_BEFORE_WARN 100
 +
 +  /** How much idleness do we tolerate? */
 +#define NUM_IDLE_SECONDS_BEFORE_WARN 3600
 +
 +  if (seconds_elapsed < -NUM_JUMPED_SECONDS_BEFORE_WARN) {
 +// moving back in time is always a bad sign.
 +circuit_note_clock_jumped(seconds_elapsed, false);
 +  } else if (seconds_elapsed >= NUM_JUMPED_SECONDS_BEFORE_WARN) {
 +/* Compare the monotonic clock to the result of time(). */
 +const int32_t monotime_msec_passed =
 +  monotime_coarse_diff_msec32(&last_updated,
 +  ¤t_second_last_changed);
 +const int monotime_sec_passed = monotime_msec_passed / 1000;
 +const int discrepancy = monotime_sec_passed - (int)seconds_elapsed;
 +/* If the monotonic clock deviates from time(NULL), we have a couple of
 + * possibilities.  On some systems, this means we have been suspended or
 + * sleeping.  Everywhere, it can mean that the wall-clock time has
 + * been changed -- for example, with settimeofday().
 + *
 + * On the other hand, if the monotonic time matches with the wall-clock
 + * time, we've probably just been idle for a while, with no events firing.
 + * we tolerate much more of that.
 + */
 +const bool clock_jumped = abs(discrepancy) > 2;
 +
 +if (clock_jumped || seconds_elapsed >= NUM_IDLE_SECONDS_BEFORE_WARN) {
 +  circuit_note_clock_jumped(seconds_elapsed, ! clock_jumped);
 +}
 +  } else if (seconds_elapsed > 0) {
 +stats_n_seconds_working += seconds_elapsed;
 +  }
 +
 +  update_approx_time(now);
 +  current_second = now;
 +}
  
  /** Libevent callback: invoked once every second. */
  static void
@@@ -2576,18 -2509,13 +2573,16 @@@ second_elapsed_callback(periodic_timer_
(void)timer;
(void)arg;
  
-   n_libevent_errors = 0;
- 
 -  /* log_notice(LD_GENERAL, "Tick."); */
now = time(NULL);
 -  update_approx_time(now);
 +
 +  /* We don't need to do this once-per-second any more: time-updating is
 +   * only in this callback _because it is a callback_. It should be fine
 +   * to disable this callback, and the time will still get updated.
 +   */
 +  update_current_time(now);
  
/* the second has rolled over. check more stuff. */
 -  seconds_elapsed = current_second ? (int)(now - current_second) : 0;
 +  // remove this once it's unneeded
bytes_read = (size_t)(stats_n_bytes_read - stats_prev_n_read);
bytes_written = (size_t)(stats_n_bytes_written - stats_prev_n_written);
stats_prev_n_read = stats_n_bytes_read;
@@@ -3721,10 -3652,7 +3709,9 @@@ tor_free_all(int postfork
should_init_bridge_stats = 1;
dns_honesty_first_time = 1;
heartbeat_callback_first_time = 1;
-   n_libevent_errors = 0;
current_second = 0;
 +  memset(¤t_second_last_changed, 0,
 + sizeof(current_second_last_changed));
  
if (!postfork) {
  release_lockfile();

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Refactor to remove n_libevent_errors

2018-05-09 Thread nickm
commit b0e5757710c476a1a79dfc8a706f566ce515c495
Author: Nick Mathewson 
Date:   Thu May 3 12:44:00 2018 -0400

Refactor to remove n_libevent_errors

We cleared this value in second_elapsed_callback.  But what were we
using it for?  For detecting if Libevent returned EINVAL too often!
We already have a way to detect too-frequent events, and that's with
a ratelim_t.  Refactor the code to use that instead.  Closes ticket
26016.
---
 changes/ticket26016 |  4 
 src/or/main.c   | 32 ++--
 2 files changed, 14 insertions(+), 22 deletions(-)

diff --git a/changes/ticket26016 b/changes/ticket26016
new file mode 100644
index 0..f0eb56d32
--- /dev/null
+++ b/changes/ticket26016
@@ -0,0 +1,4 @@
+  o Code simplification and refactoring:
+- Use our standard rate-limiting code to deal with excessive libevent
+  failures, rather than the hand-rolled logic we had before.
+  Closes ticket 26016.
diff --git a/src/or/main.c b/src/or/main.c
index 8cdf27ed4..849101906 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2493,8 +2493,6 @@ hs_service_callback(time_t now, const or_options_t 
*options)
 
 /** Timer: used to invoke second_elapsed_callback() once per second. */
 static periodic_timer_t *second_timer = NULL;
-/** Number of libevent errors in the last second: we die if we get too many. */
-static int n_libevent_errors = 0;
 /** Last time that second_elapsed_callback was called. */
 static time_t current_second = 0;
 
@@ -2512,8 +2510,6 @@ second_elapsed_callback(periodic_timer_t *timer, void 
*arg)
   (void)timer;
   (void)arg;
 
-  n_libevent_errors = 0;
-
   /* log_notice(LD_GENERAL, "Tick."); */
   now = time(NULL);
   update_approx_time(now);
@@ -2558,21 +2554,6 @@ systemd_watchdog_callback(periodic_timer_t *timer, void 
*arg)
 }
 #endif /* defined(HAVE_SYSTEMD_209) */
 
-#ifndef _WIN32
-/** Called when a possibly ignorable libevent error occurs; ensures that we
- * don't get into an infinite loop by ignoring too many errors from
- * libevent. */
-static int
-got_libevent_error(void)
-{
-  if (++n_libevent_errors > 8) {
-log_err(LD_NET, "Too many libevent errors in one second; dying");
-return -1;
-  }
-  return 0;
-}
-#endif /* !defined(_WIN32) */
-
 #define UPTIME_CUTOFF_FOR_NEW_BANDWIDTH_TEST (6*60*60)
 
 /** Called when our IP address seems to have changed. at_interface
@@ -2914,6 +2895,11 @@ do_main_loop(void)
   return run_main_loop_until_done();
 }
 
+#ifndef _WIN32
+/** Rate-limiter for EINVAL-type libevent warnings. */
+static ratelim_t libevent_error_ratelim = RATELIM_INIT(10);
+#endif
+
 /**
  * Run the main loop a single time. Return 0 for "exit"; -1 for "exit with
  * error", and 1 for "run this again."
@@ -2979,9 +2965,12 @@ run_main_loop_once(void)
   return -1;
 #ifndef _WIN32
 } else if (e == EINVAL) {
-  log_warn(LD_NET, "EINVAL from libevent: should you upgrade libevent?");
-  if (got_libevent_error())
+  log_fn_ratelim(&libevent_error_ratelim, LOG_WARN, LD_NET,
+ "EINVAL from libevent: should you upgrade libevent?");
+  if (libevent_error_ratelim.n_calls_since_last_time > 8) {
+log_err(LD_NET, "Too many libevent errors, too fast: dying");
 return -1;
+  }
 #endif /* !defined(_WIN32) */
 } else {
   tor_assert_nonfatal_once(! ERRNO_IS_EINPROGRESS(e));
@@ -3663,7 +3652,6 @@ tor_free_all(int postfork)
   should_init_bridge_stats = 1;
   dns_honesty_first_time = 1;
   heartbeat_callback_first_time = 1;
-  n_libevent_errors = 0;
   current_second = 0;
 
   if (!postfork) {



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Fix some clang warnings

2018-05-09 Thread nickm
commit 15ce5a3e5ab18f44172f1ada3fe1735f28a95c09
Author: Nick Mathewson 
Date:   Thu May 3 12:31:35 2018 -0400

Fix some clang warnings
---
 src/or/circuitbuild.c | 18 ++
 src/or/circuitbuild.h |  2 +-
 src/or/main.c |  2 +-
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 0617c2477..7f4504f6b 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -1138,22 +1138,24 @@ circuit_send_intermediate_onion_skin(origin_circuit_t 
*circ,
  * something has also gone wrong with our network: notify the user, and
  * abandon all not-yet-used circuits. */
 void
-circuit_note_clock_jumped(int seconds_elapsed, bool was_idle)
+circuit_note_clock_jumped(int64_t seconds_elapsed, bool was_idle)
 {
   int severity = server_mode(get_options()) ? LOG_WARN : LOG_NOTICE;
   if (was_idle) {
-tor_log(severity, LD_GENERAL, "Tor has been idle for %d seconds; "
-"assuming established circuits no longer work.",
-seconds_elapsed);
+tor_log(severity, LD_GENERAL, "Tor has been idle for "I64_FORMAT
+" seconds; assuming established circuits no longer work.",
+I64_PRINTF_ARG(seconds_elapsed));
   } else {
 tor_log(severity, LD_GENERAL,
-"Your system clock just jumped %d seconds %s; "
+"Your system clock just jumped "I64_FORMAT" seconds %s; "
 "assuming established circuits no longer work.",
-seconds_elapsed >=0 ? seconds_elapsed : -seconds_elapsed,
+I64_PRINTF_ARG(
+ seconds_elapsed >=0 ? seconds_elapsed : -seconds_elapsed),
 seconds_elapsed >=0 ? "forward" : "backward");
   }
-  control_event_general_status(LOG_WARN, "CLOCK_JUMPED TIME=%d IDLE=%d",
-   seconds_elapsed, was_idle?1:0);
+  control_event_general_status(LOG_WARN, "CLOCK_JUMPED TIME="I64_FORMAT
+   " IDLE=%d",
+   I64_PRINTF_ARG(seconds_elapsed), was_idle?1:0);
   /* so we log when it works again */
   note_that_we_maybe_cant_complete_circuits();
   control_event_client_status(severity, "CIRCUIT_NOT_ESTABLISHED REASON=%s",
diff --git a/src/or/circuitbuild.h b/src/or/circuitbuild.h
index f3a8bbfc9..725d872d0 100644
--- a/src/or/circuitbuild.h
+++ b/src/or/circuitbuild.h
@@ -29,7 +29,7 @@ void circuit_n_chan_done(channel_t *chan, int status,
 int inform_testing_reachability(void);
 int circuit_timeout_want_to_count_circ(const origin_circuit_t *circ);
 int circuit_send_next_onion_skin(origin_circuit_t *circ);
-void circuit_note_clock_jumped(int seconds_elapsed, bool was_idle);
+void circuit_note_clock_jumped(int64_t seconds_elapsed, bool was_idle);
 int circuit_extend(cell_t *cell, circuit_t *circ);
 int circuit_init_cpath_crypto(crypt_path_t *cpath,
   const char *key_data, size_t key_data_len,
diff --git a/src/or/main.c b/src/or/main.c
index b6035fa76..b8827b947 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2538,7 +2538,7 @@ update_current_time(time_t now)
   monotime_coarse_diff_msec32(&last_updated,
   ¤t_second_last_changed);
 const int monotime_sec_passed = monotime_msec_passed / 1000;
-const int discrepency = monotime_sec_passed - seconds_elapsed;
+const int discrepency = monotime_sec_passed - (int)seconds_elapsed;
 /* If the monotonic clock deviates from time(NULL), we have a couple of
  * possibilities.  On some systems, this means we have been suspended or
  * sleeping.  Everywhere, it can mean that the wall-clock time has



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] spelling fix

2018-05-09 Thread nickm
commit 0abf09b2cea9e2af5a9d743b78447021213d02ab
Author: Nick Mathewson 
Date:   Wed May 9 12:00:39 2018 -0400

spelling fix
---
 src/or/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/or/main.c b/src/or/main.c
index b8827b947..ed1bf9aeb 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2538,7 +2538,7 @@ update_current_time(time_t now)
   monotime_coarse_diff_msec32(&last_updated,
   ¤t_second_last_changed);
 const int monotime_sec_passed = monotime_msec_passed / 1000;
-const int discrepency = monotime_sec_passed - (int)seconds_elapsed;
+const int discrepancy = monotime_sec_passed - (int)seconds_elapsed;
 /* If the monotonic clock deviates from time(NULL), we have a couple of
  * possibilities.  On some systems, this means we have been suspended or
  * sleeping.  Everywhere, it can mean that the wall-clock time has
@@ -2548,7 +2548,7 @@ update_current_time(time_t now)
  * time, we've probably just been idle for a while, with no events firing.
  * we tolerate much more of that.
  */
-const bool clock_jumped = abs(discrepency) > 2;
+const bool clock_jumped = abs(discrepancy) > 2;
 
 if (clock_jumped || seconds_elapsed >= NUM_IDLE_SECONDS_BEFORE_WARN) {
   circuit_note_clock_jumped(seconds_elapsed, ! clock_jumped);



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Merge branch 'ticket26009'

2018-05-09 Thread nickm
commit f684b48b5be5515395846d089a386167e76f895a
Merge: 61d5ce83a 0abf09b2c
Author: Nick Mathewson 
Date:   Wed May 9 14:01:08 2018 -0400

Merge branch 'ticket26009'

 changes/ticket26009  |   9 +++
 src/or/circuitbuild.c|  30 ++
 src/or/circuitbuild.h|   2 +-
 src/or/connection.c  |   3 +-
 src/or/main.c|  90 --
 src/or/main.h|   2 +
 src/or/periodic.c|   2 +
 src/test/include.am  |   1 +
 src/test/test.c  |   1 +
 src/test/test.h  |   1 +
 src/test/test_mainloop.c | 142 +++
 11 files changed, 255 insertions(+), 28 deletions(-)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Mark the 1-per-sec update_current_time() call as redundant.

2018-05-09 Thread nickm
commit c9f07f36bf986f274ac9fc56b5c61bbcc669b22e
Author: Nick Mathewson 
Date:   Thu May 3 12:23:55 2018 -0400

Mark the 1-per-sec update_current_time() call as redundant.

We still do this time update here, since we do it from all
callbacks, but it is no longer a reason to keep the once-per-second
callback enabled.

Closes ticket 26009.
---
 changes/ticket26009 | 9 +
 src/or/main.c   | 6 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/changes/ticket26009 b/changes/ticket26009
new file mode 100644
index 0..51ada1572
--- /dev/null
+++ b/changes/ticket26009
@@ -0,0 +1,9 @@
+  o Minor features (mainloop):
+   - Move responsibility for
+ keeping track of Tor's uptime
+  from a nce-per-second callback to a callback that is only scheduled as
+  needed.  Once enough items are removed from our once-per-second
+  callback, we can eliminate it entirely to conserve CPU when idle.
+  Closes ticket
+  26009.
+
diff --git a/src/or/main.c b/src/or/main.c
index e82162c39..b6035fa76 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2576,8 +2576,12 @@ second_elapsed_callback(periodic_timer_t *timer, void 
*arg)
 
   n_libevent_errors = 0;
 
-  /* log_notice(LD_GENERAL, "Tick."); */
   now = time(NULL);
+
+  /* We don't need to do this once-per-second any more: time-updating is
+   * only in this callback _because it is a callback_. It should be fine
+   * to disable this callback, and the time will still get updated.
+   */
   update_current_time(now);
 
   /* the second has rolled over. check more stuff. */



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Move the "update the current second" code from second_elapsed_callback

2018-05-09 Thread nickm
commit b0598f2a124d0b75aa3e1d06c8ed59cc6142a235
Author: Nick Mathewson 
Date:   Thu May 3 10:35:49 2018 -0400

Move the "update the current second" code from second_elapsed_callback

This now happens in a new function, with the intent of having it
invoked from our callbacks.  This is one step on the way to 26009.
---
 src/or/main.c | 50 +++---
 src/or/main.h |  2 ++
 2 files changed, 37 insertions(+), 15 deletions(-)

diff --git a/src/or/main.c b/src/or/main.c
index 8cdf27ed4..6ecc340a9 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2495,9 +2495,41 @@ hs_service_callback(time_t now, const or_options_t 
*options)
 static periodic_timer_t *second_timer = NULL;
 /** Number of libevent errors in the last second: we die if we get too many. */
 static int n_libevent_errors = 0;
-/** Last time that second_elapsed_callback was called. */
+
+/** Last time that update_current_time was called. */
 static time_t current_second = 0;
 
+/**
+ * Set the current time to "now", which should be the value returned by
+ * time().  Check for clock jumps and track the total number of seconds we
+ * have been running.
+ */
+void
+update_current_time(time_t now)
+{
+  if (PREDICT_LIKELY(now == current_second)) {
+/* We call this function a lot.  Most frequently, the current second
+ * will not have changed, so we just return. */
+return;
+  }
+
+  const time_t seconds_elapsed = current_second ? (now - current_second) : 0;
+
+/** If more than this many seconds have elapsed, probably the clock
+ * jumped: doesn't count. */
+#define NUM_JUMPED_SECONDS_BEFORE_WARN 100
+
+  if (seconds_elapsed < -NUM_JUMPED_SECONDS_BEFORE_WARN ||
+  seconds_elapsed >= NUM_JUMPED_SECONDS_BEFORE_WARN) {
+circuit_note_clock_jumped(seconds_elapsed);
+  } else if (seconds_elapsed > 0) {
+stats_n_seconds_working += seconds_elapsed;
+  }
+
+  update_approx_time(now);
+  current_second = now;
+}
+
 /** Libevent callback: invoked once every second. */
 static void
 second_elapsed_callback(periodic_timer_t *timer, void *arg)
@@ -2508,7 +2540,6 @@ second_elapsed_callback(periodic_timer_t *timer, void 
*arg)
   time_t now;
   size_t bytes_written;
   size_t bytes_read;
-  int seconds_elapsed;
   (void)timer;
   (void)arg;
 
@@ -2516,10 +2547,10 @@ second_elapsed_callback(periodic_timer_t *timer, void 
*arg)
 
   /* log_notice(LD_GENERAL, "Tick."); */
   now = time(NULL);
-  update_approx_time(now);
+  update_current_time(now);
 
   /* the second has rolled over. check more stuff. */
-  seconds_elapsed = current_second ? (int)(now - current_second) : 0;
+  // remove this once it's unneeded
   bytes_read = (size_t)(stats_n_bytes_read - stats_prev_n_read);
   bytes_written = (size_t)(stats_n_bytes_written - stats_prev_n_written);
   stats_prev_n_read = stats_n_bytes_read;
@@ -2531,18 +2562,7 @@ second_elapsed_callback(periodic_timer_t *timer, void 
*arg)
   control_event_circ_bandwidth_used();
   control_event_circuit_cell_stats();
 
-/** If more than this many seconds have elapsed, probably the clock
- * jumped: doesn't count. */
-#define NUM_JUMPED_SECONDS_BEFORE_WARN 100
-  if (seconds_elapsed < -NUM_JUMPED_SECONDS_BEFORE_WARN ||
-  seconds_elapsed >= NUM_JUMPED_SECONDS_BEFORE_WARN) {
-circuit_note_clock_jumped(seconds_elapsed);
-  } else if (seconds_elapsed > 0)
-stats_n_seconds_working += seconds_elapsed;
-
   run_scheduled_events(now);
-
-  current_second = now; /* remember which second it is, for next time */
 }
 
 #ifdef HAVE_SYSTEMD_209
diff --git a/src/or/main.h b/src/or/main.h
index a312b51e0..45d6b4478 100644
--- a/src/or/main.h
+++ b/src/or/main.h
@@ -66,6 +66,8 @@ void reschedule_dirvote(const or_options_t *options);
 void mainloop_schedule_postloop_cleanup(void);
 void rescan_periodic_events(const or_options_t *options);
 
+void update_current_time(time_t now);
+
 MOCK_DECL(long,get_uptime,(void));
 MOCK_DECL(void,reset_uptime,(void));
 



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Basic unit tests for update_current_time().

2018-05-09 Thread nickm
commit 1d16b7124f8c5cdcd04599aac62fb903862acdee
Author: Nick Mathewson 
Date:   Thu May 3 10:53:19 2018 -0400

Basic unit tests for update_current_time().

This function is about to get more complicated, so we should track
how it's working.
---
 src/test/include.am  |   1 +
 src/test/test.c  |   1 +
 src/test/test.h  |   1 +
 src/test/test_mainloop.c | 102 +++
 4 files changed, 105 insertions(+)

diff --git a/src/test/include.am b/src/test/include.am
index eb61d7489..aa386b5fa 100644
--- a/src/test/include.am
+++ b/src/test/include.am
@@ -139,6 +139,7 @@ src_test_test_SOURCES = \
src/test/test_keypin.c \
src/test/test_link_handshake.c \
src/test/test_logging.c \
+   src/test/test_mainloop.c \
src/test/test_microdesc.c \
src/test/test_nodelist.c \
src/test/test_oom.c \
diff --git a/src/test/test.c b/src/test/test.c
index 2963f169c..8951b0f73 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -859,6 +859,7 @@ struct testgroup_t testgroups[] = {
   { "introduce/", introduce_tests },
   { "keypin/", keypin_tests },
   { "link-handshake/", link_handshake_tests },
+  { "mainloop/", mainloop_tests },
   { "nodelist/", nodelist_tests },
   { "oom/", oom_tests },
   { "oos/", oos_tests },
diff --git a/src/test/test.h b/src/test/test.h
index 15965ccaf..c9200a937 100644
--- a/src/test/test.h
+++ b/src/test/test.h
@@ -234,6 +234,7 @@ extern struct testcase_t introduce_tests[];
 extern struct testcase_t keypin_tests[];
 extern struct testcase_t link_handshake_tests[];
 extern struct testcase_t logging_tests[];
+extern struct testcase_t mainloop_tests[];
 extern struct testcase_t microdesc_tests[];
 extern struct testcase_t nodelist_tests[];
 extern struct testcase_t oom_tests[];
diff --git a/src/test/test_mainloop.c b/src/test/test_mainloop.c
new file mode 100644
index 0..2f8a7bca6
--- /dev/null
+++ b/src/test/test_mainloop.c
@@ -0,0 +1,102 @@
+/* Copyright (c) 2018, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file test_mainloop.c
+ * \brief Tests for functions closely related to the Tor main loop
+ */
+
+#include "test.h"
+#include "log_test_helpers.h"
+
+#include "or.h"
+#include "main.h"
+
+static void
+test_mainloop_update_time_normal(void *arg)
+{
+  (void)arg;
+
+  /* This time is in the past as of when this test was written. */
+  time_t now = 1525272090;
+  reset_uptime();
+  update_current_time(now);
+  tt_int_op(approx_time(), OP_EQ, now);
+  tt_int_op(get_uptime(), OP_EQ, 0);
+
+  update_current_time(now); // Same time as before is a no-op.
+  tt_int_op(get_uptime(), OP_EQ, 0);
+
+  now += 1;
+  update_current_time(now);
+  tt_int_op(approx_time(), OP_EQ, now);
+  tt_int_op(get_uptime(), OP_EQ, 1);
+
+  now += 2; // two-second jump is unremarkable.
+  update_current_time(now);
+  tt_int_op(approx_time(), OP_EQ, now);
+  tt_int_op(get_uptime(), OP_EQ, 3);
+
+  now -= 1; // a one-second hop backwards is also unremarkable.
+  update_current_time(now);
+  tt_int_op(approx_time(), OP_EQ, now); // it changes the approx time...
+  tt_int_op(get_uptime(), OP_EQ, 3); // but it doesn't roll back our uptime
+
+ done:
+  ;
+}
+
+static void
+test_mainloop_update_time_jumps(void *arg)
+{
+  (void)arg;
+
+  /* This time is in the past as of when this test was written. */
+  time_t now = 220897152;
+  reset_uptime();
+  update_current_time(now);
+  tt_int_op(approx_time(), OP_EQ, now);
+  tt_int_op(get_uptime(), OP_EQ, 0);
+
+  /* Put some uptime on the clock.. */
+  now += 3;
+  update_current_time(now);
+  tt_int_op(approx_time(), OP_EQ, now);
+  tt_int_op(get_uptime(), OP_EQ, 3);
+
+  /* Now try jumping forward. */
+  setup_capture_of_logs(LOG_NOTICE);
+  now += 3600;
+  update_current_time(now);
+  expect_single_log_msg_containing(
+   "Your system clock just jumped 3600 seconds forward");
+  tt_int_op(approx_time(), OP_EQ, now);
+  tt_int_op(get_uptime(), OP_EQ, 3); // no uptime change.
+  mock_clean_saved_logs();
+
+  now -= 600;
+  update_current_time(now);
+  expect_single_log_msg_containing(
+   "Your system clock just jumped 600 seconds backward");
+  tt_int_op(approx_time(), OP_EQ, now);
+  tt_int_op(get_uptime(), OP_EQ, 3); // no uptime change.
+
+  /* uptime tracking should go normally now if the clock moves sensibly. */
+  now += 2;
+  update_current_time(now);
+  tt_int_op(approx_time(), OP_EQ, now);
+  tt_int_op(get_uptime(), OP_EQ, 5);
+
+ done:
+  teardown_capture_of_logs();
+}
+
+#define MAINLOOP_TEST(name) \
+  { #name, test_mainloop_## name , TT_FORK, NULL, NULL }
+
+struct testcase_t mainloop_tests[] = {
+  MAINLOOP_TEST(update_time_normal),
+  MAINLOOP_TEST(update_time_jumps),
+  END_OF_TESTCASES
+};
+



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Add update_current_time() calls to periodic and event-driven callbacks

2018-05-09 Thread nickm
commit 83137275a77eedbf177fbdb298c89a346abe2243
Author: Nick Mathewson 
Date:   Thu May 3 10:56:49 2018 -0400

Add update_current_time() calls to periodic and event-driven callbacks

This is part of 26009, where we're going to keep track of the
current time and its jumps without having to do so in
second_elapsed_callback.
---
 src/or/connection.c | 3 ++-
 src/or/main.c   | 1 +
 src/or/periodic.c   | 2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/or/connection.c b/src/or/connection.c
index c2673ade1..df36d4211 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -3439,7 +3439,7 @@ int
 connection_handle_read(connection_t *conn)
 {
   int res;
-
+  update_current_time(time(NULL));
   res = connection_handle_read_impl(conn);
   return res;
 }
@@ -3982,6 +3982,7 @@ int
 connection_handle_write(connection_t *conn, int force)
 {
 int res;
+update_current_time(time(NULL));
 conn->in_connection_handle_write = 1;
 res = connection_handle_write_impl(conn, force);
 conn->in_connection_handle_write = 0;
diff --git a/src/or/main.c b/src/or/main.c
index 6ecc340a9..d773c8e29 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -3047,6 +3047,7 @@ signal_callback(evutil_socket_t fd, short events, void 
*arg)
   (void)fd;
   (void)events;
 
+  update_current_time(time(NULL));
   process_signal(sig);
 }
 
diff --git a/src/or/periodic.c b/src/or/periodic.c
index 76aa418b3..92fa677f8 100644
--- a/src/or/periodic.c
+++ b/src/or/periodic.c
@@ -14,6 +14,7 @@
 #include "or.h"
 #include "compat_libevent.h"
 #include "config.h"
+#include "main.h"
 #include "periodic.h"
 
 /** We disable any interval greater than this number of seconds, on the
@@ -48,6 +49,7 @@ periodic_event_dispatch(mainloop_event_t *ev, void *data)
   }
 
   time_t now = time(NULL);
+  update_current_time(now);
   const or_options_t *options = get_options();
 //  log_debug(LD_GENERAL, "Dispatching %s", event->name);
   int r = event->fn(now, options);



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Distinguish true clock jumps from idleness

2018-05-09 Thread nickm
commit 285e7c98fdca8eda97683c0b96f86645ee3f0546
Author: Nick Mathewson 
Date:   Thu May 3 11:51:32 2018 -0400

Distinguish true clock jumps from idleness

Since we're going to be disabling the second-elapsed callback, we're
going to sometimes have long periods when no events file, and so the
current second is not updated.  Handle that by having a better means
to detect "clock jumps" as opposed to "being idle for a while".
Tolerate far more of the latter.

Part of #26009.
---
 src/or/circuitbuild.c| 28 ++--
 src/or/circuitbuild.h|  2 +-
 src/or/main.c| 43 ++-
 src/test/test_mainloop.c | 48 
 4 files changed, 101 insertions(+), 20 deletions(-)

diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 24c32b710..0617c2477 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -1133,19 +1133,27 @@ circuit_send_intermediate_onion_skin(origin_circuit_t 
*circ,
   return 0;
 }
 
-/** Our clock just jumped by seconds_elapsed. Assume
- * something has also gone wrong with our network: notify the user,
- * and abandon all not-yet-used circuits. */
+/** Our clock just jumped by seconds_elapsed. If was_idle is
+ * true, then the monotonic time matches; otherwise it doesn't. Assume
+ * something has also gone wrong with our network: notify the user, and
+ * abandon all not-yet-used circuits. */
 void
-circuit_note_clock_jumped(int seconds_elapsed)
+circuit_note_clock_jumped(int seconds_elapsed, bool was_idle)
 {
   int severity = server_mode(get_options()) ? LOG_WARN : LOG_NOTICE;
-  tor_log(severity, LD_GENERAL, "Your system clock just jumped %d seconds %s; "
-  "assuming established circuits no longer work.",
-  seconds_elapsed >=0 ? seconds_elapsed : -seconds_elapsed,
-  seconds_elapsed >=0 ? "forward" : "backward");
-  control_event_general_status(LOG_WARN, "CLOCK_JUMPED TIME=%d",
-   seconds_elapsed);
+  if (was_idle) {
+tor_log(severity, LD_GENERAL, "Tor has been idle for %d seconds; "
+"assuming established circuits no longer work.",
+seconds_elapsed);
+  } else {
+tor_log(severity, LD_GENERAL,
+"Your system clock just jumped %d seconds %s; "
+"assuming established circuits no longer work.",
+seconds_elapsed >=0 ? seconds_elapsed : -seconds_elapsed,
+seconds_elapsed >=0 ? "forward" : "backward");
+  }
+  control_event_general_status(LOG_WARN, "CLOCK_JUMPED TIME=%d IDLE=%d",
+   seconds_elapsed, was_idle?1:0);
   /* so we log when it works again */
   note_that_we_maybe_cant_complete_circuits();
   control_event_client_status(severity, "CIRCUIT_NOT_ESTABLISHED REASON=%s",
diff --git a/src/or/circuitbuild.h b/src/or/circuitbuild.h
index bea31ad0d..f3a8bbfc9 100644
--- a/src/or/circuitbuild.h
+++ b/src/or/circuitbuild.h
@@ -29,7 +29,7 @@ void circuit_n_chan_done(channel_t *chan, int status,
 int inform_testing_reachability(void);
 int circuit_timeout_want_to_count_circ(const origin_circuit_t *circ);
 int circuit_send_next_onion_skin(origin_circuit_t *circ);
-void circuit_note_clock_jumped(int seconds_elapsed);
+void circuit_note_clock_jumped(int seconds_elapsed, bool was_idle);
 int circuit_extend(cell_t *cell, circuit_t *circ);
 int circuit_init_cpath_crypto(crypt_path_t *cpath,
   const char *key_data, size_t key_data_len,
diff --git a/src/or/main.c b/src/or/main.c
index d773c8e29..e82162c39 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2498,6 +2498,8 @@ static int n_libevent_errors = 0;
 
 /** Last time that update_current_time was called. */
 static time_t current_second = 0;
+/** Last time that update_current_time updated current_second. */
+static monotime_coarse_t current_second_last_changed;
 
 /**
  * Set the current time to "now", which should be the value returned by
@@ -2515,13 +2517,42 @@ update_current_time(time_t now)
 
   const time_t seconds_elapsed = current_second ? (now - current_second) : 0;
 
-/** If more than this many seconds have elapsed, probably the clock
- * jumped: doesn't count. */
+  /* Check the wall clock against the monotonic clock, so we can
+   * better tell idleness from clock jumps and/or other shenanigans. */
+  monotime_coarse_t last_updated;
+  memcpy(&last_updated, ¤t_second_last_changed, sizeof(last_updated));
+  monotime_coarse_get(¤t_second_last_changed);
+
+  /** How much clock jumping do we tolerate? */
 #define NUM_JUMPED_SECONDS_BEFORE_WARN 100
 
-  if (seconds_elapsed < -NUM_JUMPED_SECONDS_BEFORE_WARN ||
-  seconds_elapsed >= NUM_JUMPED_SECONDS_BEFORE_WARN) {
-circuit_note_clock_jumped(seconds_elapsed);
+  /** How much idleness do we tolerate? */
+#define NUM_IDLE_SECONDS_BEFORE_WARN 3600
+
+  if (seconds_elapsed < -NUM_JUMPED_SECONDS_BEFORE_WARN) {
+// moving back in time is always a bad sign

[tor-commits] [webwml/master] Add new Tor Browser version: 7.5.4

2018-05-09 Thread boklm
commit cd2fb4c68242ba92d2cd9e169a22b5daa7a321e0
Author: Nicolas Vigier 
Date:   Wed May 9 19:34:31 2018 +0200

Add new Tor Browser version: 7.5.4
---
 include/versions.wmi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/versions.wmi b/include/versions.wmi
index 4acd207b..cb255f72 100644
--- a/include/versions.wmi
+++ b/include/versions.wmi
@@ -4,8 +4,8 @@
 maint-7.5
 
 # *** tor browser stable ***
-7.5.3
-2018-03-26
+7.5.4
+2018-05-09
 0.3.2.10
 
 # If all platforms are on the same version, you only need to update

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Merge branch 'maint-0.3.2' into maint-0.3.3

2018-05-09 Thread nickm
commit abde29824ceb76bd21e728260796ecb4ff55151a
Merge: a639a6784 394f102ea
Author: Nick Mathewson 
Date:   Wed May 9 11:53:18 2018 -0400

Merge branch 'maint-0.3.2' into maint-0.3.3

 changes/bug25761 | 3 +++
 src/or/hs_service.c  | 5 -
 src/or/rendservice.c | 5 +++--
 3 files changed, 6 insertions(+), 7 deletions(-)




___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Merge branch 'maint-0.3.3'

2018-05-09 Thread nickm
commit 61d5ce83a1ecc459798b530730316bfebe3bb192
Merge: 9df20f607 abde29824
Author: Nick Mathewson 
Date:   Wed May 9 11:53:18 2018 -0400

Merge branch 'maint-0.3.3'

 changes/bug25761 | 3 +++
 src/or/hs_service.c  | 5 -
 src/or/rendservice.c | 5 +++--
 3 files changed, 6 insertions(+), 7 deletions(-)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.2] Detect when v3 services get disabled after HUP.

2018-05-09 Thread nickm
commit 7e8c5e36622d4581840bb0a037a66d9504c433a5
Author: George Kadianakis 
Date:   Tue May 8 18:14:02 2018 +0300

Detect when v3 services get disabled after HUP.

Remove v3 optimization which made Tor not detect disabling services.

This optimization is not so needed because we only call that function after 
HUP
anyway.

Fixes bug #25761.
---
 changes/bug25761| 3 +++
 src/or/hs_service.c | 5 -
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/changes/bug25761 b/changes/bug25761
new file mode 100644
index 0..096fadcf0
--- /dev/null
+++ b/changes/bug25761
@@ -0,0 +1,3 @@
+  o Major bugfixes (onion service):
+- Correctly detect when onion services get disabled after HUP.
+  Fixes bug 25761; bugfix on 0.3.2.1.
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index 8ddd68c69..b9a1dfc36 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -859,11 +859,6 @@ register_all_services(void)
 
   tor_assert(hs_service_staging_list);
 
-  /* We'll save us some allocation and computing time. */
-  if (smartlist_len(hs_service_staging_list) == 0) {
-return;
-  }
-
   /* Allocate a new map that will replace the current one. */
   new_service_map = tor_malloc_zero(sizeof(*new_service_map));
   HT_INIT(hs_service_ht, new_service_map);



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.3] Merge branch 'maint-0.3.3' into release-0.3.3

2018-05-09 Thread nickm
commit ff46d08fd4f1fd6a93fd878e1b4b18f610b53132
Merge: 582f78454 abde29824
Author: Nick Mathewson 
Date:   Wed May 9 11:53:18 2018 -0400

Merge branch 'maint-0.3.3' into release-0.3.3

 changes/bug25761 | 3 +++
 src/or/hs_service.c  | 5 -
 src/or/rendservice.c | 5 +++--
 3 files changed, 6 insertions(+), 7 deletions(-)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.2] Merge remote-tracking branch 'asn-github/bug25761_032' into maint-0.3.2

2018-05-09 Thread nickm
commit 394f102ea6b0494cde97769a99d75e91b5743616
Merge: be5b4415c 7e8c5e366
Author: Nick Mathewson 
Date:   Wed May 9 11:53:15 2018 -0400

Merge remote-tracking branch 'asn-github/bug25761_032' into maint-0.3.2

 changes/bug25761 | 3 +++
 src/or/hs_service.c  | 5 -
 src/or/rendservice.c | 5 +++--
 3 files changed, 6 insertions(+), 7 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.3] Merge remote-tracking branch 'asn-github/bug25761_032' into maint-0.3.2

2018-05-09 Thread nickm
commit 394f102ea6b0494cde97769a99d75e91b5743616
Merge: be5b4415c 7e8c5e366
Author: Nick Mathewson 
Date:   Wed May 9 11:53:15 2018 -0400

Merge remote-tracking branch 'asn-github/bug25761_032' into maint-0.3.2

 changes/bug25761 | 3 +++
 src/or/hs_service.c  | 5 -
 src/or/rendservice.c | 5 +++--
 3 files changed, 6 insertions(+), 7 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Merge remote-tracking branch 'asn-github/bug25761_032' into maint-0.3.2

2018-05-09 Thread nickm
commit 394f102ea6b0494cde97769a99d75e91b5743616
Merge: be5b4415c 7e8c5e366
Author: Nick Mathewson 
Date:   Wed May 9 11:53:15 2018 -0400

Merge remote-tracking branch 'asn-github/bug25761_032' into maint-0.3.2

 changes/bug25761 | 3 +++
 src/or/hs_service.c  | 5 -
 src/or/rendservice.c | 5 +++--
 3 files changed, 6 insertions(+), 7 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.3] Detect when v3 services get disabled after HUP.

2018-05-09 Thread nickm
commit 7e8c5e36622d4581840bb0a037a66d9504c433a5
Author: George Kadianakis 
Date:   Tue May 8 18:14:02 2018 +0300

Detect when v3 services get disabled after HUP.

Remove v3 optimization which made Tor not detect disabling services.

This optimization is not so needed because we only call that function after 
HUP
anyway.

Fixes bug #25761.
---
 changes/bug25761| 3 +++
 src/or/hs_service.c | 5 -
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/changes/bug25761 b/changes/bug25761
new file mode 100644
index 0..096fadcf0
--- /dev/null
+++ b/changes/bug25761
@@ -0,0 +1,3 @@
+  o Major bugfixes (onion service):
+- Correctly detect when onion services get disabled after HUP.
+  Fixes bug 25761; bugfix on 0.3.2.1.
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index 8ddd68c69..b9a1dfc36 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -859,11 +859,6 @@ register_all_services(void)
 
   tor_assert(hs_service_staging_list);
 
-  /* We'll save us some allocation and computing time. */
-  if (smartlist_len(hs_service_staging_list) == 0) {
-return;
-  }
-
   /* Allocate a new map that will replace the current one. */
   new_service_map = tor_malloc_zero(sizeof(*new_service_map));
   HT_INIT(hs_service_ht, new_service_map);



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.3] Merge branch 'maint-0.3.2' into maint-0.3.3

2018-05-09 Thread nickm
commit abde29824ceb76bd21e728260796ecb4ff55151a
Merge: a639a6784 394f102ea
Author: Nick Mathewson 
Date:   Wed May 9 11:53:18 2018 -0400

Merge branch 'maint-0.3.2' into maint-0.3.3

 changes/bug25761 | 3 +++
 src/or/hs_service.c  | 5 -
 src/or/rendservice.c | 5 +++--
 3 files changed, 6 insertions(+), 7 deletions(-)




___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Detect when v3 services get disabled after HUP.

2018-05-09 Thread nickm
commit 7e8c5e36622d4581840bb0a037a66d9504c433a5
Author: George Kadianakis 
Date:   Tue May 8 18:14:02 2018 +0300

Detect when v3 services get disabled after HUP.

Remove v3 optimization which made Tor not detect disabling services.

This optimization is not so needed because we only call that function after 
HUP
anyway.

Fixes bug #25761.
---
 changes/bug25761| 3 +++
 src/or/hs_service.c | 5 -
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/changes/bug25761 b/changes/bug25761
new file mode 100644
index 0..096fadcf0
--- /dev/null
+++ b/changes/bug25761
@@ -0,0 +1,3 @@
+  o Major bugfixes (onion service):
+- Correctly detect when onion services get disabled after HUP.
+  Fixes bug 25761; bugfix on 0.3.2.1.
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index 8ddd68c69..b9a1dfc36 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -859,11 +859,6 @@ register_all_services(void)
 
   tor_assert(hs_service_staging_list);
 
-  /* We'll save us some allocation and computing time. */
-  if (smartlist_len(hs_service_staging_list) == 0) {
-return;
-  }
-
   /* Allocate a new map that will replace the current one. */
   new_service_map = tor_malloc_zero(sizeof(*new_service_map));
   HT_INIT(hs_service_ht, new_service_map);



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.3] Detect when v2 services get disabled after HUP.

2018-05-09 Thread nickm
commit 5dc00c06615ef1e99e1d82dfdf41823c0d4bf7f6
Author: George Kadianakis 
Date:   Tue May 8 18:07:08 2018 +0300

Detect when v2 services get disabled after HUP.

During service configuration, rend_service_prune_list_impl_() sets
rend_service_staging_list to NULL, which blocked pruning after a HUP.

This patch initializes rend_service_staging_list when needed, so that HUP 
can
detect disabled onion services.

Fixes bug #25761.
---
 src/or/rendservice.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 2c5c5840a..fed8c97eb 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -618,10 +618,11 @@ void
 rend_service_prune_list(void)
 {
   smartlist_t *old_service_list = rend_service_list;
-  /* Don't try to prune anything if we have no staging list. */
+
   if (!rend_service_staging_list) {
-return;
+rend_service_staging_list = smartlist_new();
   }
+
   rend_service_prune_list_impl_();
   if (old_service_list) {
 /* Every remaining service in the old list have been removed from the



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.3.3] Merge remote-tracking branch 'asn-github/bug25761_032' into maint-0.3.2

2018-05-09 Thread nickm
commit 394f102ea6b0494cde97769a99d75e91b5743616
Merge: be5b4415c 7e8c5e366
Author: Nick Mathewson 
Date:   Wed May 9 11:53:15 2018 -0400

Merge remote-tracking branch 'asn-github/bug25761_032' into maint-0.3.2

 changes/bug25761 | 3 +++
 src/or/hs_service.c  | 5 -
 src/or/rendservice.c | 5 +++--
 3 files changed, 6 insertions(+), 7 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.2] Merge branch 'maint-0.3.2' into release-0.3.2

2018-05-09 Thread nickm
commit 7e1102ff25ae23d86afe3eacac890eb7743fac16
Merge: a1243864f 394f102ea
Author: Nick Mathewson 
Date:   Wed May 9 11:53:18 2018 -0400

Merge branch 'maint-0.3.2' into release-0.3.2

 changes/bug25761 | 3 +++
 src/or/hs_service.c  | 5 -
 src/or/rendservice.c | 5 +++--
 3 files changed, 6 insertions(+), 7 deletions(-)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.3.2] Detect when v2 services get disabled after HUP.

2018-05-09 Thread nickm
commit 5dc00c06615ef1e99e1d82dfdf41823c0d4bf7f6
Author: George Kadianakis 
Date:   Tue May 8 18:07:08 2018 +0300

Detect when v2 services get disabled after HUP.

During service configuration, rend_service_prune_list_impl_() sets
rend_service_staging_list to NULL, which blocked pruning after a HUP.

This patch initializes rend_service_staging_list when needed, so that HUP 
can
detect disabled onion services.

Fixes bug #25761.
---
 src/or/rendservice.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 2c5c5840a..fed8c97eb 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -618,10 +618,11 @@ void
 rend_service_prune_list(void)
 {
   smartlist_t *old_service_list = rend_service_list;
-  /* Don't try to prune anything if we have no staging list. */
+
   if (!rend_service_staging_list) {
-return;
+rend_service_staging_list = smartlist_new();
   }
+
   rend_service_prune_list_impl_();
   if (old_service_list) {
 /* Every remaining service in the old list have been removed from the



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.3.3] Detect when v2 services get disabled after HUP.

2018-05-09 Thread nickm
commit 5dc00c06615ef1e99e1d82dfdf41823c0d4bf7f6
Author: George Kadianakis 
Date:   Tue May 8 18:07:08 2018 +0300

Detect when v2 services get disabled after HUP.

During service configuration, rend_service_prune_list_impl_() sets
rend_service_staging_list to NULL, which blocked pruning after a HUP.

This patch initializes rend_service_staging_list when needed, so that HUP 
can
detect disabled onion services.

Fixes bug #25761.
---
 src/or/rendservice.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 2c5c5840a..fed8c97eb 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -618,10 +618,11 @@ void
 rend_service_prune_list(void)
 {
   smartlist_t *old_service_list = rend_service_list;
-  /* Don't try to prune anything if we have no staging list. */
+
   if (!rend_service_staging_list) {
-return;
+rend_service_staging_list = smartlist_new();
   }
+
   rend_service_prune_list_impl_();
   if (old_service_list) {
 /* Every remaining service in the old list have been removed from the



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.2] Detect when v2 services get disabled after HUP.

2018-05-09 Thread nickm
commit 5dc00c06615ef1e99e1d82dfdf41823c0d4bf7f6
Author: George Kadianakis 
Date:   Tue May 8 18:07:08 2018 +0300

Detect when v2 services get disabled after HUP.

During service configuration, rend_service_prune_list_impl_() sets
rend_service_staging_list to NULL, which blocked pruning after a HUP.

This patch initializes rend_service_staging_list when needed, so that HUP 
can
detect disabled onion services.

Fixes bug #25761.
---
 src/or/rendservice.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 2c5c5840a..fed8c97eb 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -618,10 +618,11 @@ void
 rend_service_prune_list(void)
 {
   smartlist_t *old_service_list = rend_service_list;
-  /* Don't try to prune anything if we have no staging list. */
+
   if (!rend_service_staging_list) {
-return;
+rend_service_staging_list = smartlist_new();
   }
+
   rend_service_prune_list_impl_();
   if (old_service_list) {
 /* Every remaining service in the old list have been removed from the



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.3.2] Detect when v3 services get disabled after HUP.

2018-05-09 Thread nickm
commit 7e8c5e36622d4581840bb0a037a66d9504c433a5
Author: George Kadianakis 
Date:   Tue May 8 18:14:02 2018 +0300

Detect when v3 services get disabled after HUP.

Remove v3 optimization which made Tor not detect disabling services.

This optimization is not so needed because we only call that function after 
HUP
anyway.

Fixes bug #25761.
---
 changes/bug25761| 3 +++
 src/or/hs_service.c | 5 -
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/changes/bug25761 b/changes/bug25761
new file mode 100644
index 0..096fadcf0
--- /dev/null
+++ b/changes/bug25761
@@ -0,0 +1,3 @@
+  o Major bugfixes (onion service):
+- Correctly detect when onion services get disabled after HUP.
+  Fixes bug 25761; bugfix on 0.3.2.1.
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index 8ddd68c69..b9a1dfc36 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -859,11 +859,6 @@ register_all_services(void)
 
   tor_assert(hs_service_staging_list);
 
-  /* We'll save us some allocation and computing time. */
-  if (smartlist_len(hs_service_staging_list) == 0) {
-return;
-  }
-
   /* Allocate a new map that will replace the current one. */
   new_service_map = tor_malloc_zero(sizeof(*new_service_map));
   HT_INIT(hs_service_ht, new_service_map);



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.3.3] Detect when v3 services get disabled after HUP.

2018-05-09 Thread nickm
commit 7e8c5e36622d4581840bb0a037a66d9504c433a5
Author: George Kadianakis 
Date:   Tue May 8 18:14:02 2018 +0300

Detect when v3 services get disabled after HUP.

Remove v3 optimization which made Tor not detect disabling services.

This optimization is not so needed because we only call that function after 
HUP
anyway.

Fixes bug #25761.
---
 changes/bug25761| 3 +++
 src/or/hs_service.c | 5 -
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/changes/bug25761 b/changes/bug25761
new file mode 100644
index 0..096fadcf0
--- /dev/null
+++ b/changes/bug25761
@@ -0,0 +1,3 @@
+  o Major bugfixes (onion service):
+- Correctly detect when onion services get disabled after HUP.
+  Fixes bug 25761; bugfix on 0.3.2.1.
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index 8ddd68c69..b9a1dfc36 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -859,11 +859,6 @@ register_all_services(void)
 
   tor_assert(hs_service_staging_list);
 
-  /* We'll save us some allocation and computing time. */
-  if (smartlist_len(hs_service_staging_list) == 0) {
-return;
-  }
-
   /* Allocate a new map that will replace the current one. */
   new_service_map = tor_malloc_zero(sizeof(*new_service_map));
   HT_INIT(hs_service_ht, new_service_map);



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Detect when v2 services get disabled after HUP.

2018-05-09 Thread nickm
commit 5dc00c06615ef1e99e1d82dfdf41823c0d4bf7f6
Author: George Kadianakis 
Date:   Tue May 8 18:07:08 2018 +0300

Detect when v2 services get disabled after HUP.

During service configuration, rend_service_prune_list_impl_() sets
rend_service_staging_list to NULL, which blocked pruning after a HUP.

This patch initializes rend_service_staging_list when needed, so that HUP 
can
detect disabled onion services.

Fixes bug #25761.
---
 src/or/rendservice.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 2c5c5840a..fed8c97eb 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -618,10 +618,11 @@ void
 rend_service_prune_list(void)
 {
   smartlist_t *old_service_list = rend_service_list;
-  /* Don't try to prune anything if we have no staging list. */
+
   if (!rend_service_staging_list) {
-return;
+rend_service_staging_list = smartlist_new();
   }
+
   rend_service_prune_list_impl_();
   if (old_service_list) {
 /* Every remaining service in the old list have been removed from the



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.3.3] Merge branch 'maint-0.3.2' into maint-0.3.3

2018-05-09 Thread nickm
commit abde29824ceb76bd21e728260796ecb4ff55151a
Merge: a639a6784 394f102ea
Author: Nick Mathewson 
Date:   Wed May 9 11:53:18 2018 -0400

Merge branch 'maint-0.3.2' into maint-0.3.3

 changes/bug25761 | 3 +++
 src/or/hs_service.c  | 5 -
 src/or/rendservice.c | 5 +++--
 3 files changed, 6 insertions(+), 7 deletions(-)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.3.2] Merge remote-tracking branch 'asn-github/bug25761_032' into maint-0.3.2

2018-05-09 Thread nickm
commit 394f102ea6b0494cde97769a99d75e91b5743616
Merge: be5b4415c 7e8c5e366
Author: Nick Mathewson 
Date:   Wed May 9 11:53:15 2018 -0400

Merge remote-tracking branch 'asn-github/bug25761_032' into maint-0.3.2

 changes/bug25761 | 3 +++
 src/or/hs_service.c  | 5 -
 src/or/rendservice.c | 5 +++--
 3 files changed, 6 insertions(+), 7 deletions(-)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [metrics-web/master] Fix TB downloads by locale and Relays by flag graphs.

2018-05-09 Thread karsten
commit 4cb0fd677271a1faa3a7f99e5e7868d5cf50a7a8
Author: Karsten Loesing 
Date:   Wed May 9 15:13:55 2018 +0200

Fix TB downloads by locale and Relays by flag graphs.
---
 src/main/R/rserver/graphs.R | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/R/rserver/graphs.R b/src/main/R/rserver/graphs.R
index b6eb221..79d5600 100644
--- a/src/main/R/rserver/graphs.R
+++ b/src/main/R/rserver/graphs.R
@@ -580,8 +580,8 @@ plot_relayflags <- function(start, end, flags, path) {
 
 write_relayflags <- function(start, end, flags, path) {
   prepare_relayflags(start, end, flags) %>%
-mutate(variable = tolower(variable)) %>%
-spread(variable, value) %>%
+mutate(flag = tolower(flag)) %>%
+spread(flag, relays) %>%
 write.csv(path, quote = FALSE, row.names = FALSE)
 }
 
@@ -1269,7 +1269,7 @@ write_webstats_tb_platform <- function(start, end, path) {
 
 plot_webstats_tb_locale <- function(start, end, path) {
   d <- read.csv(paste(stats_dir, "webstats.csv", sep = ""),
-colClasses = c("log_date" = "Date"))
+colClasses = c("log_date" = "Date", "locale" = "character"))
   d <- d[d$log_date >= start & d$log_date <= end & d$request_type == "tbid", ]
   e <- d
   e <- aggregate(list(count = e$count), by = list(locale = e$locale), FUN = 
sum)
@@ -1300,7 +1300,7 @@ plot_webstats_tb_locale <- function(start, end, path) {
 # breaks and labels. Left as future work.
 write_webstats_tb_locale <- function(start, end, path) {
   d <- read.csv(paste(stats_dir, "webstats.csv", sep = ""),
-colClasses = c("log_date" = "Date"))
+colClasses = c("log_date" = "Date", "locale" = "character"))
   d <- d[d$log_date >= start & d$log_date <= end & d$request_type == "tbid", ]
   e <- d
   e <- aggregate(list(count = e$count), by = list(locale = e$locale), FUN = 
sum)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [translation/support-topics_completed] Update translations for support-topics_completed

2018-05-09 Thread translation
commit 119e60a90fc04faa0239fdb17c3bc299e77b4422
Author: Translation commit bot 
Date:   Wed May 9 12:49:50 2018 +

Update translations for support-topics_completed
---
 zh_CN.json | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/zh_CN.json b/zh_CN.json
index f9afa7cf2..7f0018aa4 100644
--- a/zh_CN.json
+++ b/zh_CN.json
@@ -5,18 +5,18 @@
"label": "常见问题"
 },
 "tbb": {
-   "path": "#tor浏览器",
-   "control": "tor浏览器",
+   "path": "#tbb",
+   "control": "tbb",
"label": "tor浏览器"
 },
 "tormessenger": {
-   "path": "#tor-messenger",
-   "control": "tor-messenger",
+   "path": "#tormessenger",
+   "control": "tormessenger",
"label": "Tor Messenger"
 },
 "tormobile": {
-   "path": "#tor-mobile",
-   "control": "tor-mobile",
+   "path": "#tormobile",
+   "control": "tormobile",
"label": "Tor Mobile"
 },
 "gettor": {
@@ -25,8 +25,8 @@
"label": "GetTor"
 },
 "connecting": {
-   "path": "#连接tor",
-   "control": "连接tor",
+   "path": "#连接到tor",
+   "control": "连接到tor",
"label": "连接Tor"
 },
 "censorship": {

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [translation/support-topics] Update translations for support-topics

2018-05-09 Thread translation
commit e833ff7ce896a6e1db051d122b804c5e20dfa00e
Author: Translation commit bot 
Date:   Wed May 9 12:49:45 2018 +

Update translations for support-topics
---
 zh_CN.json | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/zh_CN.json b/zh_CN.json
index 4043509d8..7f0018aa4 100644
--- a/zh_CN.json
+++ b/zh_CN.json
@@ -25,8 +25,8 @@
"label": "GetTor"
 },
 "connecting": {
-   "path": "#connectingtotor",
-   "control": "connectingtotor",
+   "path": "#连接到tor",
+   "control": "连接到tor",
"label": "连接Tor"
 },
 "censorship": {
@@ -45,8 +45,8 @@
"label": "选项"
 },
 "onionservices": {
-   "path": "#onionservices",
-   "control": "onionservices",
+   "path": "#洋葱服务",
+   "control": "洋葱服务",
"label": "洋葱服务"
 },
 "misc": {

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.3] Merge branch 'libressl_201805_033' into maint-0.3.3

2018-05-09 Thread nickm
commit a639a67844909bd05fadaea5c1847f5e9af55cde
Merge: b979415e8 bf3e899dc
Author: Nick Mathewson 
Date:   Wed May 9 08:25:32 2018 -0400

Merge branch 'libressl_201805_033' into maint-0.3.3

 changes/ticket26006 | 4 
 src/common/compat_openssl.h | 6 +-
 src/test/test_tortls.c  | 3 +++
 3 files changed, 12 insertions(+), 1 deletion(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.3] Merge branch 'maint-0.3.3' into release-0.3.3

2018-05-09 Thread nickm
commit 582f784548747bac228d5e5d327d7e7ca039ece5
Merge: 6db0c006b a639a6784
Author: Nick Mathewson 
Date:   Wed May 9 08:26:08 2018 -0400

Merge branch 'maint-0.3.3' into release-0.3.3

 changes/ticket26006 | 4 
 src/common/compat_openssl.h | 6 +-
 src/test/test_tortls.c  | 3 +++
 3 files changed, 12 insertions(+), 1 deletion(-)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Merge branch 'maint-0.3.3'

2018-05-09 Thread nickm
commit 9df20f60762dbd21796bb8c9c621585662e7f708
Merge: e6d634769 a639a6784
Author: Nick Mathewson 
Date:   Wed May 9 08:25:52 2018 -0400

Merge branch 'maint-0.3.3'

 changes/ticket26006 | 4 
 src/common/compat_openssl.h | 6 +-
 src/test/test_tortls.c  | 3 +++
 3 files changed, 12 insertions(+), 1 deletion(-)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.3] LibreSSL compatibility fixes.

2018-05-09 Thread nickm
commit 75f3fbaa3c7316fcef3509ef1e3813b94d8c4c8a
Author: Nick Mathewson 
Date:   Wed May 2 08:18:48 2018 -0400

LibreSSL compatibility fixes.

LibreSSL, despite not having the OpenSSL 1.1 API, does define
OPENSSL_VERSION in crypto.h.  Additionally, it apparently annotates
some functions as returning NULL, so that our unit tests need to be
more careful about checking for NULL so they don't get compilation
warnings.

Closes ticket 26006.
---
 changes/ticket26006 | 4 
 src/common/compat_openssl.h | 7 ++-
 src/test/test_tortls.c  | 3 +++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/changes/ticket26006 b/changes/ticket26006
new file mode 100644
index 0..e33e3f1cd
--- /dev/null
+++ b/changes/ticket26006
@@ -0,0 +1,4 @@
+  o Minor features (compilation, portability):
+- Avoid some compilation warnings with recent versions
+  of LibreSSL. Closes ticket 26006.
+
diff --git a/src/common/compat_openssl.h b/src/common/compat_openssl.h
index 1bfe18807..76679872b 100644
--- a/src/common/compat_openssl.h
+++ b/src/common/compat_openssl.h
@@ -8,6 +8,8 @@
 #define TOR_COMPAT_OPENSSL_H
 
 #include 
+// workaround for libressl; not needed in later Tor versions.
+#include 
 
 /**
  * \file compat_openssl.h
@@ -27,8 +29,11 @@
 #define OPENSSL_1_1_API
 #endif
 
-#ifndef OPENSSL_1_1_API
+#ifndef OPENSSL_VERSION
 #define OPENSSL_VERSION SSLEAY_VERSION
+#endif
+
+#ifndef OPENSSL_1_1_API
 #define OpenSSL_version(v) SSLeay_version(v)
 #define OpenSSL_version_num() SSLeay()
 #define RAND_OpenSSL() RAND_SSLeay()
diff --git a/src/test/test_tortls.c b/src/test/test_tortls.c
index 47455cff8..5028a9540 100644
--- a/src/test/test_tortls.c
+++ b/src/test/test_tortls.c
@@ -840,8 +840,10 @@ test_tortls_classify_client_ciphers(void *ignored)
   sk_SSL_CIPHER_zero(ciphers);
 
   one = get_cipher_by_name("ECDHE-RSA-AES256-GCM-SHA384");
+  tt_assert(one);
   one->id = 0x00ff;
   two = get_cipher_by_name("ECDHE-RSA-AES128-GCM-SHA256");
+  tt_assert(two);
   two->id = 0x;
   sk_SSL_CIPHER_push(ciphers, one);
   tls->client_cipher_list_type = 0;
@@ -912,6 +914,7 @@ test_tortls_client_is_using_v2_ciphers(void *ignored)
 
   ciphers = sk_SSL_CIPHER_new_null();
   SSL_CIPHER *one = get_cipher_by_name("ECDHE-RSA-AES256-GCM-SHA384");
+  tt_assert(one);
   one->id = 0x00ff;
   sk_SSL_CIPHER_push(ciphers, one);
   sess->ciphers = ciphers;



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Merge branch 'libressl_201805_029' into maint-0.3.3

2018-05-09 Thread nickm
commit bf3e899dcef368a021033c6845b93c08884dae02
Merge: b116710e3 75f3fbaa3
Author: Nick Mathewson 
Date:   Wed May 2 08:26:49 2018 -0400

Merge branch 'libressl_201805_029' into maint-0.3.3

 changes/ticket26006 | 4 
 src/common/compat_openssl.h | 6 +-
 src/test/test_tortls.c  | 3 +++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --cc src/common/compat_openssl.h
index 1299ac36b,76679872b..d1481fb46
--- a/src/common/compat_openssl.h
+++ b/src/common/compat_openssl.h
@@@ -8,7 -8,9 +8,8 @@@
  #define TOR_COMPAT_OPENSSL_H
  
  #include 
 -// workaround for libressl; not needed in later Tor versions.
 -#include 
 +#include "crypto_openssl_mgt.h"
+ 
  /**
   * \file compat_openssl.h
   *
@@@ -25,10 -27,13 +26,13 @@@
  /* We define this macro if we're trying to build with the majorly refactored
   * API in OpenSSL 1.1 */
  #define OPENSSL_1_1_API
 -#endif
 +#endif /* OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0) && ... */
  
- #ifndef OPENSSL_1_1_API
+ #ifndef OPENSSL_VERSION
  #define OPENSSL_VERSION SSLEAY_VERSION
+ #endif
+ 
+ #ifndef OPENSSL_1_1_API
  #define OpenSSL_version(v) SSLeay_version(v)
  #define OpenSSL_version_num() SSLeay()
  #define RAND_OpenSSL() RAND_SSLeay()



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.3.3] Merge branch 'libressl_201805_033' into maint-0.3.3

2018-05-09 Thread nickm
commit a639a67844909bd05fadaea5c1847f5e9af55cde
Merge: b979415e8 bf3e899dc
Author: Nick Mathewson 
Date:   Wed May 9 08:25:32 2018 -0400

Merge branch 'libressl_201805_033' into maint-0.3.3

 changes/ticket26006 | 4 
 src/common/compat_openssl.h | 6 +-
 src/test/test_tortls.c  | 3 +++
 3 files changed, 12 insertions(+), 1 deletion(-)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Merge branch 'libressl_201805_033' into maint-0.3.3

2018-05-09 Thread nickm
commit a639a67844909bd05fadaea5c1847f5e9af55cde
Merge: b979415e8 bf3e899dc
Author: Nick Mathewson 
Date:   Wed May 9 08:25:32 2018 -0400

Merge branch 'libressl_201805_033' into maint-0.3.3

 changes/ticket26006 | 4 
 src/common/compat_openssl.h | 6 +-
 src/test/test_tortls.c  | 3 +++
 3 files changed, 12 insertions(+), 1 deletion(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.3.3] Merge branch 'libressl_201805_029' into maint-0.3.3

2018-05-09 Thread nickm
commit bf3e899dcef368a021033c6845b93c08884dae02
Merge: b116710e3 75f3fbaa3
Author: Nick Mathewson 
Date:   Wed May 2 08:26:49 2018 -0400

Merge branch 'libressl_201805_029' into maint-0.3.3

 changes/ticket26006 | 4 
 src/common/compat_openssl.h | 6 +-
 src/test/test_tortls.c  | 3 +++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --cc src/common/compat_openssl.h
index 1299ac36b,76679872b..d1481fb46
--- a/src/common/compat_openssl.h
+++ b/src/common/compat_openssl.h
@@@ -8,7 -8,9 +8,8 @@@
  #define TOR_COMPAT_OPENSSL_H
  
  #include 
 -// workaround for libressl; not needed in later Tor versions.
 -#include 
 +#include "crypto_openssl_mgt.h"
+ 
  /**
   * \file compat_openssl.h
   *
@@@ -25,10 -27,13 +26,13 @@@
  /* We define this macro if we're trying to build with the majorly refactored
   * API in OpenSSL 1.1 */
  #define OPENSSL_1_1_API
 -#endif
 +#endif /* OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0) && ... */
  
- #ifndef OPENSSL_1_1_API
+ #ifndef OPENSSL_VERSION
  #define OPENSSL_VERSION SSLEAY_VERSION
+ #endif
+ 
+ #ifndef OPENSSL_1_1_API
  #define OpenSSL_version(v) SSLeay_version(v)
  #define OpenSSL_version_num() SSLeay()
  #define RAND_OpenSSL() RAND_SSLeay()



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.3] Merge branch 'libressl_201805_029' into maint-0.3.3

2018-05-09 Thread nickm
commit bf3e899dcef368a021033c6845b93c08884dae02
Merge: b116710e3 75f3fbaa3
Author: Nick Mathewson 
Date:   Wed May 2 08:26:49 2018 -0400

Merge branch 'libressl_201805_029' into maint-0.3.3

 changes/ticket26006 | 4 
 src/common/compat_openssl.h | 6 +-
 src/test/test_tortls.c  | 3 +++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --cc src/common/compat_openssl.h
index 1299ac36b,76679872b..d1481fb46
--- a/src/common/compat_openssl.h
+++ b/src/common/compat_openssl.h
@@@ -8,7 -8,9 +8,8 @@@
  #define TOR_COMPAT_OPENSSL_H
  
  #include 
 -// workaround for libressl; not needed in later Tor versions.
 -#include 
 +#include "crypto_openssl_mgt.h"
+ 
  /**
   * \file compat_openssl.h
   *
@@@ -25,10 -27,13 +26,13 @@@
  /* We define this macro if we're trying to build with the majorly refactored
   * API in OpenSSL 1.1 */
  #define OPENSSL_1_1_API
 -#endif
 +#endif /* OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0) && ... */
  
- #ifndef OPENSSL_1_1_API
+ #ifndef OPENSSL_VERSION
  #define OPENSSL_VERSION SSLEAY_VERSION
+ #endif
+ 
+ #ifndef OPENSSL_1_1_API
  #define OpenSSL_version(v) SSLeay_version(v)
  #define OpenSSL_version_num() SSLeay()
  #define RAND_OpenSSL() RAND_SSLeay()



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.3.3] LibreSSL compatibility fixes.

2018-05-09 Thread nickm
commit 75f3fbaa3c7316fcef3509ef1e3813b94d8c4c8a
Author: Nick Mathewson 
Date:   Wed May 2 08:18:48 2018 -0400

LibreSSL compatibility fixes.

LibreSSL, despite not having the OpenSSL 1.1 API, does define
OPENSSL_VERSION in crypto.h.  Additionally, it apparently annotates
some functions as returning NULL, so that our unit tests need to be
more careful about checking for NULL so they don't get compilation
warnings.

Closes ticket 26006.
---
 changes/ticket26006 | 4 
 src/common/compat_openssl.h | 7 ++-
 src/test/test_tortls.c  | 3 +++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/changes/ticket26006 b/changes/ticket26006
new file mode 100644
index 0..e33e3f1cd
--- /dev/null
+++ b/changes/ticket26006
@@ -0,0 +1,4 @@
+  o Minor features (compilation, portability):
+- Avoid some compilation warnings with recent versions
+  of LibreSSL. Closes ticket 26006.
+
diff --git a/src/common/compat_openssl.h b/src/common/compat_openssl.h
index 1bfe18807..76679872b 100644
--- a/src/common/compat_openssl.h
+++ b/src/common/compat_openssl.h
@@ -8,6 +8,8 @@
 #define TOR_COMPAT_OPENSSL_H
 
 #include 
+// workaround for libressl; not needed in later Tor versions.
+#include 
 
 /**
  * \file compat_openssl.h
@@ -27,8 +29,11 @@
 #define OPENSSL_1_1_API
 #endif
 
-#ifndef OPENSSL_1_1_API
+#ifndef OPENSSL_VERSION
 #define OPENSSL_VERSION SSLEAY_VERSION
+#endif
+
+#ifndef OPENSSL_1_1_API
 #define OpenSSL_version(v) SSLeay_version(v)
 #define OpenSSL_version_num() SSLeay()
 #define RAND_OpenSSL() RAND_SSLeay()
diff --git a/src/test/test_tortls.c b/src/test/test_tortls.c
index 47455cff8..5028a9540 100644
--- a/src/test/test_tortls.c
+++ b/src/test/test_tortls.c
@@ -840,8 +840,10 @@ test_tortls_classify_client_ciphers(void *ignored)
   sk_SSL_CIPHER_zero(ciphers);
 
   one = get_cipher_by_name("ECDHE-RSA-AES256-GCM-SHA384");
+  tt_assert(one);
   one->id = 0x00ff;
   two = get_cipher_by_name("ECDHE-RSA-AES128-GCM-SHA256");
+  tt_assert(two);
   two->id = 0x;
   sk_SSL_CIPHER_push(ciphers, one);
   tls->client_cipher_list_type = 0;
@@ -912,6 +914,7 @@ test_tortls_client_is_using_v2_ciphers(void *ignored)
 
   ciphers = sk_SSL_CIPHER_new_null();
   SSL_CIPHER *one = get_cipher_by_name("ECDHE-RSA-AES256-GCM-SHA384");
+  tt_assert(one);
   one->id = 0x00ff;
   sk_SSL_CIPHER_push(ciphers, one);
   sess->ciphers = ciphers;



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] LibreSSL compatibility fixes.

2018-05-09 Thread nickm
commit 75f3fbaa3c7316fcef3509ef1e3813b94d8c4c8a
Author: Nick Mathewson 
Date:   Wed May 2 08:18:48 2018 -0400

LibreSSL compatibility fixes.

LibreSSL, despite not having the OpenSSL 1.1 API, does define
OPENSSL_VERSION in crypto.h.  Additionally, it apparently annotates
some functions as returning NULL, so that our unit tests need to be
more careful about checking for NULL so they don't get compilation
warnings.

Closes ticket 26006.
---
 changes/ticket26006 | 4 
 src/common/compat_openssl.h | 7 ++-
 src/test/test_tortls.c  | 3 +++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/changes/ticket26006 b/changes/ticket26006
new file mode 100644
index 0..e33e3f1cd
--- /dev/null
+++ b/changes/ticket26006
@@ -0,0 +1,4 @@
+  o Minor features (compilation, portability):
+- Avoid some compilation warnings with recent versions
+  of LibreSSL. Closes ticket 26006.
+
diff --git a/src/common/compat_openssl.h b/src/common/compat_openssl.h
index 1bfe18807..76679872b 100644
--- a/src/common/compat_openssl.h
+++ b/src/common/compat_openssl.h
@@ -8,6 +8,8 @@
 #define TOR_COMPAT_OPENSSL_H
 
 #include 
+// workaround for libressl; not needed in later Tor versions.
+#include 
 
 /**
  * \file compat_openssl.h
@@ -27,8 +29,11 @@
 #define OPENSSL_1_1_API
 #endif
 
-#ifndef OPENSSL_1_1_API
+#ifndef OPENSSL_VERSION
 #define OPENSSL_VERSION SSLEAY_VERSION
+#endif
+
+#ifndef OPENSSL_1_1_API
 #define OpenSSL_version(v) SSLeay_version(v)
 #define OpenSSL_version_num() SSLeay()
 #define RAND_OpenSSL() RAND_SSLeay()
diff --git a/src/test/test_tortls.c b/src/test/test_tortls.c
index 47455cff8..5028a9540 100644
--- a/src/test/test_tortls.c
+++ b/src/test/test_tortls.c
@@ -840,8 +840,10 @@ test_tortls_classify_client_ciphers(void *ignored)
   sk_SSL_CIPHER_zero(ciphers);
 
   one = get_cipher_by_name("ECDHE-RSA-AES256-GCM-SHA384");
+  tt_assert(one);
   one->id = 0x00ff;
   two = get_cipher_by_name("ECDHE-RSA-AES128-GCM-SHA256");
+  tt_assert(two);
   two->id = 0x;
   sk_SSL_CIPHER_push(ciphers, one);
   tls->client_cipher_list_type = 0;
@@ -912,6 +914,7 @@ test_tortls_client_is_using_v2_ciphers(void *ignored)
 
   ciphers = sk_SSL_CIPHER_new_null();
   SSL_CIPHER *one = get_cipher_by_name("ECDHE-RSA-AES256-GCM-SHA384");
+  tt_assert(one);
   one->id = 0x00ff;
   sk_SSL_CIPHER_push(ciphers, one);
   sess->ciphers = ciphers;



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Use OPENSSL_1_1_API in place of raw OPENSSL_VERSION_NUMBER checks

2018-05-09 Thread nickm
commit 89cafc4afac37ee3c9186f5c600cdf2fba1d7d1c
Author: Nick Mathewson 
Date:   Thu May 3 13:33:14 2018 -0400

Use OPENSSL_1_1_API in place of raw OPENSSL_VERSION_NUMBER checks

This is needed for libressl-2.6.4 compatibility, which we broke when
we merged a15b2c57e1f901c53 to fix bug 19981.  Fixes bug 26005; bug
not in any released Tor.
---
 src/common/aes.c   |  2 +-
 src/common/crypto.c| 10 +-
 src/common/tortls.c|  4 ++--
 src/test/test_tortls.c |  2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/common/aes.c b/src/common/aes.c
index 95737cffc..efb4fe855 100644
--- a/src/common/aes.c
+++ b/src/common/aes.c
@@ -116,7 +116,7 @@ aes_cipher_free_(aes_cnt_cipher_t *cipher_)
   if (!cipher_)
 return;
   EVP_CIPHER_CTX *cipher = (EVP_CIPHER_CTX *) cipher_;
-#if OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0)
+#ifdef OPENSSL_1_1_API
   EVP_CIPHER_CTX_reset(cipher);
 #else
   EVP_CIPHER_CTX_cleanup(cipher);
diff --git a/src/common/crypto.c b/src/common/crypto.c
index c98a96875..394346502 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -205,7 +205,7 @@ crypto_early_init(void)
 
 crypto_early_initialized_ = 1;
 
-#if OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0)
+#ifdef OPENSSL_1_1_API
 OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS |
  OPENSSL_INIT_LOAD_CRYPTO_STRINGS |
  OPENSSL_INIT_ADD_ALL_CIPHERS |
@@ -1668,13 +1668,13 @@ memwipe(void *mem, uint8_t byte, size_t sz)
 int
 crypto_global_cleanup(void)
 {
-#if OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(1,1,0)
+#ifndef OPENSSL_1_1_API
   EVP_cleanup();
 #endif
 #ifndef NEW_THREAD_API
   ERR_remove_thread_state(NULL);
 #endif
-#if OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(1,1,0)
+#ifndef OPENSSL_1_1_API
   ERR_free_strings();
 #endif
 
@@ -1688,13 +1688,13 @@ crypto_global_cleanup(void)
   dh_param_p = dh_param_p_tls = dh_param_g = NULL;
 
 #ifndef DISABLE_ENGINES
-#if OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(1,1,0)
+#ifndef OPENSSL_1_1_API
   ENGINE_cleanup();
 #endif
 #endif
 
   CONF_modules_unload(1);
-#if OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(1,1,0)
+#ifndef OPENSSL_1_1_API
   CRYPTO_cleanup_all_ex_data();
 #endif
 
diff --git a/src/common/tortls.c b/src/common/tortls.c
index cd236363f..4044a0e70 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -56,7 +56,7 @@ ENABLE_GCC_WARNING(redundant-decls)
 #include "container.h"
 #include 
 
-#if OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0)
+#ifdef OPENSSL_1_1_API
 #define X509_get_notBefore_const(cert) \
 X509_get0_notBefore(cert)
 #define X509_get_notAfter_const(cert) \
@@ -370,7 +370,7 @@ tor_tls_init(void)
   check_no_tls_errors();
 
   if (!tls_library_is_initialized) {
-#if OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0)
+#ifdef OPENSSL_1_1_API
 OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL);
 #else
 SSL_library_init();
diff --git a/src/test/test_tortls.c b/src/test/test_tortls.c
index ef1be139a..ffa641ec4 100644
--- a/src/test/test_tortls.c
+++ b/src/test/test_tortls.c
@@ -205,7 +205,7 @@ test_tortls_tor_tls_get_error(void *data)
 static void
 library_init(void)
 {
-#if OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0)
+#ifdef OPENSSL_1_1_API
   OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL);
 #else
   SSL_library_init();



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Merge remote-tracking branch 'public/bug26005_034'

2018-05-09 Thread nickm
commit e6d6347690d085dddb57d087a952750131b80758
Merge: 01d729cbf 89cafc4af
Author: Nick Mathewson 
Date:   Wed May 9 08:23:27 2018 -0400

Merge remote-tracking branch 'public/bug26005_034'

 src/common/aes.c   |  2 +-
 src/common/crypto.c| 10 +-
 src/common/tortls.c|  4 ++--
 src/test/test_tortls.c |  2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits