[tor-commits] [tor/release-0.3.5] Merge branch 'bug28096-029-squashed' into bug28096-035-squashed

2018-11-26 Thread nickm
commit 44ced9b750a65d867dc5dd2cbbcf7e42a46ae90d
Merge: d598d834f 2fbc58cf0
Author: teor 
Date:   Thu Nov 15 12:23:29 2018 +1000

Merge branch 'bug28096-029-squashed' into bug28096-035-squashed

Move the get_uname() changes from src/common/compat.c to
src/lib/osinfo/uname.c

 changes/bug28096   | 13 +++
 src/lib/osinfo/uname.c | 95 ++
 2 files changed, 77 insertions(+), 31 deletions(-)

diff --cc src/lib/osinfo/uname.c
index 9d1923695,0..7111ae31d
mode 100644,00..100644
--- a/src/lib/osinfo/uname.c
+++ b/src/lib/osinfo/uname.c
@@@ -1,116 -1,0 +1,149 @@@
 +/* Copyright (c) 2003-2004, Roger Dingledine
 + * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
 + * Copyright (c) 2007-2018, The Tor Project, Inc. */
 +/* See LICENSE for licensing information */
 +
 +/**
 + * \file uname.c
 + * \brief Look up a description of the operating system.
 + **/
 +
 +#include "orconfig.h"
 +#include "lib/osinfo/uname.h"
 +
 +#include "lib/string/compat_string.h"
 +#include "lib/string/printf.h"
 +
 +#ifdef HAVE_UNAME
 +#include 
 +#endif
 +#ifdef _WIN32
 +#include 
 +#endif
 +#include 
 +
 +/** Hold the result of our call to uname. */
 +static char uname_result[256];
 +/** True iff uname_result is set. */
 +static int uname_result_is_set = 0;
 +
 +/** Return a pointer to a description of our platform.
 + */
 +MOCK_IMPL(const char *,
 +get_uname,(void))
 +{
 +#ifdef HAVE_UNAME
 +  struct utsname u;
 +#endif
 +  if (!uname_result_is_set) {
 +#ifdef HAVE_UNAME
 +if (uname() != -1) {
 +  /* (Linux says 0 is success, Solaris says 1 is success) */
 +  strlcpy(uname_result, u.sysname, sizeof(uname_result));
 +} else
 +#endif /* defined(HAVE_UNAME) */
 +  {
 +#ifdef _WIN32
 +OSVERSIONINFOEX info;
 +int i;
++int is_client = 0;
++int is_server = 0;
 +const char *plat = NULL;
 +static struct {
-   unsigned major; unsigned minor; const char *version;
++  unsigned major; unsigned minor;
++  const char *client_version; const char *server_version;
 +} win_version_table[] = {
-   { 6, 2, "Windows 8" },
-   { 6, 1, "Windows 7" },
-   { 6, 0, "Windows Vista" },
-   { 5, 2, "Windows Server 2003" },
-   { 5, 1, "Windows XP" },
-   { 5, 0, "Windows 2000" },
-   /* { 4, 0, "Windows NT 4.0" }, */
-   { 4, 90, "Windows Me" },
-   { 4, 10, "Windows 98" },
-   /* { 4, 0, "Windows 95" } */
-   { 3, 51, "Windows NT 3.51" },
-   { 0, 0, NULL }
++/* This table must be sorted in descending order.
++ * Sources:
++ *   https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
++ *   https://docs.microsoft.com/en-us/windows/desktop/api/winnt/
++ * ns-winnt-_osversioninfoexa#remarks
++ */
++/* Windows Server 2019 is indistinguishable from Windows Server 2016
++ * using GetVersionEx().
++{ 10,  0, NULL,"Windows Server 2019" }, */
++{ 10,  0, "Windows 10","Windows Server 2016" },
++{  6,  3, "Windows 8.1",   "Windows Server 2012 R2" },
++{  6,  2, "Windows 8", "Windows Server 2012" },
++{  6,  1, "Windows 7", "Windows Server 2008 R2" },
++{  6,  0, "Windows Vista", "Windows Server 2008" },
++{  5,  2, "Windows XP Professional",   "Windows Server 2003" },
++/* Windows XP did not have a server version, but we need something here */
++{  5,  1, "Windows XP","Windows XP Server" },
++{  5,  0, "Windows 2000 Professional", "Windows 2000 Server" },
++/* Earlier versions are not supported by GetVersionEx(). */
++{  0,  0, NULL,NULL }
 +};
 +memset(, 0, sizeof(info));
 +info.dwOSVersionInfoSize = sizeof(info);
 +if (! GetVersionEx((LPOSVERSIONINFO))) {
 +  strlcpy(uname_result, "Bizarre version of Windows where 
GetVersionEx"
 +  " doesn't work.", sizeof(uname_result));
 +  uname_result_is_set = 1;
 +  return uname_result;
 +}
- if (info.dwMajorVersion == 4 && info.dwMinorVersion == 0) {
-   if (info.dwPlatformId == VER_PLATFORM_WIN32_NT)
- plat = "Windows NT 4.0";
-   else
- plat = "Windows 95";
++#ifdef VER_NT_SERVER
++if (info.wProductType == VER_NT_SERVER ||
++info.wProductType == VER_NT_DOMAIN_CONTROLLER) {
++  is_server = 1;
 +} else {
-   for (i=0; win_version_table[i].major>0; ++i) {
- if (win_version_table[i].major == info.dwMajorVersion &&
- win_version_table[i].minor == info.dwMinorVersion) {
-   plat = win_version_table[i].version;
-   break;
++  is_client = 1;
++}
++#endif /* defined(VER_NT_SERVER) */
++/* 

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

2018-11-26 Thread nickm
commit 3153c272630510ee56c6797d75b7bf94d1681abc
Merge: fc591870b feb41b7c3
Author: Nick Mathewson 
Date:   Mon Nov 26 17:27:36 2018 -0500

Merge branch 'maint-0.3.5' into release-0.3.5

 changes/bug28096   | 13 +++
 src/lib/osinfo/uname.c | 95 ++
 2 files changed, 77 insertions(+), 31 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.5] Windows: fix uname on recent Windows versions

2018-11-26 Thread nickm
commit 2fbc58cf07fd7367ddaf81b82868b5f37d7883ae
Author: teor 
Date:   Mon Oct 22 14:02:43 2018 +1000

Windows: fix uname on recent Windows versions

Correctly identify Windows 8.1, Windows 10, and Windows Server 2008
and later from their NT versions.

On recent Windows versions, the GetVersionEx() function may report
an earlier Windows version than the running OS. To avoid user
confusion, add "[or later]" to Tor's version string on affected
versions of Windows.

Remove Windows versions that were never supported by the
GetVersionEx() function.

Stop duplicating the latest Windows version in get_uname().

Fixes bug 28096; bugfix on 0.2.2.34; reported by Keifer Bly.
---
 changes/bug28096| 13 
 src/common/compat.c | 95 -
 2 files changed, 77 insertions(+), 31 deletions(-)

diff --git a/changes/bug28096 b/changes/bug28096
new file mode 100644
index 0..6847df979
--- /dev/null
+++ b/changes/bug28096
@@ -0,0 +1,13 @@
+  o Minor bugfixes (Windows):
+- Correctly identify Windows 8.1, Windows 10, and Windows Server 2008
+  and later from their NT versions.
+  Fixes bug 28096; bugfix on 0.2.2.34; reported by Keifer Bly.
+- On recent Windows versions, the GetVersionEx() function may report
+  an earlier Windows version than the running OS. To avoid user
+  confusion, add "[or later]" to Tor's version string on affected
+  versions of Windows.
+  Fixes bug 28096; bugfix on 0.2.2.34; reported by Keifer Bly.
+- Remove Windows versions that were never supported by the
+  GetVersionEx() function. Stop duplicating the latest Windows
+  version in get_uname().
+  Fixes bug 28096; bugfix on 0.2.2.34; reported by Keifer Bly.
diff --git a/src/common/compat.c b/src/common/compat.c
index 4ac443c13..975875112 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -2689,22 +2689,33 @@ MOCK_IMPL(const char *, get_uname, (void))
 #ifdef _WIN32
 OSVERSIONINFOEX info;
 int i;
+int is_client = 0;
+int is_server = 0;
 const char *plat = NULL;
 static struct {
-  unsigned major; unsigned minor; const char *version;
+  unsigned major; unsigned minor;
+  const char *client_version; const char *server_version;
 } win_version_table[] = {
-  { 6, 2, "Windows 8" },
-  { 6, 1, "Windows 7" },
-  { 6, 0, "Windows Vista" },
-  { 5, 2, "Windows Server 2003" },
-  { 5, 1, "Windows XP" },
-  { 5, 0, "Windows 2000" },
-  /* { 4, 0, "Windows NT 4.0" }, */
-  { 4, 90, "Windows Me" },
-  { 4, 10, "Windows 98" },
-  /* { 4, 0, "Windows 95" } */
-  { 3, 51, "Windows NT 3.51" },
-  { 0, 0, NULL }
+/* This table must be sorted in descending order.
+ * Sources:
+ *   https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
+ *   https://docs.microsoft.com/en-us/windows/desktop/api/winnt/
+ * ns-winnt-_osversioninfoexa#remarks
+ */
+/* Windows Server 2019 is indistinguishable from Windows Server 2016
+ * using GetVersionEx().
+{ 10,  0, NULL,"Windows Server 2019" }, */
+{ 10,  0, "Windows 10","Windows Server 2016" },
+{  6,  3, "Windows 8.1",   "Windows Server 2012 R2" },
+{  6,  2, "Windows 8", "Windows Server 2012" },
+{  6,  1, "Windows 7", "Windows Server 2008 R2" },
+{  6,  0, "Windows Vista", "Windows Server 2008" },
+{  5,  2, "Windows XP Professional",   "Windows Server 2003" },
+/* Windows XP did not have a server version, but we need something here */
+{  5,  1, "Windows XP","Windows XP Server" },
+{  5,  0, "Windows 2000 Professional", "Windows 2000 Server" },
+/* Earlier versions are not supported by GetVersionEx(). */
+{  0,  0, NULL,NULL }
 };
 memset(, 0, sizeof(info));
 info.dwOSVersionInfoSize = sizeof(info);
@@ -2714,25 +2725,34 @@ MOCK_IMPL(const char *, get_uname, (void))
   uname_result_is_set = 1;
   return uname_result;
 }
-if (info.dwMajorVersion == 4 && info.dwMinorVersion == 0) {
-  if (info.dwPlatformId == VER_PLATFORM_WIN32_NT)
-plat = "Windows NT 4.0";
-  else
-plat = "Windows 95";
+#ifdef VER_NT_SERVER
+if (info.wProductType == VER_NT_SERVER ||
+info.wProductType == VER_NT_DOMAIN_CONTROLLER) {
+  is_server = 1;
 } else {
-  for (i=0; win_version_table[i].major>0; ++i) {
-if (win_version_table[i].major == info.dwMajorVersion &&
-win_version_table[i].minor == info.dwMinorVersion) {
-  plat = win_version_table[i].version;
-  break;
+  is_client = 1;
+ 

[tor-commits] [tor/release-0.3.5] Merge remote-tracking branch 'teor/bug28096-035-squashed' into maint-0.3.5

2018-11-26 Thread nickm
commit feb41b7c3078d6df7e93a056853badc847773d9a
Merge: 056ffdec4 44ced9b75
Author: Nick Mathewson 
Date:   Mon Nov 26 17:24:41 2018 -0500

Merge remote-tracking branch 'teor/bug28096-035-squashed' into maint-0.3.5

 changes/bug28096   | 13 +++
 src/lib/osinfo/uname.c | 95 ++
 2 files changed, 77 insertions(+), 31 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.5'

2018-11-26 Thread nickm
commit 8a15d0f69b6490eb525cdd889b3a905ad0db5e39
Merge: c292e505f feb41b7c3
Author: Nick Mathewson 
Date:   Mon Nov 26 17:25:28 2018 -0500

Merge branch 'maint-0.3.5'

 changes/bug28096   | 13 +++
 src/lib/osinfo/uname.c | 95 ++
 2 files changed, 77 insertions(+), 31 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 'teor/bug28096-035-squashed' into maint-0.3.5

2018-11-26 Thread nickm
commit feb41b7c3078d6df7e93a056853badc847773d9a
Merge: 056ffdec4 44ced9b75
Author: Nick Mathewson 
Date:   Mon Nov 26 17:24:41 2018 -0500

Merge remote-tracking branch 'teor/bug28096-035-squashed' into maint-0.3.5

 changes/bug28096   | 13 +++
 src/lib/osinfo/uname.c | 95 ++
 2 files changed, 77 insertions(+), 31 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.5] Windows: fix uname on recent Windows versions

2018-11-26 Thread nickm
commit 2fbc58cf07fd7367ddaf81b82868b5f37d7883ae
Author: teor 
Date:   Mon Oct 22 14:02:43 2018 +1000

Windows: fix uname on recent Windows versions

Correctly identify Windows 8.1, Windows 10, and Windows Server 2008
and later from their NT versions.

On recent Windows versions, the GetVersionEx() function may report
an earlier Windows version than the running OS. To avoid user
confusion, add "[or later]" to Tor's version string on affected
versions of Windows.

Remove Windows versions that were never supported by the
GetVersionEx() function.

Stop duplicating the latest Windows version in get_uname().

Fixes bug 28096; bugfix on 0.2.2.34; reported by Keifer Bly.
---
 changes/bug28096| 13 
 src/common/compat.c | 95 -
 2 files changed, 77 insertions(+), 31 deletions(-)

diff --git a/changes/bug28096 b/changes/bug28096
new file mode 100644
index 0..6847df979
--- /dev/null
+++ b/changes/bug28096
@@ -0,0 +1,13 @@
+  o Minor bugfixes (Windows):
+- Correctly identify Windows 8.1, Windows 10, and Windows Server 2008
+  and later from their NT versions.
+  Fixes bug 28096; bugfix on 0.2.2.34; reported by Keifer Bly.
+- On recent Windows versions, the GetVersionEx() function may report
+  an earlier Windows version than the running OS. To avoid user
+  confusion, add "[or later]" to Tor's version string on affected
+  versions of Windows.
+  Fixes bug 28096; bugfix on 0.2.2.34; reported by Keifer Bly.
+- Remove Windows versions that were never supported by the
+  GetVersionEx() function. Stop duplicating the latest Windows
+  version in get_uname().
+  Fixes bug 28096; bugfix on 0.2.2.34; reported by Keifer Bly.
diff --git a/src/common/compat.c b/src/common/compat.c
index 4ac443c13..975875112 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -2689,22 +2689,33 @@ MOCK_IMPL(const char *, get_uname, (void))
 #ifdef _WIN32
 OSVERSIONINFOEX info;
 int i;
+int is_client = 0;
+int is_server = 0;
 const char *plat = NULL;
 static struct {
-  unsigned major; unsigned minor; const char *version;
+  unsigned major; unsigned minor;
+  const char *client_version; const char *server_version;
 } win_version_table[] = {
-  { 6, 2, "Windows 8" },
-  { 6, 1, "Windows 7" },
-  { 6, 0, "Windows Vista" },
-  { 5, 2, "Windows Server 2003" },
-  { 5, 1, "Windows XP" },
-  { 5, 0, "Windows 2000" },
-  /* { 4, 0, "Windows NT 4.0" }, */
-  { 4, 90, "Windows Me" },
-  { 4, 10, "Windows 98" },
-  /* { 4, 0, "Windows 95" } */
-  { 3, 51, "Windows NT 3.51" },
-  { 0, 0, NULL }
+/* This table must be sorted in descending order.
+ * Sources:
+ *   https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
+ *   https://docs.microsoft.com/en-us/windows/desktop/api/winnt/
+ * ns-winnt-_osversioninfoexa#remarks
+ */
+/* Windows Server 2019 is indistinguishable from Windows Server 2016
+ * using GetVersionEx().
+{ 10,  0, NULL,"Windows Server 2019" }, */
+{ 10,  0, "Windows 10","Windows Server 2016" },
+{  6,  3, "Windows 8.1",   "Windows Server 2012 R2" },
+{  6,  2, "Windows 8", "Windows Server 2012" },
+{  6,  1, "Windows 7", "Windows Server 2008 R2" },
+{  6,  0, "Windows Vista", "Windows Server 2008" },
+{  5,  2, "Windows XP Professional",   "Windows Server 2003" },
+/* Windows XP did not have a server version, but we need something here */
+{  5,  1, "Windows XP","Windows XP Server" },
+{  5,  0, "Windows 2000 Professional", "Windows 2000 Server" },
+/* Earlier versions are not supported by GetVersionEx(). */
+{  0,  0, NULL,NULL }
 };
 memset(, 0, sizeof(info));
 info.dwOSVersionInfoSize = sizeof(info);
@@ -2714,25 +2725,34 @@ MOCK_IMPL(const char *, get_uname, (void))
   uname_result_is_set = 1;
   return uname_result;
 }
-if (info.dwMajorVersion == 4 && info.dwMinorVersion == 0) {
-  if (info.dwPlatformId == VER_PLATFORM_WIN32_NT)
-plat = "Windows NT 4.0";
-  else
-plat = "Windows 95";
+#ifdef VER_NT_SERVER
+if (info.wProductType == VER_NT_SERVER ||
+info.wProductType == VER_NT_DOMAIN_CONTROLLER) {
+  is_server = 1;
 } else {
-  for (i=0; win_version_table[i].major>0; ++i) {
-if (win_version_table[i].major == info.dwMajorVersion &&
-win_version_table[i].minor == info.dwMinorVersion) {
-  plat = win_version_table[i].version;
-  break;
+  is_client = 1;
+ 

[tor-commits] [tor/master] Windows: fix uname on recent Windows versions

2018-11-26 Thread nickm
commit 2fbc58cf07fd7367ddaf81b82868b5f37d7883ae
Author: teor 
Date:   Mon Oct 22 14:02:43 2018 +1000

Windows: fix uname on recent Windows versions

Correctly identify Windows 8.1, Windows 10, and Windows Server 2008
and later from their NT versions.

On recent Windows versions, the GetVersionEx() function may report
an earlier Windows version than the running OS. To avoid user
confusion, add "[or later]" to Tor's version string on affected
versions of Windows.

Remove Windows versions that were never supported by the
GetVersionEx() function.

Stop duplicating the latest Windows version in get_uname().

Fixes bug 28096; bugfix on 0.2.2.34; reported by Keifer Bly.
---
 changes/bug28096| 13 
 src/common/compat.c | 95 -
 2 files changed, 77 insertions(+), 31 deletions(-)

diff --git a/changes/bug28096 b/changes/bug28096
new file mode 100644
index 0..6847df979
--- /dev/null
+++ b/changes/bug28096
@@ -0,0 +1,13 @@
+  o Minor bugfixes (Windows):
+- Correctly identify Windows 8.1, Windows 10, and Windows Server 2008
+  and later from their NT versions.
+  Fixes bug 28096; bugfix on 0.2.2.34; reported by Keifer Bly.
+- On recent Windows versions, the GetVersionEx() function may report
+  an earlier Windows version than the running OS. To avoid user
+  confusion, add "[or later]" to Tor's version string on affected
+  versions of Windows.
+  Fixes bug 28096; bugfix on 0.2.2.34; reported by Keifer Bly.
+- Remove Windows versions that were never supported by the
+  GetVersionEx() function. Stop duplicating the latest Windows
+  version in get_uname().
+  Fixes bug 28096; bugfix on 0.2.2.34; reported by Keifer Bly.
diff --git a/src/common/compat.c b/src/common/compat.c
index 4ac443c13..975875112 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -2689,22 +2689,33 @@ MOCK_IMPL(const char *, get_uname, (void))
 #ifdef _WIN32
 OSVERSIONINFOEX info;
 int i;
+int is_client = 0;
+int is_server = 0;
 const char *plat = NULL;
 static struct {
-  unsigned major; unsigned minor; const char *version;
+  unsigned major; unsigned minor;
+  const char *client_version; const char *server_version;
 } win_version_table[] = {
-  { 6, 2, "Windows 8" },
-  { 6, 1, "Windows 7" },
-  { 6, 0, "Windows Vista" },
-  { 5, 2, "Windows Server 2003" },
-  { 5, 1, "Windows XP" },
-  { 5, 0, "Windows 2000" },
-  /* { 4, 0, "Windows NT 4.0" }, */
-  { 4, 90, "Windows Me" },
-  { 4, 10, "Windows 98" },
-  /* { 4, 0, "Windows 95" } */
-  { 3, 51, "Windows NT 3.51" },
-  { 0, 0, NULL }
+/* This table must be sorted in descending order.
+ * Sources:
+ *   https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
+ *   https://docs.microsoft.com/en-us/windows/desktop/api/winnt/
+ * ns-winnt-_osversioninfoexa#remarks
+ */
+/* Windows Server 2019 is indistinguishable from Windows Server 2016
+ * using GetVersionEx().
+{ 10,  0, NULL,"Windows Server 2019" }, */
+{ 10,  0, "Windows 10","Windows Server 2016" },
+{  6,  3, "Windows 8.1",   "Windows Server 2012 R2" },
+{  6,  2, "Windows 8", "Windows Server 2012" },
+{  6,  1, "Windows 7", "Windows Server 2008 R2" },
+{  6,  0, "Windows Vista", "Windows Server 2008" },
+{  5,  2, "Windows XP Professional",   "Windows Server 2003" },
+/* Windows XP did not have a server version, but we need something here */
+{  5,  1, "Windows XP","Windows XP Server" },
+{  5,  0, "Windows 2000 Professional", "Windows 2000 Server" },
+/* Earlier versions are not supported by GetVersionEx(). */
+{  0,  0, NULL,NULL }
 };
 memset(, 0, sizeof(info));
 info.dwOSVersionInfoSize = sizeof(info);
@@ -2714,25 +2725,34 @@ MOCK_IMPL(const char *, get_uname, (void))
   uname_result_is_set = 1;
   return uname_result;
 }
-if (info.dwMajorVersion == 4 && info.dwMinorVersion == 0) {
-  if (info.dwPlatformId == VER_PLATFORM_WIN32_NT)
-plat = "Windows NT 4.0";
-  else
-plat = "Windows 95";
+#ifdef VER_NT_SERVER
+if (info.wProductType == VER_NT_SERVER ||
+info.wProductType == VER_NT_DOMAIN_CONTROLLER) {
+  is_server = 1;
 } else {
-  for (i=0; win_version_table[i].major>0; ++i) {
-if (win_version_table[i].major == info.dwMajorVersion &&
-win_version_table[i].minor == info.dwMinorVersion) {
-  plat = win_version_table[i].version;
-  break;
+  is_client = 1;
+ 

[tor-commits] [tor/maint-0.3.5] Merge branch 'bug28096-029-squashed' into bug28096-035-squashed

2018-11-26 Thread nickm
commit 44ced9b750a65d867dc5dd2cbbcf7e42a46ae90d
Merge: d598d834f 2fbc58cf0
Author: teor 
Date:   Thu Nov 15 12:23:29 2018 +1000

Merge branch 'bug28096-029-squashed' into bug28096-035-squashed

Move the get_uname() changes from src/common/compat.c to
src/lib/osinfo/uname.c

 changes/bug28096   | 13 +++
 src/lib/osinfo/uname.c | 95 ++
 2 files changed, 77 insertions(+), 31 deletions(-)

diff --cc src/lib/osinfo/uname.c
index 9d1923695,0..7111ae31d
mode 100644,00..100644
--- a/src/lib/osinfo/uname.c
+++ b/src/lib/osinfo/uname.c
@@@ -1,116 -1,0 +1,149 @@@
 +/* Copyright (c) 2003-2004, Roger Dingledine
 + * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
 + * Copyright (c) 2007-2018, The Tor Project, Inc. */
 +/* See LICENSE for licensing information */
 +
 +/**
 + * \file uname.c
 + * \brief Look up a description of the operating system.
 + **/
 +
 +#include "orconfig.h"
 +#include "lib/osinfo/uname.h"
 +
 +#include "lib/string/compat_string.h"
 +#include "lib/string/printf.h"
 +
 +#ifdef HAVE_UNAME
 +#include 
 +#endif
 +#ifdef _WIN32
 +#include 
 +#endif
 +#include 
 +
 +/** Hold the result of our call to uname. */
 +static char uname_result[256];
 +/** True iff uname_result is set. */
 +static int uname_result_is_set = 0;
 +
 +/** Return a pointer to a description of our platform.
 + */
 +MOCK_IMPL(const char *,
 +get_uname,(void))
 +{
 +#ifdef HAVE_UNAME
 +  struct utsname u;
 +#endif
 +  if (!uname_result_is_set) {
 +#ifdef HAVE_UNAME
 +if (uname() != -1) {
 +  /* (Linux says 0 is success, Solaris says 1 is success) */
 +  strlcpy(uname_result, u.sysname, sizeof(uname_result));
 +} else
 +#endif /* defined(HAVE_UNAME) */
 +  {
 +#ifdef _WIN32
 +OSVERSIONINFOEX info;
 +int i;
++int is_client = 0;
++int is_server = 0;
 +const char *plat = NULL;
 +static struct {
-   unsigned major; unsigned minor; const char *version;
++  unsigned major; unsigned minor;
++  const char *client_version; const char *server_version;
 +} win_version_table[] = {
-   { 6, 2, "Windows 8" },
-   { 6, 1, "Windows 7" },
-   { 6, 0, "Windows Vista" },
-   { 5, 2, "Windows Server 2003" },
-   { 5, 1, "Windows XP" },
-   { 5, 0, "Windows 2000" },
-   /* { 4, 0, "Windows NT 4.0" }, */
-   { 4, 90, "Windows Me" },
-   { 4, 10, "Windows 98" },
-   /* { 4, 0, "Windows 95" } */
-   { 3, 51, "Windows NT 3.51" },
-   { 0, 0, NULL }
++/* This table must be sorted in descending order.
++ * Sources:
++ *   https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
++ *   https://docs.microsoft.com/en-us/windows/desktop/api/winnt/
++ * ns-winnt-_osversioninfoexa#remarks
++ */
++/* Windows Server 2019 is indistinguishable from Windows Server 2016
++ * using GetVersionEx().
++{ 10,  0, NULL,"Windows Server 2019" }, */
++{ 10,  0, "Windows 10","Windows Server 2016" },
++{  6,  3, "Windows 8.1",   "Windows Server 2012 R2" },
++{  6,  2, "Windows 8", "Windows Server 2012" },
++{  6,  1, "Windows 7", "Windows Server 2008 R2" },
++{  6,  0, "Windows Vista", "Windows Server 2008" },
++{  5,  2, "Windows XP Professional",   "Windows Server 2003" },
++/* Windows XP did not have a server version, but we need something here */
++{  5,  1, "Windows XP","Windows XP Server" },
++{  5,  0, "Windows 2000 Professional", "Windows 2000 Server" },
++/* Earlier versions are not supported by GetVersionEx(). */
++{  0,  0, NULL,NULL }
 +};
 +memset(, 0, sizeof(info));
 +info.dwOSVersionInfoSize = sizeof(info);
 +if (! GetVersionEx((LPOSVERSIONINFO))) {
 +  strlcpy(uname_result, "Bizarre version of Windows where 
GetVersionEx"
 +  " doesn't work.", sizeof(uname_result));
 +  uname_result_is_set = 1;
 +  return uname_result;
 +}
- if (info.dwMajorVersion == 4 && info.dwMinorVersion == 0) {
-   if (info.dwPlatformId == VER_PLATFORM_WIN32_NT)
- plat = "Windows NT 4.0";
-   else
- plat = "Windows 95";
++#ifdef VER_NT_SERVER
++if (info.wProductType == VER_NT_SERVER ||
++info.wProductType == VER_NT_DOMAIN_CONTROLLER) {
++  is_server = 1;
 +} else {
-   for (i=0; win_version_table[i].major>0; ++i) {
- if (win_version_table[i].major == info.dwMajorVersion &&
- win_version_table[i].minor == info.dwMinorVersion) {
-   plat = win_version_table[i].version;
-   break;
++  is_client = 1;
++}
++#endif /* defined(VER_NT_SERVER) */
++/* 

[tor-commits] [tor/maint-0.3.5] Merge remote-tracking branch 'teor/bug28096-035-squashed' into maint-0.3.5

2018-11-26 Thread nickm
commit feb41b7c3078d6df7e93a056853badc847773d9a
Merge: 056ffdec4 44ced9b75
Author: Nick Mathewson 
Date:   Mon Nov 26 17:24:41 2018 -0500

Merge remote-tracking branch 'teor/bug28096-035-squashed' into maint-0.3.5

 changes/bug28096   | 13 +++
 src/lib/osinfo/uname.c | 95 ++
 2 files changed, 77 insertions(+), 31 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 'bug28096-029-squashed' into bug28096-035-squashed

2018-11-26 Thread nickm
commit 44ced9b750a65d867dc5dd2cbbcf7e42a46ae90d
Merge: d598d834f 2fbc58cf0
Author: teor 
Date:   Thu Nov 15 12:23:29 2018 +1000

Merge branch 'bug28096-029-squashed' into bug28096-035-squashed

Move the get_uname() changes from src/common/compat.c to
src/lib/osinfo/uname.c

 changes/bug28096   | 13 +++
 src/lib/osinfo/uname.c | 95 ++
 2 files changed, 77 insertions(+), 31 deletions(-)

diff --cc src/lib/osinfo/uname.c
index 9d1923695,0..7111ae31d
mode 100644,00..100644
--- a/src/lib/osinfo/uname.c
+++ b/src/lib/osinfo/uname.c
@@@ -1,116 -1,0 +1,149 @@@
 +/* Copyright (c) 2003-2004, Roger Dingledine
 + * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
 + * Copyright (c) 2007-2018, The Tor Project, Inc. */
 +/* See LICENSE for licensing information */
 +
 +/**
 + * \file uname.c
 + * \brief Look up a description of the operating system.
 + **/
 +
 +#include "orconfig.h"
 +#include "lib/osinfo/uname.h"
 +
 +#include "lib/string/compat_string.h"
 +#include "lib/string/printf.h"
 +
 +#ifdef HAVE_UNAME
 +#include 
 +#endif
 +#ifdef _WIN32
 +#include 
 +#endif
 +#include 
 +
 +/** Hold the result of our call to uname. */
 +static char uname_result[256];
 +/** True iff uname_result is set. */
 +static int uname_result_is_set = 0;
 +
 +/** Return a pointer to a description of our platform.
 + */
 +MOCK_IMPL(const char *,
 +get_uname,(void))
 +{
 +#ifdef HAVE_UNAME
 +  struct utsname u;
 +#endif
 +  if (!uname_result_is_set) {
 +#ifdef HAVE_UNAME
 +if (uname() != -1) {
 +  /* (Linux says 0 is success, Solaris says 1 is success) */
 +  strlcpy(uname_result, u.sysname, sizeof(uname_result));
 +} else
 +#endif /* defined(HAVE_UNAME) */
 +  {
 +#ifdef _WIN32
 +OSVERSIONINFOEX info;
 +int i;
++int is_client = 0;
++int is_server = 0;
 +const char *plat = NULL;
 +static struct {
-   unsigned major; unsigned minor; const char *version;
++  unsigned major; unsigned minor;
++  const char *client_version; const char *server_version;
 +} win_version_table[] = {
-   { 6, 2, "Windows 8" },
-   { 6, 1, "Windows 7" },
-   { 6, 0, "Windows Vista" },
-   { 5, 2, "Windows Server 2003" },
-   { 5, 1, "Windows XP" },
-   { 5, 0, "Windows 2000" },
-   /* { 4, 0, "Windows NT 4.0" }, */
-   { 4, 90, "Windows Me" },
-   { 4, 10, "Windows 98" },
-   /* { 4, 0, "Windows 95" } */
-   { 3, 51, "Windows NT 3.51" },
-   { 0, 0, NULL }
++/* This table must be sorted in descending order.
++ * Sources:
++ *   https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
++ *   https://docs.microsoft.com/en-us/windows/desktop/api/winnt/
++ * ns-winnt-_osversioninfoexa#remarks
++ */
++/* Windows Server 2019 is indistinguishable from Windows Server 2016
++ * using GetVersionEx().
++{ 10,  0, NULL,"Windows Server 2019" }, */
++{ 10,  0, "Windows 10","Windows Server 2016" },
++{  6,  3, "Windows 8.1",   "Windows Server 2012 R2" },
++{  6,  2, "Windows 8", "Windows Server 2012" },
++{  6,  1, "Windows 7", "Windows Server 2008 R2" },
++{  6,  0, "Windows Vista", "Windows Server 2008" },
++{  5,  2, "Windows XP Professional",   "Windows Server 2003" },
++/* Windows XP did not have a server version, but we need something here */
++{  5,  1, "Windows XP","Windows XP Server" },
++{  5,  0, "Windows 2000 Professional", "Windows 2000 Server" },
++/* Earlier versions are not supported by GetVersionEx(). */
++{  0,  0, NULL,NULL }
 +};
 +memset(, 0, sizeof(info));
 +info.dwOSVersionInfoSize = sizeof(info);
 +if (! GetVersionEx((LPOSVERSIONINFO))) {
 +  strlcpy(uname_result, "Bizarre version of Windows where 
GetVersionEx"
 +  " doesn't work.", sizeof(uname_result));
 +  uname_result_is_set = 1;
 +  return uname_result;
 +}
- if (info.dwMajorVersion == 4 && info.dwMinorVersion == 0) {
-   if (info.dwPlatformId == VER_PLATFORM_WIN32_NT)
- plat = "Windows NT 4.0";
-   else
- plat = "Windows 95";
++#ifdef VER_NT_SERVER
++if (info.wProductType == VER_NT_SERVER ||
++info.wProductType == VER_NT_DOMAIN_CONTROLLER) {
++  is_server = 1;
 +} else {
-   for (i=0; win_version_table[i].major>0; ++i) {
- if (win_version_table[i].major == info.dwMajorVersion &&
- win_version_table[i].minor == info.dwMinorVersion) {
-   plat = win_version_table[i].version;
-   break;
++  is_client = 1;
++}
++#endif /* defined(VER_NT_SERVER) */
++/* 

[tor-commits] [tor/master] Merge remote-tracking branch 'tor-github/pr/539'

2018-11-26 Thread nickm
commit c292e505ff46a41f5f966556e9f4588385816c77
Merge: fc1ad9ab6 997a8b0ca
Author: Nick Mathewson 
Date:   Mon Nov 26 17:22:37 2018 -0500

Merge remote-tracking branch 'tor-github/pr/539'

 src/test/test_rebind.py | 10 +++---
 src/test/test_rebind.sh | 15 ++-
 2 files changed, 21 insertions(+), 4 deletions(-)

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


[tor-commits] [tor/master] Create a temporary directory for tor's DataDirectory in test_rebind.

2018-11-26 Thread nickm
commit 997a8b0ca7a4f4eafa2cd09582c4bcc0507e2fa6
Author: Taylor R Campbell 
Date:   Thu Nov 22 00:53:57 2018 +

Create a temporary directory for tor's DataDirectory in test_rebind.

Fixes #28562.

While here, put the argument count test and usage message _before_ we
attempt to read from sys.argv.
---
 src/test/test_rebind.py | 10 +++---
 src/test/test_rebind.sh | 15 ++-
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/test/test_rebind.py b/src/test/test_rebind.py
index c63341a68..2f366b271 100644
--- a/src/test/test_rebind.py
+++ b/src/test/test_rebind.py
@@ -67,12 +67,19 @@ socks_port = pick_random_port()
 assert control_port != 0
 assert socks_port != 0
 
+if len(sys.argv) < 3:
+ fail('Usage: %s  ' % sys.argv[0])
+
 if not os.path.exists(sys.argv[1]):
 fail('ERROR: cannot find tor at %s' % sys.argv[1])
+if not os.path.exists(sys.argv[2]):
+fail('ERROR: cannot find datadir at %s' % sys.argv[2])
 
 tor_path = sys.argv[1]
+data_dir = sys.argv[2]
 
 tor_process = subprocess.Popen([tor_path,
+   '-DataDirectory', data_dir,
'-ControlPort', 
'127.0.0.1:{}'.format(control_port),
'-SOCKSPort', '127.0.0.1:{}'.format(socks_port),
'-FetchServerDescriptors', '0'],
@@ -82,9 +89,6 @@ tor_process = subprocess.Popen([tor_path,
 if tor_process == None:
 fail('ERROR: running tor failed')
 
-if len(sys.argv) < 2:
- fail('Usage: %s ' % sys.argv[0])
-
 wait_for_log('Opened Control listener on')
 
 try_connecting_to_socksport()
diff --git a/src/test/test_rebind.sh b/src/test/test_rebind.sh
index 76eb9f2e4..498072de3 100755
--- a/src/test/test_rebind.sh
+++ b/src/test/test_rebind.sh
@@ -14,6 +14,19 @@ fi
 
 exitcode=0
 
-"${PYTHON:-python}" "${abs_top_srcdir:-.}/src/test/test_rebind.py" 
"${TESTING_TOR_BINARY}" || exitcode=1
+tmpdir=
+clean () { test -n "$tmpdir" && test -d "$tmpdir" && rm -rf "$tmpdir" || :; }
+trap clean EXIT HUP INT TERM
+
+tmpdir="`mktemp -d -t tor_rebind_test.XX`"
+if [ -z "$tmpdir" ]; then
+  echo >&2 mktemp failed
+  exit 2
+elif [ ! -d "$tmpdir" ]; then
+  echo >&2 mktemp failed to make a directory
+  exit 3
+fi
+
+"${PYTHON:-python}" "${abs_top_srcdir:-.}/src/test/test_rebind.py" 
"${TESTING_TOR_BINARY}" "$tmpdir" || exitcode=1
 
 exit ${exitcode}



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


[tor-commits] [tor/master] Make ROUTERLIST_PRUNING_INTERVAL 1 hr.

2018-11-26 Thread nickm
commit 411780d563e4d08e12d8aef0bbe8915f48011cca
Author: rl1987 
Date:   Sat Nov 17 10:19:25 2018 +0200

Make ROUTERLIST_PRUNING_INTERVAL 1 hr.
---
 src/core/mainloop/mainloop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index be1913613..0b9d4e088 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -2231,7 +2231,7 @@ retry_dns_callback(time_t now, const or_options_t 
*options)
 static int
 prune_old_routers_callback(time_t now, const or_options_t *options)
 {
-#define ROUTERLIST_PRUNING_INTERVAL (60) // 1 minute.
+#define ROUTERLIST_PRUNING_INTERVAL (60*60) // 1 hour.
   (void)now;
   (void)options;
 



___
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 'tor-github/pr/495'

2018-11-26 Thread nickm
commit fc1ad9ab652063bdabb56a71ea6c005b66ed9f4c
Merge: e12fdeb18 c8c4c3dff
Author: Nick Mathewson 
Date:   Mon Nov 26 17:17:40 2018 -0500

Merge remote-tracking branch 'tor-github/pr/495'

 changes/bug27929 |  5 +
 src/core/mainloop/mainloop.c | 32 ++--
 2 files changed, 31 insertions(+), 6 deletions(-)

diff --cc src/core/mainloop/mainloop.c
index 42df1038a,0b9d4e088..2e2ae876d
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@@ -1371,80 -1376,72 +1372,82 @@@ CALLBACK(second_elapsed)
  #undef CALLBACK
  
  /* Now we declare an array of periodic_event_item_t for each periodic event */
 -#define CALLBACK(name, r, f) PERIODIC_EVENT(name, r, f)
 +#define CALLBACK(name, r, f) \
 +  PERIODIC_EVENT(name, PERIODIC_EVENT_ROLE_ ## r, f)
 +#define FL(name) (PERIODIC_EVENT_FLAG_ ## name)
  
  STATIC periodic_event_item_t periodic_events[] = {
 -  /* Everyone needs to run those. */
 -  CALLBACK(add_entropy, PERIODIC_EVENT_ROLE_ALL, 0),
 -  CALLBACK(check_expired_networkstatus, PERIODIC_EVENT_ROLE_ALL, 0),
 -  CALLBACK(clean_caches, PERIODIC_EVENT_ROLE_ALL, 0),
 -  CALLBACK(fetch_networkstatus, PERIODIC_EVENT_ROLE_ALL,
 -   PERIODIC_EVENT_FLAG_NEED_NET),
 -  CALLBACK(heartbeat, PERIODIC_EVENT_ROLE_ALL, 0),
 -  CALLBACK(launch_descriptor_fetches, PERIODIC_EVENT_ROLE_ALL,
 -   PERIODIC_EVENT_FLAG_NEED_NET),
 -  CALLBACK(reset_padding_counts, PERIODIC_EVENT_ROLE_ALL, 0),
 -  CALLBACK(retry_listeners, PERIODIC_EVENT_ROLE_ALL,
 -   PERIODIC_EVENT_FLAG_NEED_NET),
 -  CALLBACK(save_state, PERIODIC_EVENT_ROLE_ALL, 0),
 -  CALLBACK(prune_old_routers, PERIODIC_EVENT_ROLE_ALL,
 -   PERIODIC_EVENT_FLAG_NEED_NET),
 -  CALLBACK(rotate_x509_certificate, PERIODIC_EVENT_ROLE_ALL, 0),
 -  CALLBACK(write_stats_file, PERIODIC_EVENT_ROLE_ALL, 0),
++
 +  /* Everyone needs to run these. They need to have very long timeouts for
 +   * that to be safe. */
 +  CALLBACK(add_entropy, ALL, 0),
 +  CALLBACK(heartbeat, ALL, 0),
 +  CALLBACK(reset_padding_counts, ALL, 0),
 +
 +  /* This is a legacy catch-all callback that runs once per second if
 +   * we are online and active. */
 +  CALLBACK(second_elapsed, NET_PARTICIPANT,
 +   FL(NEED_NET)|FL(RUN_ON_DISABLE)),
 +
 +  /*  Do we have a reason to do this on a callback? Does it do any good at
 +   * all?  For now, if we're dormant, we can let our listeners decay. */
 +  CALLBACK(retry_listeners, NET_PARTICIPANT, FL(NEED_NET)),
 +
 +  /* We need to do these if we're participating in the Tor network. */
 +  CALLBACK(check_expired_networkstatus, NET_PARTICIPANT, 0),
 +  CALLBACK(fetch_networkstatus, NET_PARTICIPANT, 0),
 +  CALLBACK(launch_descriptor_fetches, NET_PARTICIPANT, FL(NEED_NET)),
 +  CALLBACK(rotate_x509_certificate, NET_PARTICIPANT, 0),
 +  CALLBACK(check_network_participation, NET_PARTICIPANT, 0),
 +
 +  /* We need to do these if we're participating in the Tor network, and
 +   * immediately before we stop. */
 +  CALLBACK(clean_caches, NET_PARTICIPANT, FL(RUN_ON_DISABLE)),
 +  CALLBACK(save_state, NET_PARTICIPANT, FL(RUN_ON_DISABLE)),
 +  CALLBACK(write_stats_file, NET_PARTICIPANT, FL(RUN_ON_DISABLE)),
++  CALLBACK(prune_old_routers, NET_PARTICIPANT, FL(RUN_ON_DISABLE)),
  
/* Routers (bridge and relay) only. */
 -  CALLBACK(check_descriptor, PERIODIC_EVENT_ROLE_ROUTER,
 -   PERIODIC_EVENT_FLAG_NEED_NET),
 -  CALLBACK(check_ed_keys, PERIODIC_EVENT_ROLE_ROUTER, 0),
 -  CALLBACK(check_for_reachability_bw, PERIODIC_EVENT_ROLE_ROUTER,
 -   PERIODIC_EVENT_FLAG_NEED_NET),
 -  CALLBACK(check_onion_keys_expiry_time, PERIODIC_EVENT_ROLE_ROUTER, 0),
 -  CALLBACK(expire_old_ciruits_serverside, PERIODIC_EVENT_ROLE_ROUTER,
 -   PERIODIC_EVENT_FLAG_NEED_NET),
 -  CALLBACK(reachability_warnings, PERIODIC_EVENT_ROLE_ROUTER,
 -   PERIODIC_EVENT_FLAG_NEED_NET),
 -  CALLBACK(retry_dns, PERIODIC_EVENT_ROLE_ROUTER, 0),
 -  CALLBACK(rotate_onion_key, PERIODIC_EVENT_ROLE_ROUTER, 0),
 +  CALLBACK(check_descriptor, ROUTER, FL(NEED_NET)),
 +  CALLBACK(check_ed_keys, ROUTER, 0),
 +  CALLBACK(check_for_reachability_bw, ROUTER, FL(NEED_NET)),
 +  CALLBACK(check_onion_keys_expiry_time, ROUTER, 0),
 +  CALLBACK(expire_old_ciruits_serverside, ROUTER, FL(NEED_NET)),
 +  CALLBACK(reachability_warnings, ROUTER, FL(NEED_NET)),
 +  CALLBACK(retry_dns, ROUTER, 0),
 +  CALLBACK(rotate_onion_key, ROUTER, 0),
  
/* Authorities (bridge and directory) only. */
 -  CALLBACK(downrate_stability, PERIODIC_EVENT_ROLE_AUTHORITIES, 0),
 -  CALLBACK(launch_reachability_tests, PERIODIC_EVENT_ROLE_AUTHORITIES,
 -   PERIODIC_EVENT_FLAG_NEED_NET),
 -  CALLBACK(save_stability, PERIODIC_EVENT_ROLE_AUTHORITIES, 0),
 +  CALLBACK(downrate_stability, AUTHORITIES, 0),
 +  CALLBACK(launch_reachability_tests, AUTHORITIES, FL(NEED_NET)),
 +  CALLBACK(save_stability, AUTHORITIES, 0),
  
/* Directory authority only. */
 -  CALLBACK(check_authority_cert, PERIODIC_EVENT_ROLE_DIRAUTH, 0),
 -  

[tor-commits] [tor/master] fixup! Make ROUTERLIST_PRUNING_INTERVAL 1 hr.

2018-11-26 Thread nickm
commit c8c4c3dffa71b4bbc9e7cabfee2124fb5e19ad39
Author: rl1987 
Date:   Sat Nov 17 10:27:10 2018 +0200

fixup! Make ROUTERLIST_PRUNING_INTERVAL 1 hr.
---
 changes/bug27929 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/changes/bug27929 b/changes/bug27929
index a97d18f20..dab57a2ec 100644
--- a/changes/bug27929
+++ b/changes/bug27929
@@ -1,5 +1,5 @@
   o Minor bugfixes (periodic events):
 - Refrain from calling routerlist_remove_old_routers() from
   check_descriptor_callback(). Instead, create a new periodic
-  event that will run every minute even if Tor is not configured
+  event that will run once every hour even if Tor is not configured
   as onion router. Fixes bug 27929; bugfix on 0.2.8.1-alpha.



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


[tor-commits] [tor/master] Create new periodic event for pruning old info about Tor routers

2018-11-26 Thread nickm
commit 100136ca8624151605601d80b63746cfaeb6df47
Author: rl1987 
Date:   Sun Nov 11 20:24:07 2018 +0200

Create new periodic event for pruning old info about Tor routers
---
 changes/bug27929 |  5 +
 src/core/mainloop/mainloop.c | 32 ++--
 2 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/changes/bug27929 b/changes/bug27929
new file mode 100644
index 0..a97d18f20
--- /dev/null
+++ b/changes/bug27929
@@ -0,0 +1,5 @@
+  o Minor bugfixes (periodic events):
+- Refrain from calling routerlist_remove_old_routers() from
+  check_descriptor_callback(). Instead, create a new periodic
+  event that will run every minute even if Tor is not configured
+  as onion router. Fixes bug 27929; bugfix on 0.2.8.1-alpha.
diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index a9f142978..be1913613 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -1359,6 +1359,7 @@ CALLBACK(heartbeat);
 CALLBACK(hs_service);
 CALLBACK(launch_descriptor_fetches);
 CALLBACK(launch_reachability_tests);
+CALLBACK(prune_old_routers);
 CALLBACK(reachability_warnings);
 CALLBACK(record_bridge_stats);
 CALLBACK(rend_cache_failure_clean);
@@ -1391,6 +1392,8 @@ STATIC periodic_event_item_t periodic_events[] = {
   CALLBACK(retry_listeners, PERIODIC_EVENT_ROLE_ALL,
PERIODIC_EVENT_FLAG_NEED_NET),
   CALLBACK(save_state, PERIODIC_EVENT_ROLE_ALL, 0),
+  CALLBACK(prune_old_routers, PERIODIC_EVENT_ROLE_ALL,
+   PERIODIC_EVENT_FLAG_NEED_NET),
   CALLBACK(rotate_x509_certificate, PERIODIC_EVENT_ROLE_ALL, 0),
   CALLBACK(write_stats_file, PERIODIC_EVENT_ROLE_ALL, 0),
 
@@ -1454,6 +1457,7 @@ static periodic_event_item_t 
*fetch_networkstatus_event=NULL;
 static periodic_event_item_t *launch_descriptor_fetches_event=NULL;
 static periodic_event_item_t *check_dns_honesty_event=NULL;
 static periodic_event_item_t *save_state_event=NULL;
+static periodic_event_item_t *prune_old_routers_event=NULL;
 
 /** Reset all the periodic events so we'll do all our actions again as if we
  * just started up.
@@ -1556,6 +1560,7 @@ initialize_periodic_events(void)
   STMT_BEGIN name ## _event = find_periodic_event( #name ); STMT_END
 
   NAMED_CALLBACK(check_descriptor);
+  NAMED_CALLBACK(prune_old_routers);
   NAMED_CALLBACK(dirvote);
   NAMED_CALLBACK(fetch_networkstatus);
   NAMED_CALLBACK(launch_descriptor_fetches);
@@ -2220,6 +2225,27 @@ retry_dns_callback(time_t now, const or_options_t 
*options)
   return RETRY_DNS_INTERVAL;
 }
 
+/**
+ * Periodic callback: prune routerlist of old information about Tor network.
+ */
+static int
+prune_old_routers_callback(time_t now, const or_options_t *options)
+{
+#define ROUTERLIST_PRUNING_INTERVAL (60) // 1 minute.
+  (void)now;
+  (void)options;
+
+  if (!net_is_disabled()) {
+/* If any networkstatus documents are no longer recent, we need to
+ * update all the descriptors' running status. */
+/* Remove dead routers. */
+log_debug(LD_GENERAL, "Pruning routerlist...");
+routerlist_remove_old_routers();
+  }
+
+  return ROUTERLIST_PRUNING_INTERVAL;
+}
+
 /** Periodic callback: consider rebuilding or and re-uploading our descriptor
  * (if we've passed our internal checks). */
 static int
@@ -2239,12 +2265,6 @@ check_descriptor_callback(time_t now, const or_options_t 
*options)
 check_descriptor_ipaddress_changed(now);
 mark_my_descriptor_dirty_if_too_old(now);
 consider_publishable_server(0);
-/* If any networkstatus documents are no longer recent, we need to
- * update all the descriptors' running status. */
-/* Remove dead routers. */
-/*  This doesn't belong here, but it was here in the pre-
- *  refactoring code. */
-routerlist_remove_old_routers();
   }
 
   return CHECK_DESCRIPTOR_INTERVAL;



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


[tor-commits] [translation/abouttor-homepage] Update translations for abouttor-homepage

2018-11-26 Thread translation
commit b84633947f6bbeb0c831b8a354a97deea7b67446
Author: Translation commit bot 
Date:   Mon Nov 26 22:15:04 2018 +

Update translations for abouttor-homepage
---
 es_AR/aboutTor.dtd | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/es_AR/aboutTor.dtd b/es_AR/aboutTor.dtd
index 4e129ea75..692f996f9 100644
--- a/es_AR/aboutTor.dtd
+++ b/es_AR/aboutTor.dtd
@@ -35,13 +35,13 @@
 
 
 
-
-
-
-
+
+
+
+
 
 
-
+
 
 
 

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


[tor-commits] [torspec/master] Correct spaces format

2018-11-26 Thread nickm
commit a5292eefbda6a1e93655bf89ab3ce27ce3cfb515
Author: juga0 
Date:   Thu Nov 8 08:09:52 2018 +

Correct spaces format
---
 bandwidth-file-spec.txt | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index ee02a88..3d95927 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -44,13 +44,13 @@
 
1.0.0 - The legacy fallback Bandwidth List format
 
-1.1.0 - Add a header containing information about the bandwidth file.
-Document the sbws and Torflow relay line keys.
+   1.1.0 - Add a header containing information about the bandwidth
+   file. Document the sbws and Torflow relay line keys.
 
1.2.0 - If there are not enough eligible relays, the bandwidth file
-   SHOULD contain a header, but no relays. (To match
-   Torflow's existing behaviour.) Adds new
-   KeyValue Lines to the Header List section with
+   SHOULD contain a header, but no relays. (To match Torflow's
+   existing behaviour.)
+   Adds new KeyValue Lines to the Header List section with
statistics about the number of relays included in the file.
Add new KeyValue Lines to the Relays' Bandwidth List section
with different bandwidth values.



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


[tor-commits] [torspec/master] Include variable used in pseudocode in step 1

2018-11-26 Thread nickm
commit 102f3727a65de1030eb26f4943437d42b8e37e37
Author: teor 
Date:   Wed Nov 7 17:30:29 2018 +

Include variable used in pseudocode in step 1

Co-Authored-By: juga0 
---
 bandwidth-file-spec.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index d8c27de..b5b400c 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -535,7 +535,7 @@ ones that this bandwidth authority has measured for the 
relays that
 would be included in the next bandwidth authority's upcoming vote.
 
 1. Calculate the filtered bandwidth for each relay:
-   - choose the relay's measurements that are equal or greater than the
+   - choose the relay's measurements (`bw_j`) that are equal or greater than 
the
  mean of the measurements for this relay
- calculate the mean of those measurements
 



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


[tor-commits] [torspec/master] Add torflow scaling section

2018-11-26 Thread nickm
commit 0f95e49d0b4d27b6b1a19141d72bcf4261372215
Author: juga0 
Date:   Thu Oct 25 15:41:29 2018 +

Add torflow scaling section

It explains in a different way section 2.2 in torflow's
README.spec.txt.
---
 bandwidth-file-spec.txt | 65 +
 1 file changed, 65 insertions(+)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 9a3f63f..8e84bdd 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -522,3 +522,68 @@ reduced or increased as needed. Smaller quotas decrease 
the size
 of uncompressed consensuses, and may decrease the size of
 consensus diffs and compressed consensuses. But if the relay
 quota is too small, some relays may be over- or under-weighted.
+
+B.4. Torflow aggreation
+
+Torflow implements two methods to compute the bandwidth values from the
+(stream) bandwidth measurements: with and without PID control feedback.
+The method described here is the later (see Torflow specification,
+section 2.2).
+
+In the following sections, the relays' measured bandwidth refer to the
+ones that this bandwidth authority has measured for the relays that
+would be included in the next bandwidth authority's upcoming vote.
+
+1. Calculate the filtered bandwidth for each relay:
+   - choose the relay's measurements that are equal or greater than the
+ mean of the measurements for this relay
+   - calculate the mean of those measurements
+
+   In pseudocode:
+
+  bw_filt_i = mean(max(mean(bw_j), bw_j))
+
+2. Calculate network averages:
+   - calculate the filtered average by dividing the sum of all the
+ relays' filtered bandwidth by the number of relays that have been
+ measured, ie, calculate the mean average of the relays' filtered
+ bandwidth.
+   - calculate the stream average by dividing the sum of all the
+ relays' filtered bandwidth by the number of relays that have been
+ measured, ie, calculate the mean average or the relays' measured
+ bandwidth.
+
+In pseudocode:
+
+  bw_avg_filt_ = bw_filt_i / n_filt
+  bw_avg_strm = bw_i / n
+
+3. Calculate ratios for each relay:
+   - calculate the filtered ratio by dividing each relay filtered bandwidth
+ by the filtered average
+   - calculate the stream ratio by dividing each relay measured bandwidth
+ by the stream average
+
+   In pseudocode:
+
+r_filt_i = bw_filt_i / bw_avg_filt
+r_strm_i = bw_avg_strm / bw_avg_strm
+
+4. Calculate the final ratio for each relay:
+   The final ratio is the larger between the filtered bandwidth and the
+   stream bandwidth.
+
+   In pseudocode:
+
+r_i = max(r_filt_i, r_strm_i)
+
+5. Calculate the scaled bandwidth for each relay:
+   The most recent descriptor observed bandwidth is multiplied by the ratio
+
+   In pseudocode:
+
+   bw_new_i = r_i * bw_obs_i
+
+   <>



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


[tor-commits] [torspec/master] Merge remote-tracking branch 'tor-github/pr/37'

2018-11-26 Thread nickm
commit 78fdde420a9a8bf2d6584cca6a4c557973743485
Merge: d41a32a a9138a0
Author: Nick Mathewson 
Date:   Mon Nov 26 16:52:40 2018 -0500

Merge remote-tracking branch 'tor-github/pr/37'

 bandwidth-file-spec.txt | 66 +
 1 file changed, 66 insertions(+)

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


[tor-commits] [torspec/master] Rephrase which torflow method is explained

2018-11-26 Thread nickm
commit c06bcce1fe6cfd0b43bf051a4bbe6c492b1620d5
Author: teor 
Date:   Wed Nov 7 17:26:54 2018 +

Rephrase which torflow method is explained

Co-Authored-By: juga0 
---
 bandwidth-file-spec.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 8e84bdd..d8c27de 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -527,7 +527,7 @@ B.4. Torflow aggreation
 
 Torflow implements two methods to compute the bandwidth values from the
 (stream) bandwidth measurements: with and without PID control feedback.
-The method described here is the later (see Torflow specification,
+The method described here is without PID control (see Torflow specification,
 section 2.2).
 
 In the following sections, the relays' measured bandwidth refer to the



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


[tor-commits] [torspec/master] Include bw_obs_i variable in step 5

2018-11-26 Thread nickm
commit 15d2c00685bc83deaa2422ab79771d2204e989c8
Author: teor 
Date:   Wed Nov 7 17:44:18 2018 +

Include bw_obs_i variable in step 5

Co-Authored-By: juga0 
---
 bandwidth-file-spec.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 120789a..50e7294 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -578,7 +578,7 @@ would be included in the next bandwidth authority's 
upcoming vote.
 r_i = max(r_filt_i, r_strm_i)
 
 5. Calculate the scaled bandwidth for each relay:
-   The most recent descriptor observed bandwidth is multiplied by the ratio
+   The most recent descriptor observed bandwidth (`bw_obs_i`) is multiplied by 
the ratio
 
In pseudocode:
 



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


[tor-commits] [torspec/master] Include variable n in step 2

2018-11-26 Thread nickm
commit 9f5b4a1debb6bf56c2ccc8539aa04b3585e27277
Author: teor 
Date:   Wed Nov 7 17:33:33 2018 +

Include variable n in step 2

Co-Authored-By: juga0 
---
 bandwidth-file-spec.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 784e92a..7073539 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -550,7 +550,7 @@ would be included in the next bandwidth authority's 
upcoming vote.
  bandwidth.
- calculate the stream average by dividing the sum of all the
  relays' filtered bandwidth by the number of relays that have been
- measured, ie, calculate the mean average or the relays' measured
+ measured (`n`), ie, calculate the mean average or the relays' measured
  bandwidth.
 
 In pseudocode:



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


[tor-commits] [torspec/master] Include n_filt in description in step 2

2018-11-26 Thread nickm
commit 111039d66a9fb8b560d3145c29f317a81cae8507
Author: teor 
Date:   Wed Nov 7 17:32:48 2018 +

Include n_filt in description in step 2

Co-Authored-By: juga0 
---
 bandwidth-file-spec.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index b5b400c..784e92a 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -546,7 +546,7 @@ would be included in the next bandwidth authority's 
upcoming vote.
 2. Calculate network averages:
- calculate the filtered average by dividing the sum of all the
  relays' filtered bandwidth by the number of relays that have been
- measured, ie, calculate the mean average of the relays' filtered
+ measured (`n_filt`), ie, calculate the mean average of the relays' 
filtered
  bandwidth.
- calculate the stream average by dividing the sum of all the
  relays' filtered bandwidth by the number of relays that have been



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


[tor-commits] [torspec/master] Correct n_filt by n in step 2

2018-11-26 Thread nickm
commit 45da870809210ba30330e5cffd876b83f443c76d
Author: juga0 
Date:   Wed Nov 7 18:00:32 2018 +

Correct n_filt by n in step 2

The number of relays does not change for a relay filtered bandwdith.
---
 bandwidth-file-spec.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 50e7294..87bdb7e 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -546,7 +546,7 @@ would be included in the next bandwidth authority's 
upcoming vote.
 2. Calculate network averages:
- calculate the filtered average by dividing the sum of all the
  relays' filtered bandwidth by the number of relays that have been
- measured (`n_filt`), ie, calculate the mean average of the relays' 
filtered
+ measured (`n`), ie, calculate the mean average of the relays' filtered
  bandwidth.
- calculate the stream average by dividing the sum of all the
  relays' filtered bandwidth by the number of relays that have been
@@ -555,7 +555,7 @@ would be included in the next bandwidth authority's 
upcoming vote.
 
 In pseudocode:
 
-  bw_avg_filt_ = bw_filt_i / n_filt
+  bw_avg_filt_ = bw_filt_i / n
   bw_avg_strm = bw_i / n
 
 3. Calculate ratios for each relay:



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


[tor-commits] [torspec/master] Format to maximum 72 characters per line

2018-11-26 Thread nickm
commit a9138a07b9bde7287ffddebbdf75f5a98029497c
Author: juga0 
Date:   Wed Nov 7 18:08:53 2018 +

Format to maximum 72 characters per line
---
 bandwidth-file-spec.txt | 33 +
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 87bdb7e..014dbe0 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -527,16 +527,16 @@ B.4. Torflow aggreation
 
 Torflow implements two methods to compute the bandwidth values from the
 (stream) bandwidth measurements: with and without PID control feedback.
-The method described here is without PID control (see Torflow specification,
-section 2.2).
+The method described here is without PID control (see Torflow
+specification, section 2.2).
 
 In the following sections, the relays' measured bandwidth refer to the
 ones that this bandwidth authority has measured for the relays that
 would be included in the next bandwidth authority's upcoming vote.
 
 1. Calculate the filtered bandwidth for each relay:
-   - choose the relay's measurements (`bw_j`) that are equal or greater than 
the
- mean of the measurements for this relay
+   - choose the relay's measurements (`bw_j`) that are equal or greater
+ than the mean of the measurements for this relay
- calculate the mean of those measurements
 
In pseudocode:
@@ -546,12 +546,12 @@ would be included in the next bandwidth authority's 
upcoming vote.
 2. Calculate network averages:
- calculate the filtered average by dividing the sum of all the
  relays' filtered bandwidth by the number of relays that have been
- measured (`n`), ie, calculate the mean average of the relays' filtered
- bandwidth.
+ measured (`n`), ie, calculate the mean average of the relays'
+ filtered bandwidth.
- calculate the stream average by dividing the sum of all the
  relays' filtered bandwidth by the number of relays that have been
- measured (`n`), ie, calculate the mean average or the relays' measured
- bandwidth.
+ measured (`n`), ie, calculate the mean average or the relays'
+ measured bandwidth.
 
 In pseudocode:
 
@@ -559,10 +559,10 @@ would be included in the next bandwidth authority's 
upcoming vote.
   bw_avg_strm = bw_i / n
 
 3. Calculate ratios for each relay:
-   - calculate the filtered ratio by dividing each relay filtered bandwidth
- by the filtered average
-   - calculate the stream ratio by dividing each relay measured bandwidth
- by the stream average
+   - calculate the filtered ratio by dividing each relay filtered
+ bandwidth by the filtered average
+   - calculate the stream ratio by dividing each relay measured
+ bandwidth by the stream average
 
In pseudocode:
 
@@ -578,12 +578,13 @@ would be included in the next bandwidth authority's 
upcoming vote.
 r_i = max(r_filt_i, r_strm_i)
 
 5. Calculate the scaled bandwidth for each relay:
-   The most recent descriptor observed bandwidth (`bw_obs_i`) is multiplied by 
the ratio
+   The most recent descriptor observed bandwidth (`bw_obs_i`) is
+   multiplied by the ratio
 
In pseudocode:
 
bw_new_i = r_i * bw_obs_i
 
-   <>
+   <>



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


[tor-commits] [torspec/master] Merge remote-tracking branch 'tor-github/pr/38'

2018-11-26 Thread nickm
commit d41a32ae35672aa19953b44d6d113ec357d0da8c
Merge: bab8a89 a5292ee
Author: Nick Mathewson 
Date:   Mon Nov 26 16:51:52 2018 -0500

Merge remote-tracking branch 'tor-github/pr/38'

 bandwidth-file-spec.txt | 140 ++--
 1 file changed, 135 insertions(+), 5 deletions(-)

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


[tor-commits] [torspec/master] Correct bandwidth variable in step 3

2018-11-26 Thread nickm
commit 35479626bfa8d13244521e2312f032e04700fd29
Author: teor 
Date:   Wed Nov 7 17:42:59 2018 +

Correct bandwidth variable in step 3

Co-Authored-By: juga0 
---
 bandwidth-file-spec.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 7073539..120789a 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -567,7 +567,7 @@ would be included in the next bandwidth authority's 
upcoming vote.
In pseudocode:
 
 r_filt_i = bw_filt_i / bw_avg_filt
-r_strm_i = bw_avg_strm / bw_avg_strm
+r_strm_i = bw_i / bw_avg_strm
 
 4. Calculate the final ratio for each relay:
The final ratio is the larger between the filtered bandwidth and the



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


[tor-commits] [torspec/master] Correct specification version in the examples

2018-11-26 Thread nickm
commit 3f3f225531c01febcbb9049b4676f831088e662f
Author: juga0 
Date:   Wed Nov 7 18:23:10 2018 +

Correct specification version in the examples

Also change sbws version in the examples by X and add TODO to
change that when it is implemented.
---
 bandwidth-file-spec.txt | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 8ab0493..0006952 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -563,12 +563,12 @@ earliest_bandwidth=2018-04-16T15:13:26
 bw=380 error_circ=0 error_misc=0 error_stream=1 
master_key_ed25519=YaqV4vbvPYKucElk297eVdNArDz9HtIwUoIeo0+cVIpQ nick=Test 
node_id=$68A483E05A2ABDCA6DA5A3EF8DB5177638A27F80 rtt=380 success=1 
time=2018-05-08T16:13:26
 bw=189 error_circ=0 error_misc=0 error_stream=0 
master_key_ed25519=a6a+dZadrQBtfSbmQkP7j2ardCmLnm5NJ4ZzkvDxbo0I nick=Test2 
node_id=$96C15995F30895689291F455587BD94CA427B6FC rtt=378 success=1 
time=2018-05-08T16:13:36
 
-A.3. Generated by sbws version 0.2.X
-
+A.3. Generated by sbws version 1.X.X
+[TODO: change the version of sbws that generates this when it is implemented]
 1523911758
-version=1.1.0
+version=1.2.0
 software=sbws
-software_version=0.1.0
+software_version=1.X.X
 latest_bandwidth=2018-04-16T20:49:18
 file_created=2018-04-16T21:49:18
 generator_started=2018-04-16T15:13:25
@@ -580,7 +580,7 @@ bw=1 bw_mean=199162 bw_median=185675 desc_avg_bw=409600 
desc_obs_bw_last=836165
 When there are not enough eligible measured relays:
 
 1540496079
-version=1.1.0
+version=1.2.0
 earliest_bandwidth=2018-10-20T19:35:52
 file_created=2018-10-25T19:35:03
 generator_started=2018-10-25T11:42:56
@@ -591,7 +591,7 @@ num_target_relays=3862
 perc_measured_relays=46
 perc_measured_targed=60
 software=sbws
-software_version=0.8.1-dev0
+software_version=1.X.X
 
 B. Scaling bandwidths
 



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


[tor-commits] [torspec/master] Explain better what is added in version 1.2.0

2018-11-26 Thread nickm
commit 1c4fbae4542e08a2b86f49556e4b71d8dfcc5dc1
Author: teor 
Date:   Thu Nov 8 07:49:02 2018 +

Explain better what is added in version 1.2.0

Co-Authored-By: juga0 
---
 bandwidth-file-spec.txt | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index f6c56fc..e7ee924 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -47,7 +47,10 @@
1.1.0 - Adds KeyValue Lines to the Header List section, add KeyValues
to RelayLines and format versions.
 
-   1.2.0 - Adds new KeyValue Lines to the Header List section with
+   1.2.0 - If there are not enough eligible relays, the bandwidth file
+   SHOULD contain a header, but no relays. (To match
+   Torflow's existing behaviour.) Adds new
+   KeyValue Lines to the Header List section with
statistics about the number of relays included in the file.
Add new KeyValue Lines to the Relays' Bandwidth List section
with different bandwidth values.



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


[tor-commits] [torspec/master] Explain better what is added in version 1.1.0

2018-11-26 Thread nickm
commit c45ca96db574ef04b5311ab75aaebecacd761ea8
Author: teor 
Date:   Thu Nov 8 07:49:39 2018 +

Explain better what is added in version 1.1.0

Co-Authored-By: juga0 
---
 bandwidth-file-spec.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index e7ee924..8aa3b7b 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -44,7 +44,8 @@
 
1.0.0 - The legacy fallback Bandwidth List format
 
-   1.1.0 - Adds KeyValue Lines to the Header List section, add KeyValues
+1.1.0 - Add a header containing information about the bandwidth file.
+Document the sbws and Torflow relay line keys.
to RelayLines and format versions.
 
1.2.0 - If there are not enough eligible relays, the bandwidth file



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


[tor-commits] [torspec/master] Correct header keyvalue names in examples

2018-11-26 Thread nickm
commit 36837f8a854d46fb09a9830675f90ce034376b7b
Author: juga0 
Date:   Thu Nov 8 08:01:31 2018 +

Correct header keyvalue names in examples

And reorder them in the way sbws does.
---
 bandwidth-file-spec.txt | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 8f54ab3..ee02a88 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -574,11 +574,11 @@ latest_bandwidth=2018-04-16T20:49:18
 file_created=2018-04-16T21:49:18
 generator_started=2018-04-16T15:13:25
 earliest_bandwidth=2018-04-16T15:13:26
-num_measured_relays=6000
-num_net_relays=6436
-num_target_relays=3862
-perc_measured_relays=93
-perc_measured_targed=60
+minimum_number_eligible_relays=3862
+minimum_percent_eligible_relays=60
+number_consensus_relays=6436
+number_eligible_relays=6000
+percent_eligible_relays=93
 software=sbws
 software_version=1.X.X
 [TODO: change the version of sbws that generates this when it is implemented]
@@ -594,11 +594,11 @@ earliest_bandwidth=2018-10-20T19:35:52
 file_created=2018-10-25T19:35:03
 generator_started=2018-10-25T11:42:56
 latest_bandwidth=2018-10-25T19:34:39
-num_measured_relays=2960
-num_net_relays=6436
-num_target_relays=3862
-perc_measured_relays=46
-perc_measured_targed=60
+minimum_number_eligible_relays=3862
+minimum_percent_eligible_relays=60
+number_consensus_relays=6436
+number_eligible_relays=2960
+percent_eligible_relays=46
 software=sbws
 software_version=1.X.X
 [TODO: change the version of sbws that generates this when it is implemented]



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


[tor-commits] [torspec/master] Add TODO in the software_version in the examples

2018-11-26 Thread nickm
commit a5df39806e846e438c7f536df7de9747ee9d2c44
Author: juga0 
Date:   Thu Nov 8 07:52:43 2018 +

Add TODO in the software_version in the examples
---
 bandwidth-file-spec.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 4a9cdd9..8f54ab3 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -581,6 +581,7 @@ perc_measured_relays=93
 perc_measured_targed=60
 software=sbws
 software_version=1.X.X
+[TODO: change the version of sbws that generates this when it is implemented]
 =
 bw=38000 bw_mean=1127824 bw_median=1180062 desc_avg_bw=1073741824 
desc_obs_bw_last=17230879 desc_obs_bw_mean=14732306 error_circ=0 error_misc=0 
error_stream=1 master_key_ed25519=YaqV4vbvPYKucElk297eVdNArDz9HtIwUoIeo0+cVIpQ 
nick=Test node_id=$68A483E05A2ABDCA6DA5A3EF8DB5177638A27F80 rtt=380 success=1 
time=2018-05-08T16:13:26
 bw=1 bw_mean=199162 bw_median=185675 desc_avg_bw=409600 
desc_obs_bw_last=836165 desc_obs_bw_mean=858030 error_circ=0 error_misc=0 
error_stream=0 master_key_ed25519=a6a+dZadrQBtfSbmQkP7j2ardCmLnm5NJ4ZzkvDxbo0I 
nick=Test2 node_id=$96C15995F30895689291F455587BD94CA427B6FC rtt=378 success=1 
time=2018-05-08T16:13:36
@@ -600,6 +601,7 @@ perc_measured_relays=46
 perc_measured_targed=60
 software=sbws
 software_version=1.X.X
+[TODO: change the version of sbws that generates this when it is implemented]
 =
 
 B. Scaling bandwidths



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


[tor-commits] [torspec/master] Correct sbws version in example

2018-11-26 Thread nickm
commit 10fd6a98b848552cecc8d5c92152d0ee81d363b2
Author: teor 
Date:   Thu Nov 8 07:41:48 2018 +

Correct sbws version in example

Co-Authored-By: juga0 
---
 bandwidth-file-spec.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index d082a7e..fd497e5 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -549,7 +549,7 @@ This an example version 1.0.0 document:
 node_id=$68A483E05A2ABDCA6DA5A3EF8DB5177638A27F80 bw=760 nick=Test 
measured_at=1523911725 updated_at=1523911725 pid_error=4.11374090719 
pid_error_sum=4.11374090719 pid_bw=57136645 pid_delta=2.12168374577 
circ_fail=0.2 scanner=/filepath
 node_id=$96C15995F30895689291F455587BD94CA427B6FC bw=189 nick=Test2 
measured_at=1523911623 updated_at=1523911623 pid_error=3.96703337994 
pid_error_sum=3.96703337994 pid_bw=47422125 pid_delta=2.65469736988 
circ_fail=0.0 scanner=/filepath
 
-A.2. Generated by sbws version 0.1.X
+A.2. Generated by sbws version 0.1.0
 
 1523911758
 version=1.1.0



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


[tor-commits] [torspec/master] Add later to the version Tor can consume

2018-11-26 Thread nickm
commit 9c91c8376959377330f415cb27654af37e519455
Author: teor 
Date:   Thu Nov 8 07:48:19 2018 +

Add later to the version Tor can consume

Co-Authored-By: juga0 
---
 bandwidth-file-spec.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index fd497e5..f6c56fc 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -53,7 +53,7 @@
with different bandwidth values.
 
   All Tor versions can consume format version 1.0.0.
-  All Tor versions can consume format version 1.1.0,
+  All Tor versions can consume format version 1.1.0 and later,
   but they warn on additional header Lines.
   [TODO: this might be fixed, and if it is fixed should be said which
   version of Tor]



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


[tor-commits] [torspec/master] Remove line about RelayLines in version 1.1.0

2018-11-26 Thread nickm
commit 12e3f52446464cfb8660be9d109e33159a1a6871
Author: teor 
Date:   Thu Nov 8 07:51:18 2018 +

Remove line about RelayLines in version 1.1.0

Co-Authored-By: juga0 
---
 bandwidth-file-spec.txt | 1 -
 1 file changed, 1 deletion(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 8aa3b7b..4a9cdd9 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -46,7 +46,6 @@
 
 1.1.0 - Add a header containing information about the bandwidth file.
 Document the sbws and Torflow relay line keys.
-   to RelayLines and format versions.
 
1.2.0 - If there are not enough eligible relays, the bandwidth file
SHOULD contain a header, but no relays. (To match



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


[tor-commits] [torspec/master] Remove sentence about including headers but no lines

2018-11-26 Thread nickm
commit addf056f201561f1d967be45279c27f602b1eb2c
Author: juga0 
Date:   Wed Nov 7 16:37:32 2018 +

Remove sentence about including headers but no lines

When the are not enough eligible relays, since it's already
mentioned in one of the KeyValues.
---
 bandwidth-file-spec.txt | 20 
 1 file changed, 20 deletions(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 84429b8..6afc0a8 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -215,10 +215,6 @@ It consists of:
 The number of relays that have enough measurements to be
 included in the bandwidth file.
 
-Implementations SHOULD include this KeyValue when
-"minimum_percent_eligible_relays" is minor than
-"percent_eligible_relays" and MAY not include any RelayLine.
-
 This Line has been added in version 1.2.0 of this specification.
 
   "minimum_percent_eligible_relays=" Int NL
@@ -233,10 +229,6 @@ It consists of:
 The minimum percentage is 60% in Torflow, so sbws uses
 60% as the default.
 
-Implementations SHOULD include this KeyValue when
-"minimum_percent_eligible_relays" is minor than
-"percent_eligible_relays" and MAY not include any RelayLine.
-
 This Line has been added in version 1.2.0 of this specification.
 
   "number_consensus_relays=" Int NL
@@ -245,10 +237,6 @@ It consists of:
 
 The number of relays in the consensus.
 
-Implementations SHOULD include this KeyValue when
-"minimum_percent_eligible_relays" is minor than
-"percent_eligible_relays" and MAY not include any RelayLine.
-
 This Line has been added in version 1.2.0 of this specification.
 
   "percent_eligible_relays=" Int NL
@@ -262,10 +250,6 @@ It consists of:
 (number_eligible_relays * 100.0) / number_consensus_relays
 to the number of relays in the consensus to include in this file.
 
-Implementations SHOULD include this KeyValue when
-"minimum_percent_eligible_relays" is minor than
-"percent_eligible_relays" and MAY not include any RelayLine.
-
 This Line has been added in version 1.2.0 of this specification.
 
   "minimum_number_eligible_relays=" Int NL
@@ -277,10 +261,6 @@ It consists of:
 This line SHOULD be equal to:
 number_consensus_relays * (minimum_percent_eligible_relays / 100.0)
 
-Implementations SHOULD include this KeyValue when
-"minimum_percent_eligible_relays" is minor than
-"percent_eligible_relays" and MAY not include any RelayLine.
-
 This Line has been added in version 1.2.0 of this specification.
 
   KeyValue NL



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


[tor-commits] [torspec/master] Include definition of minimum_percent_eligible_relays

2018-11-26 Thread nickm
commit 3c69441436f176c55a919928b825664c65f5b128
Author: teor 
Date:   Wed Nov 7 13:50:42 2018 +

Include definition of minimum_percent_eligible_relays

Change made by teor.

Co-Authored-By: juga0 
---
 bandwidth-file-spec.txt | 8 
 1 file changed, 8 insertions(+)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 910b904..c57b480 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -266,6 +266,14 @@ It consists of:
 
 [Zero or one time.]
 
+The percentage of relays in the consensus that SHOULD be
+included in every generated bandwidth file.  If there are not
+enough eligible relays, the bandwidth file SHOULD contain a
+header, but no relays.
+
+The minimum percentage is 60% in Torflow, so sbws uses
+60% as the default.
+
 Implementations SHOULD include this KeyValue when
 "minimum_percent_eligible_relays" is minor than
 "percent_eligible_relays" and MAY not include any RelayLine.



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


[tor-commits] [torspec/master] Change order of KeyValues

2018-11-26 Thread nickm
commit 6eddf6d1d53b41e4efae35c877e0c3dc0897a407
Author: juga0 
Date:   Wed Nov 7 16:30:40 2018 +

Change order of KeyValues

As suggested by teor
---
 bandwidth-file-spec.txt | 46 +++---
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 62bee23..84429b8 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -208,16 +208,12 @@ It consists of:
 
 This Line has been added in version 1.1.0 of this specification.
 
-  "percent_eligible_relays=" Int NL
+  "number_eligible_relays=" Int NL
 
 [Zero or one time.]
 
-The number of eligible relays, as a percentage of the number
-of relays in the consensus.
-
-This line SHOULD be equal to:
-(number_eligible_relays * 100.0) / number_consensus_relays
-to the number of relays in the consensus to include in this file.
+The number of relays that have enough measurements to be
+included in the bandwidth file.
 
 Implementations SHOULD include this KeyValue when
 "minimum_percent_eligible_relays" is minor than
@@ -225,14 +221,17 @@ It consists of:
 
 This Line has been added in version 1.2.0 of this specification.
 
-  "minimum_number_eligible_relays=" Int NL
+  "minimum_percent_eligible_relays=" Int NL
 
 [Zero or one time.]
 
-The minimum number of relays to include in the bandwidth file.
+The percentage of relays in the consensus that SHOULD be
+included in every generated bandwidth file.  If there are not
+enough eligible relays, the bandwidth file SHOULD contain a
+header, but no relays.
 
-This line SHOULD be equal to:
-number_consensus_relays * (minimum_percent_eligible_relays / 100.0)
+The minimum percentage is 60% in Torflow, so sbws uses
+60% as the default.
 
 Implementations SHOULD include this KeyValue when
 "minimum_percent_eligible_relays" is minor than
@@ -252,12 +251,16 @@ It consists of:
 
 This Line has been added in version 1.2.0 of this specification.
 
-  "number_eligible_relays=" Int NL
+  "percent_eligible_relays=" Int NL
 
 [Zero or one time.]
 
-The number of relays that have enough measurements to be
-included in the bandwidth file.
+The number of eligible relays, as a percentage of the number
+of relays in the consensus.
+
+This line SHOULD be equal to:
+(number_eligible_relays * 100.0) / number_consensus_relays
+to the number of relays in the consensus to include in this file.
 
 Implementations SHOULD include this KeyValue when
 "minimum_percent_eligible_relays" is minor than
@@ -265,18 +268,15 @@ It consists of:
 
 This Line has been added in version 1.2.0 of this specification.
 
-  "minimum_percent_eligible_relays=" Int NL
+  "minimum_number_eligible_relays=" Int NL
 
 [Zero or one time.]
 
-The percentage of relays in the consensus that SHOULD be
-included in every generated bandwidth file.  If there are not
-enough eligible relays, the bandwidth file SHOULD contain a
-header, but no relays.
-
-The minimum percentage is 60% in Torflow, so sbws uses
-60% as the default.
-
+The minimum number of relays to include in the bandwidth file.
+
+This line SHOULD be equal to:
+number_consensus_relays * (minimum_percent_eligible_relays / 100.0)
+
 Implementations SHOULD include this KeyValue when
 "minimum_percent_eligible_relays" is minor than
 "percent_eligible_relays" and MAY not include any RelayLine.



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


[tor-commits] [torspec/master] Add new version (1.2) in Format Versions

2018-11-26 Thread nickm
commit d86cea62c2ca8db814794c434e7e4b70bc07f2b7
Author: juga0 
Date:   Wed Nov 7 16:47:24 2018 +

Add new version (1.2) in Format Versions
---
 bandwidth-file-spec.txt | 5 +
 1 file changed, 5 insertions(+)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 6afc0a8..8ab0493 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -47,6 +47,11 @@
1.1.0 - Adds KeyValue Lines to the Header List section, add KeyValues
to RelayLines and format versions.
 
+   1.2.0 - Adds new KeyValue Lines to the Header List section with
+   statistics about the number of relays included in the file.
+   Add new KeyValue Lines to the Relays' Bandwidth List section
+   with different bandwidth values.
+
   All Tor versions can consume format version 1.0.0.
   All Tor versions can consume format version 1.1.0,
   but they warn on additional header Lines.



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


[tor-commits] [torspec/master] Remove duplicated line

2018-11-26 Thread nickm
commit 958df7bc3c521e691e432a3aa5a810a42010dda4
Author: teor 
Date:   Wed Nov 7 15:47:43 2018 +

Remove duplicated line

Co-Authored-By: juga0 
---
 bandwidth-file-spec.txt | 1 -
 1 file changed, 1 deletion(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 5403311..62bee23 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -258,7 +258,6 @@ It consists of:
 
 The number of relays that have enough measurements to be
 included in the bandwidth file.
-include in the bandwidth file.
 
 Implementations SHOULD include this KeyValue when
 "minimum_percent_eligible_relays" is minor than



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


[tor-commits] [torspec/master] Correct number of characters in terminator

2018-11-26 Thread nickm
commit 4805cae3b910ce9050556d0df4d79009b9b3d567
Author: teor 
Date:   Thu Nov 8 07:39:37 2018 +

Correct number of characters in terminator

Co-Authored-By: juga0 
---
 bandwidth-file-spec.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 0cc7b81..f7138f7 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -578,7 +578,7 @@ perc_measured_relays=93
 perc_measured_targed=60
 software=sbws
 software_version=1.X.X
-
+=
 bw=38000 bw_mean=1127824 bw_median=1180062 desc_avg_bw=1073741824 
desc_obs_bw_last=17230879 desc_obs_bw_mean=14732306 error_circ=0 error_misc=0 
error_stream=1 master_key_ed25519=YaqV4vbvPYKucElk297eVdNArDz9HtIwUoIeo0+cVIpQ 
nick=Test node_id=$68A483E05A2ABDCA6DA5A3EF8DB5177638A27F80 rtt=380 success=1 
time=2018-05-08T16:13:26
 bw=1 bw_mean=199162 bw_median=185675 desc_avg_bw=409600 
desc_obs_bw_last=836165 desc_obs_bw_mean=858030 error_circ=0 error_misc=0 
error_stream=0 master_key_ed25519=a6a+dZadrQBtfSbmQkP7j2ardCmLnm5NJ4ZzkvDxbo0I 
nick=Test2 node_id=$96C15995F30895689291F455587BD94CA427B6FC rtt=378 success=1 
time=2018-05-08T16:13:36
 



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


[tor-commits] [torspec/master] Include v1.2 headers in example with relays

2018-11-26 Thread nickm
commit 9afc14ba50060642bce91649350ff2cd4bf0fee9
Author: juga0 
Date:   Wed Nov 7 18:27:15 2018 +

Include v1.2 headers in example with relays
---
 bandwidth-file-spec.txt | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 0006952..0cc7b81 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -567,12 +567,17 @@ A.3. Generated by sbws version 1.X.X
 [TODO: change the version of sbws that generates this when it is implemented]
 1523911758
 version=1.2.0
-software=sbws
-software_version=1.X.X
 latest_bandwidth=2018-04-16T20:49:18
 file_created=2018-04-16T21:49:18
 generator_started=2018-04-16T15:13:25
 earliest_bandwidth=2018-04-16T15:13:26
+num_measured_relays=6000
+num_net_relays=6436
+num_target_relays=3862
+perc_measured_relays=93
+perc_measured_targed=60
+software=sbws
+software_version=1.X.X
 
 bw=38000 bw_mean=1127824 bw_median=1180062 desc_avg_bw=1073741824 
desc_obs_bw_last=17230879 desc_obs_bw_mean=14732306 error_circ=0 error_misc=0 
error_stream=1 master_key_ed25519=YaqV4vbvPYKucElk297eVdNArDz9HtIwUoIeo0+cVIpQ 
nick=Test node_id=$68A483E05A2ABDCA6DA5A3EF8DB5177638A27F80 rtt=380 success=1 
time=2018-05-08T16:13:26
 bw=1 bw_mean=199162 bw_median=185675 desc_avg_bw=409600 
desc_obs_bw_last=836165 desc_obs_bw_mean=858030 error_circ=0 error_misc=0 
error_stream=0 master_key_ed25519=a6a+dZadrQBtfSbmQkP7j2ardCmLnm5NJ4ZzkvDxbo0I 
nick=Test2 node_id=$96C15995F30895689291F455587BD94CA427B6FC rtt=378 success=1 
time=2018-05-08T16:13:36



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


[tor-commits] [torspec/master] Include terminator in examples without RelayLines

2018-11-26 Thread nickm
commit 40d380753250987500ea8a0b0f05575de6284836
Author: teor 
Date:   Thu Nov 8 07:41:04 2018 +

Include terminator in examples without RelayLines

Co-Authored-By: juga0 
---
 bandwidth-file-spec.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index f7138f7..d082a7e 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -597,6 +597,7 @@ perc_measured_relays=46
 perc_measured_targed=60
 software=sbws
 software_version=1.X.X
+=
 
 B. Scaling bandwidths
 



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


[tor-commits] [torspec/master] Include calculations for minimum_number_eligible_relays

2018-11-26 Thread nickm
commit b77eb0995defdf92eac9166d8d2e1c12bf0d0a50
Author: teor 
Date:   Wed Nov 7 13:53:17 2018 +

Include calculations for minimum_number_eligible_relays

Co-Authored-By: juga0 
---
 bandwidth-file-spec.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index c57b480..bf77187 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -231,6 +231,9 @@ It consists of:
 
 The minimum number of relays to include in the bandwidth file.
 
+This line SHOULD be equal to:
+number_consensus_relays * (minimum_percent_eligible_relays / 100.0)
+
 Implementations SHOULD include this KeyValue when
 "minimum_percent_eligible_relays" is minor than
 "percent_eligible_relays" and MAY not include any RelayLine.



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


[tor-commits] [torspec/master] Add new header KeyValues

2018-11-26 Thread nickm
commit a955a35f05cb37bd152e9ab59ff2d93af43b2eba
Author: juga0 
Date:   Fri Oct 26 12:52:23 2018 +

Add new header KeyValues
---
 bandwidth-file-spec.txt | 60 +
 1 file changed, 60 insertions(+)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 9a3f63f..cfa2ab9 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -208,6 +208,66 @@ It consists of:
 
 This Line has been added in version 1.1.0 of this specification.
 
+  "percent_eligible_relays=" Int NL
+
+[Zero or one time.]
+
+The minimum percentage of eligible measured relays with respect
+to the number of relays in the consensus to include in this file.
+
+Implementations SHOULD include this KeyValue when
+"minimum_percent_eligible_relays" is minor than
+"percent_eligible_relays" and MAY not include any RelayLine.
+
+This Line has been added in version 1.2.0 of this specification.
+
+  "minimum_number_eligible_relays=" Int NL
+
+[Zero or one time.]
+
+The minimum number of relays to include in the bandwidth file.
+
+Implementations SHOULD include this KeyValue when
+"minimum_percent_eligible_relays" is minor than
+"percent_eligible_relays" and MAY not include any RelayLine.
+
+This Line has been added in version 1.2.0 of this specification.
+
+  "number_consensus_relays=" Int NL
+
+[Zero or one time.]
+
+The number of relays in the consensus.
+
+Implementations SHOULD include this KeyValue when
+"minimum_percent_eligible_relays" is minor than
+"percent_eligible_relays" and MAY not include any RelayLine.
+
+This Line has been added in version 1.2.0 of this specification.
+
+  "number_eligible_relays=" Int NL
+
+[Zero or one time.]
+
+The number of relays that has been measured and are eligible to
+include in the bandwidth file.
+
+Implementations SHOULD include this KeyValue when
+"minimum_percent_eligible_relays" is minor than
+"percent_eligible_relays" and MAY not include any RelayLine.
+
+This Line has been added in version 1.2.0 of this specification.
+
+  "minimum_percent_eligible_relays=" Int NL
+
+[Zero or one time.]
+
+Implementations SHOULD include this KeyValue when
+"minimum_percent_eligible_relays" is minor than
+"percent_eligible_relays" and MAY not include any RelayLine.
+
+This Line has been added in version 1.2.0 of this specification.
+
   KeyValue NL
 
 [Zero or more times.]



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


[tor-commits] [torspec/master] Add KeyValues in sbws section

2018-11-26 Thread nickm
commit 41bd88c03d3e71789771fde0029e62f11f696b20
Author: juga0 
Date:   Fri Oct 26 12:52:46 2018 +

Add KeyValues in sbws section
---
 bandwidth-file-spec.txt | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index cfa2ab9..107c58a 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -495,6 +495,36 @@ Every RelayLine in sbws version 0.1.0 consists of:
 The number of times that the bandwidth measurements for this relay
 failed because of other reasons.
 
+  "bw_mean=" Int NL
+
+[Zero or one time.]
+
+The measured bandwidth mean for this relay.
+
+  "bw_median=" Int NL
+
+[Zero or one time.]
+
+The measured bandwidth median for this relay.
+
+  "desc_bw_average=" Int NL
+
+[Zero or one time.]
+
+The descriptor average bandwidth for this relay.
+
+  "desc_bw_obs_last=" Int NL
+
+[Zero or one time.]
+
+The last descriptor observed bandwidth for this relay.
+
+  "desc_bw_obs_mean=" Int NL
+
+[Zero or one time.]
+
+The descriptor observed bandwidth mean for this relay.
+
 2.4.2.2. Torflow
 
 Torflow RelayLines include node_id and bw, and other KeyValue pairs [2].



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


[tor-commits] [torspec/master] Add sbws example generating 1.2.X version

2018-11-26 Thread nickm
commit 4d7114ddb266c0fa3bf9807f2a4050367b7151d3
Author: juga0 
Date:   Fri Oct 26 13:07:10 2018 +

Add sbws example generating 1.2.X version
---
 bandwidth-file-spec.txt | 31 ++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index 107c58a..bcccd7a 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -550,7 +550,6 @@ node_id=$68A483E05A2ABDCA6DA5A3EF8DB5177638A27F80 bw=760 
nick=Test measured_at=1
 node_id=$96C15995F30895689291F455587BD94CA427B6FC bw=189 nick=Test2 
measured_at=1523911623 updated_at=1523911623 pid_error=3.96703337994 
pid_error_sum=3.96703337994 pid_bw=47422125 pid_delta=2.65469736988 
circ_fail=0.0 scanner=/filepath
 
 A.2. Generated by sbws version 0.1.X
-[TODO: this needs to be implemented when this spec is finished]
 
 1523911758
 version=1.1.0
@@ -564,6 +563,36 @@ earliest_bandwidth=2018-04-16T15:13:26
 bw=380 error_circ=0 error_misc=0 error_stream=1 
master_key_ed25519=YaqV4vbvPYKucElk297eVdNArDz9HtIwUoIeo0+cVIpQ nick=Test 
node_id=$68A483E05A2ABDCA6DA5A3EF8DB5177638A27F80 rtt=380 success=1 
time=2018-05-08T16:13:26
 bw=189 error_circ=0 error_misc=0 error_stream=0 
master_key_ed25519=a6a+dZadrQBtfSbmQkP7j2ardCmLnm5NJ4ZzkvDxbo0I nick=Test2 
node_id=$96C15995F30895689291F455587BD94CA427B6FC rtt=378 success=1 
time=2018-05-08T16:13:36
 
+A.3. Generated by sbws version 0.2.X
+
+1523911758
+version=1.1.0
+software=sbws
+software_version=0.1.0
+latest_bandwidth=2018-04-16T20:49:18
+file_created=2018-04-16T21:49:18
+generator_started=2018-04-16T15:13:25
+earliest_bandwidth=2018-04-16T15:13:26
+
+bw=38000 bw_mean=1127824 bw_median=1180062 desc_avg_bw=1073741824 
desc_obs_bw_last=17230879 desc_obs_bw_mean=14732306 error_circ=0 error_misc=0 
error_stream=1 master_key_ed25519=YaqV4vbvPYKucElk297eVdNArDz9HtIwUoIeo0+cVIpQ 
nick=Test node_id=$68A483E05A2ABDCA6DA5A3EF8DB5177638A27F80 rtt=380 success=1 
time=2018-05-08T16:13:26
+bw=1 bw_mean=199162 bw_median=185675 desc_avg_bw=409600 
desc_obs_bw_last=836165 desc_obs_bw_mean=858030 error_circ=0 error_misc=0 
error_stream=0 master_key_ed25519=a6a+dZadrQBtfSbmQkP7j2ardCmLnm5NJ4ZzkvDxbo0I 
nick=Test2 node_id=$96C15995F30895689291F455587BD94CA427B6FC rtt=378 success=1 
time=2018-05-08T16:13:36
+
+When there are not enough eligible measured relays:
+
+1540496079
+version=1.1.0
+earliest_bandwidth=2018-10-20T19:35:52
+file_created=2018-10-25T19:35:03
+generator_started=2018-10-25T11:42:56
+latest_bandwidth=2018-10-25T19:34:39
+num_measured_relays=2960
+num_net_relays=6436
+num_target_relays=3862
+perc_measured_relays=46
+perc_measured_targed=60
+software=sbws
+software_version=0.8.1-dev0
+
 B. Scaling bandwidths
 
 B.1. Scaling requirements



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


[tor-commits] [torspec/master] Rephrase definition of number_eligible_relays

2018-11-26 Thread nickm
commit 6b1ccb00e66eec8235ed238bcadea50601c20bb3
Author: teor 
Date:   Wed Nov 7 13:54:16 2018 +

Rephrase definition of number_eligible_relays

Co-Authored-By: juga0 
---
 bandwidth-file-spec.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index bf77187..5403311 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -256,7 +256,8 @@ It consists of:
 
 [Zero or one time.]
 
-The number of relays that has been measured and are eligible to
+The number of relays that have enough measurements to be
+included in the bandwidth file.
 include in the bandwidth file.
 
 Implementations SHOULD include this KeyValue when



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


[tor-commits] [torspec/master] Rephrase percent_eligible_relays and add calculation

2018-11-26 Thread nickm
commit 964937e145fbc6de901fa949b383a3b53b5d62f2
Author: teor 
Date:   Wed Nov 7 13:47:31 2018 +

Rephrase percent_eligible_relays and add calculation

As suggested by teor.

Co-Authored-By: juga0 
---
 bandwidth-file-spec.txt | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bandwidth-file-spec.txt b/bandwidth-file-spec.txt
index bcccd7a..910b904 100644
--- a/bandwidth-file-spec.txt
+++ b/bandwidth-file-spec.txt
@@ -212,7 +212,11 @@ It consists of:
 
 [Zero or one time.]
 
-The minimum percentage of eligible measured relays with respect
+The number of eligible relays, as a percentage of the number
+of relays in the consensus.
+
+This line SHOULD be equal to:
+(number_eligible_relays * 100.0) / number_consensus_relays
 to the number of relays in the consensus to include in this file.
 
 Implementations SHOULD include this KeyValue when



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


[tor-commits] [torspec/master] Merge remote-tracking branch 'tor-github/pr/43'

2018-11-26 Thread nickm
commit bab8a89223eebd28445aa3c4c9e41370b891b8c2
Merge: 4421149 2decb3e
Author: Nick Mathewson 
Date:   Mon Nov 26 16:50:47 2018 -0500

Merge remote-tracking branch 'tor-github/pr/43'

 dir-spec.txt | 18 --
 1 file changed, 18 deletions(-)

diff --cc dir-spec.txt
index 3058180,7312dd2..a6547ce
--- a/dir-spec.txt
+++ b/dir-spec.txt
@@@ -2105,44 -2105,8 +2105,26 @@@
  If an authority is configured with a V3BandwidthsFile, but parsing
  fails, this line SHOULD appear in its vote, but without any headers.
  
- Current Keywords:
- "timestamp" -- the Unix Epoch time in seconds of the most recent
- generator result.
- "version" -- the Bandwidth List format document specification version.
- "software" -- the name of the software that created the document.
- "software_version" -- the version of the software that created the
- document.
- "file_created" -- the date and time timestamp in ISO 8601 format
- and UTC time zone when the file was created.
- "generator_started" -- the date and time timestamp in ISO 8601 format
- and UTC time zone when the generator started.
- "earliest_bandwidth" -- the date and time timestamp in ISO 8601 format
- and UTC time zone when the first relay bandwidth was obtained.
- "latest_bandwidth" -- the date and time timestamp in ISO 8601 format
- and UTC time zone of the most recent generator result.
- This time MUST be identical to the initial Timestamp line.
- This duplicate value is included to make the format easier for people
- to read.
  First-appeared: Tor 0.3.5.1-alpha.
  
 +"bandwidth-file-digest" 1*(SP algorithm "=" digest) NL
 +
 +[At most once for votes; does not occur in consensuses.]
 +
 +A digest of the bandwidth file used to generate this vote.
 +"algorithm" is the name of the hash algorithm producing "digest",
 +which can be "sha256" or another algorithm.  "digest" is the
 +base64 encoding of the hash of the bandwidth file, with trailing =s
 +omitted.
 +
 +If an authority is not configured with a V3BandwidthsFile, this line
 +SHOULD NOT appear in its vote.
 +
 +If an authority is configured with a V3BandwidthsFile, but parsing
 +fails, this line SHOULD appear in its vote, with the digest(s) of the
 +unparseable file.
 +First-appeared: Tor 0.4.0.1-alpha
 +
 The authority section of a vote contains the following items, followed
 in turn by the authority's current key certificate:
  

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


[tor-commits] [torspec/master] dir-spec: remove Keywords in bandwidth-file-headers

2018-11-26 Thread nickm
commit 2decb3ea271dd316bbe1dab3b3c51667252bea85
Author: juga0 
Date:   Sun Nov 11 08:33:27 2018 +

dir-spec: remove Keywords in bandwidth-file-headers

Remove the header's Keywords in the bandwidth-file-headers item,
since they are described in bandwidth-file-spec.txt and we should
not need to update two specifications every time they change.
---
 dir-spec.txt | 18 --
 1 file changed, 18 deletions(-)

diff --git a/dir-spec.txt b/dir-spec.txt
index 8da28c4..7312dd2 100644
--- a/dir-spec.txt
+++ b/dir-spec.txt
@@ -2105,24 +2105,6 @@
 If an authority is configured with a V3BandwidthsFile, but parsing
 fails, this line SHOULD appear in its vote, but without any headers.
 
-Current Keywords:
-"timestamp" -- the Unix Epoch time in seconds of the most recent
-generator result.
-"version" -- the Bandwidth List format document specification version.
-"software" -- the name of the software that created the document.
-"software_version" -- the version of the software that created the
-document.
-"file_created" -- the date and time timestamp in ISO 8601 format
-and UTC time zone when the file was created.
-"generator_started" -- the date and time timestamp in ISO 8601 format
-and UTC time zone when the generator started.
-"earliest_bandwidth" -- the date and time timestamp in ISO 8601 format
-and UTC time zone when the first relay bandwidth was obtained.
-"latest_bandwidth" -- the date and time timestamp in ISO 8601 format
-and UTC time zone of the most recent generator result.
-This time MUST be identical to the initial Timestamp line.
-This duplicate value is included to make the format easier for people
-to read.
 First-appeared: Tor 0.3.5.1-alpha.
 
The authority section of a vote contains the following items, followed



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


[tor-commits] [torspec/master] Describe SIGNAL ACTIVE and SIGNAL DORMANT.

2018-11-26 Thread nickm
commit 4421149986369b4f746fc02a5d78c7337fe5d4ea
Author: Nick Mathewson 
Date:   Mon Nov 19 16:41:19 2018 -0500

Describe SIGNAL ACTIVE and SIGNAL DORMANT.
---
 control-spec.txt | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/control-spec.txt b/control-spec.txt
index 6a04b65..ae4a417 100644
--- a/control-spec.txt
+++ b/control-spec.txt
@@ -430,7 +430,7 @@
 
  Signal = "RELOAD" / "SHUTDOWN" / "DUMP" / "DEBUG" / "HALT" /
   "HUP" / "INT" / "USR1" / "USR2" / "TERM" / "NEWNYM" /
-  "CLEARDNSCACHE" / "HEARTBEAT"
+  "CLEARDNSCACHE" / "HEARTBEAT" / "ACTIVE" / "DORMANT"
 
   The meaning of the signals are:
 
@@ -448,6 +448,12 @@
the client-side DNS cache.  (Tor MAY rate-limit its
response to this signal.)
   HEARTBEAT -- Make Tor dump an unscheduled Heartbeat message to log.
+  DORMANT   -- Tell Tor to become "dormant".  A dormant Tor will
+   try to avoid CPU and network usage until it receives
+   user-initiated network request.  (Don't use this
+   on relays or hidden services yet!)
+  ACTIVE-- Tell Tor to stop being "dormant", as if it had received
+   a user-initiated network request.
 
   The server responds with "250 OK" if the signal is recognized (or simply
   closes the socket if it was asked to close immediately), or "552
@@ -463,6 +469,8 @@
   DUMP: USR1
   DEBUG: USR2
 
+  [SIGNAL DORMANT and SIGNAL ACTIVE were added in 0.4.0.1-alpha.]
+
 3.8. MAPADDRESS
 
   Sent from the client to the server.  The syntax is:

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


[tor-commits] [tor/master] Changes file for "Dormant Mode" (28335, 2149).

2018-11-26 Thread nickm
commit e12fdeb18199925070f4e99e60f2c5bda7f6af82
Author: Nick Mathewson 
Date:   Mon Nov 26 16:39:44 2018 -0500

Changes file for "Dormant Mode" (28335, 2149).
---
 changes/ticket28335 | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/changes/ticket28335 b/changes/ticket28335
new file mode 100644
index 0..eecf7c7fd
--- /dev/null
+++ b/changes/ticket28335
@@ -0,0 +1,7 @@
+  o Major features (client):
+- When Tor is running as a client, and it is unused for a long time, it
+  can now enter a "dormant" state.  When Tor is dormant, it avoids
+  network activity and CPU wakeups until it is reawoken either by a user
+  request or by a controller command.  For more information, see
+  the configuration options starting with "Dormant". Implements tickets
+  2149 and 28335.

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


[tor-commits] [tor/master] Test for check_network_participation_callback()

2018-11-26 Thread nickm
commit 02843c4a4e2fab9c5d9cdb95c425c37ff3d1a4ae
Author: Nick Mathewson 
Date:   Mon Nov 19 16:31:50 2018 -0500

Test for check_network_participation_callback()
---
 src/core/mainloop/connection.c |  4 +-
 src/core/mainloop/connection.h |  2 +-
 src/core/mainloop/mainloop.c   |  3 +-
 src/core/mainloop/mainloop.h   |  3 ++
 src/feature/hs/hs_service.c|  4 +-
 src/feature/hs/hs_service.h|  2 +-
 src/test/test_mainloop.c   | 88 ++
 7 files changed, 98 insertions(+), 8 deletions(-)

diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c
index 25224fd99..c1c7c3678 100644
--- a/src/core/mainloop/connection.c
+++ b/src/core/mainloop/connection.c
@@ -4433,8 +4433,8 @@ connection_get_by_type_state(int type, int state)
  * Return a connection of type type that is not an internally linked
  * connection, and is not marked for close.
  **/
-connection_t *
-connection_get_by_type_nonlinked(int type)
+MOCK_IMPL(connection_t *,
+connection_get_by_type_nonlinked,(int type))
 {
   CONN_GET_TEMPLATE(conn, conn->type == type && !conn->linked);
 }
diff --git a/src/core/mainloop/connection.h b/src/core/mainloop/connection.h
index 9f1a23c6f..07b8df413 100644
--- a/src/core/mainloop/connection.h
+++ b/src/core/mainloop/connection.h
@@ -240,7 +240,7 @@ size_t connection_get_outbuf_len(connection_t *conn);
 connection_t *connection_get_by_global_id(uint64_t id);
 
 connection_t *connection_get_by_type(int type);
-connection_t *connection_get_by_type_nonlinked(int type);
+MOCK_DECL(connection_t *,connection_get_by_type_nonlinked,(int type));
 MOCK_DECL(connection_t *,connection_get_by_type_addr_port_purpose,(int type,
   const tor_addr_t *addr,
   uint16_t port, int purpose));
diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index 331f7021a..42df1038a 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -1367,7 +1367,6 @@ CALLBACK(write_bridge_ns);
 CALLBACK(write_stats_file);
 CALLBACK(control_per_second_events);
 CALLBACK(second_elapsed);
-CALLBACK(check_network_participation);
 
 #undef CALLBACK
 
@@ -2003,7 +2002,7 @@ add_entropy_callback(time_t now, const or_options_t 
*options)
 
 /** Periodic callback: if there has been no network usage in a while,
  * enter a dormant state. */
-static int
+STATIC int
 check_network_participation_callback(time_t now, const or_options_t *options)
 {
   /* If we're a server, we can't become dormant. */
diff --git a/src/core/mainloop/mainloop.h b/src/core/mainloop/mainloop.h
index e5e730fc8..14e80ebb2 100644
--- a/src/core/mainloop/mainloop.h
+++ b/src/core/mainloop/mainloop.h
@@ -104,6 +104,9 @@ STATIC void close_closeable_connections(void);
 STATIC void initialize_periodic_events(void);
 STATIC void teardown_periodic_events(void);
 STATIC int get_my_roles(const or_options_t *);
+STATIC int check_network_participation_callback(time_t now,
+const or_options_t *options);
+
 #ifdef TOR_UNIT_TESTS
 extern smartlist_t *connection_array;
 
diff --git a/src/feature/hs/hs_service.c b/src/feature/hs/hs_service.c
index c288e28e8..ee0b64a96 100644
--- a/src/feature/hs/hs_service.c
+++ b/src/feature/hs/hs_service.c
@@ -3667,8 +3667,8 @@ hs_service_lookup_current_desc(const ed25519_public_key_t 
*pk)
 }
 
 /* Return the number of service we have configured and usable. */
-unsigned int
-hs_service_get_num_services(void)
+MOCK_IMPL(unsigned int,
+hs_service_get_num_services,(void))
 {
   if (hs_service_map == NULL) {
 return 0;
diff --git a/src/feature/hs/hs_service.h b/src/feature/hs/hs_service.h
index a8a9faaea..be1155bcd 100644
--- a/src/feature/hs/hs_service.h
+++ b/src/feature/hs/hs_service.h
@@ -310,7 +310,7 @@ hs_service_t *hs_service_new(const or_options_t *options);
 void hs_service_free_(hs_service_t *service);
 #define hs_service_free(s) FREE_AND_NULL(hs_service_t, hs_service_free_, (s))
 
-unsigned int hs_service_get_num_services(void);
+MOCK_DECL(unsigned int, hs_service_get_num_services,(void));
 void hs_service_stage_services(const smartlist_t *service_list);
 int hs_service_load_all_keys(void);
 int hs_service_get_version_from_key(const hs_service_t *service);
diff --git a/src/test/test_mainloop.c b/src/test/test_mainloop.c
index 94b684fb3..8dfd5f619 100644
--- a/src/test/test_mainloop.c
+++ b/src/test/test_mainloop.c
@@ -6,13 +6,21 @@
  * \brief Tests for functions closely related to the Tor main loop
  */
 
+#define CONFIG_PRIVATE
+#define MAINLOOP_PRIVATE
+
 #include "test/test.h"
 #include "test/log_test_helpers.h"
 
 #include "core/or/or.h"
+#include "core/mainloop/connection.h"
 #include "core/mainloop/mainloop.h"
 #include "core/mainloop/netstatus.h"
 
+#include "feature/hs/hs_service.h"
+
+#include "app/config/config.h"
+
 static const uint64_t BILLION = 10;
 
 static void
@@ -186,6 +194,85 @@ 

[tor-commits] [tor/master] Test netstatus.c tracking of user participation status

2018-11-26 Thread nickm
commit 55512ef022de39770e0787e9dfc2e29e762652ae
Author: Nick Mathewson 
Date:   Mon Nov 19 15:35:55 2018 -0500

Test netstatus.c tracking of user participation status
---
 src/core/mainloop/mainloop.c |  4 ++--
 src/core/mainloop/mainloop.h |  2 +-
 src/test/test_mainloop.c | 57 +++-
 3 files changed, 59 insertions(+), 4 deletions(-)

diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index 1bd186d85..331f7021a 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -1608,8 +1608,8 @@ rescan_periodic_events_cb(mainloop_event_t *event, void 
*arg)
 /**
  * Schedule an event that will rescan which periodic events should run.
  **/
-void
-schedule_rescan_periodic_events(void)
+MOCK_IMPL(void,
+schedule_rescan_periodic_events,(void))
 {
   if (!rescan_periodic_events_ev) {
 rescan_periodic_events_ev =
diff --git a/src/core/mainloop/mainloop.h b/src/core/mainloop/mainloop.h
index 7f27ef9a5..e5e730fc8 100644
--- a/src/core/mainloop/mainloop.h
+++ b/src/core/mainloop/mainloop.h
@@ -65,7 +65,7 @@ void reschedule_or_state_save(void);
 void reschedule_dirvote(const or_options_t *options);
 void mainloop_schedule_postloop_cleanup(void);
 void rescan_periodic_events(const or_options_t *options);
-void schedule_rescan_periodic_events(void);
+MOCK_DECL(void, schedule_rescan_periodic_events,(void));
 
 void update_current_time(time_t now);
 
diff --git a/src/test/test_mainloop.c b/src/test/test_mainloop.c
index 92ce2e991..94b684fb3 100644
--- a/src/test/test_mainloop.c
+++ b/src/test/test_mainloop.c
@@ -11,6 +11,7 @@
 
 #include "core/or/or.h"
 #include "core/mainloop/mainloop.h"
+#include "core/mainloop/netstatus.h"
 
 static const uint64_t BILLION = 10;
 
@@ -131,12 +132,66 @@ test_mainloop_update_time_jumps(void *arg)
   monotime_disable_test_mocking();
 }
 
+static int schedule_rescan_called = 0;
+static void
+mock_schedule_rescan_periodic_events(void)
+{
+  ++schedule_rescan_called;
+}
+
+static void
+test_mainloop_user_activity(void *arg)
+{
+  (void)arg;
+  const time_t start = 1542658829;
+  update_approx_time(start);
+
+  MOCK(schedule_rescan_periodic_events, mock_schedule_rescan_periodic_events);
+
+  reset_user_activity(start);
+  tt_i64_op(get_last_user_activity_time(), OP_EQ, start);
+
+  set_network_participation(false);
+
+  // reset can move backwards and forwards, but does not change network
+  // participation.
+  reset_user_activity(start-10);
+  tt_i64_op(get_last_user_activity_time(), OP_EQ, start-10);
+  reset_user_activity(start+10);
+  tt_i64_op(get_last_user_activity_time(), OP_EQ, start+10);
+
+  tt_int_op(schedule_rescan_called, OP_EQ, 0);
+  tt_int_op(false, OP_EQ, is_participating_on_network());
+
+  // "note" can only move forward.  Calling it from a non-participating
+  // state makes us rescan the periodic callbacks and set participation.
+  note_user_activity(start+20);
+  tt_i64_op(get_last_user_activity_time(), OP_EQ, start+20);
+  tt_int_op(true, OP_EQ, is_participating_on_network());
+  tt_int_op(schedule_rescan_called, OP_EQ, 1);
+
+  // Calling it again will move us forward, but not call rescan again.
+  note_user_activity(start+25);
+  tt_i64_op(get_last_user_activity_time(), OP_EQ, start+25);
+  tt_int_op(true, OP_EQ, is_participating_on_network());
+  tt_int_op(schedule_rescan_called, OP_EQ, 1);
+
+  // We won't move backwards.
+  note_user_activity(start+20);
+  tt_i64_op(get_last_user_activity_time(), OP_EQ, start+25);
+  tt_int_op(true, OP_EQ, is_participating_on_network());
+  tt_int_op(schedule_rescan_called, OP_EQ, 1);
+
+ done:
+  UNMOCK(schedule_rescan_periodic_events);
+}
+
 #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),
+  MAINLOOP_TEST(user_activity),
   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] Reset dormancy status when the clock jumps.

2018-11-26 Thread nickm
commit d0e6abd0876f0d4adb0b82f5528220a81b34962e
Author: Nick Mathewson 
Date:   Tue Nov 13 15:57:18 2018 -0500

Reset dormancy status when the clock jumps.
---
 src/core/mainloop/mainloop.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index e6dee94fc..2a68e8c09 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -2674,6 +2674,11 @@ update_current_time(time_t now)
   if (seconds_elapsed < -NUM_JUMPED_SECONDS_BEFORE_WARN) {
 // moving back in time is always a bad sign.
 circuit_note_clock_jumped(seconds_elapsed, false);
+
+/* Don't go dormant just because we jumped in time. */
+if (is_participating_on_network()) {
+  reset_user_activity(now);
+}
   } else if (seconds_elapsed >= NUM_JUMPED_SECONDS_BEFORE_WARN) {
 /* Compare the monotonic clock to the result of time(). */
 const int32_t monotime_msec_passed =
@@ -2695,6 +2700,11 @@ update_current_time(time_t now)
 if (clock_jumped || seconds_elapsed >= NUM_IDLE_SECONDS_BEFORE_WARN) {
   circuit_note_clock_jumped(seconds_elapsed, ! clock_jumped);
 }
+
+/* Don't go dormant just because we jumped in time. */
+if (is_participating_on_network()) {
+  reset_user_activity(now);
+}
   } else if (seconds_elapsed > 0) {
 stats_n_seconds_working += seconds_elapsed;
   }



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


[tor-commits] [tor/master] Make sure that we are always a net participant when being a server

2018-11-26 Thread nickm
commit 53ccdb6945f0d4a9b27a9939211a3c9125ca4427
Author: Nick Mathewson 
Date:   Wed Nov 14 15:05:05 2018 -0500

Make sure that we are always a net participant when being a server

Otherwise, if we're dormant, and we set ORPort, nothing makes us become
non-dormant.
---
 src/core/mainloop/mainloop.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index 9f45f3c86..2d12e2648 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -1515,7 +1515,8 @@ get_my_roles(const or_options_t *options)
   options->ControlPort_set ||
   options->OwningControllerFD != UINT64_MAX;
 
-  int is_net_participant = is_participating_on_network();
+  int is_net_participant = is_participating_on_network() ||
+is_relay || is_hidden_service;
 
   if (is_bridge) roles |= PERIODIC_EVENT_ROLE_BRIDGE;
   if (is_client) roles |= PERIODIC_EVENT_ROLE_CLIENT;



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


[tor-commits] [tor/master] write_stats_file() is indeed NET_PARTICIPANT; remove comment.

2018-11-26 Thread nickm
commit ccbb36048f5167b9d5011b7c8b0d2c346ce567e8
Author: Nick Mathewson 
Date:   Tue Nov 13 10:44:04 2018 -0500

write_stats_file() is indeed NET_PARTICIPANT; remove comment.
---
 src/core/mainloop/mainloop.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index 6df51062a..e67ebdb4a 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -1401,8 +1401,6 @@ STATIC periodic_event_item_t periodic_events[] = {
* immediately before we stop. */
   CALLBACK(clean_caches, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
   CALLBACK(save_state, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
-
-  /*  investigate this. ??? */
   CALLBACK(write_stats_file, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
 
   /* Routers (bridge and relay) only. */



___
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 'dormant_v2_squashed'

2018-11-26 Thread nickm
commit 7d8e0cc9abf2a74789e635d2fd4d0e18b8e0d1fe
Merge: 2b9a907bd 02843c4a4
Author: Nick Mathewson 
Date:   Mon Nov 26 16:33:31 2018 -0500

Merge branch 'dormant_v2_squashed'

 doc/tor.1.txt |  13 ++
 src/app/config/config.c   |   9 +-
 src/app/config/or_options_st.h|  10 ++
 src/app/main/main.c   |  15 ++
 src/core/mainloop/connection.c|  13 ++
 src/core/mainloop/connection.h|   1 +
 src/core/mainloop/mainloop.c  | 319 +-
 src/core/mainloop/mainloop.h  |   7 +-
 src/core/mainloop/netstatus.c |  73 +
 src/core/mainloop/netstatus.h |   7 +
 src/core/mainloop/periodic.c  |  22 ++-
 src/core/mainloop/periodic.h  |  15 +-
 src/core/or/connection_edge.c |  11 ++
 src/core/or/or.h  |   2 +
 src/feature/client/dnsserv.c  |   4 +
 src/feature/control/control.c |   4 +-
 src/feature/hibernate/hibernate.c |  22 ++-
 src/feature/hs/hs_service.c   |   4 +-
 src/feature/hs/hs_service.h   |   2 +-
 src/test/test_compat_libevent.c   |   1 -
 src/test/test_mainloop.c  | 145 -
 src/test/test_options.c   |   1 +
 src/test/test_periodic_event.c|  61 +---
 23 files changed, 604 insertions(+), 157 deletions(-)

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


[tor-commits] [tor/master] Add options to control dormant-client feature.

2018-11-26 Thread nickm
commit 3743f7969587079a2f2bb03d0b7e5038557fd64a
Author: Nick Mathewson 
Date:   Thu Nov 15 13:16:58 2018 -0500

Add options to control dormant-client feature.

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.
---
 doc/tor.1.txt  | 13 +
 src/app/config/config.c|  6 ++
 src/app/config/or_options_st.h | 10 ++
 src/core/mainloop/mainloop.c   | 19 ++-
 src/core/or/connection_edge.c  | 11 +++
 src/test/test_options.c|  1 +
 6 files changed, 51 insertions(+), 9 deletions(-)

diff --git a/doc/tor.1.txt b/doc/tor.1.txt
index b147ad68a..47bddea09 100644
--- a/doc/tor.1.txt
+++ b/doc/tor.1.txt
@@ -1789,6 +1789,19 @@ The following options are useful only for clients (that 
is, if
 Try this many simultaneous connections to download a consensus before
 waiting for one to complete, timeout, or error out. (Default: 3)
 
+[[DormantClientTimeout]] **DormantClientTimeout**  __N__ 
**minutes**|**hours**|**days**|**weeks**::
+If Tor spends this much time without any client activity,
+enter a dormant state where automatic circuits are not built, and
+directory information is not fetched.
+Does not affect servers or onion services. Must be at least 10 minutes.
+(Default: 24 hours)
+
+[[DormantTimeoutDisabledByIdleStreams]] **DormantTimeoutDisabledByIdleStreams  
**0**|**1**::
+If true, then any open client stream (even one not reading or writing)
+counts as client activity for the purpose of DormantClientTimeout.
+If false, then only network activity counts. (Default: 1)
+
+
 SERVER OPTIONS
 --
 
diff --git a/src/app/config/config.c b/src/app/config/config.c
index 8aa0c1f4b..90eae50fd 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -389,6 +389,8 @@ static config_var_t option_vars_[] = {
   OBSOLETE("DynamicDHGroups"),
   VPORT(DNSPort),
   OBSOLETE("DNSListenAddress"),
+  V(DormantClientTimeout, INTERVAL, "24 hours"),
+  V(DormantTimeoutDisabledByIdleStreams, BOOL, "1"),
   /* DoS circuit creation options. */
   V(DoSCircuitCreationEnabled,   AUTOBOOL, "auto"),
   V(DoSCircuitCreationMinConnections,  UINT, "0"),
@@ -3836,6 +3838,10 @@ options_validate(or_options_t *old_options, or_options_t 
*options,
"default.");
   }
 
+  if (options->DormantClientTimeout < 10*60 && !options->TestingTorNetwork) {
+REJECT("DormantClientTimeout is too low. It must be at least 10 minutes.");
+  }
+
   if (options->PathBiasNoticeRate > 1.0) {
 tor_asprintf(msg,
   "PathBiasNoticeRate is too high. "
diff --git a/src/app/config/or_options_st.h b/src/app/config/or_options_st.h
index 3524b99b5..6cbc86ec1 100644
--- a/src/app/config/or_options_st.h
+++ b/src/app/config/or_options_st.h
@@ -1072,6 +1072,16 @@ struct or_options_t {
 
   /** Autobool: Do we refuse single hop client rendezvous? */
   int DoSRefuseSingleHopClientRendezvous;
+
+  /** Interval: how long without activity does it take for a client
+   * to become dormant?
+   **/
+  int DormantClientTimeout;
+
+  /** Boolean: true if having an idle stream is sufficient to prevent a client
+   * from becoming dormant.
+   **/
+  int DormantTimeoutDisabledByIdleStreams;
 };
 
 #endif
diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index 2d12e2648..1bd186d85 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -2018,24 +2018,25 @@ check_network_participation_callback(time_t now, const 
or_options_t *options)
 goto found_activity;
   }
 
-  /*  Add an option to never become dormant. */
-
   /* If we have any currently open entry streams other than "linked"
* connections used for directory requests, those count as user activity.
*/
-  /*  make this configurable? */
-  if (connection_get_by_type_nonlinked(CONN_TYPE_AP) != NULL) {
-goto found_activity;
+  if (options->DormantTimeoutDisabledByIdleStreams) {
+if (connection_get_by_type_nonlinked(CONN_TYPE_AP) != NULL) {
+  goto found_activity;
+}
   }
 
   /*  Make this configurable? */
 /** How often do we check whether we have had network activity? */
 #define CHECK_PARTICIPATION_INTERVAL (5*60)
 
-  /** Become dormant if there has been no user activity in this long. */
-  /*  make this configurable! */
-#define BECOME_DORMANT_AFTER_INACTIVITY (24*60*60)
-  if (get_last_user_activity_time() + BECOME_DORMANT_AFTER_INACTIVITY >= now) {
+  /* Become dormant if there has been no user activity in a long time.
+   * (The funny checks 

[tor-commits] [tor/master] Rename and fix docs on FLUSH_ON_DISABLE

2018-11-26 Thread nickm
commit 2f28cd1dc8e797b140271e5c33b9e4f823f7f2d8
Author: Nick Mathewson 
Date:   Wed Nov 14 13:42:09 2018 -0500

Rename and fix docs on FLUSH_ON_DISABLE

Also rename "...flush_and_disable()" to "...schedule_and_disable()"
---
 src/core/mainloop/mainloop.c | 16 
 src/core/mainloop/periodic.c |  2 +-
 src/core/mainloop/periodic.h |  6 +++---
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index 2a68e8c09..9f45f3c86 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -1386,7 +1386,7 @@ STATIC periodic_event_item_t periodic_events[] = {
   /* This is a legacy catch-all callback that runs once per second if
* we are online and active. */
   CALLBACK(second_elapsed, NET_PARTICIPANT,
-   FL(NEED_NET)|FL(FLUSH_ON_DISABLE)),
+   FL(NEED_NET)|FL(RUN_ON_DISABLE)),
 
   /*  Do we have a reason to do this on a callback? Does it do any good at
* all?  For now, if we're dormant, we can let our listeners decay. */
@@ -1401,9 +1401,9 @@ STATIC periodic_event_item_t periodic_events[] = {
 
   /* We need to do these if we're participating in the Tor network, and
* immediately before we stop. */
-  CALLBACK(clean_caches, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
-  CALLBACK(save_state, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
-  CALLBACK(write_stats_file, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
+  CALLBACK(clean_caches, NET_PARTICIPANT, FL(RUN_ON_DISABLE)),
+  CALLBACK(save_state, NET_PARTICIPANT, FL(RUN_ON_DISABLE)),
+  CALLBACK(write_stats_file, NET_PARTICIPANT, FL(RUN_ON_DISABLE)),
 
   /* Routers (bridge and relay) only. */
   CALLBACK(check_descriptor, ROUTER, FL(NEED_NET)),
@@ -1436,7 +1436,7 @@ STATIC periodic_event_item_t periodic_events[] = {
 
   /* Client only. */
   /*  this could be restricted to CLIENT+NET_PARTICIPANT */
-  CALLBACK(rend_cache_failure_clean, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
+  CALLBACK(rend_cache_failure_clean, NET_PARTICIPANT, FL(RUN_ON_DISABLE)),
 
   /* Bridge Authority only. */
   CALLBACK(write_bridge_ns, BRIDGEAUTH, 0),
@@ -1651,8 +1651,8 @@ rescan_periodic_events(const or_options_t *options)
   periodic_event_enable(item);
 } else {
   log_debug(LD_GENERAL, "Disabling periodic event %s", item->name);
-  if (item->flags & PERIODIC_EVENT_FLAG_FLUSH_ON_DISABLE) {
-periodic_event_flush_and_disable(item);
+  if (item->flags & PERIODIC_EVENT_FLAG_RUN_ON_DISABLE) {
+periodic_event_schedule_and_disable(item);
   } else {
 periodic_event_disable(item);
   }
@@ -1814,7 +1814,7 @@ second_elapsed_callback(time_t now, const or_options_t 
*options)
*/
   /* (If our circuit build timeout can ever become lower than a second (which
* it can't, currently), we should do this more often.) */
-  // TODO: All expire stuff can become NET_PARTICIPANT, FLUSH_ON_DISABLE
+  // TODO: All expire stuff can become NET_PARTICIPANT, RUN_ON_DISABLE
   circuit_expire_building();
   circuit_expire_waiting_for_better_guard();
 
diff --git a/src/core/mainloop/periodic.c b/src/core/mainloop/periodic.c
index c290c3744..9f9b178e4 100644
--- a/src/core/mainloop/periodic.c
+++ b/src/core/mainloop/periodic.c
@@ -174,7 +174,7 @@ periodic_event_disable(periodic_event_item_t *event)
  * Do nothing if the event was already disabled.
  */
 void
-periodic_event_flush_and_disable(periodic_event_item_t *event)
+periodic_event_schedule_and_disable(periodic_event_item_t *event)
 {
   tor_assert(event);
   if (!periodic_event_is_enabled(event))
diff --git a/src/core/mainloop/periodic.h b/src/core/mainloop/periodic.h
index 52d5450ee..05ba4297f 100644
--- a/src/core/mainloop/periodic.h
+++ b/src/core/mainloop/periodic.h
@@ -39,10 +39,10 @@
  * the net_is_disabled() check. */
 #define PERIODIC_EVENT_FLAG_NEED_NET  (1U << 0)
 
-/* Indicate that it the event is enabled, it event needs to be run once before
+/* Indicate that if the event is enabled, it needs to be run once before
  * it becomes disabled.
  */
-#define PERIODIC_EVENT_FLAG_FLUSH_ON_DISABLE  (1U << 1)
+#define PERIODIC_EVENT_FLAG_RUN_ON_DISABLE  (1U << 1)
 
 /** Callback function for a periodic event to take action.  The return value
 * influences the next time the function will get called.  Return
@@ -88,6 +88,6 @@ void periodic_event_destroy(periodic_event_item_t *event);
 void periodic_event_reschedule(periodic_event_item_t *event);
 void periodic_event_enable(periodic_event_item_t *event);
 void periodic_event_disable(periodic_event_item_t *event);
-void periodic_event_flush_and_disable(periodic_event_item_t *event);
+void periodic_event_schedule_and_disable(periodic_event_item_t *event);
 
 #endif /* !defined(TOR_PERIODIC_H) */



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


[tor-commits] [tor/master] Add a function to schedule a periodic event once, then disable it

2018-11-26 Thread nickm
commit 6d84972eb8e27d5e9f1adea36fcc9a9879d718ad
Author: Nick Mathewson 
Date:   Mon Nov 5 16:24:10 2018 -0500

Add a function to schedule a periodic event once, then disable it
---
 src/core/mainloop/mainloop.c |  6 +-
 src/core/mainloop/periodic.c | 22 +-
 src/core/mainloop/periodic.h |  7 ++-
 3 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index 12820888f..42f6fb50c 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -1600,7 +1600,11 @@ rescan_periodic_events(const or_options_t *options)
   periodic_event_enable(item);
 } else {
   log_debug(LD_GENERAL, "Disabling periodic event %s", item->name);
-  periodic_event_disable(item);
+  if (item->flags & PERIODIC_EVENT_FLAG_FLUSH_ON_DISABLE) {
+periodic_event_flush_and_disable(item);
+  } else {
+periodic_event_disable(item);
+  }
 }
   }
 }
diff --git a/src/core/mainloop/periodic.c b/src/core/mainloop/periodic.c
index c1785eb38..c290c3744 100644
--- a/src/core/mainloop/periodic.c
+++ b/src/core/mainloop/periodic.c
@@ -45,10 +45,6 @@ periodic_event_dispatch(mainloop_event_t *ev, void *data)
   periodic_event_item_t *event = data;
   tor_assert(ev == event->ev);
 
-  if (BUG(!periodic_event_is_enabled(event))) {
-return;
-  }
-
   time_t now = time(NULL);
   update_current_time(now);
   const or_options_t *options = get_options();
@@ -57,7 +53,7 @@ periodic_event_dispatch(mainloop_event_t *ev, void *data)
   int next_interval = 0;
 
   if (!periodic_event_is_enabled(event)) {
-/* The event got disabled from inside its callback; no need to
+/* The event got disabled from inside its callback, or before: no need to
  * reschedule. */
 return;
   }
@@ -172,3 +168,19 @@ periodic_event_disable(periodic_event_item_t *event)
   mainloop_event_cancel(event->ev);
   event->enabled = 0;
 }
+
+/**
+ * Disable an event, then schedule it to run once.
+ * Do nothing if the event was already disabled.
+ */
+void
+periodic_event_flush_and_disable(periodic_event_item_t *event)
+{
+  tor_assert(event);
+  if (!periodic_event_is_enabled(event))
+return;
+
+  periodic_event_disable(event);
+
+  mainloop_event_activate(event->ev);
+}
diff --git a/src/core/mainloop/periodic.h b/src/core/mainloop/periodic.h
index 4c8c3c96c..7c71be7bc 100644
--- a/src/core/mainloop/periodic.h
+++ b/src/core/mainloop/periodic.h
@@ -39,6 +39,11 @@
  * the net_is_disabled() check. */
 #define PERIODIC_EVENT_FLAG_NEED_NET  (1U << 0)
 
+/* Indicate that it the event is enabled, it event needs to be run once before
+ * it becomes disabled.
+ */
+#define PERIODIC_EVENT_FLAG_FLUSH_ON_DISABLE  (1U << 1)
+
 /** Callback function for a periodic event to take action.  The return value
 * influences the next time the function will get called.  Return
 * PERIODIC_EVENT_NO_UPDATE to not update last_action_time and be polled
@@ -83,6 +88,6 @@ void periodic_event_destroy(periodic_event_item_t *event);
 void periodic_event_reschedule(periodic_event_item_t *event);
 void periodic_event_enable(periodic_event_item_t *event);
 void periodic_event_disable(periodic_event_item_t *event);
+void periodic_event_flush_and_disable(periodic_event_item_t *event);
 
 #endif /* !defined(TOR_PERIODIC_H) */
-



___
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 responsibility for delayed shutdown into the mainloop

2018-11-26 Thread nickm
commit 303e5c70e08d72614ea95fd0c5aad7e05852b6b7
Author: Nick Mathewson 
Date:   Tue Nov 13 09:04:11 2018 -0500

Move the responsibility for delayed shutdown into the mainloop

This is part of 28422, so we don't have to call
consider_hibernation() once per second when we're dormant.

This commit does not remove delayed shutdown from hibernate.c: it
uses it as a backup shutdown mechanism, in case the regular shutdown
timer mechanism fails for some reason.
---
 src/core/mainloop/mainloop.c  | 36 +++-
 src/core/mainloop/mainloop.h  |  2 ++
 src/feature/hibernate/hibernate.c | 20 ++--
 3 files changed, 47 insertions(+), 11 deletions(-)

diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index ebf9735d4..d5f3cb13f 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -1703,6 +1703,30 @@ mainloop_schedule_postloop_cleanup(void)
   mainloop_event_activate(postloop_cleanup_ev);
 }
 
+/** Event to run 'scheduled_shutdown_cb' */
+static mainloop_event_t *scheduled_shutdown_ev=NULL;
+
+/** Callback: run a scheduled shutdown */
+static void
+scheduled_shutdown_cb(mainloop_event_t *ev, void *arg)
+{
+  (void)ev;
+  (void)arg;
+  log_notice(LD_GENERAL, "Clean shutdown finished. Exiting.");
+  tor_shutdown_event_loop_and_exit(0);
+}
+
+/** Schedule the mainloop to exit after delay_sec seconds. */
+void
+mainloop_schedule_shutdown(int delay_sec)
+{
+  const struct timeval delay_tv = { delay_sec, 0 };
+  if (! scheduled_shutdown_ev) {
+scheduled_shutdown_ev = mainloop_event_new(scheduled_shutdown_cb, NULL);
+  }
+  mainloop_event_schedule(scheduled_shutdown_ev, _tv);
+}
+
 #define LONGEST_TIMER_PERIOD (30 * 86400)
 /** Helper: Return the number of seconds between now and next,
  * clipped to the range [1 second, LONGEST_TIMER_PERIOD]. */
@@ -1743,12 +1767,13 @@ second_elapsed_callback(periodic_timer_t *timer, void 
*arg)
*/
   update_current_time(now);
 
-  /* 0. See if we've been asked to shut down and our timeout has
-   * expired; or if our bandwidth limits are exhausted and we
-   * should hibernate; or if it's time to wake up from hibernation.
+  /* 0. See if our bandwidth limits are exhausted and we should hibernate; or
+   * if it's time to wake up from hibernation; or if we have a scheduled
+   * shutdown and it's time to run it.
+   *
+   * Note: we have redundant mechanisms to handle the
*/
-  // TODO: Refactor or rewrite, or NET_PARTICIPANT. Needs separate wakeup
-  //   handling.
+  // TODO: NET_PARTICIPANT.
   consider_hibernation(now);
 
   /* Maybe enough time elapsed for us to reconsider a circuit. */
@@ -2936,6 +2961,7 @@ tor_mainloop_free_all(void)
   mainloop_event_free(schedule_active_linked_connections_event);
   mainloop_event_free(postloop_cleanup_ev);
   mainloop_event_free(handle_deferred_signewnym_ev);
+  mainloop_event_free(scheduled_shutdown_ev);
 
 #ifdef HAVE_SYSTEMD_209
   periodic_timer_free(systemd_watchdog_timer);
diff --git a/src/core/mainloop/mainloop.h b/src/core/mainloop/mainloop.h
index 632733d9a..6f7b71685 100644
--- a/src/core/mainloop/mainloop.h
+++ b/src/core/mainloop/mainloop.h
@@ -86,6 +86,8 @@ void reschedule_per_second_timer(void);
 void do_signewnym(time_t);
 time_t get_last_signewnym_time(void);
 
+void mainloop_schedule_shutdown(int delay_sec);
+
 void tor_init_connection_lists(void);
 void initialize_mainloop_events(void);
 void tor_mainloop_free_all(void);
diff --git a/src/feature/hibernate/hibernate.c 
b/src/feature/hibernate/hibernate.c
index 6f8795cec..968c39dd6 100644
--- a/src/feature/hibernate/hibernate.c
+++ b/src/feature/hibernate/hibernate.c
@@ -66,8 +66,9 @@ static hibernate_state_t hibernate_state = 
HIBERNATE_STATE_INITIAL;
 /** If are hibernating, when do we plan to wake up? Set to 0 if we
  * aren't hibernating. */
 static time_t hibernate_end_time = 0;
-/** If we are shutting down, when do we plan finally exit? Set to 0 if
- * we aren't shutting down. */
+/** If we are shutting down, when do we plan finally exit? Set to 0 if we
+ * aren't shutting down. (This is obsolete; scheduled shutdowns are supposed
+ * to happen from mainloop_schedule_shutdown() now.) */
 static time_t shutdown_time = 0;
 
 /** A timed event that we'll use when it's time to wake up from
@@ -867,7 +868,13 @@ hibernate_begin(hibernate_state_t new_state, time_t now)
 log_notice(LD_GENERAL,"Interrupt: we have stopped accepting new "
"connections, and will shut down in %d seconds. Interrupt "
"again to exit now.", options->ShutdownWaitLength);
-shutdown_time = time(NULL) + options->ShutdownWaitLength;
+/* We add an arbitrary delay here so that even if something goes wrong
+ * with the mainloop shutdown code, we can still shutdown from
+ * consider_hibernation() if we call it... but so that the
+ * mainloop_schedule_shutdown() mechanism will be the first one called.
+ */
+

[tor-commits] [tor/master] Add a periodic event to become dormant.

2018-11-26 Thread nickm
commit ce6209cee4a113c6a224f0c98244852354ccdb40
Author: Nick Mathewson 
Date:   Tue Nov 13 15:51:53 2018 -0500

Add a periodic event to become dormant.

This event makes us become dormant if we have seen no activity in a
long time.

Note that being any kind of a server, or running an onion service,
always counts as being active.

Note that right now, just having an open stream that Tor
did not open on its own (for a directory request) counts as "being
active", so if you have an idle ssh connection, that will keep Tor
from becoming dormant.

Many of the features here should become configurable; I'd like
feedback on which.
---
 src/core/mainloop/connection.c | 10 +
 src/core/mainloop/connection.h |  1 +
 src/core/mainloop/mainloop.c   | 50 ++
 3 files changed, 61 insertions(+)

diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c
index e0f1680c9..25224fd99 100644
--- a/src/core/mainloop/connection.c
+++ b/src/core/mainloop/connection.c
@@ -4429,6 +4429,16 @@ connection_get_by_type_state(int type, int state)
   CONN_GET_TEMPLATE(conn, conn->type == type && conn->state == state);
 }
 
+/**
+ * Return a connection of type type that is not an internally linked
+ * connection, and is not marked for close.
+ **/
+connection_t *
+connection_get_by_type_nonlinked(int type)
+{
+  CONN_GET_TEMPLATE(conn, conn->type == type && !conn->linked);
+}
+
 /** Return a connection of type type that has rendquery equal
  * to rendquery, and that is not marked for close. If state
  * is non-zero, conn must be of that state too.
diff --git a/src/core/mainloop/connection.h b/src/core/mainloop/connection.h
index b569bb038..9f1a23c6f 100644
--- a/src/core/mainloop/connection.h
+++ b/src/core/mainloop/connection.h
@@ -240,6 +240,7 @@ size_t connection_get_outbuf_len(connection_t *conn);
 connection_t *connection_get_by_global_id(uint64_t id);
 
 connection_t *connection_get_by_type(int type);
+connection_t *connection_get_by_type_nonlinked(int type);
 MOCK_DECL(connection_t *,connection_get_by_type_addr_port_purpose,(int type,
   const tor_addr_t *addr,
   uint16_t port, int purpose));
diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index f18db2898..e6dee94fc 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -1367,6 +1367,7 @@ CALLBACK(write_bridge_ns);
 CALLBACK(write_stats_file);
 CALLBACK(control_per_second_events);
 CALLBACK(second_elapsed);
+CALLBACK(check_network_participation);
 
 #undef CALLBACK
 
@@ -1396,6 +1397,7 @@ STATIC periodic_event_item_t periodic_events[] = {
   CALLBACK(fetch_networkstatus, NET_PARTICIPANT, 0),
   CALLBACK(launch_descriptor_fetches, NET_PARTICIPANT, FL(NEED_NET)),
   CALLBACK(rotate_x509_certificate, NET_PARTICIPANT, 0),
+  CALLBACK(check_network_participation, NET_PARTICIPANT, 0),
 
   /* We need to do these if we're participating in the Tor network, and
* immediately before we stop. */
@@ -1998,6 +2000,54 @@ add_entropy_callback(time_t now, const or_options_t 
*options)
   return ENTROPY_INTERVAL;
 }
 
+/** Periodic callback: if there has been no network usage in a while,
+ * enter a dormant state. */
+static int
+check_network_participation_callback(time_t now, const or_options_t *options)
+{
+  /* If we're a server, we can't become dormant. */
+  if (server_mode(options)) {
+goto found_activity;
+  }
+
+  /* If we're running an onion service, we can't become dormant. */
+  /*  this would be nice to change, so that we can be dormant with a
+   * service. */
+  if (hs_service_get_num_services() || rend_num_services()) {
+goto found_activity;
+  }
+
+  /*  Add an option to never become dormant. */
+
+  /* If we have any currently open entry streams other than "linked"
+   * connections used for directory requests, those count as user activity.
+   */
+  /*  make this configurable? */
+  if (connection_get_by_type_nonlinked(CONN_TYPE_AP) != NULL) {
+goto found_activity;
+  }
+
+  /*  Make this configurable? */
+/** How often do we check whether we have had network activity? */
+#define CHECK_PARTICIPATION_INTERVAL (5*60)
+
+  /** Become dormant if there has been no user activity in this long. */
+  /*  make this configurable! */
+#define BECOME_DORMANT_AFTER_INACTIVITY (24*60*60)
+  if (get_last_user_activity_time() + BECOME_DORMANT_AFTER_INACTIVITY >= now) {
+log_notice(LD_GENERAL, "No user activity in a long time: becoming"
+   " dormant.");
+set_network_participation(false);
+rescan_periodic_events(options);
+  }
+
+  return CHECK_PARTICIPATION_INTERVAL;
+
+ found_activity:
+  note_user_activity(now);
+  return CHECK_PARTICIPATION_INTERVAL;
+}
+
 /**
  * Periodic callback: if we're an authority, make sure we test
  * the routers on the network for 

[tor-commits] [tor/master] Turn second_elapsed_callback into a normal periodic event.

2018-11-26 Thread nickm
commit 4bf79fa4fa99fe66f6b1ad413cbf475325803e04
Author: Nick Mathewson 
Date:   Tue Nov 13 09:30:51 2018 -0500

Turn second_elapsed_callback into a normal periodic event.
---
 src/app/config/config.c   |  3 --
 src/core/mainloop/mainloop.c  | 81 ---
 src/core/mainloop/mainloop.h  |  1 -
 src/feature/hibernate/hibernate.c |  2 -
 4 files changed, 17 insertions(+), 70 deletions(-)

diff --git a/src/app/config/config.c b/src/app/config/config.c
index 45a23d67d..8aa0c1f4b 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -1993,9 +1993,6 @@ options_act(const or_options_t *old_options)
 finish_daemon(options->DataDirectory);
   }
 
-  /* See whether we need to enable/disable our once-a-second timer. */
-  reschedule_per_second_timer();
-
   /* We want to reinit keys as needed before we do much of anything else:
  keys are important, and other things can depend on them. */
   if (transition_affects_workers ||
diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index d5f3cb13f..176399b33 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -205,7 +205,6 @@ static void 
connection_start_reading_from_linked_conn(connection_t *conn);
 static int connection_should_read_from_linked_conn(connection_t *conn);
 static void conn_read_callback(evutil_socket_t fd, short event, void *_conn);
 static void conn_write_callback(evutil_socket_t fd, short event, void *_conn);
-static void second_elapsed_callback(periodic_timer_t *timer, void *args);
 static void shutdown_did_not_work_callback(evutil_socket_t fd, short event,
void *arg) ATTR_NORETURN;
 
@@ -1367,6 +1366,7 @@ CALLBACK(save_state);
 CALLBACK(write_bridge_ns);
 CALLBACK(write_stats_file);
 CALLBACK(control_per_second_events);
+CALLBACK(second_elapsed);
 
 #undef CALLBACK
 
@@ -1380,6 +1380,11 @@ STATIC periodic_event_item_t periodic_events[] = {
   CALLBACK(add_entropy, ALL, 0),
   CALLBACK(heartbeat, ALL, 0),
 
+  /* This is a legacy catch-all callback that runs once per second if
+   * we are online and active. */
+  CALLBACK(second_elapsed, NET_PARTICIPANT,
+   FL(NEED_NET)|FL(FLUSH_ON_DISABLE)),
+
   /*  Do we have a reason to do this on a callback? Does it do any good at
* all?  For now, if we're dormant, we can let our listeners decay. */
   CALLBACK(retry_listeners, NET_PARTICIPANT, FL(NEED_NET)),
@@ -1753,43 +1758,30 @@ safe_timer_diff(time_t now, time_t next)
 /** Perform regular maintenance tasks.  This function gets run once per
  * second.
  */
-static void
-second_elapsed_callback(periodic_timer_t *timer, void *arg)
+static int
+second_elapsed_callback(time_t now, const or_options_t *options)
 {
-  (void) timer;
-  (void) arg;
-  const time_t now = time(NULL);
-  const or_options_t *options = get_options();
-
-  /* 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);
-
-  /* 0. See if our bandwidth limits are exhausted and we should hibernate; or
-   * if it's time to wake up from hibernation; or if we have a scheduled
-   * shutdown and it's time to run it.
+  /* 0. See if our bandwidth limits are exhausted and we should hibernate
*
-   * Note: we have redundant mechanisms to handle the
+   * Note: we have redundant mechanisms to handle the case where it's
+   * time to wake up from hibernation; or where we have a scheduled
+   * shutdown and it's time to run it, but this will also handle those.
*/
-  // TODO: NET_PARTICIPANT.
   consider_hibernation(now);
 
   /* Maybe enough time elapsed for us to reconsider a circuit. */
-  // TODO: NET_PARTICIPANT
   circuit_upgrade_circuits_from_guard_wait();
 
   if (options->UseBridges && !net_is_disabled()) {
 /* Note: this check uses net_is_disabled(), not should_delay_dir_fetches()
  * -- the latter is only for fetching consensus-derived directory info. */
-// TODO: client+NET_PARTICIPANT.
+// TODO: client
 // Also, schedule this rather than probing 1x / sec
 fetch_bridge_descriptors(options, now);
   }
 
   if (accounting_is_enabled(options)) {
-// TODO: refactor or rewrite; NET_PARTICIPANT
+// TODO: refactor or rewrite?
 accounting_run_housekeeping(now);
   }
 
@@ -1809,12 +1801,10 @@ second_elapsed_callback(periodic_timer_t *timer, void 
*arg)
* Do this before step 4, so we can put them back into pending
* state to be picked up by the new circuit.
*/
-  // TODO: All expire stuff can become NET_PARTICIPANT, FLUSH_ON_DISABLE
   connection_ap_expire_beginning();
 
   /* 3c. And expire connections that we've held open for too long.
*/
-  // TODO: All expire stuff can become NET_PARTICIPANT, FLUSH_ON_DISABLE
   connection_expire_held_open();
 
   /* 4. Every 

[tor-commits] [tor/master] Make the NET_PARTICIPANT role dependent on user activity

2018-11-26 Thread nickm
commit 2c15b6538123047c258987b00475fa658ca14878
Author: Nick Mathewson 
Date:   Tue Nov 13 15:33:46 2018 -0500

Make the NET_PARTICIPANT role dependent on user activity

This patch implements all of 28337, except for the part where we
turn off the role if we've been idle for a long time.
---
 src/app/main/main.c | 15 +
 src/core/mainloop/connection.c  |  3 ++
 src/core/mainloop/mainloop.c| 34 +--
 src/core/mainloop/mainloop.h|  1 +
 src/core/mainloop/netstatus.c   | 73 +
 src/core/mainloop/netstatus.h   |  7 
 src/core/or/or.h|  2 ++
 src/feature/client/dnsserv.c|  4 +++
 src/feature/control/control.c   |  2 ++
 src/test/test_compat_libevent.c |  1 -
 src/test/test_periodic_event.c  | 11 ++-
 11 files changed, 149 insertions(+), 4 deletions(-)

diff --git a/src/app/main/main.c b/src/app/main/main.c
index b8dcb852d..03b3a95d0 100644
--- a/src/app/main/main.c
+++ b/src/app/main/main.c
@@ -303,6 +303,19 @@ process_signal(int sig)
   log_heartbeat(time(NULL));
   control_event_signal(sig);
   break;
+case SIGACTIVE:
+  /* "SIGACTIVE" counts as ersatz user activity. */
+  note_user_activity(approx_time());
+  control_event_signal(sig);
+  break;
+case SIGDORMANT:
+  /* "SIGDORMANT" means to ignore past user activity */
+  log_notice(LD_GENERAL, "Going dormant because of controller request.");
+  reset_user_activity(0);
+  set_network_participation(false);
+  schedule_rescan_periodic_events();
+  control_event_signal(sig);
+  break;
   }
 }
 
@@ -472,6 +485,8 @@ static struct {
   { SIGNEWNYM, 0, NULL },
   { SIGCLEARDNSCACHE, 0, NULL },
   { SIGHEARTBEAT, 0, NULL },
+  { SIGACTIVE, 0, NULL },
+  { SIGDORMANT, 0, NULL },
   { -1, -1, NULL }
 };
 
diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c
index 1198a01ad..e0f1680c9 100644
--- a/src/core/mainloop/connection.c
+++ b/src/core/mainloop/connection.c
@@ -1874,6 +1874,9 @@ connection_init_accepted_conn(connection_t *conn,
   TO_ENTRY_CONN(conn)->nym_epoch = get_signewnym_epoch();
   TO_ENTRY_CONN(conn)->socks_request->listener_type = listener->base_.type;
 
+  /* Any incoming connection on an entry port counts as user activity. */
+  note_user_activity(approx_time());
+
   switch (TO_CONN(listener)->type) {
 case CONN_TYPE_AP_LISTENER:
   conn->state = AP_CONN_STATE_SOCKS_WAIT;
diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index e67ebdb4a..f18db2898 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -1513,8 +1513,7 @@ get_my_roles(const or_options_t *options)
   options->ControlPort_set ||
   options->OwningControllerFD != UINT64_MAX;
 
-  /* We actually want a better definition here for our work on dormancy. */
-  int is_net_participant = ! net_is_disabled();
+  int is_net_participant = is_participating_on_network();
 
   if (is_bridge) roles |= PERIODIC_EVENT_ROLE_BRIDGE;
   if (is_client) roles |= PERIODIC_EVENT_ROLE_CLIENT;
@@ -1592,6 +1591,30 @@ teardown_periodic_events(void)
   periodic_events_initialized = 0;
 }
 
+static mainloop_event_t *rescan_periodic_events_ev = NULL;
+
+/** Callback: rescan the periodic event list. */
+static void
+rescan_periodic_events_cb(mainloop_event_t *event, void *arg)
+{
+  (void)event;
+  (void)arg;
+  rescan_periodic_events(get_options());
+}
+
+/**
+ * Schedule an event that will rescan which periodic events should run.
+ **/
+void
+schedule_rescan_periodic_events(void)
+{
+  if (!rescan_periodic_events_ev) {
+rescan_periodic_events_ev =
+  mainloop_event_new(rescan_periodic_events_cb, NULL);
+  }
+  mainloop_event_activate(rescan_periodic_events_ev);
+}
+
 /** Do a pass at all our periodic events, disable those we don't need anymore
  * and enable those we need now using the given options. */
 void
@@ -2714,6 +2737,12 @@ initialize_mainloop_events(void)
 int
 do_main_loop(void)
 {
+  /* For now, starting Tor always counts as user activity. Later, we might
+   * have an option to control this.
+   */
+  reset_user_activity(approx_time());
+  set_network_participation(true);
+
   /* initialize the periodic events first, so that code that depends on the
* events being present does not assert.
*/
@@ -2912,6 +2941,7 @@ tor_mainloop_free_all(void)
   mainloop_event_free(postloop_cleanup_ev);
   mainloop_event_free(handle_deferred_signewnym_ev);
   mainloop_event_free(scheduled_shutdown_ev);
+  mainloop_event_free(rescan_periodic_events_ev);
 
 #ifdef HAVE_SYSTEMD_209
   periodic_timer_free(systemd_watchdog_timer);
diff --git a/src/core/mainloop/mainloop.h b/src/core/mainloop/mainloop.h
index be642d81f..7f27ef9a5 100644
--- a/src/core/mainloop/mainloop.h
+++ b/src/core/mainloop/mainloop.h
@@ -65,6 +65,7 @@ void reschedule_or_state_save(void);
 void reschedule_dirvote(const 

[tor-commits] [tor/master] Remove run_scheduled_events() as a separate function.

2018-11-26 Thread nickm
commit e535ec8542a1d42243c0b6ae28036aec8262269b
Author: Nick Mathewson 
Date:   Tue Nov 13 08:36:38 2018 -0500

Remove run_scheduled_events() as a separate function.

(There was nothing else in second_elapsed_callbck() that couldn't go
here.)
---
 src/core/mainloop/mainloop.c | 35 +++
 1 file changed, 11 insertions(+), 24 deletions(-)

diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index a9d5d8155..ebf9735d4 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -1727,13 +1727,22 @@ safe_timer_diff(time_t now, time_t next)
 }
 
 /** Perform regular maintenance tasks.  This function gets run once per
- * second by second_elapsed_callback().
+ * second.
  */
 static void
-run_scheduled_events(time_t now)
+second_elapsed_callback(periodic_timer_t *timer, void *arg)
 {
+  (void) timer;
+  (void) arg;
+  const time_t now = time(NULL);
   const or_options_t *options = get_options();
 
+  /* 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);
+
   /* 0. See if we've been asked to shut down and our timeout has
* expired; or if our bandwidth limits are exhausted and we
* should hibernate; or if it's time to wake up from hibernation.
@@ -2642,28 +2651,6 @@ update_current_time(time_t now)
   current_second = now;
 }
 
-/** Libevent callback: invoked once every second. */
-static void
-second_elapsed_callback(periodic_timer_t *timer, void *arg)
-{
-  /*  This could be sensibly refactored into multiple callbacks, and we
-   * could use Libevent's timers for this rather than checking the current
-   * time against a bunch of timeouts every second. */
-  time_t now;
-  (void)timer;
-  (void)arg;
-
-  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);
-
-  run_scheduled_events(now);
-}
-
 #ifdef HAVE_SYSTEMD_209
 static periodic_timer_t *systemd_watchdog_timer = NULL;
 



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


[tor-commits] [tor/master] Use macros to make the periodic event table less verbose.

2018-11-26 Thread nickm
commit 2070765c7c062c505358d0f1c83f2846181d1667
Author: Nick Mathewson 
Date:   Mon Nov 5 16:09:13 2018 -0500

Use macros to make the periodic event table less verbose.
---
 src/core/mainloop/mainloop.c | 78 
 1 file changed, 35 insertions(+), 43 deletions(-)

diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index 7eff82fee..12820888f 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -1370,74 +1370,66 @@ CALLBACK(write_stats_file);
 #undef CALLBACK
 
 /* Now we declare an array of periodic_event_item_t for each periodic event */
-#define CALLBACK(name, r, f) PERIODIC_EVENT(name, r, f)
+#define CALLBACK(name, r, f) \
+  PERIODIC_EVENT(name, PERIODIC_EVENT_ROLE_ ## r, f)
+#define FL(name) (PERIODIC_EVENT_FLAG_ ## name)
 
 STATIC periodic_event_item_t periodic_events[] = {
   /* Everyone needs to run those. */
-  CALLBACK(add_entropy, PERIODIC_EVENT_ROLE_ALL, 0),
-  CALLBACK(check_expired_networkstatus, PERIODIC_EVENT_ROLE_ALL, 0),
-  CALLBACK(clean_caches, PERIODIC_EVENT_ROLE_ALL, 0),
-  CALLBACK(fetch_networkstatus, PERIODIC_EVENT_ROLE_ALL,
-   PERIODIC_EVENT_FLAG_NEED_NET),
-  CALLBACK(heartbeat, PERIODIC_EVENT_ROLE_ALL, 0),
-  CALLBACK(launch_descriptor_fetches, PERIODIC_EVENT_ROLE_ALL,
-   PERIODIC_EVENT_FLAG_NEED_NET),
-  CALLBACK(reset_padding_counts, PERIODIC_EVENT_ROLE_ALL, 0),
-  CALLBACK(retry_listeners, PERIODIC_EVENT_ROLE_ALL,
-   PERIODIC_EVENT_FLAG_NEED_NET),
-  CALLBACK(save_state, PERIODIC_EVENT_ROLE_ALL, 0),
-  CALLBACK(rotate_x509_certificate, PERIODIC_EVENT_ROLE_ALL, 0),
-  CALLBACK(write_stats_file, PERIODIC_EVENT_ROLE_ALL, 0),
+  CALLBACK(add_entropy, ALL, 0),
+  CALLBACK(check_expired_networkstatus, ALL, 0),
+  CALLBACK(clean_caches, ALL, 0),
+  CALLBACK(fetch_networkstatus, ALL, 0),
+  CALLBACK(heartbeat, ALL, 0),
+  CALLBACK(launch_descriptor_fetches, ALL, FL(NEED_NET)),
+  CALLBACK(reset_padding_counts, ALL, 0),
+  CALLBACK(retry_listeners, ALL, FL(NEED_NET)),
+  CALLBACK(save_state, ALL, 0),
+  CALLBACK(rotate_x509_certificate, ALL, 0),
+  CALLBACK(write_stats_file, ALL, 0),
 
   /* Routers (bridge and relay) only. */
-  CALLBACK(check_descriptor, PERIODIC_EVENT_ROLE_ROUTER,
-   PERIODIC_EVENT_FLAG_NEED_NET),
-  CALLBACK(check_ed_keys, PERIODIC_EVENT_ROLE_ROUTER, 0),
-  CALLBACK(check_for_reachability_bw, PERIODIC_EVENT_ROLE_ROUTER,
-   PERIODIC_EVENT_FLAG_NEED_NET),
-  CALLBACK(check_onion_keys_expiry_time, PERIODIC_EVENT_ROLE_ROUTER, 0),
-  CALLBACK(expire_old_ciruits_serverside, PERIODIC_EVENT_ROLE_ROUTER,
-   PERIODIC_EVENT_FLAG_NEED_NET),
-  CALLBACK(reachability_warnings, PERIODIC_EVENT_ROLE_ROUTER,
-   PERIODIC_EVENT_FLAG_NEED_NET),
-  CALLBACK(retry_dns, PERIODIC_EVENT_ROLE_ROUTER, 0),
-  CALLBACK(rotate_onion_key, PERIODIC_EVENT_ROLE_ROUTER, 0),
+  CALLBACK(check_descriptor, ROUTER, FL(NEED_NET)),
+  CALLBACK(check_ed_keys, ROUTER, 0),
+  CALLBACK(check_for_reachability_bw, ROUTER, FL(NEED_NET)),
+  CALLBACK(check_onion_keys_expiry_time, ROUTER, 0),
+  CALLBACK(expire_old_ciruits_serverside, ROUTER, FL(NEED_NET)),
+  CALLBACK(reachability_warnings, ROUTER, FL(NEED_NET)),
+  CALLBACK(retry_dns, ROUTER, 0),
+  CALLBACK(rotate_onion_key, ROUTER, 0),
 
   /* Authorities (bridge and directory) only. */
-  CALLBACK(downrate_stability, PERIODIC_EVENT_ROLE_AUTHORITIES, 0),
-  CALLBACK(launch_reachability_tests, PERIODIC_EVENT_ROLE_AUTHORITIES,
-   PERIODIC_EVENT_FLAG_NEED_NET),
-  CALLBACK(save_stability, PERIODIC_EVENT_ROLE_AUTHORITIES, 0),
+  CALLBACK(downrate_stability, AUTHORITIES, 0),
+  CALLBACK(launch_reachability_tests, AUTHORITIES, FL(NEED_NET)),
+  CALLBACK(save_stability, AUTHORITIES, 0),
 
   /* Directory authority only. */
-  CALLBACK(check_authority_cert, PERIODIC_EVENT_ROLE_DIRAUTH, 0),
-  CALLBACK(dirvote, PERIODIC_EVENT_ROLE_DIRAUTH, PERIODIC_EVENT_FLAG_NEED_NET),
+  CALLBACK(check_authority_cert, DIRAUTH, 0),
+  CALLBACK(dirvote, DIRAUTH, FL(NEED_NET)),
 
   /* Relay only. */
-  CALLBACK(check_canonical_channels, PERIODIC_EVENT_ROLE_RELAY,
-   PERIODIC_EVENT_FLAG_NEED_NET),
-  CALLBACK(check_dns_honesty, PERIODIC_EVENT_ROLE_RELAY,
-   PERIODIC_EVENT_FLAG_NEED_NET),
+  CALLBACK(check_canonical_channels, RELAY, FL(NEED_NET)),
+  CALLBACK(check_dns_honesty, RELAY, FL(NEED_NET)),
 
   /* Hidden Service service only. */
-  CALLBACK(hs_service, PERIODIC_EVENT_ROLE_HS_SERVICE,
-   PERIODIC_EVENT_FLAG_NEED_NET),
+  CALLBACK(hs_service, HS_SERVICE, FL(NEED_NET)),
 
   /* Bridge only. */
-  CALLBACK(record_bridge_stats, PERIODIC_EVENT_ROLE_BRIDGE, 0),
+  CALLBACK(record_bridge_stats, BRIDGE, 0),
 
   /* Client only. */
-  CALLBACK(rend_cache_failure_clean, PERIODIC_EVENT_ROLE_CLIENT, 0),
+  CALLBACK(rend_cache_failure_clean, CLIENT, 0),
 
   /* Bridge Authority only. */
-  CALLBACK(write_bridge_ns, PERIODIC_EVENT_ROLE_BRIDGEAUTH, 0),
+  CALLBACK(write_bridge_ns, BRIDGEAUTH, 0),
 
   /* 

[tor-commits] [tor/master] Move control_per_second_events() into a callback with its own role

2018-11-26 Thread nickm
commit a0380b705daceb69c29ccda3a2f1453b9dcbc40d
Author: Nick Mathewson 
Date:   Tue Nov 13 08:22:58 2018 -0500

Move control_per_second_events() into a callback with its own role

Part of making extra-dormant mode work; closes ticket 28421.
---
 src/core/mainloop/mainloop.c   | 29 +++--
 src/core/mainloop/periodic.h   |  5 +++--
 src/feature/control/control.c  |  2 +-
 src/test/test_periodic_event.c |  3 ++-
 4 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index 7e5e5d0ef..a9d5d8155 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -1366,6 +1366,7 @@ CALLBACK(save_stability);
 CALLBACK(save_state);
 CALLBACK(write_bridge_ns);
 CALLBACK(write_stats_file);
+CALLBACK(control_per_second_events);
 
 #undef CALLBACK
 
@@ -1439,6 +1440,9 @@ STATIC periodic_event_item_t periodic_events[] = {
   /* Directory server only. */
   CALLBACK(clean_consdiffmgr, DIRSERVER, 0),
 
+  /* Controller with per-second events only. */
+  CALLBACK(control_per_second_events, CONTROLEV, 0),
+
   END_OF_PERIODIC_EVENTS
 };
 #undef CALLBACK
@@ -1498,6 +1502,8 @@ get_my_roles(const or_options_t *options)
   int is_hidden_service = !!hs_service_get_num_services() ||
   !!rend_num_services();
   int is_dirserver = dir_server_mode(options);
+  int sending_control_events = control_any_per_second_event_enabled();
+
   /* We also consider tor to have the role of a client if the ControlPort is
* set because a lot of things can be done over the control port which
* requires tor to have basic functionnalities. */
@@ -1516,6 +1522,7 @@ get_my_roles(const or_options_t *options)
   if (is_hidden_service) roles |= PERIODIC_EVENT_ROLE_HS_SERVICE;
   if (is_dirserver) roles |= PERIODIC_EVENT_ROLE_DIRSERVER;
   if (is_net_participant) roles |= PERIODIC_EVENT_ROLE_NET_PARTICIPANT;
+  if (sending_control_events) roles |= PERIODIC_EVENT_ROLE_CONTROLEV;
 
   return roles;
 }
@@ -2524,6 +2531,21 @@ hs_service_callback(time_t now, const or_options_t 
*options)
   return 1;
 }
 
+/*
+ * Periodic callback: Send once-per-second events to the controller(s).
+ * This is called every second.
+ */
+static int
+control_per_second_events_callback(time_t now, const or_options_t *options)
+{
+  (void) options;
+  (void) now;
+
+  control_per_second_events();
+
+  return 1;
+}
+
 /** Timer: used to invoke second_elapsed_callback() once per second. */
 static periodic_timer_t *second_timer = NULL;
 
@@ -2546,8 +2568,7 @@ reschedule_per_second_timer(void)
 tor_assert(second_timer);
   }
 
-  const bool run_per_second_events =
-control_any_per_second_event_enabled() || ! net_is_completely_disabled();
+  const bool run_per_second_events = ! net_is_completely_disabled();
 
   if (run_per_second_events) {
 periodic_timer_launch(second_timer, _second);
@@ -2640,10 +2661,6 @@ second_elapsed_callback(periodic_timer_t *timer, void 
*arg)
*/
   update_current_time(now);
 
-  // TODO  Turn this into a separate event.
-  /* Maybe some controller events are ready to fire */
-  control_per_second_events();
-
   run_scheduled_events(now);
 }
 
diff --git a/src/core/mainloop/periodic.h b/src/core/mainloop/periodic.h
index 23459ff2b..52d5450ee 100644
--- a/src/core/mainloop/periodic.h
+++ b/src/core/mainloop/periodic.h
@@ -15,9 +15,10 @@
 #define PERIODIC_EVENT_ROLE_BRIDGEAUTH  (1U << 4)
 #define PERIODIC_EVENT_ROLE_HS_SERVICE  (1U << 5)
 #define PERIODIC_EVENT_ROLE_DIRSERVER   (1U << 6)
+#define PERIODIC_EVENT_ROLE_CONTROLEV   (1U << 7)
 
-#define PERIODIC_EVENT_ROLE_NET_PARTICIPANT (1U << 7)
-#define PERIODIC_EVENT_ROLE_ALL (1U << 8)
+#define PERIODIC_EVENT_ROLE_NET_PARTICIPANT (1U << 8)
+#define PERIODIC_EVENT_ROLE_ALL (1U << 9)
 
 /* Helper macro to make it a bit less annoying to defined groups of roles that
  * are often used. */
diff --git a/src/feature/control/control.c b/src/feature/control/control.c
index b31b448e9..a5b6ab3bf 100644
--- a/src/feature/control/control.c
+++ b/src/feature/control/control.c
@@ -368,7 +368,7 @@ control_update_global_event_mask(void)
 control_get_bytes_rw_last_sec(, );
   }
   if (any_old_per_sec_events != control_any_per_second_event_enabled()) {
-reschedule_per_second_timer();
+rescan_periodic_events(get_options());
   }
 
 #undef NEWLY_ENABLED
diff --git a/src/test/test_periodic_event.c b/src/test/test_periodic_event.c
index f63adf8e3..6a3e320b2 100644
--- a/src/test/test_periodic_event.c
+++ b/src/test/test_periodic_event.c
@@ -172,7 +172,8 @@ test_pe_launch(void *arg)
 
   for (int i = 0; periodic_events[i].name; ++i) {
 periodic_event_item_t *item = _events[i];
-tt_int_op(periodic_event_is_enabled(item), OP_EQ, 1);
+tt_int_op(periodic_event_is_enabled(item), OP_EQ,
+  (item->roles != PERIODIC_EVENT_ROLE_CONTROLEV));
   }
 
  done:



___
tor-commits mailing 

[tor-commits] [tor/master] reset_padding_counts is only once per 24h; it can be all.

2018-11-26 Thread nickm
commit dc21f1f6625ba35a6888190a601efded9cfa5e5e
Author: Nick Mathewson 
Date:   Tue Nov 13 10:43:08 2018 -0500

reset_padding_counts is only once per 24h; it can be all.
---
 src/core/mainloop/mainloop.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index 176399b33..6df51062a 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -1376,9 +1376,11 @@ CALLBACK(second_elapsed);
 #define FL(name) (PERIODIC_EVENT_FLAG_ ## name)
 
 STATIC periodic_event_item_t periodic_events[] = {
-  /* Everyone needs to run those. */
+  /* Everyone needs to run these. They need to have very long timeouts for
+   * that to be safe. */
   CALLBACK(add_entropy, ALL, 0),
   CALLBACK(heartbeat, ALL, 0),
+  CALLBACK(reset_padding_counts, ALL, 0),
 
   /* This is a legacy catch-all callback that runs once per second if
* we are online and active. */
@@ -1403,9 +1405,6 @@ STATIC periodic_event_item_t periodic_events[] = {
   /*  investigate this. ??? */
   CALLBACK(write_stats_file, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
 
-  /*  investigate this.  */
-  CALLBACK(reset_padding_counts, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
-
   /* Routers (bridge and relay) only. */
   CALLBACK(check_descriptor, ROUTER, FL(NEED_NET)),
   CALLBACK(check_ed_keys, ROUTER, 0),



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


[tor-commits] [tor/master] Annotate 1/s callback elements with NET_PARTICIPANT status.

2018-11-26 Thread nickm
commit db53bfe8f74dad1b45ba381a5ee3366148a30237
Author: Nick Mathewson 
Date:   Tue Nov 6 11:14:50 2018 -0500

Annotate 1/s callback elements with NET_PARTICIPANT status.
---
 src/core/mainloop/mainloop.c | 28 ++--
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index 3c3f441a9..7e5e5d0ef 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -1379,8 +1379,9 @@ STATIC periodic_event_item_t periodic_events[] = {
   CALLBACK(add_entropy, ALL, 0),
   CALLBACK(heartbeat, ALL, 0),
 
-  /*  Do we have a reason to do this on a callback? */
-  CALLBACK(retry_listeners, ALL, FL(NEED_NET)),
+  /*  Do we have a reason to do this on a callback? Does it do any good at
+   * all?  For now, if we're dormant, we can let our listeners decay. */
+  CALLBACK(retry_listeners, NET_PARTICIPANT, FL(NEED_NET)),
 
   /* We need to do these if we're participating in the Tor network. */
   CALLBACK(check_expired_networkstatus, NET_PARTICIPANT, 0),
@@ -1393,10 +1394,10 @@ STATIC periodic_event_item_t periodic_events[] = {
   CALLBACK(clean_caches, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
   CALLBACK(save_state, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
 
-  /*  investigate this. */
+  /*  investigate this. ??? */
   CALLBACK(write_stats_file, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
 
-  /*  investigate this. */
+  /*  investigate this.  */
   CALLBACK(reset_padding_counts, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
 
   /* Routers (bridge and relay) only. */
@@ -1423,13 +1424,13 @@ STATIC periodic_event_item_t periodic_events[] = {
   CALLBACK(check_dns_honesty, RELAY, FL(NEED_NET)),
 
   /* Hidden Service service only. */
-  CALLBACK(hs_service, HS_SERVICE, FL(NEED_NET)),
+  CALLBACK(hs_service, HS_SERVICE, FL(NEED_NET)), //  break this down more
 
   /* Bridge only. */
   CALLBACK(record_bridge_stats, BRIDGE, 0),
 
   /* Client only. */
-  /*  this could be restricted to CLIENT even. */
+  /*  this could be restricted to CLIENT+NET_PARTICIPANT */
   CALLBACK(rend_cache_failure_clean, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
 
   /* Bridge Authority only. */
@@ -1730,18 +1731,24 @@ run_scheduled_events(time_t now)
* expired; or if our bandwidth limits are exhausted and we
* should hibernate; or if it's time to wake up from hibernation.
*/
+  // TODO: Refactor or rewrite, or NET_PARTICIPANT. Needs separate wakeup
+  //   handling.
   consider_hibernation(now);
 
   /* Maybe enough time elapsed for us to reconsider a circuit. */
+  // TODO: NET_PARTICIPANT
   circuit_upgrade_circuits_from_guard_wait();
 
   if (options->UseBridges && !net_is_disabled()) {
 /* Note: this check uses net_is_disabled(), not should_delay_dir_fetches()
  * -- the latter is only for fetching consensus-derived directory info. */
+// TODO: client+NET_PARTICIPANT.
+// Also, schedule this rather than probing 1x / sec
 fetch_bridge_descriptors(options, now);
   }
 
   if (accounting_is_enabled(options)) {
+// TODO: refactor or rewrite; NET_PARTICIPANT
 accounting_run_housekeeping(now);
   }
 
@@ -1752,6 +1759,7 @@ run_scheduled_events(time_t now)
*/
   /* (If our circuit build timeout can ever become lower than a second (which
* it can't, currently), we should do this more often.) */
+  // TODO: All expire stuff can become NET_PARTICIPANT, FLUSH_ON_DISABLE
   circuit_expire_building();
   circuit_expire_waiting_for_better_guard();
 
@@ -1760,10 +1768,12 @@ run_scheduled_events(time_t now)
* Do this before step 4, so we can put them back into pending
* state to be picked up by the new circuit.
*/
+  // TODO: All expire stuff can become NET_PARTICIPANT, FLUSH_ON_DISABLE
   connection_ap_expire_beginning();
 
   /* 3c. And expire connections that we've held open for too long.
*/
+  // TODO: All expire stuff can become NET_PARTICIPANT, FLUSH_ON_DISABLE
   connection_expire_held_open();
 
   /* 4. Every second, we try a new circuit if there are no valid
@@ -1773,19 +1783,24 @@ run_scheduled_events(time_t now)
*/
   const int have_dir_info = router_have_minimum_dir_info();
   if (have_dir_info && !net_is_disabled()) {
+// TODO: NET_PARTICIPANT.
 circuit_build_needed_circs(now);
   } else {
+// TODO: NET_PARTICIPANT, FLUSH_ON_DISABLE
 circuit_expire_old_circs_as_needed(now);
   }
 
   /* 5. We do housekeeping for each connection... */
+  // TODO: NET_PARTICIPANT
   channel_update_bad_for_new_circs(NULL, 0);
   int i;
   for (i=0;ihttps://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Add new "ALL" and "NET_PARTICIPANT" roles for periodic events

2018-11-26 Thread nickm
commit b9a88bd53ae79a29c292275381bc7dbaa3804034
Author: Nick Mathewson 
Date:   Tue Nov 6 07:27:31 2018 -0500

Add new "ALL" and "NET_PARTICIPANT" roles for periodic events

The previous "ALL" role was the OR of a bunch of other roles,
which is a mistake: it's better if "ALL" means "all".

The "NET_PARTICIPANT" role refers to the anything that is actively
building circuits, downloading directory information, and
participating in the Tor network.  For now, it is set to
!net_is_disabled(), but we're going to use it to implement a new
"extra dormant mode".

Closes ticket 28336.
---
 src/core/mainloop/mainloop.c   | 36 ++-
 src/core/mainloop/periodic.h   |  7 +++---
 src/test/test_periodic_event.c | 49 ++
 3 files changed, 60 insertions(+), 32 deletions(-)

diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index 42f6fb50c..3c3f441a9 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -1377,16 +1377,27 @@ CALLBACK(write_stats_file);
 STATIC periodic_event_item_t periodic_events[] = {
   /* Everyone needs to run those. */
   CALLBACK(add_entropy, ALL, 0),
-  CALLBACK(check_expired_networkstatus, ALL, 0),
-  CALLBACK(clean_caches, ALL, 0),
-  CALLBACK(fetch_networkstatus, ALL, 0),
   CALLBACK(heartbeat, ALL, 0),
-  CALLBACK(launch_descriptor_fetches, ALL, FL(NEED_NET)),
-  CALLBACK(reset_padding_counts, ALL, 0),
+
+  /*  Do we have a reason to do this on a callback? */
   CALLBACK(retry_listeners, ALL, FL(NEED_NET)),
-  CALLBACK(save_state, ALL, 0),
-  CALLBACK(rotate_x509_certificate, ALL, 0),
-  CALLBACK(write_stats_file, ALL, 0),
+
+  /* We need to do these if we're participating in the Tor network. */
+  CALLBACK(check_expired_networkstatus, NET_PARTICIPANT, 0),
+  CALLBACK(fetch_networkstatus, NET_PARTICIPANT, 0),
+  CALLBACK(launch_descriptor_fetches, NET_PARTICIPANT, FL(NEED_NET)),
+  CALLBACK(rotate_x509_certificate, NET_PARTICIPANT, 0),
+
+  /* We need to do these if we're participating in the Tor network, and
+   * immediately before we stop. */
+  CALLBACK(clean_caches, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
+  CALLBACK(save_state, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
+
+  /*  investigate this. */
+  CALLBACK(write_stats_file, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
+
+  /*  investigate this. */
+  CALLBACK(reset_padding_counts, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
 
   /* Routers (bridge and relay) only. */
   CALLBACK(check_descriptor, ROUTER, FL(NEED_NET)),
@@ -1418,7 +1429,8 @@ STATIC periodic_event_item_t periodic_events[] = {
   CALLBACK(record_bridge_stats, BRIDGE, 0),
 
   /* Client only. */
-  CALLBACK(rend_cache_failure_clean, CLIENT, 0),
+  /*  this could be restricted to CLIENT even. */
+  CALLBACK(rend_cache_failure_clean, NET_PARTICIPANT, FL(FLUSH_ON_DISABLE)),
 
   /* Bridge Authority only. */
   CALLBACK(write_bridge_ns, BRIDGEAUTH, 0),
@@ -1477,7 +1489,7 @@ get_my_roles(const or_options_t *options)
 {
   tor_assert(options);
 
-  int roles = 0;
+  int roles = PERIODIC_EVENT_ROLE_ALL;
   int is_bridge = options->BridgeRelay;
   int is_relay = server_mode(options);
   int is_dirauth = authdir_mode_v3(options);
@@ -1492,6 +1504,9 @@ get_my_roles(const or_options_t *options)
   options->ControlPort_set ||
   options->OwningControllerFD != UINT64_MAX;
 
+  /* We actually want a better definition here for our work on dormancy. */
+  int is_net_participant = ! net_is_disabled();
+
   if (is_bridge) roles |= PERIODIC_EVENT_ROLE_BRIDGE;
   if (is_client) roles |= PERIODIC_EVENT_ROLE_CLIENT;
   if (is_relay) roles |= PERIODIC_EVENT_ROLE_RELAY;
@@ -1499,6 +1514,7 @@ get_my_roles(const or_options_t *options)
   if (is_bridgeauth) roles |= PERIODIC_EVENT_ROLE_BRIDGEAUTH;
   if (is_hidden_service) roles |= PERIODIC_EVENT_ROLE_HS_SERVICE;
   if (is_dirserver) roles |= PERIODIC_EVENT_ROLE_DIRSERVER;
+  if (is_net_participant) roles |= PERIODIC_EVENT_ROLE_NET_PARTICIPANT;
 
   return roles;
 }
diff --git a/src/core/mainloop/periodic.h b/src/core/mainloop/periodic.h
index 7c71be7bc..23459ff2b 100644
--- a/src/core/mainloop/periodic.h
+++ b/src/core/mainloop/periodic.h
@@ -16,6 +16,9 @@
 #define PERIODIC_EVENT_ROLE_HS_SERVICE  (1U << 5)
 #define PERIODIC_EVENT_ROLE_DIRSERVER   (1U << 6)
 
+#define PERIODIC_EVENT_ROLE_NET_PARTICIPANT (1U << 7)
+#define PERIODIC_EVENT_ROLE_ALL (1U << 8)
+
 /* Helper macro to make it a bit less annoying to defined groups of roles that
  * are often used. */
 
@@ -25,10 +28,6 @@
 /* Authorities that is both bridge and directory. */
 #define PERIODIC_EVENT_ROLE_AUTHORITIES \
   (PERIODIC_EVENT_ROLE_BRIDGEAUTH | PERIODIC_EVENT_ROLE_DIRAUTH)
-/* All roles. */
-#define PERIODIC_EVENT_ROLE_ALL \
-  (PERIODIC_EVENT_ROLE_AUTHORITIES | PERIODIC_EVENT_ROLE_CLIENT | \
-   PERIODIC_EVENT_ROLE_HS_SERVICE | PERIODIC_EVENT_ROLE_ROUTER)
 
 /*
  * Event flags 

[tor-commits] [stem/master] Use newer cached microdescriptors if available

2018-11-26 Thread atagar
commit ddb1a360dac0a22c084e884f10c1bc7327cf7f7d
Author: Damian Johnson 
Date:   Mon Nov 26 13:04:23 2018 -0800

Use newer cached microdescriptors if available

Our data directory has up to two microdescriptor files: cached-microdescs 
and
cached-microdescs.new.

If the former is unavailable but the later is present we should use it...

  https://trac.torproject.org/projects/tor/ticket/28508

Maybe more important, when looking into this I realized that our attempt to 
get
tor's data directory stacktraces if not explicitly present in the torrc...

  >>> list(controller.get_microdescriptors())
  Traceback (most recent call last):
File "", line 1, in 
File "/home/atagar/Desktop/stem/stem/control.py", line 490, in wrapped
  for val in func(self, *args, **kwargs):
File "/home/atagar/Desktop/stem/stem/control.py", line 1791, in 
get_microdescriptors
  if not os.path.exists(data_directory):
File "/usr/lib/python2.7/genericpath.py", line 26, in exists
  os.stat(path)
  TypeError: coercing to Unicode: need string or buffer, NoneType found

Changed it so we'll instead provide a generic exception saying we were 
unable
to determine the data directory. Fortunatley this whole thing is a 
fallback, so
eventually we'll be able to remove it.
---
 stem/control.py | 35 +--
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index 68873d76..6d926ff0 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -1783,27 +1783,34 @@ class Controller(BaseController):
 else:
   # TODO: remove when tor versions that require this are obsolete
 
-  try:
-data_directory = self.get_conf('DataDirectory')
-  except stem.ControllerError as exc:
-raise stem.OperationFailed(message = 'Unable to determine the data 
directory (%s)' % exc)
+  data_directory = self.get_conf('DataDirectory', None)
 
-  cached_descriptor_path = os.path.join(data_directory, 
'cached-microdescs')
+  if data_directory is None:
+raise stem.OperationFailed(message = "Unable to determine tor's data 
directory")
 
   if not os.path.exists(data_directory):
 raise stem.OperationFailed(message = "Data directory reported by tor 
doesn't exist (%s)" % data_directory)
-  elif not os.path.exists(cached_descriptor_path):
-raise stem.OperationFailed(message = "Data directory doesn't contain 
cached microdescriptors (%s)" % cached_descriptor_path)
 
-  with stem.descriptor.reader.DescriptorReader([cached_descriptor_path]) 
as reader:
-for desc in reader:
-  # It shouldn't be possible for these to be something other than
-  # microdescriptors but as the saying goes: trust but verify.
+  microdescriptor_file = None
+
+  for filename in ('cached-microdescs', 'cached-microdescs.new'):
+cached_descriptors = os.path.join(data_directory, filename)
+
+if os.path.exists(cached_descriptors):
+  microdescriptor_file = cached_descriptors
+  break
+
+  if microdescriptor_file is None:
+raise stem.OperationFailed(message = "Data directory doesn't contain 
cached microdescriptors (%s)" % data_directory)
 
-  if not isinstance(desc, 
stem.descriptor.microdescriptor.Microdescriptor):
-raise stem.OperationFailed(message = 'BUG: Descriptor reader 
provided non-microdescriptor content (%s)' % type(desc))
+  for desc in stem.descriptor.parse_file(microdescriptor_file):
+# It shouldn't be possible for these to be something other than
+# microdescriptors but as the saying goes: trust but verify.
 
-  yield desc
+if not isinstance(desc, 
stem.descriptor.microdescriptor.Microdescriptor):
+  raise stem.OperationFailed(message = 'BUG: Descriptor reader 
provided non-microdescriptor content (%s)' % type(desc))
+
+yield desc
 
   @with_default()
   def get_server_descriptor(self, relay = None, default = UNDEFINED):

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


[tor-commits] [translation/donatepages-messagespot] Update translations for donatepages-messagespot

2018-11-26 Thread translation
commit f38b487d512e1b702d039ccbe73af1061c09035e
Author: Translation commit bot 
Date:   Mon Nov 26 20:45:21 2018 +

Update translations for donatepages-messagespot
---
 locale/fr/LC_MESSAGES/messages.po | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/locale/fr/LC_MESSAGES/messages.po 
b/locale/fr/LC_MESSAGES/messages.po
index 5f2ae5ebc..2a1cf5b0d 100644
--- a/locale/fr/LC_MESSAGES/messages.po
+++ b/locale/fr/LC_MESSAGES/messages.po
@@ -264,8 +264,8 @@ msgid ""
 "This page requires Javascript to do PayPal or credit card\n"
 "  donations, but it appears you have Javascript disabled."
 msgstr ""
-"Cette page nécessite Javascript pour faire PayPal ou carte de crédit\n"
-"mais il semble que vous ayez désactivé Javascript."
+"JavaScript est exigé par cette page pour les dons par PayPal\n"
+" ou par carte de crédit, mais il semble que JavaScript est désactivé."
 
 #: 
tmp/cache_locale/c7/c763c19bb6abb9330294c550c8241bb3874e3b4e17fb6e7b15db26c60df8d5fe.php:106
 msgid ""
@@ -273,9 +273,9 @@ msgid ""
 " https://www.torproject.org/donate/donate-options.html.en\;>other "
 "donations options page."
 msgstr ""
-"Si vous souhaitez faire un don sans activer Javascript, veuillez jeter un "
-"coup d’oeil à notre https://www.torproject.org/donate/donate-;
-"options.html.en\">page d’autres options de dons."
+"Si vous souhaitez faire un don sans activer JavaScript, veuillez consulter "
+"notre https://www.torproject.org/donate/donate-;
+"options.html.en\">page sur les autres options de don."
 
 #: 
tmp/cache_locale/c7/c763c19bb6abb9330294c550c8241bb3874e3b4e17fb6e7b15db26c60df8d5fe.php:123
 msgid "Number of Donations"
@@ -287,7 +287,7 @@ msgstr "Total des dons"
 
 #: 
tmp/cache_locale/c7/c763c19bb6abb9330294c550c8241bb3874e3b4e17fb6e7b15db26c60df8d5fe.php:155
 msgid "Total Raised with Mozilla's Match"
-msgstr "Total élevé avec le Match de Mozilla"
+msgstr "Total accumulé avec l’équivalence de don de Mozilla"
 
 #: 
tmp/cache_locale/c7/c763c19bb6abb9330294c550c8241bb3874e3b4e17fb6e7b15db26c60df8d5fe.php:163
 #: 
tmp/cache_locale/c7/c763c19bb6abb9330294c550c8241bb3874e3b4e17fb6e7b15db26c60df8d5fe.php:169
@@ -305,23 +305,24 @@ msgstr "mensuel"
 #: 
tmp/cache_locale/c7/c763c19bb6abb9330294c550c8241bb3874e3b4e17fb6e7b15db26c60df8d5fe.php:178
 #: 
tmp/cache_locale/c7/c763c19bb6abb9330294c550c8241bb3874e3b4e17fb6e7b15db26c60df8d5fe.php:331
 msgid "Want to donate Bitcoin, Stock, or via snail mail?"
-msgstr "Vous voulez faire un don de Bitcoin, Stock, ou par la poste ?"
+msgstr ""
+"Voulez-vous faire un don en bitcoins, en actions, ou par courrier 
escargot ?"
 
 #: 
tmp/cache_locale/c7/c763c19bb6abb9330294c550c8241bb3874e3b4e17fb6e7b15db26c60df8d5fe.php:193
 msgid "invalid amount"
-msgstr "montant non valide"
+msgstr "le montant est invalide"
 
 #: 
tmp/cache_locale/c7/c763c19bb6abb9330294c550c8241bb3874e3b4e17fb6e7b15db26c60df8d5fe.php:197
 msgid "$2 minimum donation"
-msgstr "Don minimum de 2 $."
+msgstr "Don minimal de 2 $"
 
 #: 
tmp/cache_locale/c7/c763c19bb6abb9330294c550c8241bb3874e3b4e17fb6e7b15db26c60df8d5fe.php:201
 msgid "$ other"
-msgstr "autres ($)"
+msgstr "Autre montant"
 
 #: 
tmp/cache_locale/c7/c763c19bb6abb9330294c550c8241bb3874e3b4e17fb6e7b15db26c60df8d5fe.php:208
 msgid "Choose your gift as a token of our thanks."
-msgstr "Choisissez votre cadeau en guise de remerciement."
+msgstr "Choisissez votre cadeau, en témoignage de notre reconnaissance."
 
 #: 
tmp/cache_locale/c7/c763c19bb6abb9330294c550c8241bb3874e3b4e17fb6e7b15db26c60df8d5fe.php:215
 msgid "No thanks, I don't want a gift."

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


[tor-commits] [translation/donatepages-messagespot] Update translations for donatepages-messagespot

2018-11-26 Thread translation
commit 5a807961362be9fa1640f4b53a899f06fc8f81b2
Author: Translation commit bot 
Date:   Mon Nov 26 20:15:22 2018 +

Update translations for donatepages-messagespot
---
 locale/fr/LC_MESSAGES/messages.po | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/locale/fr/LC_MESSAGES/messages.po 
b/locale/fr/LC_MESSAGES/messages.po
index 5bcb9bd34..5f2ae5ebc 100644
--- a/locale/fr/LC_MESSAGES/messages.po
+++ b/locale/fr/LC_MESSAGES/messages.po
@@ -178,8 +178,8 @@ msgid ""
 "The European shirt fits run a little small so you might want to consider "
 "sizing up."
 msgstr ""
-"La chemise européenne est un peu petite, vous devriez donc envisager de la "
-"mettre à votre taille."
+"Le tee-shirt européen taille un peu petit. Vous pourriez donc envisager une "
+"taille plus grande qu’habituellement."
 
 #: 
tmp/cache_locale/ce/ce708c1cd991748e8c1c29f932e6ddbd1be5be1b4cc2c5b49b607cae1df80432.php:36
 msgid "Fit"
@@ -187,15 +187,15 @@ msgstr "Taille"
 
 #: 
tmp/cache_locale/ce/ce708c1cd991748e8c1c29f932e6ddbd1be5be1b4cc2c5b49b607cae1df80432.php:40
 msgid "Select Fit"
-msgstr "Choisissez la taille"
+msgstr "Choisir l’ajustement"
 
 #: 
tmp/cache_locale/ce/ce708c1cd991748e8c1c29f932e6ddbd1be5be1b4cc2c5b49b607cae1df80432.php:44
 msgid "Slim"
-msgstr "Slim"
+msgstr "Ajusté"
 
 #: 
tmp/cache_locale/ce/ce708c1cd991748e8c1c29f932e6ddbd1be5be1b4cc2c5b49b607cae1df80432.php:48
 msgid "Classic"
-msgstr "Classic"
+msgstr "Classique"
 
 #: 
tmp/cache_locale/ce/ce708c1cd991748e8c1c29f932e6ddbd1be5be1b4cc2c5b49b607cae1df80432.php:56
 msgid "European"
@@ -253,7 +253,7 @@ msgstr "L’anonymat est contagieux."
 
 #: 
tmp/cache_locale/c7/c763c19bb6abb9330294c550c8241bb3874e3b4e17fb6e7b15db26c60df8d5fe.php:63
 msgid "summary_large_image"
-msgstr "summary_large_image"
+msgstr "résumé_grande_image"
 
 #: 
tmp/cache_locale/c7/c763c19bb6abb9330294c550c8241bb3874e3b4e17fb6e7b15db26c60df8d5fe.php:67
 msgid "@torproject"

___
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.5] man: ClientOnionAuthDir can't be reloaded with Sandbox 1

2018-11-26 Thread dgoulet
commit f41bec12904d429c17c64eafeb7a3a92a81e614e
Author: David Goulet 
Date:   Thu Nov 15 14:36:39 2018 -0500

man: ClientOnionAuthDir can't be reloaded with Sandbox 1

By adding a file to the ClientOnionAuthDir and sending a HUP signal, tor 
would
load the new file and use it. However, that doesn't work with the Sandbox
since post initilization, nothing can be changed.

Document in the manpage that limitation within the Sandbox description.

Closes #28128

Signed-off-by: David Goulet 
---
 changes/ticket28128 | 4 
 doc/tor.1.txt   | 1 +
 2 files changed, 5 insertions(+)

diff --git a/changes/ticket28128 b/changes/ticket28128
new file mode 100644
index 0..6d08c7424
--- /dev/null
+++ b/changes/ticket28128
@@ -0,0 +1,4 @@
+  o Documentation (hidden service manpage, sandbox):
+- Document in the man page that changing ClientOnionAuthDir value or
+  adding a new file in the directory will not work at runtime upon sending
+  a HUP if Sandbox 1. Closes ticket 28128.
diff --git a/doc/tor.1.txt b/doc/tor.1.txt
index 019c8af75..097db065b 100644
--- a/doc/tor.1.txt
+++ b/doc/tor.1.txt
@@ -611,6 +611,7 @@ GENERAL OPTIONS
 ServerDNSResolvConfFile
 Tor must remain in client or server mode (some changes to ClientOnly and
 ORPort are not allowed).
+ClientOnionAuthDir and any files in it won't reload on HUP signal.
 (Default: 0)
 
 [[Socks4Proxy]] **Socks4Proxy** __host__[:__port__]::



___
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.5] Merge branch 'ticket28128_035_01' into maint-0.3.5

2018-11-26 Thread dgoulet
commit 4bd63bcaeb2f4a2ac06a5371cda15fb9debb85fd
Merge: a9820f072 f41bec129
Author: David Goulet 
Date:   Mon Nov 26 14:56:50 2018 -0500

Merge branch 'ticket28128_035_01' into maint-0.3.5

 changes/ticket28128 | 4 
 doc/tor.1.txt   | 1 +
 2 files changed, 5 insertions(+)



___
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.5] Merge branch 'maint-0.3.5' into release-0.3.5

2018-11-26 Thread dgoulet
commit fc591870b32cf818832f06eceecf355b38bcfa24
Merge: 31d0f9aea 056ffdec4
Author: David Goulet 
Date:   Mon Nov 26 14:59:23 2018 -0500

Merge branch 'maint-0.3.5' into release-0.3.5

___
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.5] man: ClientOnionAuthDir can't be reloaded with Sandbox 1

2018-11-26 Thread dgoulet
commit f41bec12904d429c17c64eafeb7a3a92a81e614e
Author: David Goulet 
Date:   Thu Nov 15 14:36:39 2018 -0500

man: ClientOnionAuthDir can't be reloaded with Sandbox 1

By adding a file to the ClientOnionAuthDir and sending a HUP signal, tor 
would
load the new file and use it. However, that doesn't work with the Sandbox
since post initilization, nothing can be changed.

Document in the manpage that limitation within the Sandbox description.

Closes #28128

Signed-off-by: David Goulet 
---
 changes/ticket28128 | 4 
 doc/tor.1.txt   | 1 +
 2 files changed, 5 insertions(+)

diff --git a/changes/ticket28128 b/changes/ticket28128
new file mode 100644
index 0..6d08c7424
--- /dev/null
+++ b/changes/ticket28128
@@ -0,0 +1,4 @@
+  o Documentation (hidden service manpage, sandbox):
+- Document in the man page that changing ClientOnionAuthDir value or
+  adding a new file in the directory will not work at runtime upon sending
+  a HUP if Sandbox 1. Closes ticket 28128.
diff --git a/doc/tor.1.txt b/doc/tor.1.txt
index 019c8af75..097db065b 100644
--- a/doc/tor.1.txt
+++ b/doc/tor.1.txt
@@ -611,6 +611,7 @@ GENERAL OPTIONS
 ServerDNSResolvConfFile
 Tor must remain in client or server mode (some changes to ClientOnly and
 ORPort are not allowed).
+ClientOnionAuthDir and any files in it won't reload on HUP signal.
 (Default: 0)
 
 [[Socks4Proxy]] **Socks4Proxy** __host__[:__port__]::



___
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 'dgoulet/ticket28128_035_01' into maint-0.3.5

2018-11-26 Thread dgoulet
commit 056ffdec4cd10aac964ca354115ef806869afe81
Merge: a9820f072 f41bec129
Author: David Goulet 
Date:   Mon Nov 26 14:59:10 2018 -0500

Merge remote-tracking branch 'dgoulet/ticket28128_035_01' into maint-0.3.5

 changes/ticket28128 | 4 
 doc/tor.1.txt   | 1 +
 2 files changed, 5 insertions(+)



___
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.5] Merge remote-tracking branch 'dgoulet/ticket28128_035_01' into maint-0.3.5

2018-11-26 Thread dgoulet
commit 056ffdec4cd10aac964ca354115ef806869afe81
Merge: a9820f072 f41bec129
Author: David Goulet 
Date:   Mon Nov 26 14:59:10 2018 -0500

Merge remote-tracking branch 'dgoulet/ticket28128_035_01' into maint-0.3.5

 changes/ticket28128 | 4 
 doc/tor.1.txt   | 1 +
 2 files changed, 5 insertions(+)

___
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.5] Merge remote-tracking branch 'dgoulet/ticket28128_035_01' into maint-0.3.5

2018-11-26 Thread dgoulet
commit 056ffdec4cd10aac964ca354115ef806869afe81
Merge: a9820f072 f41bec129
Author: David Goulet 
Date:   Mon Nov 26 14:59:10 2018 -0500

Merge remote-tracking branch 'dgoulet/ticket28128_035_01' into maint-0.3.5

 changes/ticket28128 | 4 
 doc/tor.1.txt   | 1 +
 2 files changed, 5 insertions(+)



___
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.5'

2018-11-26 Thread dgoulet
commit 2b9a907bdccc588203d2110866d4e7bb72a25773
Merge: 3741f9e52 056ffdec4
Author: David Goulet 
Date:   Mon Nov 26 14:59:24 2018 -0500

Merge branch 'maint-0.3.5'

 changes/ticket28128 | 4 
 doc/tor.1.txt   | 1 +
 2 files changed, 5 insertions(+)

___
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.5] Merge branch 'maint-0.3.5' into release-0.3.5

2018-11-26 Thread dgoulet
commit 31d0f9aea751f17a348d62c39cab6e8ac818b20b
Merge: f60051708 4bd63bcae
Author: David Goulet 
Date:   Mon Nov 26 14:57:56 2018 -0500

Merge branch 'maint-0.3.5' into release-0.3.5

 changes/ticket28128 | 4 
 doc/tor.1.txt   | 1 +
 2 files changed, 5 insertions(+)



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


[tor-commits] [tor/master] man: ClientOnionAuthDir can't be reloaded with Sandbox 1

2018-11-26 Thread dgoulet
commit f41bec12904d429c17c64eafeb7a3a92a81e614e
Author: David Goulet 
Date:   Thu Nov 15 14:36:39 2018 -0500

man: ClientOnionAuthDir can't be reloaded with Sandbox 1

By adding a file to the ClientOnionAuthDir and sending a HUP signal, tor 
would
load the new file and use it. However, that doesn't work with the Sandbox
since post initilization, nothing can be changed.

Document in the manpage that limitation within the Sandbox description.

Closes #28128

Signed-off-by: David Goulet 
---
 changes/ticket28128 | 4 
 doc/tor.1.txt   | 1 +
 2 files changed, 5 insertions(+)

diff --git a/changes/ticket28128 b/changes/ticket28128
new file mode 100644
index 0..6d08c7424
--- /dev/null
+++ b/changes/ticket28128
@@ -0,0 +1,4 @@
+  o Documentation (hidden service manpage, sandbox):
+- Document in the man page that changing ClientOnionAuthDir value or
+  adding a new file in the directory will not work at runtime upon sending
+  a HUP if Sandbox 1. Closes ticket 28128.
diff --git a/doc/tor.1.txt b/doc/tor.1.txt
index 019c8af75..097db065b 100644
--- a/doc/tor.1.txt
+++ b/doc/tor.1.txt
@@ -611,6 +611,7 @@ GENERAL OPTIONS
 ServerDNSResolvConfFile
 Tor must remain in client or server mode (some changes to ClientOnly and
 ORPort are not allowed).
+ClientOnionAuthDir and any files in it won't reload on HUP signal.
 (Default: 0)
 
 [[Socks4Proxy]] **Socks4Proxy** __host__[:__port__]::



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


[tor-commits] [translation/donatepages-messagespot] Update translations for donatepages-messagespot

2018-11-26 Thread translation
commit 7d8a23464dfded52545c2da0bf8380516a50185d
Author: Translation commit bot 
Date:   Mon Nov 26 19:45:20 2018 +

Update translations for donatepages-messagespot
---
 locale/fr/LC_MESSAGES/messages.po | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/locale/fr/LC_MESSAGES/messages.po 
b/locale/fr/LC_MESSAGES/messages.po
index b7fc7abaf..5bcb9bd34 100644
--- a/locale/fr/LC_MESSAGES/messages.po
+++ b/locale/fr/LC_MESSAGES/messages.po
@@ -116,10 +116,10 @@ msgid ""
 "target=\"_blank\" href=\"https://www.irs.gov/pub/irs-;
 "pdf/f990ezb.pdf\">Schedule B of the Form 990."
 msgstr ""
-"Si vous donnez plus de 5 000 $ et que nous connaissons votre nom et votre "
-"adresse, nous sommes tenus de les divulguer à l’IRS à https://www.irs.gov/pub/irs-;
-"pdf/f990ezb.pdf\">l’annexe B du formulaire 990."
+"Si vous faites un don supérieur à 5 000 $ et que nous connaissons vos nom 
et"
+" adresse, nous sommes tenus de les divulguer à l’IRS (fisc étatsunien) à 
https://www.irs.gov/pub;
+"/irs-pdf/f990ezb.pdf\"> l’annexe B du formulaire 990."
 
 #: 
tmp/cache_locale/fa/fadd8d2107638a3de94449a9eddfca4e8f010bb26f3f6a71e2d875cb910cc5f1.php:89
 msgid ""
@@ -127,7 +127,7 @@ msgid ""
 " Form 990."
 msgstr ""
 "Toutefois, ces renseignements sont supprimés de la version publique de notre"
-" formulaire 990."
+" formulaire 990."
 
 #: 
tmp/cache_locale/fa/fadd8d2107638a3de94449a9eddfca4e8f010bb26f3f6a71e2d875cb910cc5f1.php:91
 msgid ""
@@ -139,8 +139,8 @@ msgstr ""
 #: 
tmp/cache_locale/fa/fadd8d2107638a3de94449a9eddfca4e8f010bb26f3f6a71e2d875cb910cc5f1.php:96
 msgid "We do not publish, sell, trade, or rent any information about you."
 msgstr ""
-"Nous ne publions, ne vendons, n’échangeons ni ne louons aucune information 
"
-"vous concernant."
+"Nous ne publions, ne vendons, n’échangeons, ni ne louons aucun 
renseignement"
+" vous concernant."
 
 #: 
tmp/cache_locale/fa/fadd8d2107638a3de94449a9eddfca4e8f010bb26f3f6a71e2d875cb910cc5f1.php:98
 msgid ""
@@ -156,17 +156,17 @@ msgid ""
 "who need it to do their work, for example by thanking you or mailing you a "
 "t-shirt."
 msgstr ""
-"L’accès à ces informations est limité dans le projet Tor aux personnes 
qui "
-"en ont besoin pour faire leur travail, par exemple en vous remerciant ou en "
-"vous envoyant un t-shirt."
+"L’accès à ces renseignements est limité, dans le projet Tor, aux 
personnes "
+"qui en ont besoin pour faire leur travail, par exemple pour vous remercier "
+"ou pour vous envoyer un tee-shirt."
 
 #: 
tmp/cache_locale/fa/fadd8d2107638a3de94449a9eddfca4e8f010bb26f3f6a71e2d875cb910cc5f1.php:105
 msgid ""
 "The Tor Project very much appreciates all its donors. "
 "Thank you for supporting Tor."
 msgstr ""
-"Le Projet Tor apprécie beaucoup tous ses donateurs. "
-"Merci de soutenir Tor."
+"Le Projet Tor est très reconnaissant envers tous ses "
+"donateurs. Nous vous remercions de soutenir Tor."
 
 #: 
tmp/cache_locale/fa/fadd8d2107638a3de94449a9eddfca4e8f010bb26f3f6a71e2d875cb910cc5f1.php:113
 #: 
tmp/cache_locale/0e/0e65c68f2900f432bc062864e7bafc989d6286e272f5e98882a99f52ea4c5c89.php:658

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


[tor-commits] [translation/donatepages-messagespot] Update translations for donatepages-messagespot

2018-11-26 Thread translation
commit 3a7522406bfb1e50c4aa12243beaf10b9c441aa9
Author: Translation commit bot 
Date:   Mon Nov 26 19:15:21 2018 +

Update translations for donatepages-messagespot
---
 locale/fr/LC_MESSAGES/messages.po | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/locale/fr/LC_MESSAGES/messages.po 
b/locale/fr/LC_MESSAGES/messages.po
index 981bc8233..b7fc7abaf 100644
--- a/locale/fr/LC_MESSAGES/messages.po
+++ b/locale/fr/LC_MESSAGES/messages.po
@@ -90,24 +90,24 @@ msgid ""
 "The Tor Project will never have access to your financial data, such as your "
 "credit card information.We aim to be careful with your information."
 msgstr ""
-"Le projet Tor n’aura jamais accès à vos données financières, telles que 
vos "
-"informations de carte de crédit. Nous nous efforçons d’être prudents 
avec "
-"vos informations."
+"Le projet Tor n’aura jamais accès à vos données financières telles que "
+"celles liées à votre carte de crédit. Nous nous efforçons de traiter vos "
+"renseignements avec prudence."
 
 #: 
tmp/cache_locale/fa/fadd8d2107638a3de94449a9eddfca4e8f010bb26f3f6a71e2d875cb910cc5f1.php:83
 msgid ""
 "If you have provided your email address, we will email you once to thank you"
 " and give you a receipt."
 msgstr ""
-"Si vous avez fourni votre adresse électronique, nous vous enverrons un "
+"Si vous avez indiqué votre adresse courriel, nous vous enverrons un seul "
 "courriel pour vous remercier et vous remettre un reçu."
 
 #: 
tmp/cache_locale/fa/fadd8d2107638a3de94449a9eddfca4e8f010bb26f3f6a71e2d875cb910cc5f1.php:85
 msgid ""
 "If you opt in during the donation process, we may email you again in future."
 msgstr ""
-"Si vous choisissez de participer au processus de don, il se peut que nous "
-"vous envoyions à nouveau un courriel à l’avenir."
+"Si vous y avez consenti lors du processus de don, il se peut que nous vous "
+"recontactions par courriel à l’avenir."
 
 #: 
tmp/cache_locale/fa/fadd8d2107638a3de94449a9eddfca4e8f010bb26f3f6a71e2d875cb910cc5f1.php:87
 msgid ""

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


[tor-commits] [tor-browser-build/master] Bug 28594: Remove tor browser alpha nightly builds

2018-11-26 Thread boklm
commit e24e2dea8ebe54b9e8ddd27044bffa21adf08c94
Author: Nicolas Vigier 
Date:   Mon Nov 26 19:34:45 2018 +0100

Bug 28594: Remove tor browser alpha nightly builds

Update testsuite_git_commit to remove tor browser alpha nightly builds.
---
 tools/ansible/roles/tbb-nightly-build/defaults/main.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ansible/roles/tbb-nightly-build/defaults/main.yml 
b/tools/ansible/roles/tbb-nightly-build/defaults/main.yml
index 5f04029..26820a9 100644
--- a/tools/ansible/roles/tbb-nightly-build/defaults/main.yml
+++ b/tools/ansible/roles/tbb-nightly-build/defaults/main.yml
@@ -5,7 +5,7 @@ nightly_build_cron_minute: 20
 nightly_build_keep_builds: 2
 testsuite_dir: "/home/{{ nightly_build_user }}/tbb-testsuite"
 testsuite_git_url: 
https://git.torproject.org/user/boklm/tor-browser-bundle-testsuite.git
-testsuite_git_commit: 7b0dcd9f21bfde6b097b687c63f84fa579296804
+testsuite_git_commit: 7b1e23e06761c7336795d2b2a6fa40f5914b0aef
 nightly_build_wwwdir: "/home/{{ nightly_build_user }}/www"
 nightly_build_nginx_enable: true
 nightly_build_nginx_listen: 127.0.0.1:80

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


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

2018-11-26 Thread translation
commit 2d72360a65a7fc0e962eae8bc77597f10c8f4aad
Author: Translation commit bot 
Date:   Mon Nov 26 18:49:17 2018 +

Update translations for support-portal
---
 contents+fr.po | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/contents+fr.po b/contents+fr.po
index d7f047082..fef898942 100644
--- a/contents+fr.po
+++ b/contents+fr.po
@@ -1,8 +1,7 @@
 # Translators:
-# AO , 2018
 # erinm, 2018
 # Emma Peel, 2018
-# Curtis Baltimore , 2018
+# AO , 2018
 # 
 msgid ""
 msgstr ""
@@ -10,7 +9,7 @@ msgstr ""
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2018-11-22 10:53+CET\n"
 "PO-Revision-Date: 2018-10-02 22:41+\n"
-"Last-Translator: Curtis Baltimore , 2018\n"
+"Last-Translator: AO , 2018\n"
 "Language-Team: French (https://www.transifex.com/otf/teams/1519/fr/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -1341,7 +1340,7 @@ msgid ""
 "Circuit option inside the site information menu, in the URL bar."
 msgstr ""
 "Les deux options se trouvent dans le menu, mais vous pouvez également "
-"accéder à l'option Nouveau circuit dans le menu des informations du site, "
+"accéder à l’option Nouveau circuit dans le menu des informations du site, 
"
 "dans la barre URL."
 
 #: https//support.torproject.org/tbb/tbb-29/
@@ -3926,7 +3925,7 @@ msgid ""
 "indicating that obfs4proxy is functional."
 msgstr ""
 "* Vous devriez également voir le message « Registered server transport "
-"'obfs4' » qui indique que obfs4proxy fonctionne."
+"’obfs4’ » qui indique que obfs4proxy fonctionne."
 
 #: https//support.torproject.org/operators/operators-6/
 #: (content/operators/operators-6/contents+en.lrquestion.seo_slug)
@@ -4093,10 +4092,10 @@ msgid ""
 "at the URL bar an icon of a little green onion displaying the state of your "
 "connection: secure and using an onion service."
 msgstr ""
-"Lorsque vous accédez à un site Web qui utilise un service d'onion, Tor "
-"Browser affichera dans la barre URL une icône d'un petit oignon vert "
-"affichant l'état de votre connexion : sécurisé et utilisant un service "
-"d'onion."
+"Lorsque vous accédez à un site Web qui utilise un service d’onion, Tor "
+"Browser affichera dans la barre URL une icône d’un petit oignon vert "
+"affichant l’état de votre connexion : sécurisé et utilisant un service "
+"d’onion."
 
 #: https//support.torproject.org/onionservices/onionservices-2/
 #: (content/onionservices/onionservices-2/contents+en.lrquestion.description)
@@ -4110,7 +4109,7 @@ msgid ""
 " an icon of a green onion and a padlock."
 msgstr ""
 "Et si vous accédez à un site Web avec service https et onion, il affichera "
-"l'icône d'un oignon vert et un cadenas."
+"l’icône d’un oignon vert et un cadenas."
 
 #: https//support.torproject.org/onionservices/onionservices-2/
 #: (content/onionservices/onionservices-2/contents+en.lrquestion.description)

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


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

2018-11-26 Thread translation
commit 4f8257e6a4056816af2a080bdcf45a0a3825f820
Author: Translation commit bot 
Date:   Mon Nov 26 18:49:22 2018 +

Update translations for support-portal_completed
---
 contents+fr.po | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/contents+fr.po b/contents+fr.po
index d7f047082..fef898942 100644
--- a/contents+fr.po
+++ b/contents+fr.po
@@ -1,8 +1,7 @@
 # Translators:
-# AO , 2018
 # erinm, 2018
 # Emma Peel, 2018
-# Curtis Baltimore , 2018
+# AO , 2018
 # 
 msgid ""
 msgstr ""
@@ -10,7 +9,7 @@ msgstr ""
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2018-11-22 10:53+CET\n"
 "PO-Revision-Date: 2018-10-02 22:41+\n"
-"Last-Translator: Curtis Baltimore , 2018\n"
+"Last-Translator: AO , 2018\n"
 "Language-Team: French (https://www.transifex.com/otf/teams/1519/fr/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -1341,7 +1340,7 @@ msgid ""
 "Circuit option inside the site information menu, in the URL bar."
 msgstr ""
 "Les deux options se trouvent dans le menu, mais vous pouvez également "
-"accéder à l'option Nouveau circuit dans le menu des informations du site, "
+"accéder à l’option Nouveau circuit dans le menu des informations du site, 
"
 "dans la barre URL."
 
 #: https//support.torproject.org/tbb/tbb-29/
@@ -3926,7 +3925,7 @@ msgid ""
 "indicating that obfs4proxy is functional."
 msgstr ""
 "* Vous devriez également voir le message « Registered server transport "
-"'obfs4' » qui indique que obfs4proxy fonctionne."
+"’obfs4’ » qui indique que obfs4proxy fonctionne."
 
 #: https//support.torproject.org/operators/operators-6/
 #: (content/operators/operators-6/contents+en.lrquestion.seo_slug)
@@ -4093,10 +4092,10 @@ msgid ""
 "at the URL bar an icon of a little green onion displaying the state of your "
 "connection: secure and using an onion service."
 msgstr ""
-"Lorsque vous accédez à un site Web qui utilise un service d'onion, Tor "
-"Browser affichera dans la barre URL une icône d'un petit oignon vert "
-"affichant l'état de votre connexion : sécurisé et utilisant un service "
-"d'onion."
+"Lorsque vous accédez à un site Web qui utilise un service d’onion, Tor "
+"Browser affichera dans la barre URL une icône d’un petit oignon vert "
+"affichant l’état de votre connexion : sécurisé et utilisant un service "
+"d’onion."
 
 #: https//support.torproject.org/onionservices/onionservices-2/
 #: (content/onionservices/onionservices-2/contents+en.lrquestion.description)
@@ -4110,7 +4109,7 @@ msgid ""
 " an icon of a green onion and a padlock."
 msgstr ""
 "Et si vous accédez à un site Web avec service https et onion, il affichera "
-"l'icône d'un oignon vert et un cadenas."
+"l’icône d’un oignon vert et un cadenas."
 
 #: https//support.torproject.org/onionservices/onionservices-2/
 #: (content/onionservices/onionservices-2/contents+en.lrquestion.description)

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


[tor-commits] [translation/tbmanual-contentspot] Update translations for tbmanual-contentspot

2018-11-26 Thread translation
commit 0ca9f6cf1166c3d4fb7b82256a2a84a17223fe5f
Author: Translation commit bot 
Date:   Mon Nov 26 18:47:04 2018 +

Update translations for tbmanual-contentspot
---
 contents+fr.po | 70 +-
 1 file changed, 35 insertions(+), 35 deletions(-)

diff --git a/contents+fr.po b/contents+fr.po
index e4ba64d32..206735080 100644
--- a/contents+fr.po
+++ b/contents+fr.po
@@ -1,7 +1,7 @@
 # Translators:
-# AO , 2018
 # erinm, 2018
 # Emma Peel, 2018
+# AO , 2018
 # Curtis Baltimore , 2018
 # 
 msgid ""
@@ -87,8 +87,8 @@ msgid ""
 "=\"/managing-identities/#new-identity\">New Identity is requested)."
 msgstr ""
 "Par défaut, Tor Browser ne conserve aucun historique de navigation. Les "
-"cookies ne sont valides que pour une seule session (jusqu'à ce que Tor "
-"Browser soit quitté ou qu'une nouvelle identité soit demandée)."
 
 #: https//tb-manual.torproject.org/en-US/about/
@@ -189,7 +189,7 @@ msgid ""
 "Institute](https://tor.calyxinstitute.org)."
 msgstr ""
 "Si vous ne parvenez pas à télécharger le navigateur Tor à partir du site "
-"officiel du projet Tor, vous pouvez essayer de le télécharger à partir 
d'un "
+"officiel du projet Tor, vous pouvez essayer de le télécharger à partir 
d’un "
 "de nos miroirs officiels, soit via [EFF] (https://tor.eff.org) ou [Calyx "
 "Institute] (https://tor.calyxinstitute.org)."
 
@@ -470,7 +470,7 @@ msgstr ""
 msgid ""
 "* Email brid...@torproject.org from a Gmail, Yahoo, or Riseup email address"
 msgstr ""
-"* Envoyez un courriel à brid...@torproject.org à partir d'une adresse "
+"* Envoyez un courriel à brid...@torproject.org à partir d’une adresse "
 "courriel Gmail, Yahoo ou Riseup."
 
 #: https//tb-manual.torproject.org/en-US/bridges/
@@ -495,9 +495,9 @@ msgid ""
 " of the URL bar, then select 'Tor Network Settings...' to access these "
 "options."
 msgstr ""
-"Si vous démarrez Tor Browser pour la première fois, cliquez sur 
'Configurer'"
+"Si vous démarrez Tor Browser pour la première fois, cliquez sur 
’Configurer’"
 " pour ouvrir la fenêtre Tor Network Settings. Sinon, cliquez sur le bouton "
-"Tor à gauche de la barre URL, puis sélectionnez 'Tor Network Settings...' "
+"Tor à gauche de la barre URL, puis sélectionnez ’Tor Network 
Settings...’ "
 "pour accéder à ces options."
 
 #: https//tb-manual.torproject.org/en-US/bridges/
@@ -507,8 +507,8 @@ msgid ""
 "Then, select 'Provide a bridge I know' and enter each bridge address on a "
 "separate line."
 msgstr ""
-"Dans la fenêtre Paramètres du réseau Tor, sélectionnez 'Tor est censuré 
dans"
-" mon pays'. Ensuite, sélectionnez 'Fournir un pont que je connais' et entrez"
+"Dans la fenêtre Paramètres du réseau Tor, sélectionnez ’Tor est 
censuré dans"
+" mon pays’. Ensuite, sélectionnez ’Fournir un pont que je connais’ et 
entrez"
 " chaque adresse de pont sur une ligne séparée."
 
 #: https//tb-manual.torproject.org/en-US/bridges/
@@ -526,8 +526,8 @@ msgid ""
 "Click “OK” to save your settings. Using bridges may slow down the 
connection"
 " compared to using ordinary Tor relays."
 msgstr ""
-"Cliquez sur \"OK\" pour enregistrer vos paramètres. L'utilisation de "
-"passerelles peut ralentir la connexion par rapport à l'utilisation de relays"
+"Cliquez sur \"OK\" pour enregistrer vos paramètres. L’utilisation de "
+"passerelles peut ralentir la connexion par rapport à l’utilisation de 
relays"
 " Tor ordinaires."
 
 #: https//tb-manual.torproject.org/en-US/bridges/
@@ -537,7 +537,7 @@ msgid ""
 "one of the above methods to obtain more bridge addresses, and try again."
 msgstr ""
 "Si la connexion échoue, les ponts que vous avez reçus pourraient être hors 
"
-"service. Utilisez l'une des méthodes ci-dessus afin d'obtenir d'autres "
+"service. Utilisez l’une des méthodes ci-dessus afin d’obtenir d’autres 
"
 "adresses de ponts et ressayez."
 
 #: https//tb-manual.torproject.org/en-US/bridges/
@@ -929,7 +929,7 @@ msgid ""
 "current tab in the site information menu, in the URL bar."
 msgstr ""
 "Vous pouvez voir un diagramme du circuit que Tor Browser utilise pour "
-"l'onglet courant dans le menu des informations du site, dans la barre URL."
+"l’onglet courant dans le menu des informations du site, dans la barre URL."
 
 #: https//tb-manual.torproject.org/en-US/managing-identities/
 #: (content/managing-identities/contents+en-US.lrtopic.body)
@@ -942,12 +942,12 @@ msgid ""
 "href=\"https://www.torproject.org/docs/faq#EntryGuards\;>FAQ and https://support.torproject.org/tbb/tbb-2/\;>Support Portal."
 msgstr ""
-"Dans le circuit, le nœud Garde ou nœud d'entrée est le premier nœud et il 
"
+"Dans le circuit, le nœud Garde ou nœud d’entrée est le premier nœud et 
il "
 "est automatiquement et aléatoirement sélectionné par Tor. Mais il est "
-"différent des autres nœuds du circuit. Afin d'éviter les attaques de "
-"profilage, le nœud Guard ne change qu'après 2-3 

[tor-commits] [translation/tbmanual-contentspot_completed] Update translations for tbmanual-contentspot_completed

2018-11-26 Thread translation
commit 5a63d9be1595d40d5eed3c5dc4b46db7dceb0ca3
Author: Translation commit bot 
Date:   Mon Nov 26 18:47:09 2018 +

Update translations for tbmanual-contentspot_completed
---
 contents+fr.po | 70 +-
 1 file changed, 35 insertions(+), 35 deletions(-)

diff --git a/contents+fr.po b/contents+fr.po
index e4ba64d32..206735080 100644
--- a/contents+fr.po
+++ b/contents+fr.po
@@ -1,7 +1,7 @@
 # Translators:
-# AO , 2018
 # erinm, 2018
 # Emma Peel, 2018
+# AO , 2018
 # Curtis Baltimore , 2018
 # 
 msgid ""
@@ -87,8 +87,8 @@ msgid ""
 "=\"/managing-identities/#new-identity\">New Identity is requested)."
 msgstr ""
 "Par défaut, Tor Browser ne conserve aucun historique de navigation. Les "
-"cookies ne sont valides que pour une seule session (jusqu'à ce que Tor "
-"Browser soit quitté ou qu'une nouvelle identité soit demandée)."
 
 #: https//tb-manual.torproject.org/en-US/about/
@@ -189,7 +189,7 @@ msgid ""
 "Institute](https://tor.calyxinstitute.org)."
 msgstr ""
 "Si vous ne parvenez pas à télécharger le navigateur Tor à partir du site "
-"officiel du projet Tor, vous pouvez essayer de le télécharger à partir 
d'un "
+"officiel du projet Tor, vous pouvez essayer de le télécharger à partir 
d’un "
 "de nos miroirs officiels, soit via [EFF] (https://tor.eff.org) ou [Calyx "
 "Institute] (https://tor.calyxinstitute.org)."
 
@@ -470,7 +470,7 @@ msgstr ""
 msgid ""
 "* Email brid...@torproject.org from a Gmail, Yahoo, or Riseup email address"
 msgstr ""
-"* Envoyez un courriel à brid...@torproject.org à partir d'une adresse "
+"* Envoyez un courriel à brid...@torproject.org à partir d’une adresse "
 "courriel Gmail, Yahoo ou Riseup."
 
 #: https//tb-manual.torproject.org/en-US/bridges/
@@ -495,9 +495,9 @@ msgid ""
 " of the URL bar, then select 'Tor Network Settings...' to access these "
 "options."
 msgstr ""
-"Si vous démarrez Tor Browser pour la première fois, cliquez sur 
'Configurer'"
+"Si vous démarrez Tor Browser pour la première fois, cliquez sur 
’Configurer’"
 " pour ouvrir la fenêtre Tor Network Settings. Sinon, cliquez sur le bouton "
-"Tor à gauche de la barre URL, puis sélectionnez 'Tor Network Settings...' "
+"Tor à gauche de la barre URL, puis sélectionnez ’Tor Network 
Settings...’ "
 "pour accéder à ces options."
 
 #: https//tb-manual.torproject.org/en-US/bridges/
@@ -507,8 +507,8 @@ msgid ""
 "Then, select 'Provide a bridge I know' and enter each bridge address on a "
 "separate line."
 msgstr ""
-"Dans la fenêtre Paramètres du réseau Tor, sélectionnez 'Tor est censuré 
dans"
-" mon pays'. Ensuite, sélectionnez 'Fournir un pont que je connais' et entrez"
+"Dans la fenêtre Paramètres du réseau Tor, sélectionnez ’Tor est 
censuré dans"
+" mon pays’. Ensuite, sélectionnez ’Fournir un pont que je connais’ et 
entrez"
 " chaque adresse de pont sur une ligne séparée."
 
 #: https//tb-manual.torproject.org/en-US/bridges/
@@ -526,8 +526,8 @@ msgid ""
 "Click “OK” to save your settings. Using bridges may slow down the 
connection"
 " compared to using ordinary Tor relays."
 msgstr ""
-"Cliquez sur \"OK\" pour enregistrer vos paramètres. L'utilisation de "
-"passerelles peut ralentir la connexion par rapport à l'utilisation de relays"
+"Cliquez sur \"OK\" pour enregistrer vos paramètres. L’utilisation de "
+"passerelles peut ralentir la connexion par rapport à l’utilisation de 
relays"
 " Tor ordinaires."
 
 #: https//tb-manual.torproject.org/en-US/bridges/
@@ -537,7 +537,7 @@ msgid ""
 "one of the above methods to obtain more bridge addresses, and try again."
 msgstr ""
 "Si la connexion échoue, les ponts que vous avez reçus pourraient être hors 
"
-"service. Utilisez l'une des méthodes ci-dessus afin d'obtenir d'autres "
+"service. Utilisez l’une des méthodes ci-dessus afin d’obtenir d’autres 
"
 "adresses de ponts et ressayez."
 
 #: https//tb-manual.torproject.org/en-US/bridges/
@@ -929,7 +929,7 @@ msgid ""
 "current tab in the site information menu, in the URL bar."
 msgstr ""
 "Vous pouvez voir un diagramme du circuit que Tor Browser utilise pour "
-"l'onglet courant dans le menu des informations du site, dans la barre URL."
+"l’onglet courant dans le menu des informations du site, dans la barre URL."
 
 #: https//tb-manual.torproject.org/en-US/managing-identities/
 #: (content/managing-identities/contents+en-US.lrtopic.body)
@@ -942,12 +942,12 @@ msgid ""
 "href=\"https://www.torproject.org/docs/faq#EntryGuards\;>FAQ and https://support.torproject.org/tbb/tbb-2/\;>Support Portal."
 msgstr ""
-"Dans le circuit, le nœud Garde ou nœud d'entrée est le premier nœud et il 
"
+"Dans le circuit, le nœud Garde ou nœud d’entrée est le premier nœud et 
il "
 "est automatiquement et aléatoirement sélectionné par Tor. Mais il est "
-"différent des autres nœuds du circuit. Afin d'éviter les attaques de "
-"profilage, le nœud Guard ne change 

[tor-commits] [translation/bridgedb] Update translations for bridgedb

2018-11-26 Thread translation
commit dabe0a151927f22d2e71f94dca52297a0538e86e
Author: Translation commit bot 
Date:   Mon Nov 26 18:45:11 2018 +

Update translations for bridgedb
---
 gu/LC_MESSAGES/bridgedb.po | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gu/LC_MESSAGES/bridgedb.po b/gu/LC_MESSAGES/bridgedb.po
index 486c9beb9..f8e64cf08 100644
--- a/gu/LC_MESSAGES/bridgedb.po
+++ b/gu/LC_MESSAGES/bridgedb.po
@@ -9,7 +9,7 @@ msgstr ""
 "Project-Id-Version: Tor Project\n"
 "Report-Msgid-Bugs-To: 
'https://trac.torproject.org/projects/tor/newticket?component=BridgeDB=bridgedb-reported,msgid=isis,sysrqb=isis'\n"
 "POT-Creation-Date: 2015-07-25 03:40+\n"
-"PO-Revision-Date: 2018-11-20 17:05+\n"
+"PO-Revision-Date: 2018-11-26 18:28+\n"
 "Last-Translator: Drashti Kaushik \n"
 "Language-Team: Gujarati 
(http://www.transifex.com/otf/torproject/language/gu/)\n"
 "MIME-Version: 1.0\n"
@@ -40,7 +40,7 @@ msgstr "સમસ્યાની જાણ કરો"
 
 #: bridgedb/https/templates/base.html:82
 msgid "Source Code"
-msgstr ""
+msgstr "સ્ત્રોત કોડ"
 
 #: bridgedb/https/templates/base.html:85
 msgid "Changelog"

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


[tor-commits] [translation/donatepages-messagespot] Update translations for donatepages-messagespot

2018-11-26 Thread translation
commit 3adbcfd539987d83e91da4a6f98e41a64abae5fc
Author: Translation commit bot 
Date:   Mon Nov 26 18:45:21 2018 +

Update translations for donatepages-messagespot
---
 locale/fr/LC_MESSAGES/messages.po | 234 +++---
 1 file changed, 117 insertions(+), 117 deletions(-)

diff --git a/locale/fr/LC_MESSAGES/messages.po 
b/locale/fr/LC_MESSAGES/messages.po
index ebca67701..981bc8233 100644
--- a/locale/fr/LC_MESSAGES/messages.po
+++ b/locale/fr/LC_MESSAGES/messages.po
@@ -1,7 +1,7 @@
 # Translators:
 # N W, 2018
-# AO , 2018
 # erinm, 2018
+# AO , 2018
 # Curtis Baltimore , 2018
 # 
 msgid ""
@@ -82,16 +82,16 @@ msgid ""
 "We may also learn incidental data such as the date and time of your "
 "donation."
 msgstr ""
-"Il se peut également que nous apprenions des données accessoires telles que 
"
-"la date et l'heure de votre don."
+"Il se peut également que nous prenions connaissance de données accessoires "
+"telles que la date et l’heure de votre don."
 
 #: 
tmp/cache_locale/fa/fadd8d2107638a3de94449a9eddfca4e8f010bb26f3f6a71e2d875cb910cc5f1.php:78
 msgid ""
 "The Tor Project will never have access to your financial data, such as your "
 "credit card information.We aim to be careful with your information."
 msgstr ""
-"Le projet Tor n'aura jamais accès à vos données financières, telles que 
vos "
-"informations de carte de crédit. Nous nous efforçons d'être prudents avec "
+"Le projet Tor n’aura jamais accès à vos données financières, telles que 
vos "
+"informations de carte de crédit. Nous nous efforçons d’être prudents 
avec "
 "vos informations."
 
 #: 
tmp/cache_locale/fa/fadd8d2107638a3de94449a9eddfca4e8f010bb26f3f6a71e2d875cb910cc5f1.php:83
@@ -107,7 +107,7 @@ msgid ""
 "If you opt in during the donation process, we may email you again in future."
 msgstr ""
 "Si vous choisissez de participer au processus de don, il se peut que nous "
-"vous envoyions à nouveau un courriel à l'avenir."
+"vous envoyions à nouveau un courriel à l’avenir."
 
 #: 
tmp/cache_locale/fa/fadd8d2107638a3de94449a9eddfca4e8f010bb26f3f6a71e2d875cb910cc5f1.php:87
 msgid ""
@@ -117,9 +117,9 @@ msgid ""
 "pdf/f990ezb.pdf\">Schedule B of the Form 990."
 msgstr ""
 "Si vous donnez plus de 5 000 $ et que nous connaissons votre nom et votre "
-"adresse, nous sommes tenus de les divulguer à l'IRS à https://www.irs.gov/pub/irs-;
-"pdf/f990ezb.pdf\">l'annexe B du formulaire 990."
+"pdf/f990ezb.pdf\">l’annexe B du formulaire 990."
 
 #: 
tmp/cache_locale/fa/fadd8d2107638a3de94449a9eddfca4e8f010bb26f3f6a71e2d875cb910cc5f1.php:89
 msgid ""
@@ -139,7 +139,7 @@ msgstr ""
 #: 
tmp/cache_locale/fa/fadd8d2107638a3de94449a9eddfca4e8f010bb26f3f6a71e2d875cb910cc5f1.php:96
 msgid "We do not publish, sell, trade, or rent any information about you."
 msgstr ""
-"Nous ne publions, ne vendons, n'échangeons ni ne louons aucune information "
+"Nous ne publions, ne vendons, n’échangeons ni ne louons aucune information 
"
 "vous concernant."
 
 #: 
tmp/cache_locale/fa/fadd8d2107638a3de94449a9eddfca4e8f010bb26f3f6a71e2d875cb910cc5f1.php:98
@@ -156,7 +156,7 @@ msgid ""
 "who need it to do their work, for example by thanking you or mailing you a "
 "t-shirt."
 msgstr ""
-"L'accès à ces informations est limité dans le projet Tor aux personnes qui 
"
+"L’accès à ces informations est limité dans le projet Tor aux personnes 
qui "
 "en ont besoin pour faire leur travail, par exemple en vous remerciant ou en "
 "vous envoyant un t-shirt."
 
@@ -274,8 +274,8 @@ msgid ""
 "donations options page."
 msgstr ""
 "Si vous souhaitez faire un don sans activer Javascript, veuillez jeter un "
-"coup d'oeil à notre https://www.torproject.org/donate/donate-;
-"options.html.en\">page d'autres options de dons."
+"coup d’oeil à notre https://www.torproject.org/donate/donate-;
+"options.html.en\">page d’autres options de dons."
 
 #: 
tmp/cache_locale/c7/c763c19bb6abb9330294c550c8241bb3874e3b4e17fb6e7b15db26c60df8d5fe.php:123
 msgid "Number of Donations"
@@ -334,7 +334,7 @@ msgstr "Je préférerais que 100% de mon don aille au 
travail du projet Tor."
 
 #: 
tmp/cache_locale/c7/c763c19bb6abb9330294c550c8241bb3874e3b4e17fb6e7b15db26c60df8d5fe.php:228
 msgid "sticker Pack"
-msgstr "Paquet d'autocollants"
+msgstr "Paquet d’autocollants"
 
 #: 
tmp/cache_locale/c7/c763c19bb6abb9330294c550c8241bb3874e3b4e17fb6e7b15db26c60df8d5fe.php:235
 msgid ""
@@ -385,7 +385,7 @@ msgstr "sweatshirt"
 #: 
tmp/cache_locale/c7/c763c19bb6abb9330294c550c8241bb3874e3b4e17fb6e7b15db26c60df8d5fe.php:306
 msgid "Your generous support of Tor gets you this high-quality zip hoodie."
 msgstr ""
-"Votre généreux soutien de Tor vous permet d'obtenir ce sweat à capuche 
zippé"
+"Votre généreux soutien de Tor vous permet d’obtenir ce sweat à capuche 
zippé"
 " de haute qualité."
 
 #: 
tmp/cache_locale/c7/c763c19bb6abb9330294c550c8241bb3874e3b4e17fb6e7b15db26c60df8d5fe.php:316
@@ -442,7 +442,7 @@ msgstr "Nous vous 

[tor-commits] [snowflake/master] Change go_import_path in travis since we have relative imports

2018-11-26 Thread arlo
commit 596d28b57628dc57dd44080bb50b435c27c48861
Author: Arlo Breault 
Date:   Mon Nov 26 12:51:40 2018 -0500

Change go_import_path in travis since we have relative imports
---
 .travis.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index f570d54..2fc053b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,6 +3,8 @@ language: go
 sudo: required
 dist: trusty
 
+go_import_path: git.torproject.org/pluggable-transports/snowflake.git
+
 addons:
 apt:
 sources:

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


[tor-commits] [snowflake/master] Bump version of golang in travis to v1.10

2018-11-26 Thread arlo
commit d821846cc43df1159524dd9540583d5b61e8df1b
Author: Arlo Breault 
Date:   Mon Nov 26 12:43:56 2018 -0500

Bump version of golang in travis to v1.10

The http2 package removed support for v1.8 in,

https://github.com/golang/net/commit/22700d5518f6200cd1355b9d417285458095e8da

and it says 1.9 isn't actively tested.
---
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index 7171e2c..f570d54 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,7 +12,7 @@ addons:
 - gcc-5
 
 go:
-- 1.8.3
+- 1.10.x
 
 env:
 - TRAVIS_NODE_VERSION="4.2" CC="gcc-5" CXX="g++-5"



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


[tor-commits] [tpo/staging] Fix logo relative link

2018-11-26 Thread hiro
commit 681b1613826d12ad58e56c72d76e0af7e60d279d
Author: hiro 
Date:   Mon Nov 26 16:52:43 2018 +0100

Fix logo relative link
---
 i18n/contents.pot | 2 +-
 templates/navbar.html | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/i18n/contents.pot b/i18n/contents.pot
index 901abea..d594dbe 100644
--- a/i18n/contents.pot
+++ b/i18n/contents.pot
@@ -2,7 +2,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2018-11-26 16:50+CET\n"
+"POT-Creation-Date: 2018-11-26 16:52+CET\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME \n"
 "Language-Team: en \n"
diff --git a/templates/navbar.html b/templates/navbar.html
index c132b3b..60dc63e 100644
--- a/templates/navbar.html
+++ b/templates/navbar.html
@@ -1,7 +1,7 @@
 
   
 
-  
+  
   {{ _("Tor Logo") }}
 
 

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


  1   2   >