[tor-commits] [translation/torbutton-torbuttonproperties] https://gitweb.torproject.org/translation.git/commit/?h=torbutton-torbuttonproperties

2020-07-10 Thread translation
commit aaadf093c9cba6934b8a385f93feef8607a6390d
Author: Translation commit bot 
Date:   Fri Jul 10 21:47:17 2020 +


https://gitweb.torproject.org/translation.git/commit/?h=torbutton-torbuttonproperties
---
 fa/torbutton.properties | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fa/torbutton.properties b/fa/torbutton.properties
index 065da9afc0..3b87c048dd 100644
--- a/fa/torbutton.properties
+++ b/fa/torbutton.properties
@@ -111,7 +111,7 @@ onionServices.introTimedOut=اتصال به سایت 
پیازی، احتمالا
 onionServices.introTimedOut.longDescription=جزئیات: S% — وقت 
اتصال به سرویس پیازی درخواست شده اتمام یافت 
در حالی که سعی داشت تا چرخه ملاقات را ایجاد 
کند.
 #
 # LOCALIZATION NOTE: %S will be replaced with the .onion address.
-onionServices.authPrompt.description2=%S is requesting that you authenticate.
+onionServices.authPrompt.description2=%S از شما می خواهد تا 
احراز هویت کنید.
 onionServices.authPrompt.keyPlaceholder=کلید خصوصی خود برای 
این سرویس Onion را، وارد کنید.
 onionServices.authPrompt.done=انجام شد
 onionServices.authPrompt.doneAccessKey=d

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


[tor-commits] [translation/tails-misc_release] https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_release

2020-07-10 Thread translation
commit 5601f07dfc2ca079ce87bfe557c2b8a598735a7f
Author: Translation commit bot 
Date:   Fri Jul 10 21:46:21 2020 +

https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_release
---
 fa.po | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fa.po b/fa.po
index de09c0a954..ea6bb3858f 100644
--- a/fa.po
+++ b/fa.po
@@ -37,7 +37,7 @@ msgstr ""
 "Project-Id-Version: Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2020-06-19 19:37+0200\n"
-"PO-Revision-Date: 2020-07-10 21:12+\n"
+"PO-Revision-Date: 2020-07-10 21:25+\n"
 "Last-Translator: Reza Ghasemi\n"
 "Language-Team: Persian 
(http://www.transifex.com/otf/torproject/language/fa/)\n"
 "MIME-Version: 1.0\n"

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


[tor-commits] [translation/tails-misc] https://gitweb.torproject.org/translation.git/commit/?h=tails-misc

2020-07-10 Thread translation
commit 5a4220da126a0104706d33e283a5f25d543d057b
Author: Translation commit bot 
Date:   Fri Jul 10 21:45:43 2020 +

https://gitweb.torproject.org/translation.git/commit/?h=tails-misc
---
 fa.po | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fa.po b/fa.po
index 53c49023ea..cb854aec56 100644
--- a/fa.po
+++ b/fa.po
@@ -37,7 +37,7 @@ msgstr ""
 "Project-Id-Version: Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2020-06-19 19:37+0200\n"
-"PO-Revision-Date: 2020-07-10 21:12+\n"
+"PO-Revision-Date: 2020-07-10 21:25+\n"
 "Last-Translator: Reza Ghasemi\n"
 "Language-Team: Persian 
(http://www.transifex.com/otf/torproject/language/fa/)\n"
 "MIME-Version: 1.0\n"
@@ -1652,7 +1652,7 @@ msgid ""
 "A captive portal is a web page that is displayed before you can access the 
Internet. Captive portals usually require to log in to the network or enter 
information such as an email address.\n"
 "\n"
 "The Unsafe Browser is not anonymous and can deanonymize you. Use it only to 
log in to captive portals."
-msgstr ""
+msgstr "مرورگر ناامن به شما اجازه می دهد تا 
وارد یک پورتال ناگزیر شوید.\n\nیک پورتال 
ناگزیر یک صفحه وب است که پیش از اینکه به 
اینترنت دستیابی پیدا کنید نمایش داده می 
شود. پورتال های ناگزیر معمولاً نیاز به وارد 
شدن به شبکه یا وارد کردن اطلاعاتی مانند 
نشانی ایمیل دارند.\n\nمرورگر نا‌امن ناشناس 
نیست و می‌تواند باعث شناساندن شما شود. فقط 
برای وارد شدن به پورتال‌های ناگزیر از آن 
استفاده کنید."
 
 #: 
../config/chroot_local-includes/usr/share/tails/greeter/additional_settings.ui.in:572
 msgid "Disable the Unsafe Browser (default)"
@@ -1664,7 +1664,7 @@ msgstr "فعال‌سازی مرورگر نا‌امن"
 
 #: ../config/chroot_local-includes/usr/share/tails/greeter/main.ui.in:100
 msgid "Settings were loaded from the persistent storage."
-msgstr ""
+msgstr "تنظیمات از حافظه مداوم بارگذاری شدند."
 
 #: ../config/chroot_local-includes/usr/share/tails/greeter/main.ui.in:168
 msgid ""

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


[tor-commits] [translation/tails-misc_release] https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_release

2020-07-10 Thread translation
commit ab0100faa8ce1f55bf46df54d5ec0560201c82f2
Author: Translation commit bot 
Date:   Fri Jul 10 21:16:25 2020 +

https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_release
---
 fa.po | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fa.po b/fa.po
index eb664c3c2c..de09c0a954 100644
--- a/fa.po
+++ b/fa.po
@@ -27,7 +27,7 @@
 # Mohammad Hadi K , 2018
 # Mohammad Hossein , 2014
 # Mohsen Eghbal , 2019
-# Reza Ghasemi, 2019
+# Reza Ghasemi, 2019-2020
 # Samaneh M , 2019
 # Sina Eghbal , 2016
 # b0b47d46632b78a09a40de799fda9a65, 2019
@@ -37,8 +37,8 @@ msgstr ""
 "Project-Id-Version: Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2020-06-19 19:37+0200\n"
-"PO-Revision-Date: 2020-06-29 00:35+\n"
-"Last-Translator: Hamid reza Zaefarani\n"
+"PO-Revision-Date: 2020-07-10 21:12+\n"
+"Last-Translator: Reza Ghasemi\n"
 "Language-Team: Persian 
(http://www.transifex.com/otf/torproject/language/fa/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"

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


[tor-commits] [translation/tails-misc] https://gitweb.torproject.org/translation.git/commit/?h=tails-misc

2020-07-10 Thread translation
commit 5fc2015c4d2ea5ce1fa4ab4580c6a591006fd27f
Author: Translation commit bot 
Date:   Fri Jul 10 21:15:45 2020 +

https://gitweb.torproject.org/translation.git/commit/?h=tails-misc
---
 fa.po | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/fa.po b/fa.po
index 83dfcdd9c6..53c49023ea 100644
--- a/fa.po
+++ b/fa.po
@@ -27,7 +27,7 @@
 # Mohammad Hadi K , 2018
 # Mohammad Hossein , 2014
 # Mohsen Eghbal , 2019
-# Reza Ghasemi, 2019
+# Reza Ghasemi, 2019-2020
 # Samaneh M , 2019
 # Sina Eghbal , 2016
 # b0b47d46632b78a09a40de799fda9a65, 2019
@@ -37,8 +37,8 @@ msgstr ""
 "Project-Id-Version: Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2020-06-19 19:37+0200\n"
-"PO-Revision-Date: 2020-06-29 00:35+\n"
-"Last-Translator: Hamid reza Zaefarani\n"
+"PO-Revision-Date: 2020-07-10 21:12+\n"
+"Last-Translator: Reza Ghasemi\n"
 "Language-Team: Persian 
(http://www.transifex.com/otf/torproject/language/fa/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -430,7 +430,7 @@ msgstr "آفلاین"
 
 #: 
config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/additional_settings.py:329
 msgid "_Unsafe Browser"
-msgstr ""
+msgstr "_مرورگر ناامن"
 
 #: 
config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/additional_settings.py:338
 msgid "Enabled"
@@ -438,7 +438,7 @@ msgstr "فعال"
 
 #: 
config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/additional_settings.py:340
 msgid "Disabled (default)"
-msgstr ""
+msgstr "غیر‌فعال (پیش‌فرض)"
 
 #: 
config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/additional_settings.py:391
 msgid "On (default)"
@@ -683,11 +683,11 @@ msgstr "ذخيره‌كردن فايل‌ها در 
پوشه مداوم"
 
 #: 
config/chroot_local-includes/usr/src/persistence-setup/lib/Tails/Persistence/Configuration/Presets.pm:70
 msgid "Settings on the Welcome Screen"
-msgstr ""
+msgstr "تنظیمات در صفحه خوش‌آمد"
 
 #: 
config/chroot_local-includes/usr/src/persistence-setup/lib/Tails/Persistence/Configuration/Presets.pm:72
 msgid "Language, administration password, and additional settings"
-msgstr ""
+msgstr "زبان، گذرواژه مدیریتی، تنظیمات اضافی"
 
 #: 
config/chroot_local-includes/usr/src/persistence-setup/lib/Tails/Persistence/Configuration/Presets.pm:85
 msgid "Browser Bookmarks"
@@ -870,7 +870,7 @@ msgstr "درایوی که تیلز از آن اجرا م
ی‌شود، پیدا 
 
 #: config/chroot_local-includes/usr/local/lib/seahorse-tool-wrapper:42
 msgid "Import Failed"
-msgstr ""
+msgstr "درون‌برد ناموفق بود"
 
 #. Translators: Don't translate {path} or {error},
 #. they are placeholders and will be replaced.
@@ -879,13 +879,13 @@ msgstr ""
 msgid ""
 "Failed to import keys from {path}:\n"
 "{error}"
-msgstr ""
+msgstr "عدم موفقیت در درون‌برد کلید‌ها از {م
سیر}:\n{خطا}"
 
 #: config/chroot_local-includes/usr/local/lib/seahorse-tool-wrapper:53
 msgid "Key Imported"
 msgid_plural "Keys Imported"
-msgstr[0] ""
-msgstr[1] ""
+msgstr[0] "کلید وارد شد"
+msgstr[1] "کلید‌ها وارد شدند"
 
 #. Translators: Don't translate {uids}, it's a placeholder and
 #. will be replaced.
@@ -893,8 +893,8 @@ msgstr[1] ""
 #, python-brace-format
 msgid "Imported a key for {uids}"
 msgid_plural "Imported keys for {uids}"
-msgstr[0] ""
-msgstr[1] ""
+msgstr[0] "کلید برای {uids} وارد شد"
+msgstr[1] "کلید ها برای {uids} وارد شدند"
 
 #: 
config/chroot_local-includes/usr/share/gnome-shell/extensions/status-menu-hel...@tails.boum.org/extension.js:75
 msgid "Lock screen"
@@ -1462,7 +1462,7 @@ msgid ""
 "The Unsafe Browser was not enabled on the Welcome Screen.\\n\\nIf you want "
 "to use the Unsafe Browser, you have to restart Tails and enable it in the "
 "settings on the Welcome Screen."
-msgstr ""
+msgstr "مرورگر ناامن روی صفحه خوش‌‌آمد فعال 
نبود.\\n\\nاگر می خواهید از مرورگر ناامن 
استفاده کنید، باید Tails را مجدداً راه اندازی 
کنید و در تنظیمات صفحه خوش‌آمد آن را فعال 
کنید."
 
 #: config/chroot_local-includes/usr/local/sbin/unsafe-browser:98
 msgid ""
@@ -1656,11 +1656,11 @@ msgstr ""
 
 #: 
../config/chroot_local-includes/usr/share/tails/greeter/additional_settings.ui.in:572
 msgid "Disable the Unsafe Browser (default)"
-msgstr ""
+msgstr "غیر فعال کردن مرورگر ناامن (پیش‌فرض)"
 
 #: 
../config/chroot_local-includes/usr/share/tails/greeter/additional_settings.ui.in:617
 msgid "Enable the Unsafe Browser"
-msgstr ""
+msgstr "فعال‌سازی مرورگر نا‌امن"
 
 #: ../config/chroot_local-includes/usr/share/tails/greeter/main.ui.in:100
 msgid "Settings were loaded from the 

[tor-commits] [torspec/master] Proposal 325: markdown fixes

2020-07-10 Thread nickm
commit 735d90409321f4ddc5dab61285ac268d32ec5a35
Author: Nick Mathewson 
Date:   Fri Jul 10 15:18:15 2020 -0400

Proposal 325: markdown fixes
---
 proposals/325-packed-relay-cells.md | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/proposals/325-packed-relay-cells.md 
b/proposals/325-packed-relay-cells.md
index 35766ad..d402c39 100644
--- a/proposals/325-packed-relay-cells.md
+++ b/proposals/325-packed-relay-cells.md
@@ -19,7 +19,7 @@ use an entire 498-byte relay payload just to send a one-byte
 flow-control message.
 
 We already have some cases where we'd benefit from this feature.
-For example, when we send SENDME messages, END cells, or BEGIN_DIR
+For example, when we send `SENDME` messages, `END` cells, or `BEGIN_DIR`
 cells, most of the cell body is wasted with padding.
 
 As a side benefit, packing cells in this way may make the job of the
@@ -50,15 +50,15 @@ concatenated in a single relay cell.
 
 Only some relay commands are supported for relay cell packing,
 listed here:
-  - SENDME
-  - DROP
-  - DATA
-  - BEGIN
-  - BEGIN_DIR
-  - END
-  - CONNECTED
-  - PADDING_NEGOTIATE
-  - PADDING_NEGOTIATED
+  - `SENDME`
+  - `DROP`
+  - `DATA`
+  - `BEGIN`
+  - `BEGIN_DIR`
+  - `END`
+  - `CONNECTED`
+  - `PADDING_NEGOTIATE`
+  - `PADDING_NEGOTIATED`
 
 If any relay message with a relay command _not_ listed above appears
 in a packed relay cell with another relay message, then the
@@ -131,10 +131,10 @@ value, computed as:
 
 (stream_id_included<<15) | (relay_command << 9) | (relay_data_len).
 
-If the optional_stream_id field is not present, then the default
-value for the stream_id is computed as follows.  We use stream_id 0
+If the `optional_stream_id` field is not present, then the default
+value for the `stream_id` is computed as follows.  We use stream_id 0
 for any command that doesn't take a stream ID.  For commands that
-_do_ take a steam_id, we use whichever nonzero stream_id appeared
+_do_ take a `steam_id`, we use whichever nonzero `stream_id` appeared
 most recently in the same cell.
 
 This format limits the space of possible relay commands.  That's

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


[tor-commits] [torspec/master] Small edits to prop325 based on email from Ian Goldberg

2020-07-10 Thread nickm
commit fef8d018249bd6cc8ba359312b3dcd4c61922144
Author: Nick Mathewson 
Date:   Fri Jul 10 15:16:55 2020 -0400

Small edits to prop325 based on email from Ian Goldberg
---
 proposals/325-packed-relay-cells.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/proposals/325-packed-relay-cells.md 
b/proposals/325-packed-relay-cells.md
index 455e7a2..35766ad 100644
--- a/proposals/325-packed-relay-cells.md
+++ b/proposals/325-packed-relay-cells.md
@@ -79,7 +79,7 @@ should all be filled with 0-valued bytes.
 
 # Negotiation and migration
 
-After receiving a packed relay cell, the relay know that the client
+After receiving a packed relay cell, the relay knows that the client
 supports this proposal: Relays SHOULD send packed relay
 cells on any circuit on which they have received a packed relay
 cell.  Relays MUST NOT send packed relay cells otherwise.
@@ -135,7 +135,7 @@ If the optional_stream_id field is not present, then the 
default
 value for the stream_id is computed as follows.  We use stream_id 0
 for any command that doesn't take a stream ID.  For commands that
 _do_ take a steam_id, we use whichever nonzero stream_id appeared
-last in this cell.
+most recently in the same cell.
 
 This format limits the space of possible relay commands.  That's
 probably okay: after 20 years of Tor development, we have defined 25

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


[tor-commits] [translation/tails-misc] https://gitweb.torproject.org/translation.git/commit/?h=tails-misc

2020-07-10 Thread translation
commit 3dc29274566a66f5ab4dbf7cbcc7429acdfa185e
Author: Translation commit bot 
Date:   Fri Jul 10 18:45:46 2020 +

https://gitweb.torproject.org/translation.git/commit/?h=tails-misc
---
 lt.po | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/lt.po b/lt.po
index 759145a1d6..924db0abab 100644
--- a/lt.po
+++ b/lt.po
@@ -4,6 +4,7 @@
 # 
 # Translators:
 # Gediminas Golcevas <>, 2014
+# Marija Grinevičiūtė , 2020
 # Moo, 2015-2020
 # Tautvydas Ž., 2019
 msgid ""
@@ -11,8 +12,8 @@ msgstr ""
 "Project-Id-Version: Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2020-06-19 19:37+0200\n"
-"PO-Revision-Date: 2020-06-29 09:21+\n"
-"Last-Translator: Moo\n"
+"PO-Revision-Date: 2020-07-10 18:21+\n"
+"Last-Translator: Marija Grinevičiūtė \n"
 "Language-Team: Lithuanian 
(http://www.transifex.com/otf/torproject/language/lt/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -412,7 +413,7 @@ msgstr "Įjungta"
 
 #: 
config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/additional_settings.py:340
 msgid "Disabled (default)"
-msgstr ""
+msgstr "IÅ¡jungta (numatytasis)"
 
 #: 
config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/additional_settings.py:391
 msgid "On (default)"
@@ -657,7 +658,7 @@ msgstr "Išsaugoti failus, esančius \"Ilgalaikiame\" 
kataloge"
 
 #: 
config/chroot_local-includes/usr/src/persistence-setup/lib/Tails/Persistence/Configuration/Presets.pm:70
 msgid "Settings on the Welcome Screen"
-msgstr ""
+msgstr "Nustatymai pradžios ekrane"
 
 #: 
config/chroot_local-includes/usr/src/persistence-setup/lib/Tails/Persistence/Configuration/Presets.pm:72
 msgid "Language, administration password, and additional settings"
@@ -858,10 +859,10 @@ msgstr "Nepavyko importuoti raktų iš {path}:\n{error}"
 #: config/chroot_local-includes/usr/local/lib/seahorse-tool-wrapper:53
 msgid "Key Imported"
 msgid_plural "Keys Imported"
-msgstr[0] ""
-msgstr[1] ""
-msgstr[2] ""
-msgstr[3] ""
+msgstr[0] "Importuotas raktas"
+msgstr[1] "Importuota raktų"
+msgstr[2] "Importuoti raktai"
+msgstr[3] "Importuoti raktai"
 
 #. Translators: Don't translate {uids}, it's a placeholder and
 #. will be replaced.

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


[tor-commits] [translation/tails-misc_release] https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_release

2020-07-10 Thread translation
commit ab652cca0eed912f53e2f83e3a3330b1a50f4ae4
Author: Translation commit bot 
Date:   Fri Jul 10 18:46:29 2020 +

https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_release
---
 lt.po | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lt.po b/lt.po
index 56a30aedb5..1dfbea2b11 100644
--- a/lt.po
+++ b/lt.po
@@ -4,6 +4,7 @@
 # 
 # Translators:
 # Gediminas Golcevas <>, 2014
+# Marija Grinevičiūtė , 2020
 # Moo, 2015-2020
 # Tautvydas Ž., 2019
 msgid ""
@@ -11,8 +12,8 @@ msgstr ""
 "Project-Id-Version: Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2020-06-19 19:37+0200\n"
-"PO-Revision-Date: 2020-06-29 09:21+\n"
-"Last-Translator: Moo\n"
+"PO-Revision-Date: 2020-07-10 18:21+\n"
+"Last-Translator: Marija Grinevičiūtė \n"
 "Language-Team: Lithuanian 
(http://www.transifex.com/otf/torproject/language/lt/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"

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


[tor-commits] [torspec/master] Add proposal 325-packed-relay-cells.md

2020-07-10 Thread nickm
commit 3997e7a8a5a6ff0cf5b7cdce5f850a59abc12162
Author: Nick Mathewson 
Date:   Fri Jul 10 13:51:21 2020 -0400

Add proposal 325-packed-relay-cells.md
---
 proposals/000-index.txt |   2 +
 proposals/325-packed-relay-cells.md | 145 
 2 files changed, 147 insertions(+)

diff --git a/proposals/000-index.txt b/proposals/000-index.txt
index 3ddeccd..86f2a16 100644
--- a/proposals/000-index.txt
+++ b/proposals/000-index.txt
@@ -245,6 +245,7 @@ Proposals by number:
 322  Extending link specifiers to include the directory port [OPEN]
 323  Specification for Walking Onions [DRAFT]
 324  RTT-based Congestion Control for Tor [OPEN]
+325  Packed relay cells: saving space on small commands [DRAFT]
 
 
 Proposals by status:
@@ -263,6 +264,7 @@ Proposals by status:
313  Tor Relay IPv6 Statistics
316  FlashFlow: A Secure Speed Test for Tor (Parent Proposal)
323  Specification for Walking Onions
+   325  Packed relay cells: saving space on small commands
  NEEDS-REVISION:
212  Increase Acceptable Consensus Age [for 0.2.4.x+]
219  Support for full DNS and DNSSEC resolution in Tor [for 0.2.5.x]
diff --git a/proposals/325-packed-relay-cells.md 
b/proposals/325-packed-relay-cells.md
new file mode 100644
index 000..455e7a2
--- /dev/null
+++ b/proposals/325-packed-relay-cells.md
@@ -0,0 +1,145 @@
+```
+Filename: 325-packed-relay-cells.md
+Title: Packed relay cells: saving space on small commands
+Author: Nick Mathewson
+Created: 10 July 2020
+Status: Draft
+```
+
+# Introduction
+
+In proposal 319 I suggested a way to fragment long commands across
+multiple RELAY cells.  In this proposal, I suggest a new format for
+RELAY cells that can be used to pack multiple relay commands into a
+single cell.
+
+Why would we want to do this?  As we move towards improved
+congestion-control and flow-control algorithms, we might not want to
+use an entire 498-byte relay payload just to send a one-byte
+flow-control message.
+
+We already have some cases where we'd benefit from this feature.
+For example, when we send SENDME messages, END cells, or BEGIN_DIR
+cells, most of the cell body is wasted with padding.
+
+As a side benefit, packing cells in this way may make the job of the
+traffic analyst a little more tricky, as cell contents become less
+predictable.
+
+# The basic design
+
+Let's use the term "Relay Message" to mean the kind of thing that a
+relay cell used to hold.  Thus, this proposal is about packing
+multiple "Relay Messages" in to a cell.
+
+I'll use "Packed relay cell" to mean a relay cell in this new
+format, that supports multiple messages.
+
+I'll use "client" to mean the initiator of a circuit, and "relay" to
+refer to the parties through who a circuit is created.  Note that
+each "relay" (as used here) may be the "client" on circuits of its own.
+
+When a relay supports relay message packing, it advertises the fact
+using a new Relay protocol version.  Clients must opt-in to using
+this protocol version (see XXX below) before they can send any
+packed relay cells, and before the relay will send them any packed
+relay cells.
+
+When packed cells are in use, multiple cell messages can be
+concatenated in a single relay cell.
+
+Only some relay commands are supported for relay cell packing,
+listed here:
+  - SENDME
+  - DROP
+  - DATA
+  - BEGIN
+  - BEGIN_DIR
+  - END
+  - CONNECTED
+  - PADDING_NEGOTIATE
+  - PADDING_NEGOTIATED
+
+If any relay message with a relay command _not_ listed above appears
+in a packed relay cell with another relay message, then the
+receiving party MUST tear down the circuit.
+
+(Note that relay cell fragments (proposal 319) are not supported for
+packing.)
+
+The command byte "0" is now used to explicitly indicate "end of
+cell".  If the byte "0" appears after a relay message, the rest of
+the cell MUST be ignored.
+
+When generating RELAY cells, implementations SHOULD (as they do
+today) fill in the unused bytes with four 0-valued bytes, followed by
+a sequence of random bytes up to the end of the cell.  If there are
+fewer than 4 unused bytes at the end of the cell, those unused bytes
+should all be filled with 0-valued bytes.
+
+# Negotiation and migration
+
+After receiving a packed relay cell, the relay know that the client
+supports this proposal: Relays SHOULD send packed relay
+cells on any circuit on which they have received a packed relay
+cell.  Relays MUST NOT send packed relay cells otherwise.
+
+Clients, in turn, MAY send packed relay cells to any relay whose
+"Relay" subprotocol version indicates that it supports this
+protocol.  To avoid fingerprinting, this client behavior should
+controlled with a tristate (1/0/auto) torrc configuration value,
+with the default set to use a consensus parameter.
+
+The parameter is:
+
+"relay-cell-packing"
+
+Boolean: if 1, clients should send packed relay cells.
+(Min: 0, Max 1, Default: 0)
+
+To handle migration, first 

[tor-commits] [tor/master] Add an extra comment about keeping rust and c protover in sync.

2020-07-10 Thread nickm
commit 8ebbf629404a97b6110c1916d554009dc8f42c5a
Author: Nick Mathewson 
Date:   Fri Jul 10 13:32:25 2020 -0400

Add an extra comment about keeping rust and c protover in sync.
---
 src/core/or/protover.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/core/or/protover.c b/src/core/or/protover.c
index c6b024369..1ac264925 100644
--- a/src/core/or/protover.c
+++ b/src/core/or/protover.c
@@ -393,6 +393,11 @@ protocol_list_supports_protocol_or_later(const char *list,
 const char *
 protover_get_supported_protocols(void)
 {
+  /* WARNING!
+   *
+   * Remember to edit the SUPPORTED_PROTOCOLS list in protover.rs if you
+   * are editing this list.
+   */
   return
 "Cons=1-2 "
 "Desc=1-2 "

___
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-gitlab/mr/42'

2020-07-10 Thread nickm
commit 6a647be54a8e88f94461f82e16b78a9113a1c351
Merge: 0c2bb9eac 401b3a8a3
Author: Nick Mathewson 
Date:   Fri Jul 10 13:20:14 2020 -0400

Merge remote-tracking branch 'tor-gitlab/mr/42'

 src/app/config/resolve_addr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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


[tor-commits] [tor/master] addr: Remove BUG() that always triggers

2020-07-10 Thread nickm
commit 401b3a8a3c823c6d0642cc323464e05a140f0351
Author: David Goulet 
Date:   Fri Jul 10 13:09:46 2020 -0400

addr: Remove BUG() that always triggers

Fix on unreleased code.

Logical || in the BUG() made it that it would always trigger the BUG().

Fixes #40034

Signed-off-by: David Goulet 
---
 src/app/config/resolve_addr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/app/config/resolve_addr.c b/src/app/config/resolve_addr.c
index 172f69854..7ec5ae565 100644
--- a/src/app/config/resolve_addr.c
+++ b/src/app/config/resolve_addr.c
@@ -85,7 +85,7 @@ resolved_addr_get_suggested(int family, tor_addr_t *addr_out)
 void
 resolved_addr_set_suggested(const tor_addr_t *addr)
 {
-  if (BUG(tor_addr_family(addr) != AF_INET ||
+  if (BUG(tor_addr_family(addr) != AF_INET &&
   tor_addr_family(addr) != AF_INET6)) {
 return;
   }



___
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-gitlab/mr/41'

2020-07-10 Thread nickm
commit 0c2bb9eac576d899b2ff8a8fa1be91762b4ee1be
Merge: 063cdb314 46b86b22e
Author: Nick Mathewson 
Date:   Fri Jul 10 13:19:28 2020 -0400

Merge remote-tracking branch 'tor-gitlab/mr/41'

 src/feature/relay/relay_find_addr.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

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


[tor-commits] [tor/master] addr: Remove a BUG() that can normally occur

2020-07-10 Thread nickm
commit 46b86b22e3e554da6dcef77c00b622507f6c4b42
Author: David Goulet 
Date:   Fri Jul 10 13:06:20 2020 -0400

addr: Remove a BUG() that can normally occur

Fix on unreleased code.

The relay_new_address_suggestion() is called when a NETINFO cell is received
thus not only for relay or bridges.

Remove the BUG() that made sure only in server mode we could handle the
suggested address.

Fixes #40032

Signed-off-by: David Goulet 
---
 src/feature/relay/relay_find_addr.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/feature/relay/relay_find_addr.c 
b/src/feature/relay/relay_find_addr.c
index 28b5985bb..16d0a4733 100644
--- a/src/feature/relay/relay_find_addr.c
+++ b/src/feature/relay/relay_find_addr.c
@@ -64,8 +64,9 @@ relay_address_new_suggestion(const tor_addr_t *suggested_addr,
   tor_assert(peer_addr);
   tor_assert(identity_digest);
 
-  /* This should never be called on a non Tor relay. */
-  if (BUG(!server_mode(options))) {
+  /* Non server should just ignore this suggestion. Clients don't need to
+   * learn their address let alone cache it. */
+  if (!server_mode(options)) {
 return;
   }
 



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


[tor-commits] [tor/master] Collect IPv6 bidi connection statistics

2020-07-10 Thread dgoulet
commit dbdf8bebde8b0f18009c7e9c6e89406f241ad0e6
Author: Nick Mathewson 
Date:   Fri Jul 10 09:47:55 2020 -0400

Collect IPv6 bidi connection statistics
---
 src/core/mainloop/connection.c |  4 ++--
 src/feature/stats/connstats.c  | 37 +++--
 src/feature/stats/connstats.h  |  3 ++-
 src/test/test_stats.c  | 28 
 4 files changed, 47 insertions(+), 25 deletions(-)

diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c
index 0d2e6a220..1d53e077d 100644
--- a/src/core/mainloop/connection.c
+++ b/src/core/mainloop/connection.c
@@ -3363,11 +3363,11 @@ record_num_bytes_transferred_impl(connection_t *conn,
   if (!connection_is_rate_limited(conn))
 return;
 
+  const bool is_ipv6 = (conn->socket_family == AF_INET6);
   if (conn->type == CONN_TYPE_OR)
 conn_stats_note_or_conn_bytes(conn->global_identifier, num_read,
-num_written, now);
+  num_written, now, is_ipv6);
 
-  const bool is_ipv6 = (conn->socket_family == AF_INET6);
   if (num_read > 0) {
 bwhist_note_bytes_read(num_read, now, is_ipv6);
   }
diff --git a/src/feature/stats/connstats.c b/src/feature/stats/connstats.c
index 7d7c67361..73bc8d7cc 100644
--- a/src/feature/stats/connstats.c
+++ b/src/feature/stats/connstats.c
@@ -70,6 +70,8 @@ typedef struct conn_counts_t {
 
 /** A collection of connection counts, over all OR connections. */
 static conn_counts_t counts;
+/** A collection of connection counts, over IPv6 OR connections only. */
+static conn_counts_t counts_ipv6;
 
 /** Entry in a map from connection ID to the number of read and written
  * bytes on this connection in a BIDI_INTERVAL second interval. */
@@ -78,6 +80,7 @@ typedef struct bidi_map_entry_t {
   uint64_t conn_id; /**< Connection ID */
   size_t read; /**< Number of read bytes */
   size_t written; /**< Number of written bytes */
+  bool is_ipv6; /**< True if this is an IPv6 connection */
 } bidi_map_entry_t;
 
 /** Map of OR connections together with the number of read and written
@@ -123,6 +126,7 @@ conn_stats_reset(time_t now)
 {
   start_of_conn_stats_interval = now;
   memset(, 0, sizeof(counts));
+  memset(_ipv6, 0, sizeof(counts_ipv6));
   conn_stats_free_all();
 }
 
@@ -159,17 +163,18 @@ static void
 collect_period_statistics(void)
 {
   bidi_map_entry_t **ptr, **next, *ent;
-  conn_counts_t *cnt = 
   for (ptr = HT_START(bidimap, _map); ptr; ptr = next) {
 ent = *ptr;
-add_entry_to_count(cnt, ent);
+add_entry_to_count(, ent);
+if (ent->is_ipv6)
+  add_entry_to_count(_ipv6, ent);
 next = HT_NEXT_RMV(bidimap, _map, ptr);
 tor_free(ent);
   }
   log_info(LD_GENERAL, "%d below threshold, %d mostly read, "
"%d mostly written, %d both read and written.",
-   cnt->below_threshold, cnt->mostly_read, cnt->mostly_written,
-   cnt->both_read_and_written);
+   counts.below_threshold, counts.mostly_read, counts.mostly_written,
+   counts.both_read_and_written);
 }
 
 /** We read num_read bytes and wrote num_written from/to OR
@@ -178,7 +183,8 @@ collect_period_statistics(void)
  * for this connection. */
 void
 conn_stats_note_or_conn_bytes(uint64_t conn_id, size_t num_read,
-size_t num_written, time_t when)
+  size_t num_written, time_t when,
+  bool is_ipv6)
 {
   if (!start_of_conn_stats_interval)
 return;
@@ -199,11 +205,13 @@ conn_stats_note_or_conn_bytes(uint64_t conn_id, size_t 
num_read,
 if (entry) {
   entry->written += num_written;
   entry->read += num_read;
+  entry->is_ipv6 |= is_ipv6;
 } else {
   entry = tor_malloc_zero(sizeof(bidi_map_entry_t));
   entry->conn_id = conn_id;
   entry->written = num_written;
   entry->read = num_read;
+  entry->is_ipv6 = is_ipv6;
   HT_INSERT(bidimap, _map, entry);
 }
   }
@@ -215,21 +223,30 @@ conn_stats_note_or_conn_bytes(uint64_t conn_id, size_t 
num_read,
 char *
 conn_stats_format(time_t now)
 {
-  char *result, written[ISO_TIME_LEN+1];
+  char *result, written_at[ISO_TIME_LEN+1];
 
   if (!start_of_conn_stats_interval)
 return NULL; /* Not initialized. */
 
   tor_assert(now >= start_of_conn_stats_interval);
 
-  format_iso_time(written, now);
-  tor_asprintf(, "conn-bi-direct %s (%d s) %d,%d,%d,%d\n",
-   written,
+  format_iso_time(written_at, now);
+  tor_asprintf(,
+   "conn-bi-direct %s (%d s) %d,%d,%d,%d\n"
+   "ipv6-conn-bi-direct %s (%d s) %d,%d,%d,%d\n",
+   written_at,
(unsigned) (now - start_of_conn_stats_interval),
counts.below_threshold,
counts.mostly_read,
counts.mostly_written,
-   counts.both_read_and_written);
+   counts.both_read_and_written,
+   written_at,
+   (unsigned) (now - 

[tor-commits] [tor/master] connstats: extract connection type counts into a structure.

2020-07-10 Thread dgoulet
commit 0b5e19d22312291d5c9f8a5e8f8f3e6ad2ef4920
Author: Nick Mathewson 
Date:   Fri Jul 10 09:32:30 2020 -0400

connstats: extract connection type counts into a structure.
---
 src/feature/stats/connstats.c | 58 +++
 src/feature/stats/connstats.h |  2 +-
 2 files changed, 32 insertions(+), 28 deletions(-)

diff --git a/src/feature/stats/connstats.c b/src/feature/stats/connstats.c
index 82b1adcd9..2879a3018 100644
--- a/src/feature/stats/connstats.c
+++ b/src/feature/stats/connstats.c
@@ -48,22 +48,28 @@ conn_stats_init(time_t now)
 /** Start of next BIDI_INTERVAL second interval. */
 static time_t bidi_next_interval = 0;
 
-/** Number of connections that we read and wrote less than BIDI_THRESHOLD
- * bytes from/to in BIDI_INTERVAL seconds. */
-static uint32_t below_threshold = 0;
+/** A single grouped set of connection type counts. */
+typedef struct conn_counts_t {
+  /** Number of connections that we read and wrote less than BIDI_THRESHOLD
+   * bytes from/to in BIDI_INTERVAL seconds. */
+  uint32_t below_threshold;
 
-/** Number of connections that we read at least BIDI_FACTOR times more
- * bytes from than we wrote to in BIDI_INTERVAL seconds. */
-static uint32_t mostly_read = 0;
+  /** Number of connections that we read at least BIDI_FACTOR times more
+   * bytes from than we wrote to in BIDI_INTERVAL seconds. */
+  uint32_t mostly_read;
 
-/** Number of connections that we wrote at least BIDI_FACTOR times more
- * bytes to than we read from in BIDI_INTERVAL seconds. */
-static uint32_t mostly_written = 0;
+  /** Number of connections that we wrote at least BIDI_FACTOR times more
+   * bytes to than we read from in BIDI_INTERVAL seconds. */
+  uint32_t mostly_written;
 
-/** Number of connections that we read and wrote at least BIDI_THRESHOLD
- * bytes from/to, but not BIDI_FACTOR times more in either direction in
- * BIDI_INTERVAL seconds. */
-static uint32_t both_read_and_written = 0;
+  /** Number of connections that we read and wrote at least BIDI_THRESHOLD
+   * bytes from/to, but not BIDI_FACTOR times more in either direction in
+   * BIDI_INTERVAL seconds. */
+  uint32_t both_read_and_written;
+} conn_counts_t ;
+
+/** A collection of connection counts, over all OR connections. */
+static conn_counts_t counts;
 
 /** Entry in a map from connection ID to the number of read and written
  * bytes on this connection in a BIDI_INTERVAL second interval. */
@@ -116,10 +122,7 @@ void
 conn_stats_reset(time_t now)
 {
   start_of_conn_stats_interval = now;
-  below_threshold = 0;
-  mostly_read = 0;
-  mostly_written = 0;
-  both_read_and_written = 0;
+  memset(, 0, sizeof(counts));
   conn_stats_free_all();
 }
 
@@ -147,16 +150,17 @@ conn_stats_note_or_conn_bytes(uint64_t conn_id, size_t 
num_read,
   /* Sum up last period's statistics */
   if (when >= bidi_next_interval) {
 bidi_map_entry_t **ptr, **next, *ent;
+conn_counts_t *cnt = 
 for (ptr = HT_START(bidimap, _map); ptr; ptr = next) {
   ent = *ptr;
   if (ent->read + ent->written < BIDI_THRESHOLD)
-below_threshold++;
+cnt->below_threshold++;
   else if (ent->read >= ent->written * BIDI_FACTOR)
-mostly_read++;
+cnt->mostly_read++;
   else if (ent->written >= ent->read * BIDI_FACTOR)
-mostly_written++;
+cnt->mostly_written++;
   else
-both_read_and_written++;
+cnt->both_read_and_written++;
   next = HT_NEXT_RMV(bidimap, _map, ptr);
   tor_free(ent);
 }
@@ -164,8 +168,8 @@ conn_stats_note_or_conn_bytes(uint64_t conn_id, size_t 
num_read,
   bidi_next_interval += BIDI_INTERVAL;
 log_info(LD_GENERAL, "%d below threshold, %d mostly read, "
  "%d mostly written, %d both read and written.",
- below_threshold, mostly_read, mostly_written,
- both_read_and_written);
+ cnt->below_threshold, cnt->mostly_read, cnt->mostly_written,
+ cnt->both_read_and_written);
   }
   /* Add this connection's bytes. */
   if (num_read > 0 || num_written > 0) {
@@ -202,10 +206,10 @@ conn_stats_format(time_t now)
   tor_asprintf(, "conn-bi-direct %s (%d s) %d,%d,%d,%d\n",
written,
(unsigned) (now - start_of_conn_stats_interval),
-   below_threshold,
-   mostly_read,
-   mostly_written,
-   both_read_and_written);
+   counts.below_threshold,
+   counts.mostly_read,
+   counts.mostly_written,
+   counts.both_read_and_written);
   return result;
 }
 
diff --git a/src/feature/stats/connstats.h b/src/feature/stats/connstats.h
index 26ff74cfd..43b654974 100644
--- a/src/feature/stats/connstats.h
+++ b/src/feature/stats/connstats.h
@@ -14,7 +14,7 @@
 
 void conn_stats_init(time_t now);
 void conn_stats_note_or_conn_bytes(uint64_t conn_id, size_t num_read,
- size_t num_written, time_t when);
+

[tor-commits] [tor/master] Merge branch 'tor-gitlab/mr/39'

2020-07-10 Thread dgoulet
commit 063cdb3142f380ca1167f50d42fb61c2687dbef6
Merge: 6fb163725 fae19df98
Author: David Goulet 
Date:   Fri Jul 10 13:12:22 2020 -0400

Merge branch 'tor-gitlab/mr/39'

 changes/ticket33264  |   4 +
 src/core/mainloop/connection.c   |   7 +-
 src/core/mainloop/mainloop.c |   3 +-
 src/feature/relay/relay_config.c |   5 +-
 src/feature/stats/connstats.c| 283 +++
 src/feature/stats/connstats.h|  25 
 src/feature/stats/include.am |   2 +
 src/feature/stats/rephist.c  | 223 +-
 src/feature/stats/rephist.h  |   8 --
 src/test/test_stats.c|  45 ---
 10 files changed, 350 insertions(+), 255 deletions(-)

___
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 ipv6 bidi (ticket 33264)

2020-07-10 Thread dgoulet
commit fae19df98581ee5128faca704e384a5eeefc5966
Author: Nick Mathewson 
Date:   Fri Jul 10 09:52:35 2020 -0400

Changes file for ipv6 bidi (ticket 33264)
---
 changes/ticket33264 | 4 
 1 file changed, 4 insertions(+)

diff --git a/changes/ticket33264 b/changes/ticket33264
new file mode 100644
index 0..c72ea1c57
--- /dev/null
+++ b/changes/ticket33264
@@ -0,0 +1,4 @@
+  o Minor features (statistics, ipv6):
+- Relays now publish IPv6-specific counts of single-direction
+  versus bidirectional relay connections.
+  Closes ticket 33264.



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


[tor-commits] [tor/master] connstats: use correct formatter for uint32_t.

2020-07-10 Thread dgoulet
commit 0f60a1d33c64ec71eea3ea95e2a87e32dd74421c
Author: Nick Mathewson 
Date:   Fri Jul 10 09:50:04 2020 -0400

connstats: use correct formatter for uint32_t.

We have had no reports of negative counts here, so it is probably
safe not to backport this.
---
 src/feature/stats/connstats.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/feature/stats/connstats.c b/src/feature/stats/connstats.c
index 73bc8d7cc..f0c786efb 100644
--- a/src/feature/stats/connstats.c
+++ b/src/feature/stats/connstats.c
@@ -232,8 +232,10 @@ conn_stats_format(time_t now)
 
   format_iso_time(written_at, now);
   tor_asprintf(,
-   "conn-bi-direct %s (%d s) %d,%d,%d,%d\n"
-   "ipv6-conn-bi-direct %s (%d s) %d,%d,%d,%d\n",
+   "conn-bi-direct %s (%d s) "
+"%"PRIu32",%"PRIu32",%"PRIu32",%"PRIu32"\n"
+   "ipv6-conn-bi-direct %s (%d s) "
+"%"PRIu32",%"PRIu32",%"PRIu32",%"PRIu32"\n",
written_at,
(unsigned) (now - start_of_conn_stats_interval),
counts.below_threshold,



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


[tor-commits] [tor/master] Change connstats.c identifers to start with conn_stats

2020-07-10 Thread dgoulet
commit 3f2de0bcca301785c5f1911354f2d3f4d5ba1708
Author: Nick Mathewson 
Date:   Fri Jul 10 09:11:12 2020 -0400

Change connstats.c identifers to start with conn_stats

This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
rep_hist_conn_stats_init conn_stats_init \
rep_hist_note_or_conn_bytes conn_stats_note_or_conn_bytes \
rep_hist_reset_conn_stats conn_stats_reset \
rep_hist_format_conn_stats conn_stats_format \
rep_hist_conn_stats_write conn_stats_save \
rep_hist_conn_stats_term conn_stats_terminate \
bidi_map_free_all conn_stats_free_all
---
 src/core/mainloop/connection.c   |  2 +-
 src/core/mainloop/mainloop.c |  2 +-
 src/feature/relay/relay_config.c |  4 ++--
 src/feature/stats/connstats.c| 24 
 src/feature/stats/connstats.h| 14 +++---
 src/feature/stats/rephist.c  |  2 +-
 src/test/test_stats.c| 36 ++--
 7 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c
index 2d6f02fc6..0d2e6a220 100644
--- a/src/core/mainloop/connection.c
+++ b/src/core/mainloop/connection.c
@@ -3364,7 +3364,7 @@ record_num_bytes_transferred_impl(connection_t *conn,
 return;
 
   if (conn->type == CONN_TYPE_OR)
-rep_hist_note_or_conn_bytes(conn->global_identifier, num_read,
+conn_stats_note_or_conn_bytes(conn->global_identifier, num_read,
 num_written, now);
 
   const bool is_ipv6 = (conn->socket_family == AF_INET6);
diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index edea036fa..3bf9be566 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -1951,7 +1951,7 @@ write_stats_file_callback(time_t now, const or_options_t 
*options)
   next_time_to_write_stats_files = next_write;
   }
   if (options->ConnDirectionStatistics) {
-time_t next_write = rep_hist_conn_stats_write(now);
+time_t next_write = conn_stats_save(now);
 if (next_write && next_write < next_time_to_write_stats_files)
   next_time_to_write_stats_files = next_write;
   }
diff --git a/src/feature/relay/relay_config.c b/src/feature/relay/relay_config.c
index 4ba83d4bc..7cb7f2ccf 100644
--- a/src/feature/relay/relay_config.c
+++ b/src/feature/relay/relay_config.c
@@ -1308,7 +1308,7 @@ options_act_relay_stats(const or_options_t *old_options,
 }
 if ((!old_options || !old_options->ConnDirectionStatistics) &&
 options->ConnDirectionStatistics) {
-  rep_hist_conn_stats_init(now);
+  conn_stats_init(now);
 }
 if ((!old_options || !old_options->HiddenServiceStatistics) &&
 options->HiddenServiceStatistics) {
@@ -1338,7 +1338,7 @@ options_act_relay_stats(const or_options_t *old_options,
 rep_hist_exit_stats_term();
   if (old_options && old_options->ConnDirectionStatistics &&
   !options->ConnDirectionStatistics)
-rep_hist_conn_stats_term();
+conn_stats_terminate();
 
   return 0;
 }
diff --git a/src/feature/stats/connstats.c b/src/feature/stats/connstats.c
index f8df26ecc..32987ecf9 100644
--- a/src/feature/stats/connstats.c
+++ b/src/feature/stats/connstats.c
@@ -23,7 +23,7 @@ static time_t start_of_conn_stats_interval;
 
 /** Initialize connection stats. */
 void
-rep_hist_conn_stats_init(time_t now)
+conn_stats_init(time_t now)
 {
   start_of_conn_stats_interval = now;
 }
@@ -95,7 +95,7 @@ HT_GENERATE2(bidimap, bidi_map_entry_t, node, 
bidi_map_ent_hash,
 
 /** Release all storage held in connstats.c */
 void
-bidi_map_free_all(void)
+conn_stats_free_all(void)
 {
   bidi_map_entry_t **ptr, **next, *ent;
   for (ptr = HT_START(bidimap, _map); ptr; ptr = next) {
@@ -108,22 +108,22 @@ bidi_map_free_all(void)
 
 /** Reset counters for conn statistics. */
 void
-rep_hist_reset_conn_stats(time_t now)
+conn_stats_reset(time_t now)
 {
   start_of_conn_stats_interval = now;
   below_threshold = 0;
   mostly_read = 0;
   mostly_written = 0;
   both_read_and_written = 0;
-  bidi_map_free_all();
+  conn_stats_free_all();
 }
 
 /** Stop collecting connection stats in a way that we can re-start doing
- * so in rep_hist_conn_stats_init(). */
+ * so in conn_stats_init(). */
 void
-rep_hist_conn_stats_term(void)
+conn_stats_terminate(void)
 {
-  rep_hist_reset_conn_stats(0);
+  conn_stats_reset(0);
 }
 
 /** We read num_read bytes and wrote num_written from/to OR
@@ -131,7 +131,7 @@ rep_hist_conn_stats_term(void)
  * observation in a new interval, sum up the last observations. Add bytes
  * for this connection. */
 void
-rep_hist_note_or_conn_bytes(uint64_t conn_id, size_t num_read,
+conn_stats_note_or_conn_bytes(uint64_t conn_id, size_t num_read,
 size_t num_written, time_t when)
 {
   if (!start_of_conn_stats_interval)
@@ -184,7 +184,7 @@ rep_hist_note_or_conn_bytes(uint64_t 

[tor-commits] [tor/master] Split bidi connection-stats code into a new C file.

2020-07-10 Thread dgoulet
commit 50bf2520b33eb9f477c1b8989264667c5b587a01
Author: Nick Mathewson 
Date:   Fri Jul 10 09:07:23 2020 -0400

Split bidi connection-stats code into a new C file.
---
 src/core/mainloop/connection.c   |   1 +
 src/core/mainloop/mainloop.c |   1 +
 src/feature/relay/relay_config.c |   1 +
 src/feature/stats/connstats.c| 235 +++
 src/feature/stats/connstats.h|  24 
 src/feature/stats/include.am |   2 +
 src/feature/stats/rephist.c  | 221 +---
 src/feature/stats/rephist.h  |   8 --
 src/test/test_stats.c|   1 +
 9 files changed, 266 insertions(+), 228 deletions(-)

diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c
index 2f3c70365..2d6f02fc6 100644
--- a/src/core/mainloop/connection.c
+++ b/src/core/mainloop/connection.c
@@ -105,6 +105,7 @@
 #include "feature/relay/routermode.h"
 #include "feature/rend/rendclient.h"
 #include "feature/rend/rendcommon.h"
+#include "feature/stats/connstats.h"
 #include "feature/stats/rephist.h"
 #include "feature/stats/bwhist.h"
 #include "lib/crypt_ops/crypto_util.h"
diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index e4e17f6b7..edea036fa 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -95,6 +95,7 @@
 #include "feature/rend/rendservice.h"
 #include "feature/stats/geoip_stats.h"
 #include "feature/stats/predict_ports.h"
+#include "feature/stats/connstats.h"
 #include "feature/stats/rephist.h"
 #include "lib/buf/buffers.h"
 #include "lib/crypt_ops/crypto_rand.h"
diff --git a/src/feature/relay/relay_config.c b/src/feature/relay/relay_config.c
index bd1c1e8fe..4ba83d4bc 100644
--- a/src/feature/relay/relay_config.c
+++ b/src/feature/relay/relay_config.c
@@ -36,6 +36,7 @@
 #include "feature/nodelist/nickname.h"
 #include "feature/stats/geoip_stats.h"
 #include "feature/stats/predict_ports.h"
+#include "feature/stats/connstats.h"
 #include "feature/stats/rephist.h"
 
 #include "feature/dirauth/authmode.h"
diff --git a/src/feature/stats/connstats.c b/src/feature/stats/connstats.c
new file mode 100644
index 0..f8df26ecc
--- /dev/null
+++ b/src/feature/stats/connstats.c
@@ -0,0 +1,235 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2020, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * @file connstats.c
+ * @brief Count bidirectional vs one-way connections.
+ *
+ * Connection statistics, used by relays to count connections, and track
+ * one-way and bidirectional connections.
+ **/
+
+#include "orconfig.h"
+#include "core/or/or.h"
+#include "feature/stats/connstats.h"
+#include "app/config/config.h"
+
+/** Start of the current connection stats interval or 0 if we're not
+ * collecting connection statistics. */
+static time_t start_of_conn_stats_interval;
+
+/** Initialize connection stats. */
+void
+rep_hist_conn_stats_init(time_t now)
+{
+  start_of_conn_stats_interval = now;
+}
+
+/* Count connections that we read and wrote less than these many bytes
+ * from/to as below threshold. */
+#define BIDI_THRESHOLD 20480
+
+/* Count connections that we read or wrote at least this factor as many
+ * bytes from/to than we wrote or read to/from as mostly reading or
+ * writing. */
+#define BIDI_FACTOR 10
+
+/* Interval length in seconds for considering read and written bytes for
+ * connection stats. */
+#define BIDI_INTERVAL 10
+
+/** Start of next BIDI_INTERVAL second interval. */
+static time_t bidi_next_interval = 0;
+
+/** Number of connections that we read and wrote less than BIDI_THRESHOLD
+ * bytes from/to in BIDI_INTERVAL seconds. */
+static uint32_t below_threshold = 0;
+
+/** Number of connections that we read at least BIDI_FACTOR times more
+ * bytes from than we wrote to in BIDI_INTERVAL seconds. */
+static uint32_t mostly_read = 0;
+
+/** Number of connections that we wrote at least BIDI_FACTOR times more
+ * bytes to than we read from in BIDI_INTERVAL seconds. */
+static uint32_t mostly_written = 0;
+
+/** Number of connections that we read and wrote at least BIDI_THRESHOLD
+ * bytes from/to, but not BIDI_FACTOR times more in either direction in
+ * BIDI_INTERVAL seconds. */
+static uint32_t both_read_and_written = 0;
+
+/** Entry in a map from connection ID to the number of read and written
+ * bytes on this connection in a BIDI_INTERVAL second interval. */
+typedef struct bidi_map_entry_t {
+  HT_ENTRY(bidi_map_entry_t) node;
+  uint64_t conn_id; /**< Connection ID */
+  size_t read; /**< Number of read bytes */
+  size_t written; /**< Number of written bytes */
+} bidi_map_entry_t;
+
+/** Map of OR connections together with the number of read and written
+ * bytes in the current BIDI_INTERVAL second interval. */
+static HT_HEAD(bidimap, bidi_map_entry_t) bidi_map =
+ HT_INITIALIZER();
+
+static int

[tor-commits] [tor/master] connstats: extract functions for summarizing a connection's status

2020-07-10 Thread dgoulet
commit 54141d66e27a47719fe81a886d5e92d2b730f374
Author: Nick Mathewson 
Date:   Fri Jul 10 09:36:07 2020 -0400

connstats: extract functions for summarizing a connection's status
---
 src/feature/stats/connstats.c | 58 +--
 1 file changed, 39 insertions(+), 19 deletions(-)

diff --git a/src/feature/stats/connstats.c b/src/feature/stats/connstats.c
index 2879a3018..7d7c67361 100644
--- a/src/feature/stats/connstats.c
+++ b/src/feature/stats/connstats.c
@@ -134,6 +134,44 @@ conn_stats_terminate(void)
   conn_stats_reset(0);
 }
 
+/**
+ * Record a single entry @a ent in the counts structure @cnt.
+ */
+static void
+add_entry_to_count(conn_counts_t *cnt, const bidi_map_entry_t *ent)
+{
+  if (ent->read + ent->written < BIDI_THRESHOLD)
+cnt->below_threshold++;
+  else if (ent->read >= ent->written * BIDI_FACTOR)
+cnt->mostly_read++;
+  else if (ent->written >= ent->read * BIDI_FACTOR)
+cnt->mostly_written++;
+  else
+cnt->both_read_and_written++;
+}
+
+/**
+ * Count all the connection information we've received during the current
+ * period in 'bidimap', and store that information in the appropriate count
+ * structures.
+ **/
+static void
+collect_period_statistics(void)
+{
+  bidi_map_entry_t **ptr, **next, *ent;
+  conn_counts_t *cnt = 
+  for (ptr = HT_START(bidimap, _map); ptr; ptr = next) {
+ent = *ptr;
+add_entry_to_count(cnt, ent);
+next = HT_NEXT_RMV(bidimap, _map, ptr);
+tor_free(ent);
+  }
+  log_info(LD_GENERAL, "%d below threshold, %d mostly read, "
+   "%d mostly written, %d both read and written.",
+   cnt->below_threshold, cnt->mostly_read, cnt->mostly_written,
+   cnt->both_read_and_written);
+}
+
 /** We read num_read bytes and wrote num_written from/to OR
  * connection conn_id in second when. If this is the first
  * observation in a new interval, sum up the last observations. Add bytes
@@ -149,27 +187,9 @@ conn_stats_note_or_conn_bytes(uint64_t conn_id, size_t 
num_read,
 bidi_next_interval = when + BIDI_INTERVAL;
   /* Sum up last period's statistics */
   if (when >= bidi_next_interval) {
-bidi_map_entry_t **ptr, **next, *ent;
-conn_counts_t *cnt = 
-for (ptr = HT_START(bidimap, _map); ptr; ptr = next) {
-  ent = *ptr;
-  if (ent->read + ent->written < BIDI_THRESHOLD)
-cnt->below_threshold++;
-  else if (ent->read >= ent->written * BIDI_FACTOR)
-cnt->mostly_read++;
-  else if (ent->written >= ent->read * BIDI_FACTOR)
-cnt->mostly_written++;
-  else
-cnt->both_read_and_written++;
-  next = HT_NEXT_RMV(bidimap, _map, ptr);
-  tor_free(ent);
-}
+collect_period_statistics();
 while (when >= bidi_next_interval)
   bidi_next_interval += BIDI_INTERVAL;
-log_info(LD_GENERAL, "%d below threshold, %d mostly read, "
- "%d mostly written, %d both read and written.",
- cnt->below_threshold, cnt->mostly_read, cnt->mostly_written,
- cnt->both_read_and_written);
   }
   /* Add this connection's bytes. */
   if (num_read > 0 || num_written > 0) {



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


[tor-commits] [tor/master] connstats: add and clarify some documentation.

2020-07-10 Thread dgoulet
commit 515cc49cb7fce62db8256f2729e4473015574d1a
Author: Nick Mathewson 
Date:   Fri Jul 10 09:17:18 2020 -0400

connstats: add and clarify some documentation.
---
 src/feature/stats/connstats.c | 19 ---
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/feature/stats/connstats.c b/src/feature/stats/connstats.c
index 32987ecf9..82b1adcd9 100644
--- a/src/feature/stats/connstats.c
+++ b/src/feature/stats/connstats.c
@@ -8,8 +8,12 @@
  * @file connstats.c
  * @brief Count bidirectional vs one-way connections.
  *
- * Connection statistics, used by relays to count connections, and track
- * one-way and bidirectional connections.
+ * Connection statistics, use to track one-way and bidirectional connections.
+ *
+ * Note that this code counts concurrent connections in each
+ * BIDI_INTERVAL-second interval, not total connections.  It can tell you what
+ * fraction of connections are bidirectional at each time, not necessarily
+ * what number are bidirectional.
  **/
 
 #include "orconfig.h"
@@ -28,16 +32,16 @@ conn_stats_init(time_t now)
   start_of_conn_stats_interval = now;
 }
 
-/* Count connections that we read and wrote less than these many bytes
- * from/to as below threshold. */
+/** Count connections on which we read and wrote less than this many bytes
+ * as "below threshold." */
 #define BIDI_THRESHOLD 20480
 
-/* Count connections that we read or wrote at least this factor as many
+/** Count connections that we read or wrote at least this factor as many
  * bytes from/to than we wrote or read to/from as mostly reading or
  * writing. */
 #define BIDI_FACTOR 10
 
-/* Interval length in seconds for considering read and written bytes for
+/** Interval length in seconds for considering read and written bytes for
  * connection stats. */
 #define BIDI_INTERVAL 10
 
@@ -75,13 +79,14 @@ typedef struct bidi_map_entry_t {
 static HT_HEAD(bidimap, bidi_map_entry_t) bidi_map =
  HT_INITIALIZER();
 
+/** Hashtable helper: return true if @a a and @a b have the same key. */
 static int
 bidi_map_ent_eq(const bidi_map_entry_t *a, const bidi_map_entry_t *b)
 {
   return a->conn_id == b->conn_id;
 }
 
-/* DOCDOC bidi_map_ent_hash */
+/** Hashtable helper: compute a digest for the key of @a entry. */
 static unsigned
 bidi_map_ent_hash(const bidi_map_entry_t *entry)
 {



___
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-gitlab/mr/29'

2020-07-10 Thread nickm
commit 6fb1637255122dc3660486cf731c0f4640fd98db
Merge: 1a4e475d5 dfaa0a82a
Author: Nick Mathewson 
Date:   Fri Jul 10 12:53:46 2020 -0400

Merge remote-tracking branch 'tor-gitlab/mr/29'

 changes/ticket32910  |   5 +
 configure.ac |  84 +++-
 doc/HACKING/Tracing.md   | 150 +-
 scripts/maint/practracker/exceptions.txt |   2 +
 src/app/include.am   |   4 +-
 src/app/main/main.c  |   4 +
 src/app/main/subsystem_list.c|   3 +
 src/core/or/circuitbuild.c   |   6 +
 src/core/or/circuitlist.c|  10 +
 src/core/or/circuituse.c |  15 +-
 src/core/or/include.am   |   7 +
 src/core/or/lttng_circuit.inc| 322 +++
 src/core/or/trace_probes_circuit.c   |  30 +++
 src/core/or/trace_probes_circuit.h   |  22 +++
 src/lib/trace/.may_include   |   1 +
 src/lib/trace/debug.h|  30 +--
 src/lib/trace/events.h   |  84 +---
 src/lib/trace/include.am |  26 ++-
 src/lib/trace/lttng/include.am   |   3 +
 src/lib/trace/lttng/lttng.h  |  28 +++
 src/lib/trace/trace.c|   8 +-
 src/lib/trace/trace.h|  30 ++-
 src/lib/trace/trace_stub.c   |  19 ++
 src/lib/trace/trace_sys.c|  36 
 src/lib/trace/trace_sys.h|  22 +++
 src/lib/trace/usdt/include.am|   3 +
 src/lib/trace/usdt/usdt.h|  33 
 src/test/fuzz/include.am |   2 +-
 src/test/include.am  |  18 +-
 29 files changed, 895 insertions(+), 112 deletions(-)

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


[tor-commits] [tor/master] trace: Better structure lib/trace and configure options

2020-07-10 Thread nickm
commit 6fc6cbd9b347ee1f82a024a04c0276bbc6e82c99
Author: David Goulet 
Date:   Thu Jan 9 12:17:49 2020 -0500

trace: Better structure lib/trace and configure options

In the next commits, we'll add more tracing options for instrumentation and
specific tracer.

This rename follows a more meaningful naming standard. It also adds a catch
all "HAVE_TRACING" define that indicate in the code that we have tracing
enabled.

Part of #32910

Signed-off-by: David Goulet 
---
 configure.ac | 29 +++
 src/lib/trace/debug.h| 30 ++--
 src/lib/trace/events.h   | 52 +++-
 src/lib/trace/include.am | 10 ++
 4 files changed, 66 insertions(+), 55 deletions(-)

diff --git a/configure.ac b/configure.ac
index a6df7149a..680111b10 100644
--- a/configure.ac
+++ b/configure.ac
@@ -256,15 +256,22 @@ AC_ARG_ENABLE(seccomp,
 AC_ARG_ENABLE(libscrypt,
  AS_HELP_STRING(--disable-libscrypt, [do not attempt to use libscrypt]))
 
-dnl Enable event tracing which are transformed to debug log statement.
-AC_ARG_ENABLE(event-tracing-debug,
- AS_HELP_STRING(--enable-event-tracing-debug, [build with event tracing to 
debug log]))
-AM_CONDITIONAL([USE_EVENT_TRACING_DEBUG], [test "x$enable_event_tracing_debug" 
= "xyes"])
+dnl --- Tracing Options. ---
 
-if test x$enable_event_tracing_debug = xyes; then
-  AC_DEFINE([USE_EVENT_TRACING_DEBUG], [1], [Tracing framework to log debug])
-  AC_DEFINE([TOR_EVENT_TRACING_ENABLED], [1], [Compile the event tracing 
instrumentation])
-fi
+dnl Tracepoints event to debug logs.
+AC_ARG_ENABLE(tracing-instrumentation-log-debug,
+ AS_HELP_STRING([--enable-tracing-instrumentation-log-debug],
+[build with tracing event to debug log]),
+ AC_DEFINE([USE_TRACING_INSTRUMENTATION_LOG_DEBUG], [1],
+   [Tracepoints to log debug]), [])
+AM_CONDITIONAL([USE_TRACING_INSTRUMENTATION_LOG_DEBUG],
+   [test "x$enable_tracing_instrumentation_log_debug" = "xyes"])
+
+dnl Define that tracing is supported.
+AM_COND_IF([USE_TRACING_INSTRUMENTATION_LOG_DEBUG],
+   AC_DEFINE([HAVE_TRACING], [1], [Compiled with tracing support]))
+
+dnl -- End Tracing Options. --
 
 dnl Enable Android only features.
 AC_ARG_ENABLE(android,
@@ -2718,6 +2725,12 @@ PPRINT_PROP_BOOL([libFuzzer support 
(--enable-libfuzzer)], $value)
 test "x$enable_oss_fuzz" = "xyes" && value=1 || value=0
 PPRINT_PROP_BOOL([OSS-Fuzz support (--enable-oss-fuzz)], $value)
 
+AS_ECHO
+PPRINT_SUBTITLE([Tracing])
+
+test "x$enable_tracing_instrumentation_log_debug" = "xyes" && value=1 || 
value=0
+PPRINT_PROP_BOOL([Tracepoints to log_debug() 
(--enable-tracing-instrumentation-log-debug)], $value)
+
 AS_ECHO
 PPRINT_SUBTITLE([Install Directories])
 
diff --git a/src/lib/trace/debug.h b/src/lib/trace/debug.h
index 87b3074e0..84a2867a6 100644
--- a/src/lib/trace/debug.h
+++ b/src/lib/trace/debug.h
@@ -6,8 +6,10 @@
  * \brief Macros for debugging our event-trace support.
  **/
 
-#ifndef TOR_TRACE_LOG_DEBUG_H
-#define TOR_TRACE_LOG_DEBUG_H
+#ifndef TOR_TRACE_DEBUG_H
+#define TOR_TRACE_DEBUG_H
+
+#ifdef USE_TRACING_INSTRUMENTATION_LOG_DEBUG
 
 #include "lib/log/log.h"
 
@@ -17,14 +19,20 @@
 
 /* Send every event to a debug log level. This is useful to debug new trace
  * events without implementing them for a specific event tracing framework.
- * Note that the arguments are ignored since at this step we do not know the
- * types and amount there is. */
+ *
+ * NOTE: arguments can't be used becaue there is no easy generic ways to learn
+ * their type and amount. It is probably doable with massive C pre-processor
+ * trickery but this is meant to be simple. */
+
+#define TOR_TRACE_LOG_DEBUG(subsystem, event_name, ...) \
+  log_debug(LD_GENERAL, "Tracepoint \"" XSTR(event_name) "\" from " \
+"subsystem \"" XSTR(subsystem) "\" hit.")
+
+#else /* defined(USE_TRACING_INSTRUMENTATION_LOG_DEBUG) */
+
+/* NOP the debug event. */
+#define TOR_TRACE_LOG_DEBUG(subsystem, name, ...)
 
-/* Example on how to map a tracepoint to log_debug(). */
-#undef tor_trace
-#define tor_trace(subsystem, name, args...) \
-  log_debug(LD_GENERAL, "Trace event \"" XSTR(name) "\" from " \
-"\"" XSTR(subsystem) "\" hit. " \
-"(line "XSTR(__LINE__) ")")
+#endif /* defined(USE_TRACING_INSTRUMENTATION_LOG_DEBUG) */
 
-#endif /* !defined(TOR_TRACE_LOG_DEBUG_H) */
+#endif /* !defined(TOR_TRACE_DEBUG_H) */
diff --git a/src/lib/trace/events.h b/src/lib/trace/events.h
index 368f85dd0..b1b31fdc9 100644
--- a/src/lib/trace/events.h
+++ b/src/lib/trace/events.h
@@ -6,40 +6,28 @@
  * \brief Header file for Tor event tracing.
  **/
 
-#ifndef TOR_TRACE_EVENTS_H
-#define TOR_TRACE_EVENTS_H
-
-/*
- * The following defines a generic event tracing function name that has to be
- * used to trace events in the code base.
- *
- * 

[tor-commits] [tor/master] doc: Add a WARNING section to Tracing.md

2020-07-10 Thread nickm
commit 942ecfa835bc50ed11912df034abf5f184d46033
Author: David Goulet 
Date:   Wed Mar 11 12:26:10 2020 -0400

doc: Add a WARNING section to Tracing.md

Explain what is safe or not with tracing data.

Signed-off-by: David Goulet 
---
 doc/HACKING/Tracing.md | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/doc/HACKING/Tracing.md b/doc/HACKING/Tracing.md
index 8cf68321a..d898bee17 100644
--- a/doc/HACKING/Tracing.md
+++ b/doc/HACKING/Tracing.md
@@ -4,7 +4,25 @@ This document describes how the event tracing subsystem works 
in tor so
 developers can add events to the code base but also hook them to an event
 tracing framework (i.e. tracer).
 
-## Basics
+## WARNING ##
+
+Tracing the tor daemon **always** generates sensitive data if used in
+production (on the public network).
+
+It **is** ethical for researchers to use tracing for their own tor client (for
+example: building paths, timings, or performance).
+
+It is **NOT** ethical to archive, publish or keep data containing other users'
+activity such as relay data or anything that handles users' traffic. This
+of course includes any logs below notice level.
+
+Publishing analysis of tracing data containing user traffic is **NOT** safe
+either.
+
+In other words, tracing data that contains other users's activity is **NOT**
+safe to publish in any form.
+
+## Basics ###
 
 Tracing is separated in two different concepts. The tracing API and the
 tracing probes.



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


[tor-commits] [tor/master] trace: Comments and configure fix

2020-07-10 Thread nickm
commit c31d469f3734b0d60786deb2be9dafb3225755c3
Author: David Goulet 
Date:   Wed Jan 15 10:55:07 2020 -0500

trace: Comments and configure fix

Signed-off-by: David Goulet 
---
 configure.ac   |  8 
 src/lib/trace/events.h | 25 -
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8f47ff77b..cd014268b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2768,16 +2768,16 @@ test "x$enable_oss_fuzz" = "xyes" && value=1 || value=0
 PPRINT_PROP_BOOL([OSS-Fuzz support (--enable-oss-fuzz)], $value)
 
 AS_ECHO
-PPRINT_SUBTITLE([Tracing])
+PPRINT_SUBTITLE([Tracing (--enable-tracing-instrumentation-)])
 
 test "x$enable_tracing_instrumentation_log_debug" = "xyes" && value=1 || 
value=0
-PPRINT_PROP_BOOL([Tracepoints to log_debug() 
(--enable-tracing-instrumentation-log-debug)], $value)
+PPRINT_PROP_BOOL([Tracepoints to log_debug() (log-debug)], $value)
 
 test "x$enable_tracing_instrumentation_usdt" = "xyes" && value=1 || value=0
-PPRINT_PROP_BOOL([USDT Instrumentation 
(--enable-tracing-instrumentation-usdt)], $value)
+PPRINT_PROP_BOOL([USDT Instrumentation (usdt)], $value)
 
 test "x$enable_tracing_instrumentation_lttng" = "xyes" && value=1 || value=0
-PPRINT_PROP_BOOL([LTTng Instrumentation 
(--enable-tracing-instrumentation-lttng)], $value)
+PPRINT_PROP_BOOL([LTTng Instrumentation (lttng)], $value)
 
 AS_ECHO
 PPRINT_SUBTITLE([Install Directories])
diff --git a/src/lib/trace/events.h b/src/lib/trace/events.h
index 8cc0136b0..4a8078bf3 100644
--- a/src/lib/trace/events.h
+++ b/src/lib/trace/events.h
@@ -9,7 +9,30 @@
 #ifndef TOR_LIB_TRACE_EVENTS_H
 #define TOR_LIB_TRACE_EVENTS_H
 
-/* XXX: DOCDOC once framework is stable. */
+/*
+ * A tracepoint signature is defined as follow:
+ *
+ *tor_trace(, , ...)
+ *
+ * If tracing is enabled, the tor_trace() macro is mapped to all possible
+ * instrumentations (defined below). Each instrumentation type MUST define a
+ * top level macro (TOR_TRACE_) so it can be inserted into each
+ * tracepoint.
+ *
+ * In case no tracing is enabled (HAVE_TRACING), tracepoints are NOP and thus
+ * have no execution cost.
+ *
+ * Currently, three types of instrumentation are supported:
+ *
+ *  log-debug: Every tracepoints is mapped to a log_debug() statement.
+ *
+ *  User Statically-Defined Tracing (USDT): Probes that can be used with perf,
+ *  dtrace, SystemTap, DTrace and BPF Compiler Collection (BCC).
+ *
+ *  LTTng-UST: Probes for the LTTng Userspace Tracer. If USDT interface
+ *  (sdt.h) is available, the USDT probes are also generated by LTTng thus
+ *  enabling this instrumentation provides both probes.
+ */
 
 #ifdef HAVE_TRACING
 



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


[tor-commits] [tor/master] trace: Emit a warning if tracing is built in

2020-07-10 Thread nickm
commit b049cc3ace18dd42493ca768cf4636dfd89569fc
Author: David Goulet 
Date:   Wed Mar 11 12:12:28 2020 -0400

trace: Emit a warning if tracing is built in

Built in tracing should _not_ be run if it was not set on purpose. Warn as
loud as we can in order to inform the user that they are running a version
with tracing capabilities built in.

This commit also adds a subsys stub because utlimately the logging will 
happen
in the init phase but because the default log file is not set in the
sys_logging init function, the stub is not useful for now.

Signed-off-by: David Goulet 
---
 configure.ac   |  7 ++-
 src/app/main/main.c|  4 
 src/lib/trace/include.am   |  4 
 src/lib/trace/trace.h  | 21 +
 src/lib/trace/trace_stub.c | 19 +++
 src/lib/trace/trace_sys.c  |  5 -
 src/lib/trace/trace_sys.h  |  8 
 7 files changed, 66 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index cd014268b..75fd709f9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -273,9 +273,9 @@ if test "x$enable_tracing_instrumentation_lttng" = "xyes"; 
then
   On Debian, apt install liblttng-ust-dev"])], 
[])
   AC_DEFINE([USE_TRACING_INSTRUMENTATION_LTTNG], [1], [Using LTTng 
instrumentation])
   TOR_TRACE_LIBS="-llttng-ust -ldl"
+  have_tracing=1
 fi
 
-
 dnl USDT instrumentation option.
 AC_ARG_ENABLE(tracing-instrumentation-usdt,
   AS_HELP_STRING([--enable-tracing-instrumentation-usdt],
@@ -291,6 +291,7 @@ if test "x$enable_tracing_instrumentation_usdt" = "xyes"; 
then
   dnl --with-sdt. There is unfortunately no way to check that so we always
   dnl build the USDT probes even though LTTng instrumentation was requested.
   AC_DEFINE([USE_TRACING_INSTRUMENTATION_USDT], [1], [Using USDT 
instrumentation])
+  have_tracing=1
 fi
 
 dnl Tracepoints event to debug logs.
@@ -301,6 +302,9 @@ AC_ARG_ENABLE(tracing-instrumentation-log-debug,
[Tracepoints to log debug]), [])
 AM_CONDITIONAL([USE_TRACING_INSTRUMENTATION_LOG_DEBUG],
[test "x$enable_tracing_instrumentation_log_debug" = "xyes"])
+if test "x$enable_tracing_instrumentation_log_debug" = "xyes"; then
+  have_tracing=1
+fi
 
 dnl Define that tracing is supported if any instrumentation is used.
 AM_COND_IF([USE_TRACING_INSTRUMENTATION_LOG_DEBUG],
@@ -309,6 +313,7 @@ AM_COND_IF([USE_TRACING_INSTRUMENTATION_USDT],
AC_DEFINE([HAVE_TRACING], [1], [Compiled with tracing support]))
 AM_COND_IF([USE_TRACING_INSTRUMENTATION_LTTNG],
AC_DEFINE([HAVE_TRACING], [1], [Compiled with tracing support]))
+AM_CONDITIONAL([USE_TRACING], [test "x$have_tracing" = x1 ])
 
 dnl Finally, define the trace libs.
 AC_SUBST([TOR_TRACE_LIBS])
diff --git a/src/app/main/main.c b/src/app/main/main.c
index 89ba78742..e1d5772e3 100644
--- a/src/app/main/main.c
+++ b/src/app/main/main.c
@@ -59,6 +59,7 @@
 #include "lib/crypt_ops/crypto_rand.h"
 #include "lib/crypt_ops/crypto_s2k.h"
 #include "lib/net/resolve.h"
+#include "lib/trace/trace.h"
 
 #include "lib/process/waitpid.h"
 #include "lib/pubsub/pubsub_build.h"
@@ -602,6 +603,9 @@ tor_init(int argc, char *argv[])
   rust_log_welcome_string();
 #endif /* defined(HAVE_RUST) */
 
+  /* Warn _if_ the tracing subsystem is built in. */
+  tracing_log_warning();
+
   int init_rv = options_init_from_torrc(argc,argv);
   if (init_rv < 0) {
 log_err(LD_CONFIG,"Reading config failed--see warnings above.");
diff --git a/src/lib/trace/include.am b/src/lib/trace/include.am
index 844033132..6fe136565 100644
--- a/src/lib/trace/include.am
+++ b/src/lib/trace/include.am
@@ -26,6 +26,10 @@ if USE_TRACING_INSTRUMENTATION_LTTNG
 include src/lib/trace/lttng/include.am
 endif
 
+if USE_TRACING
 src_lib_libtor_trace_a_SOURCES = $(LIBTOR_TRACE_A_SOURCES)
+else
+src_lib_libtor_trace_a_SOURCES = src/lib/trace/trace_stub.c
+endif
 
 noinst_HEADERS+= $(TRACEHEADERS)
diff --git a/src/lib/trace/trace.h b/src/lib/trace/trace.h
index 94cbbc1e4..22589dbe9 100644
--- a/src/lib/trace/trace.h
+++ b/src/lib/trace/trace.h
@@ -9,7 +9,28 @@
 #ifndef TOR_LIB_TRACE_TRACE_H
 #define TOR_LIB_TRACE_TRACE_H
 
+#include "orconfig.h"
+
 void tor_trace_init(void);
 void tor_trace_free_all(void);
 
+#ifdef HAVE_TRACING
+
+#include "lib/log/log.h"
+
+static inline void
+tracing_log_warning(void)
+{
+  log_warn(LD_GENERAL,
+   "Tracing capabilities have been built in. If this is NOT on "
+   "purpose, your tor is NOT safe to run.");
+}
+
+#else
+
+/* NOP it. */
+#define tracing_log_warning()
+
+#endif /* defined(HAVE_TRACING) */
+
 #endif /* !defined(TOR_LIB_TRACE_TRACE_H) */
diff --git a/src/lib/trace/trace_stub.c b/src/lib/trace/trace_stub.c
new file mode 100644
index 0..9043efe36
--- /dev/null
+++ b/src/lib/trace/trace_stub.c
@@ -0,0 +1,19 @@
+/* Copyright (c) 2020, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * 

[tor-commits] [tor/master] trace: Only build probes if instrumentation is enabled

2020-07-10 Thread nickm
commit 24a5983d84a99dc10c0b8fe961af03135960085b
Author: David Goulet 
Date:   Thu Feb 13 10:44:00 2020 -0500

trace: Only build probes if instrumentation is enabled

For now, trace_probes_circuit.c only contains LTTng probes so build it only 
if
enabled within in the build system _and_ the code.

Also, ignore trace_probes_circuit.h for coccinelle parsing.

Signed-off-by: David Goulet 
---
 src/core/or/include.am | 9 +++--
 src/core/or/trace_probes_circuit.h | 7 ++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/core/or/include.am b/src/core/or/include.am
index 819b8ab60..9ff92adbd 100644
--- a/src/core/or/include.am
+++ b/src/core/or/include.am
@@ -34,7 +34,6 @@ LIBTOR_APP_A_SOURCES +=   \
src/core/or/scheduler_vanilla.c \
src/core/or/sendme.c\
src/core/or/status.c\
-   src/core/or/trace_probes_circuit.c  \
src/core/or/versions.c
 
 # ADD_C_FILE: INSERT HEADERS HERE.
@@ -95,6 +94,12 @@ noinst_HEADERS +=\
src/core/or/socks_request_st.h  \
src/core/or/status.h\
src/core/or/tor_version_st.h\
-   src/core/or/trace_probes_circuit.h  \
src/core/or/var_cell_st.h   \
src/core/or/versions.h
+
+if USE_TRACING_INSTRUMENTATION_LTTNG
+LIBTOR_APP_A_SOURCES += \
+   src/core/or/trace_probes_circuit.c
+noinst_HEADERS += \
+   src/core/or/trace_probes_circuit.h
+endif
diff --git a/src/core/or/trace_probes_circuit.h 
b/src/core/or/trace_probes_circuit.h
index 44842efb0..a85ed089a 100644
--- a/src/core/or/trace_probes_circuit.h
+++ b/src/core/or/trace_probes_circuit.h
@@ -7,6 +7,8 @@
  *LTTng-UST probes are available.
  **/
 
+#ifndef COCCI
+
 #include "orconfig.h"
 
 /* We only build the following if LTTng instrumentation has been enabled. */
@@ -19,7 +21,8 @@
 #undef TRACEPOINT_INCLUDE
 #define TRACEPOINT_INCLUDE "./src/core/or/trace_probes_circuit.h"
 
-#if !defined(TOR_TRACE_PROBES_CIRCUIT_H) || 
defined(TRACEPOINT_HEADER_MULTI_READ)
+#if !defined(TOR_TRACE_PROBES_CIRCUIT_H) || \
+defined(TRACEPOINT_HEADER_MULTI_READ)
 #define TOR_TRACE_PROBES_CIRCUIT_H
 
 #include 
@@ -319,3 +322,5 @@ TRACEPOINT_EVENT(tor_circuit, change_state,
 #include 
 
 #endif /* USE_TRACING_INSTRUMENTATION_LTTNG */
+
+#endif /* COCCI */



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


[tor-commits] [tor/master] trace: Add four generic circuit tracepoints

2020-07-10 Thread nickm
commit d36a44ffa965e69a943068ab457a6528ef204b00
Author: David Goulet 
Date:   Wed Jan 15 12:36:18 2020 -0500

trace: Add four generic circuit tracepoints

Signed-off-by: David Goulet 
---
 src/core/or/circuitlist.c  |  9 +++
 src/core/or/circuituse.c   |  1 +
 src/core/or/trace_probes_circuit.h | 54 ++
 3 files changed, 64 insertions(+)

diff --git a/src/core/or/circuitlist.c b/src/core/or/circuitlist.c
index f4d6cd3c1..10fba498a 100644
--- a/src/core/or/circuitlist.c
+++ b/src/core/or/circuitlist.c
@@ -65,6 +65,7 @@
 #include "core/or/circuitpadding.h"
 #include "core/or/crypt_path.h"
 #include "core/or/extendinfo.h"
+#include "core/or/trace_probes_circuit.h"
 #include "core/mainloop/connection.h"
 #include "app/config/config.h"
 #include "core/or/connection_edge.h"
@@ -99,6 +100,7 @@
 #include "lib/compress/compress_zlib.h"
 #include "lib/compress/compress_zstd.h"
 #include "lib/buf/buffers.h"
+#include "lib/trace/events.h"
 
 #include "core/or/ocirc_event.h"
 
@@ -565,6 +567,8 @@ circuit_set_state(circuit_t *circ, uint8_t state)
   }
   if (state == CIRCUIT_STATE_GUARD_WAIT || state == CIRCUIT_STATE_OPEN)
 tor_assert(!circ->n_chan_create_cell);
+
+  tor_trace(circuit, change_state, circ, circ->state, state);
   circ->state = state;
   if (CIRCUIT_IS_ORIGIN(circ))
 circuit_state_publish(circ);
@@ -1253,6 +1257,10 @@ circuit_free_(circuit_t *circ)
   /* Clear all dangling handle references. */
   circuit_handles_clear(circ);
 
+  /* Tracepoint. Data within the circuit object is recorded so do this before
+   * the actual memory free. */
+  tor_trace(circuit, free, circ);
+
   if (should_free) {
 memwipe(mem, 0xAA, memlen); /* poison memory */
 tor_free(mem);
@@ -2275,6 +2283,7 @@ circuit_mark_for_close_, (circuit_t *circ, int reason, 
int line,
CIRCUIT_IS_ORIGIN(circ) ?
   TO_ORIGIN_CIRCUIT(circ)->global_identifier : 0,
file, line, orig_reason, reason);
+  tor_trace(circuit, mark_for_close, circ);
 }
 
 /** Called immediately before freeing a marked circuit circ from
diff --git a/src/core/or/circuituse.c b/src/core/or/circuituse.c
index b9c15c155..ac03b76d5 100644
--- a/src/core/or/circuituse.c
+++ b/src/core/or/circuituse.c
@@ -3144,6 +3144,7 @@ circuit_change_purpose(circuit_t *circ, uint8_t 
new_purpose)
 
   old_purpose = circ->purpose;
   circ->purpose = new_purpose;
+  tor_trace(circuit, change_purpose, circ, old_purpose, new_purpose);
 
   if (CIRCUIT_IS_ORIGIN(circ)) {
 control_event_circuit_purpose_changed(TO_ORIGIN_CIRCUIT(circ),
diff --git a/src/core/or/trace_probes_circuit.h 
b/src/core/or/trace_probes_circuit.h
index c0dbd1a50..e306a7886 100644
--- a/src/core/or/trace_probes_circuit.h
+++ b/src/core/or/trace_probes_circuit.h
@@ -163,6 +163,60 @@ TRACEPOINT_EVENT_INSTANCE(tor_circuit, 
origin_circuit_t_class, idle_timeout,
   TP_ARGS(const origin_circuit_t *, circ)
 )
 
+/*
+ * General circuit events.
+ */
+
+TRACEPOINT_EVENT(tor_circuit, free,
+  TP_ARGS(const circuit_t *, circ),
+  TP_FIELDS(
+ctf_integer(uint32_t, circ_id,
+(CIRCUIT_IS_ORIGIN(circ) ?
+ TO_ORIGIN_CIRCUIT(circ)->global_identifier : 0))
+ctf_enum(tor_circuit, purpose, int, purpose, circ->purpose)
+ctf_enum(tor_circuit, state, int, state, circ->state)
+  )
+)
+
+TRACEPOINT_EVENT(tor_circuit, mark_for_close,
+  TP_ARGS(const circuit_t *, circ),
+  TP_FIELDS(
+ctf_integer(uint32_t, circ_id,
+(CIRCUIT_IS_ORIGIN(circ) ?
+ TO_ORIGIN_CIRCUIT(circ)->global_identifier : 0))
+ctf_enum(tor_circuit, purpose, int, purpose, circ->purpose)
+ctf_enum(tor_circuit, state, int, state, circ->state)
+ctf_enum(tor_circuit, end_reason, int, close_reason,
+ circ->marked_for_close_reason)
+ctf_enum(tor_circuit, end_reason, int, orig_close_reason,
+ circ->marked_for_close_orig_reason)
+  )
+)
+
+TRACEPOINT_EVENT(tor_circuit, change_purpose,
+  TP_ARGS(const circuit_t *, circ, int, old_purpose, int, new_purpose),
+  TP_FIELDS(
+ctf_integer(uint32_t, circ_id,
+(CIRCUIT_IS_ORIGIN(circ) ?
+ TO_ORIGIN_CIRCUIT(circ)->global_identifier : 0))
+ctf_enum(tor_circuit, state, int, state, circ->state)
+ctf_enum(tor_circuit, purpose, int, purpose, old_purpose)
+ctf_enum(tor_circuit, purpose, int, new, new_purpose)
+  )
+)
+
+TRACEPOINT_EVENT(tor_circuit, change_state,
+  TP_ARGS(const circuit_t *, circ, int, old_state, int, new_state),
+  TP_FIELDS(
+ctf_integer(uint32_t, circ_id,
+(CIRCUIT_IS_ORIGIN(circ) ?
+ TO_ORIGIN_CIRCUIT(circ)->global_identifier : 0))
+ctf_enum(tor_circuit, purpose, int, purpose, circ->purpose)
+ctf_enum(tor_circuit, state, int, old, old_state)
+ctf_enum(tor_circuit, state, int, new, new_state)
+  )
+)
+
 #endif /* TOR_TRACE_PROBES_CIRCUIT_H */
 
 /* Must be include after the probes declaration. */




[tor-commits] [tor/master] changes: Add changes file for #32910

2020-07-10 Thread nickm
commit dfaa0a82acdfbd65dde0a30fa8fd598304a86816
Author: David Goulet 
Date:   Fri Jul 10 12:12:26 2020 -0400

changes: Add changes file for #32910

Signed-off-by: David Goulet 
---
 changes/ticket32910 | 5 +
 1 file changed, 5 insertions(+)

diff --git a/changes/ticket32910 b/changes/ticket32910
new file mode 100644
index 0..e3d64d433
--- /dev/null
+++ b/changes/ticket32910
@@ -0,0 +1,5 @@
+  o Major feature (tracing):
+- Add a tracing library with USDT and LTTng-UST support. Few tracepoints
+  were added in the circuit subsystem. More will come incrementally. This
+  feature is compiled out by default. It needs to be enabled at configure
+  time. See documentation in doc/HACKING/Tracing.md. Closes ticket 32910.



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


[tor-commits] [tor/master] trace: Add two circuit tracepoints for new circuits

2020-07-10 Thread nickm
commit c8f632784bfd9db91fb644fbf6729177b3518d63
Author: David Goulet 
Date:   Wed Jan 15 12:50:20 2020 -0500

trace: Add two circuit tracepoints for new circuits

Signed-off-by: David Goulet 
---
 src/core/or/circuitlist.c  |  2 ++
 src/core/or/trace_probes_circuit.c |  1 +
 src/core/or/trace_probes_circuit.h | 20 
 3 files changed, 23 insertions(+)

diff --git a/src/core/or/circuitlist.c b/src/core/or/circuitlist.c
index 10fba498a..b3cc67e9d 100644
--- a/src/core/or/circuitlist.c
+++ b/src/core/or/circuitlist.c
@@ -1083,6 +1083,7 @@ origin_circuit_new(void)
   prediction_time_remaining);
   }
 
+  tor_trace(circuit, new_origin, circ);
   return circ;
 }
 
@@ -1105,6 +1106,7 @@ or_circuit_new(circid_t p_circ_id, channel_t *p_chan)
 
   init_circuit_base(TO_CIRCUIT(circ));
 
+  tor_trace(circuit, new_or, circ);
   return circ;
 }
 
diff --git a/src/core/or/trace_probes_circuit.c 
b/src/core/or/trace_probes_circuit.c
index 36af6fe79..b186ffda7 100644
--- a/src/core/or/trace_probes_circuit.c
+++ b/src/core/or/trace_probes_circuit.c
@@ -19,6 +19,7 @@
 #include "core/or/crypt_path_st.h"
 #include "core/or/extend_info_st.h"
 #include "core/or/or.h"
+#include "core/or/or_circuit_st.h"
 #include "core/or/origin_circuit_st.h"
 
 #define TRACEPOINT_DEFINE
diff --git a/src/core/or/trace_probes_circuit.h 
b/src/core/or/trace_probes_circuit.h
index 36bfb1563..d2d70686f 100644
--- a/src/core/or/trace_probes_circuit.h
+++ b/src/core/or/trace_probes_circuit.h
@@ -139,10 +139,22 @@ TRACEPOINT_EVENT_CLASS(tor_circuit, 
origin_circuit_t_class,
   )
 )
 
+TRACEPOINT_EVENT_CLASS(tor_circuit, or_circuit_t_class,
+  TP_ARGS(const or_circuit_t *, circ),
+  TP_FIELDS(
+ctf_enum(tor_circuit, purpose, int, purpose, TO_CIRCUIT(circ)->purpose)
+ctf_enum(tor_circuit, state, int, state, TO_CIRCUIT(circ)->state)
+  )
+)
+
 /*
  * Origin circuit events.
  */
 
+TRACEPOINT_EVENT_INSTANCE(tor_circuit, origin_circuit_t_class, new_origin,
+  TP_ARGS(const origin_circuit_t *, circ)
+)
+
 TRACEPOINT_EVENT_INSTANCE(tor_circuit, origin_circuit_t_class, opened,
   TP_ARGS(const origin_circuit_t *, circ)
 )
@@ -185,6 +197,14 @@ TRACEPOINT_EVENT(tor_circuit, intermediate_onion_skin,
   )
 )
 
+/*
+ * OR circuit events.
+ */
+
+TRACEPOINT_EVENT_INSTANCE(tor_circuit, or_circuit_t_class, new_or,
+  TP_ARGS(const or_circuit_t *, circ)
+)
+
 /*
  * General circuit events.
  */



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


[tor-commits] [tor/master] trace: Add USDT probes generation support

2020-07-10 Thread nickm
commit 668fc70a20c602bb0e74bf0e19589a17bb45b7ae
Author: David Goulet 
Date:   Tue Jan 14 14:58:09 2020 -0500

trace: Add USDT probes generation support

This commit adds both configure options and probe generation for 
tracepoints.

Part of #32910

Signed-off-by: David Goulet 
---
 configure.ac  | 21 -
 src/lib/trace/events.h| 13 +
 src/lib/trace/include.am  |  4 
 src/lib/trace/usdt/include.am |  3 +++
 src/lib/trace/usdt/usdt.h | 33 +
 5 files changed, 69 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 680111b10..170d8dc20 100644
--- a/configure.ac
+++ b/configure.ac
@@ -258,6 +258,20 @@ AC_ARG_ENABLE(libscrypt,
 
 dnl --- Tracing Options. ---
 
+dnl USDT instrumentation option.
+AC_ARG_ENABLE(tracing-instrumentation-usdt,
+  AS_HELP_STRING([--enable-tracing-instrumentation-usdt],
+ [build with tracing USDT instrumentation]))
+AM_CONDITIONAL([USE_TRACING_INSTRUMENTATION_USDT],
+   [test "x$enable_tracing_instrumentation_usdt" = "xyes"])
+
+if test "x$enable_tracing_instrumentation_usdt" = "xyes"; then
+  AC_CHECK_HEADERS([sys/sdt.h], [],
+   [AC_MSG_ERROR([USDT instrumentation requires sys/sdt.h 
header.
+  On Debian, apt install systemtap-sdt-dev])], 
[])
+  AC_DEFINE([USE_TRACING_INSTRUMENTATION_USDT], [1], [Using USDT 
instrumentation])
+fi
+
 dnl Tracepoints event to debug logs.
 AC_ARG_ENABLE(tracing-instrumentation-log-debug,
  AS_HELP_STRING([--enable-tracing-instrumentation-log-debug],
@@ -267,9 +281,11 @@ AC_ARG_ENABLE(tracing-instrumentation-log-debug,
 AM_CONDITIONAL([USE_TRACING_INSTRUMENTATION_LOG_DEBUG],
[test "x$enable_tracing_instrumentation_log_debug" = "xyes"])
 
-dnl Define that tracing is supported.
+dnl Define that tracing is supported if any instrumentation is used.
 AM_COND_IF([USE_TRACING_INSTRUMENTATION_LOG_DEBUG],
AC_DEFINE([HAVE_TRACING], [1], [Compiled with tracing support]))
+AM_COND_IF([USE_TRACING_INSTRUMENTATION_USDT],
+   AC_DEFINE([HAVE_TRACING], [1], [Compiled with tracing support]))
 
 dnl -- End Tracing Options. --
 
@@ -2731,6 +2747,9 @@ PPRINT_SUBTITLE([Tracing])
 test "x$enable_tracing_instrumentation_log_debug" = "xyes" && value=1 || 
value=0
 PPRINT_PROP_BOOL([Tracepoints to log_debug() 
(--enable-tracing-instrumentation-log-debug)], $value)
 
+test "x$enable_tracing_instrumentation_usdt" = "xyes" && value=1 || value=0
+PPRINT_PROP_BOOL([USDT Instrumentation 
(--enable-tracing-instrumentation-usdt)], $value)
+
 AS_ECHO
 PPRINT_SUBTITLE([Install Directories])
 
diff --git a/src/lib/trace/events.h b/src/lib/trace/events.h
index b1b31fdc9..fcd31e24e 100644
--- a/src/lib/trace/events.h
+++ b/src/lib/trace/events.h
@@ -3,7 +3,7 @@
 
 /**
  * \file events.h
- * \brief Header file for Tor event tracing.
+ * \brief Header file for Tor tracing instrumentation definition.
  **/
 
 #ifndef TOR_LIB_TRACE_EVENTS_H
@@ -13,15 +13,20 @@
 
 #ifdef HAVE_TRACING
 
-#define tor_trace(subsystem, event_name, ...)   \
-  do {  \
-TOR_TRACE_LOG_DEBUG(tor_ ## subsystem, event_name); \
+#define tor_trace(subsystem, event_name, ...)   \
+  do {  \
+TOR_TRACE_LOG_DEBUG(tor_ ## subsystem, event_name); \
+TOR_TRACE_USDT(tor_ ## subsystem, event_name, ## __VA_ARGS__);  \
   } while (0)
 
 /* This corresponds to the --enable-tracing-instrumentation-log-debug
  * configure option which maps all tracepoints to a log_debug() statement. */
 #include "lib/trace/debug.h"
 
+/* This corresponds to the --enable-tracing-instrumentation-usdt configure
+ * option which will generate USDT probes for each tracepoints. */
+#include "lib/trace/usdt/usdt.h"
+
 #else /* !defined(HAVE_TRACING) */
 
 /* Reaching this point, tracing is disabled thus we NOP every tracepoints
diff --git a/src/lib/trace/include.am b/src/lib/trace/include.am
index 312fd4e87..01ea0c8a1 100644
--- a/src/lib/trace/include.am
+++ b/src/lib/trace/include.am
@@ -18,6 +18,10 @@ TRACEHEADERS += \
src/lib/trace/debug.h
 endif
 
+if USE_TRACING_INSTRUMENTATION_USDT
+include src/lib/trace/usdt/include.am
+endif
+
 src_lib_libtor_trace_a_SOURCES = $(LIBTOR_TRACE_A_SOURCES)
 
 noinst_HEADERS+= $(TRACEHEADERS)
diff --git a/src/lib/trace/usdt/include.am b/src/lib/trace/usdt/include.am
new file mode 100644
index 0..4e7e04c32
--- /dev/null
+++ b/src/lib/trace/usdt/include.am
@@ -0,0 +1,3 @@
+# ADD_C_FILE: INSERT HEADERS HERE.
+TRACEHEADERS += \
+   src/lib/trace/usdt/usdt.h
diff --git a/src/lib/trace/usdt/usdt.h b/src/lib/trace/usdt/usdt.h
new file mode 100644
index 0..0b5fd6c44
--- /dev/null
+++ b/src/lib/trace/usdt/usdt.h
@@ -0,0 +1,33 @@
+/* Copyright (c) 2020, The Tor 

[tor-commits] [tor/master] trace: Move LTTng specific declartion to .inc file

2020-07-10 Thread nickm
commit d80c34d214f88c0831ce7cf7595c5e6e8b6fa168
Author: David Goulet 
Date:   Thu Feb 13 13:25:42 2020 -0500

trace: Move LTTng specific declartion to .inc file

LTTng tracepoint probe declaration is not really following a C standard that
coccinelle and checkSpace.pl likes.

Move everything to a .inc file and standardize the trace_probes_circuit.h
header to include that LTTng specific file if the instrumentation was 
enabled
at configure time.

Part of #32910

Signed-off-by: David Goulet 
---
 scripts/maint/practracker/exceptions.txt |   1 +
 src/core/or/lttng_circuit.inc| 322 +++
 src/core/or/trace_probes_circuit.h   | 312 +-
 3 files changed, 327 insertions(+), 308 deletions(-)

diff --git a/scripts/maint/practracker/exceptions.txt 
b/scripts/maint/practracker/exceptions.txt
index 8b4ffccec..87581b6c8 100644
--- a/scripts/maint/practracker/exceptions.txt
+++ b/scripts/maint/practracker/exceptions.txt
@@ -325,3 +325,4 @@ problem function-size 
/src/tools/tor-resolve.c:build_socks5_resolve_request() 10
 problem function-size /src/tools/tor-resolve.c:do_resolve() 171
 problem function-size /src/tools/tor-resolve.c:main() 112
 problem dependency-violation /src/core/or/trace_probes_circuit.c 1
+problem dependency-violation /src/core/or/trace_probes_circuit.h 1
diff --git a/src/core/or/lttng_circuit.inc b/src/core/or/lttng_circuit.inc
new file mode 100644
index 0..fc3e175c8
--- /dev/null
+++ b/src/core/or/lttng_circuit.inc
@@ -0,0 +1,322 @@
+/* Copyright (c) 2020, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file lttng_circuit.inc
+ * \brief LTTng tracing probe declaration for the circuit subsystem. It is in
+* this .inc file due to the non C standard syntax and the way we guard
+* the header with the LTTng specific TRACEPOINT_HEADER_MULTI_READ.
+ **/
+
+#include "orconfig.h"
+
+/* We only build the following if LTTng instrumentation has been enabled. */
+#ifdef USE_TRACING_INSTRUMENTATION_LTTNG
+
+/* The following defines are LTTng-UST specific. */
+#undef TRACEPOINT_PROVIDER
+#define TRACEPOINT_PROVIDER tor_circuit
+
+#undef TRACEPOINT_INCLUDE
+#define TRACEPOINT_INCLUDE "./src/core/or/lttng_circuit.inc"
+
+#if !defined(LTTNG_CIRCUIT_INC) || defined(TRACEPOINT_HEADER_MULTI_READ)
+#define LTTNG_CIRCUIT_INC
+
+#include 
+
+/*
+ * Circuit Purposes
+ *
+ * The following defines an enumeration of all possible circuit purpose so
+ * they appear in the trace with the define name (first parameter of
+ * ctf_enum_value) instead of the numerical value.
+ */
+TRACEPOINT_ENUM(tor_circuit, purpose,
+  TP_ENUM_VALUES(
+/* Initializing. */
+ctf_enum_value("", 0)
+
+/* OR Side. */
+ctf_enum_value("OR", CIRCUIT_PURPOSE_OR)
+ctf_enum_value("OR_INTRO_POINT", CIRCUIT_PURPOSE_INTRO_POINT)
+ctf_enum_value("OR_REND_POINT_WAITING",
+   CIRCUIT_PURPOSE_REND_POINT_WAITING)
+ctf_enum_value("OR_REND_ESTABLISHED", CIRCUIT_PURPOSE_REND_ESTABLISHED)
+
+/* Client Side. */
+ctf_enum_value("C_GENERAL", CIRCUIT_PURPOSE_C_GENERAL)
+ctf_enum_value("C_INTRODUCING", CIRCUIT_PURPOSE_C_INTRODUCING)
+ctf_enum_value("C_INTRODUCE_ACK_WAIT",
+   CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT)
+ctf_enum_value("C_INTRODUCE_ACKED", CIRCUIT_PURPOSE_C_INTRODUCE_ACKED)
+ctf_enum_value("C_ESTABLISH_REND", CIRCUIT_PURPOSE_C_ESTABLISH_REND)
+ctf_enum_value("C_REND_READY", CIRCUIT_PURPOSE_C_REND_READY)
+ctf_enum_value("C_REND_READY_INTRO_ACKED",
+   CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED)
+ctf_enum_value("C_REND_JOINED", CIRCUIT_PURPOSE_C_REND_JOINED)
+ctf_enum_value("C_HSDIR_GET", CIRCUIT_PURPOSE_C_HSDIR_GET)
+
+/* CBT and Padding. */
+ctf_enum_value("C_MEASURE_TIMEOUT", CIRCUIT_PURPOSE_C_MEASURE_TIMEOUT)
+ctf_enum_value("C_CIRCUIT_PADDING", CIRCUIT_PURPOSE_C_CIRCUIT_PADDING)
+
+/* Service Side. */
+ctf_enum_value("S_ESTABLISH_INTRO", CIRCUIT_PURPOSE_S_ESTABLISH_INTRO)
+ctf_enum_value("S_INTRO", CIRCUIT_PURPOSE_S_INTRO)
+ctf_enum_value("S_CONNECT_REND", CIRCUIT_PURPOSE_S_CONNECT_REND)
+ctf_enum_value("S_REND_JOINED", CIRCUIT_PURPOSE_S_REND_JOINED)
+ctf_enum_value("S_HSDIR_POST", CIRCUIT_PURPOSE_S_HSDIR_POST)
+
+/* Misc. */
+ctf_enum_value("TESTING", CIRCUIT_PURPOSE_TESTING)
+ctf_enum_value("CONTROLER", CIRCUIT_PURPOSE_CONTROLLER)
+ctf_enum_value("PATH_BIAS_TESTING", CIRCUIT_PURPOSE_PATH_BIAS_TESTING)
+
+/* VanGuard */
+ctf_enum_value("HS_VANGUARDS", CIRCUIT_PURPOSE_HS_VANGUARDS)
+  )
+)
+
+/*
+ * Circuit End Reasons
+ *
+ * The following defines an enumeration of all possible circuit end reasons so
+ * they appear in the trace with the define name (first parameter of
+ * ctf_enum_value) instead of the numerical value.
+ */
+TRACEPOINT_ENUM(tor_circuit, end_reason,
+  TP_ENUM_VALUES(
+/* Local reasons. */
+

[tor-commits] [tor/master] trace: Comments and improve doc/HACKING/Tracing.md

2020-07-10 Thread nickm
commit 79d6127a4733cd01cece0c7bdf07d277fe8a08e3
Author: David Goulet 
Date:   Tue Feb 11 15:06:50 2020 -0500

trace: Comments and improve doc/HACKING/Tracing.md

Signed-off-by: David Goulet 
---
 doc/HACKING/Tracing.md | 130 +
 src/core/or/trace_probes_circuit.h |  56 +++-
 2 files changed, 142 insertions(+), 44 deletions(-)

diff --git a/doc/HACKING/Tracing.md b/doc/HACKING/Tracing.md
index e1e97abe6..8cf68321a 100644
--- a/doc/HACKING/Tracing.md
+++ b/doc/HACKING/Tracing.md
@@ -2,19 +2,26 @@
 
 This document describes how the event tracing subsystem works in tor so
 developers can add events to the code base but also hook them to an event
-tracing framework.
+tracing framework (i.e. tracer).
 
 ## Basics
 
-Event tracing is separated in two concepts, trace events and a tracer. The
-tracing subsystem can be found in `src/trace`. The `events.h` header file is
-the main file that maps the different tracers to trace events.
+Tracing is separated in two different concepts. The tracing API and the
+tracing probes.
+
+The API is in `src/lib/trace/` which defines how to call tracepoints in the
+tor code. Every C files should include `src/lib/trace/events.h" if they want
+to call a tracepoint.
+
+The probes are what actually record the tracepoint data. Because they often
+need to access specific subsystem objects, the probes are within each
+subsystem. They are defined in the `trace-probes-.c` files.
 
 ### Events
 
-A trace event is basically a function from which we can pass any data that
-we want to collect. In addition, we specify a context for the event such as
-a subsystem and an event name.
+A trace event is basically a function from which we can pass any data that we
+want to collect. In addition, we specify a context for the event such as the
+subsystem and an event name.
 
 A trace event in tor has the following standard format:
 
@@ -23,69 +30,106 @@ A trace event in tor has the following standard format:
 The `subsystem` parameter is the name of the subsytem the trace event is in.
 For example that could be "scheduler" or "vote" or "hs". The idea is to add
 some context to the event so when we collect them we know where it's coming
-from. The `event_name` is the name of the event which helps a lot with
-adding some semantic to the event. Finally, `args` is any number of
-arguments we want to collect.
+from.
+
+The `event\_name` is the name of the event which adds better semantic to the
+event.
+
+The `args` can be any number of arguments we want to collect.
 
 Here is an example of a possible tracepoint in main():
 
tor_trace(main, init_phase, argc)
 
-The above is a tracepoint in the `main` subsystem with `init_phase` as the
-event name and the `int argc` is passed to the event as well.
+The above is a tracepoint in the `main` subsystem with `init\_phase` as the
+event name and the `int argc` is passed to the event as one argument.
 
 How `argc` is collected or used has nothing to do with the instrumentation
 (adding trace events to the code). It is the work of the tracer so this is why
 the trace events and collection framework (tracer) are decoupled. You _can_
 have trace events without a tracer.
 
-### Tracer
+### Instrumentation ###
+
+In `src/lib/trace/events.h`, we map the high level `tor\_trace()` macro to one
+or many enabled instrumentation.
+
+Currently, we have 3 types of possible instrumentation:
+
+1. Debug
+
+  This will map every tracepoint to `log\_debug()`. However, none of the
+  arguments will be passed on because we don't know their type nor the string
+  format of the debug log. The output is standardized like this:
+
+[debug] __FUNC__: Tracepoint  from subsystem  hit.
 
-In `src/trace/events.h`, we map the `tor_trace()` function to the right
-tracer. A tracer support is only enabled at compile time. For instance, the
-file `src/trace/debug.h` contains the mapping of the generic tracing function
-`tor_trace()` to the `log_debug()` function. More specialized function can be
-mapped depending on the tracepoint.
+2. USDT
+
+  User Statically-Defined Tracing (USDT) is a kind of probe which can be
+  handled by a variety of tracers such as SystemTap, DTrace, perf, eBPF and
+  ftrace.
+
+  For each tracer, one will need to define the ABI in order for the tracer to
+  be able to extract the data from the tracepoint objects. For instance, the
+  tracer needs to know how to print the circuit state of a `circuit\_t`
+  object.
+
+3. LTTng-UST
+
+  LTTng Userspace is a tracer that has it own type of instrumentation. The
+  probe definitions are created within the C code and is strongly typed.
+
+  For more information, see https://lttng.org/docs.
 
 ## Build System
 
-This section describes how it is integrated into the build system of tor.
+This section describes how the instrumentation is integrated into the build
+system of tor.
 
-By default, every tracing events are disabled in tor that is 

[tor-commits] [tor/master] trace: Helper macro to disambiguate identifiers

2020-07-10 Thread nickm
commit 3604d86a016b6202a5864a81f46addc087658b8c
Author: David Goulet 
Date:   Wed Mar 11 10:54:47 2020 -0400

trace: Helper macro to disambiguate identifiers

In order to disambiguate the subsystem and event_name identifiers in the
tor_trace() macro, add TR_SUBSYS() and TR_EV() which help to identify the
parameters of tor_trace() explicitly.

Signed-off-by: David Goulet 
---
 src/core/or/circuitbuild.c |  6 +++---
 src/core/or/circuitlist.c  | 11 +--
 src/core/or/circuituse.c   | 15 +--
 src/core/or/trace_probes_circuit.h |  2 +-
 src/lib/trace/events.h | 17 ++---
 5 files changed, 32 insertions(+), 19 deletions(-)

diff --git a/src/core/or/circuitbuild.c b/src/core/or/circuitbuild.c
index 034a0dc77..24543d3ac 100644
--- a/src/core/or/circuitbuild.c
+++ b/src/core/or/circuitbuild.c
@@ -500,7 +500,7 @@ circuit_establish_circuit(uint8_t purpose, extend_info_t 
*exit_ei, int flags)
 return NULL;
   }
 
-  tor_trace(circuit, establish, circ);
+  tor_trace(TR_SUBSYS(circuit), TR_EV(establish), circ);
   return circ;
 }
 
@@ -983,7 +983,7 @@ circuit_send_first_onion_skin(origin_circuit_t *circ)
 
   if (circuit_deliver_create_cell(TO_CIRCUIT(circ), , 0) < 0)
 return - END_CIRC_REASON_RESOURCELIMIT;
-  tor_trace(circuit, first_onion_skin, circ, circ->cpath);
+  tor_trace(TR_SUBSYS(circuit), TR_EV(first_onion_skin), circ, circ->cpath);
 
   circ->cpath->state = CPATH_STATE_AWAITING_KEYS;
   circuit_set_state(TO_CIRCUIT(circ), CIRCUIT_STATE_BUILDING);
@@ -1147,7 +1147,7 @@ circuit_send_intermediate_onion_skin(origin_circuit_t 
*circ,
   return 0; /* circuit is closed */
   }
   hop->state = CPATH_STATE_AWAITING_KEYS;
-  tor_trace(circuit, intermediate_onion_skin, circ, hop);
+  tor_trace(TR_SUBSYS(circuit), TR_EV(intermediate_onion_skin), circ, hop);
   return 0;
 }
 
diff --git a/src/core/or/circuitlist.c b/src/core/or/circuitlist.c
index b3cc67e9d..fef13fa3f 100644
--- a/src/core/or/circuitlist.c
+++ b/src/core/or/circuitlist.c
@@ -100,7 +100,6 @@
 #include "lib/compress/compress_zlib.h"
 #include "lib/compress/compress_zstd.h"
 #include "lib/buf/buffers.h"
-#include "lib/trace/events.h"
 
 #include "core/or/ocirc_event.h"
 
@@ -568,7 +567,7 @@ circuit_set_state(circuit_t *circ, uint8_t state)
   if (state == CIRCUIT_STATE_GUARD_WAIT || state == CIRCUIT_STATE_OPEN)
 tor_assert(!circ->n_chan_create_cell);
 
-  tor_trace(circuit, change_state, circ, circ->state, state);
+  tor_trace(TR_SUBSYS(circuit), TR_EV(change_state), circ, circ->state, state);
   circ->state = state;
   if (CIRCUIT_IS_ORIGIN(circ))
 circuit_state_publish(circ);
@@ -1083,7 +1082,7 @@ origin_circuit_new(void)
   prediction_time_remaining);
   }
 
-  tor_trace(circuit, new_origin, circ);
+  tor_trace(TR_SUBSYS(circuit), TR_EV(new_origin), circ);
   return circ;
 }
 
@@ -1106,7 +1105,7 @@ or_circuit_new(circid_t p_circ_id, channel_t *p_chan)
 
   init_circuit_base(TO_CIRCUIT(circ));
 
-  tor_trace(circuit, new_or, circ);
+  tor_trace(TR_SUBSYS(circuit), TR_EV(new_or), circ);
   return circ;
 }
 
@@ -1261,7 +1260,7 @@ circuit_free_(circuit_t *circ)
 
   /* Tracepoint. Data within the circuit object is recorded so do this before
* the actual memory free. */
-  tor_trace(circuit, free, circ);
+  tor_trace(TR_SUBSYS(circuit), TR_EV(free), circ);
 
   if (should_free) {
 memwipe(mem, 0xAA, memlen); /* poison memory */
@@ -2285,7 +2284,7 @@ circuit_mark_for_close_, (circuit_t *circ, int reason, 
int line,
CIRCUIT_IS_ORIGIN(circ) ?
   TO_ORIGIN_CIRCUIT(circ)->global_identifier : 0,
file, line, orig_reason, reason);
-  tor_trace(circuit, mark_for_close, circ);
+  tor_trace(TR_SUBSYS(circuit), TR_EV(mark_for_close), circ);
 }
 
 /** Called immediately before freeing a marked circuit circ from
diff --git a/src/core/or/circuituse.c b/src/core/or/circuituse.c
index ac03b76d5..d2bdf77d8 100644
--- a/src/core/or/circuituse.c
+++ b/src/core/or/circuituse.c
@@ -840,7 +840,7 @@ circuit_expire_building(void)
  -1);
 
 circuit_log_path(LOG_INFO,LD_CIRC,TO_ORIGIN_CIRCUIT(victim));
-tor_trace(circuit, timeout, TO_ORIGIN_CIRCUIT(victim));
+tor_trace(TR_SUBSYS(circuit), TR_EV(timeout), TO_ORIGIN_CIRCUIT(victim));
 if (victim->purpose == CIRCUIT_PURPOSE_C_MEASURE_TIMEOUT)
   circuit_mark_for_close(victim, END_CIRC_REASON_MEASUREMENT_EXPIRED);
 else
@@ -1505,7 +1505,8 @@ circuit_expire_old_circuits_clientside(void)
   /* Don't do this magic for testing circuits. Their death is governed
* by circuit_expire_building */
   if (circ->purpose != CIRCUIT_PURPOSE_PATH_BIAS_TESTING) {
-tor_trace(circuit, idle_timeout, TO_ORIGIN_CIRCUIT(circ));
+tor_trace(TR_SUBSYS(circuit), TR_EV(idle_timeout),
+  TO_ORIGIN_CIRCUIT(circ));
 circuit_mark_for_close(circ, END_CIRC_REASON_FINISHED);
   }
 } else if 

[tor-commits] [tor/master] trace: Add four more circuit subsystem tracepoints

2020-07-10 Thread nickm
commit a7063345770002082c2334f290f662c8d4ce644b
Author: David Goulet 
Date:   Wed Jan 15 12:26:54 2020 -0500

trace: Add four more circuit subsystem tracepoints

Signed-off-by: David Goulet 
---
 src/core/or/circuitbuild.c |  4 
 src/core/or/circuituse.c   |  8 +++-
 src/core/or/trace_probes_circuit.h | 16 
 3 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/src/core/or/circuitbuild.c b/src/core/or/circuitbuild.c
index cef70e3e7..edbce8a2d 100644
--- a/src/core/or/circuitbuild.c
+++ b/src/core/or/circuitbuild.c
@@ -50,6 +50,7 @@
 #include "core/or/ocirc_event.h"
 #include "core/or/policies.h"
 #include "core/or/relay.h"
+#include "core/or/trace_probes_circuit.h"
 #include "core/or/crypt_path.h"
 #include "feature/client/bridges.h"
 #include "feature/client/circpathbias.h"
@@ -71,6 +72,7 @@
 #include "feature/rend/rendcommon.h"
 #include "feature/stats/predict_ports.h"
 #include "lib/crypt_ops/crypto_rand.h"
+#include "lib/trace/events.h"
 
 #include "core/or/cell_st.h"
 #include "core/or/cpath_build_state_st.h"
@@ -497,6 +499,8 @@ circuit_establish_circuit(uint8_t purpose, extend_info_t 
*exit_ei, int flags)
 circuit_mark_for_close(TO_CIRCUIT(circ), -err_reason);
 return NULL;
   }
+
+  tor_trace(circuit, establish, circ);
   return circ;
 }
 
diff --git a/src/core/or/circuituse.c b/src/core/or/circuituse.c
index 0e54c28e7..b9c15c155 100644
--- a/src/core/or/circuituse.c
+++ b/src/core/or/circuituse.c
@@ -840,6 +840,7 @@ circuit_expire_building(void)
  -1);
 
 circuit_log_path(LOG_INFO,LD_CIRC,TO_ORIGIN_CIRCUIT(victim));
+tor_trace(circuit, timeout, TO_ORIGIN_CIRCUIT(victim));
 if (victim->purpose == CIRCUIT_PURPOSE_C_MEASURE_TIMEOUT)
   circuit_mark_for_close(victim, END_CIRC_REASON_MEASUREMENT_EXPIRED);
 else
@@ -1503,8 +1504,10 @@ circuit_expire_old_circuits_clientside(void)
 circ->purpose);
   /* Don't do this magic for testing circuits. Their death is governed
* by circuit_expire_building */
-  if (circ->purpose != CIRCUIT_PURPOSE_PATH_BIAS_TESTING)
+  if (circ->purpose != CIRCUIT_PURPOSE_PATH_BIAS_TESTING) {
+tor_trace(circuit, idle_timeout, TO_ORIGIN_CIRCUIT(circ));
 circuit_mark_for_close(circ, END_CIRC_REASON_FINISHED);
+  }
 } else if (!circ->timestamp_dirty && circ->state == CIRCUIT_STATE_OPEN) {
   if (timercmp(>timestamp_began, , OP_LT)) {
 if (circ->purpose == CIRCUIT_PURPOSE_C_GENERAL ||
@@ -1523,6 +1526,7 @@ circuit_expire_old_circuits_clientside(void)
 " that has been unused for %ld msec.",
TO_ORIGIN_CIRCUIT(circ)->global_identifier,
tv_mdiff(>timestamp_began, ));
+  tor_trace(circuit, idle_timeout, TO_ORIGIN_CIRCUIT(circ));
   circuit_mark_for_close(circ, END_CIRC_REASON_FINISHED);
 } else if (!TO_ORIGIN_CIRCUIT(circ)->is_ancient) {
   /* Server-side rend joined circuits can end up really old, because
@@ -2207,6 +2211,8 @@ circuit_launch_by_extend_info(uint8_t purpose,
   tor_fragile_assert();
   return NULL;
   }
+
+  tor_trace(circuit, cannibalized, circ);
   return circ;
 }
   }
diff --git a/src/core/or/trace_probes_circuit.h 
b/src/core/or/trace_probes_circuit.h
index 5fc8f01e9..c0dbd1a50 100644
--- a/src/core/or/trace_probes_circuit.h
+++ b/src/core/or/trace_probes_circuit.h
@@ -147,6 +147,22 @@ TRACEPOINT_EVENT_INSTANCE(tor_circuit, 
origin_circuit_t_class, opened,
   TP_ARGS(const origin_circuit_t *, circ)
 )
 
+TRACEPOINT_EVENT_INSTANCE(tor_circuit, origin_circuit_t_class, establish,
+  TP_ARGS(const origin_circuit_t *, circ)
+)
+
+TRACEPOINT_EVENT_INSTANCE(tor_circuit, origin_circuit_t_class, cannibalized,
+  TP_ARGS(const origin_circuit_t *, circ)
+)
+
+TRACEPOINT_EVENT_INSTANCE(tor_circuit, origin_circuit_t_class, timeout,
+  TP_ARGS(const origin_circuit_t *, circ)
+)
+
+TRACEPOINT_EVENT_INSTANCE(tor_circuit, origin_circuit_t_class, idle_timeout,
+  TP_ARGS(const origin_circuit_t *, circ)
+)
+
 #endif /* TOR_TRACE_PROBES_CIRCUIT_H */
 
 /* Must be include after the probes declaration. */



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


[tor-commits] [tor/master] trace: Add two origin circuit specific tracepoints

2020-07-10 Thread nickm
commit 4cb6887471caa7687b5fd26a357e60e6cafbd326
Author: David Goulet 
Date:   Wed Jan 15 12:42:58 2020 -0500

trace: Add two origin circuit specific tracepoints

Signed-off-by: David Goulet 
---
 src/core/or/circuitbuild.c |  2 ++
 src/core/or/trace_probes_circuit.c |  2 ++
 src/core/or/trace_probes_circuit.h | 22 ++
 3 files changed, 26 insertions(+)

diff --git a/src/core/or/circuitbuild.c b/src/core/or/circuitbuild.c
index edbce8a2d..034a0dc77 100644
--- a/src/core/or/circuitbuild.c
+++ b/src/core/or/circuitbuild.c
@@ -983,6 +983,7 @@ circuit_send_first_onion_skin(origin_circuit_t *circ)
 
   if (circuit_deliver_create_cell(TO_CIRCUIT(circ), , 0) < 0)
 return - END_CIRC_REASON_RESOURCELIMIT;
+  tor_trace(circuit, first_onion_skin, circ, circ->cpath);
 
   circ->cpath->state = CPATH_STATE_AWAITING_KEYS;
   circuit_set_state(TO_CIRCUIT(circ), CIRCUIT_STATE_BUILDING);
@@ -1146,6 +1147,7 @@ circuit_send_intermediate_onion_skin(origin_circuit_t 
*circ,
   return 0; /* circuit is closed */
   }
   hop->state = CPATH_STATE_AWAITING_KEYS;
+  tor_trace(circuit, intermediate_onion_skin, circ, hop);
   return 0;
 }
 
diff --git a/src/core/or/trace_probes_circuit.c 
b/src/core/or/trace_probes_circuit.c
index f2594f522..36af6fe79 100644
--- a/src/core/or/trace_probes_circuit.c
+++ b/src/core/or/trace_probes_circuit.c
@@ -16,6 +16,8 @@
 
 /* Header files that the probes need. */
 #include "core/or/circuitlist.h"
+#include "core/or/crypt_path_st.h"
+#include "core/or/extend_info_st.h"
 #include "core/or/or.h"
 #include "core/or/origin_circuit_st.h"
 
diff --git a/src/core/or/trace_probes_circuit.h 
b/src/core/or/trace_probes_circuit.h
index e306a7886..36bfb1563 100644
--- a/src/core/or/trace_probes_circuit.h
+++ b/src/core/or/trace_probes_circuit.h
@@ -163,6 +163,28 @@ TRACEPOINT_EVENT_INSTANCE(tor_circuit, 
origin_circuit_t_class, idle_timeout,
   TP_ARGS(const origin_circuit_t *, circ)
 )
 
+TRACEPOINT_EVENT(tor_circuit, first_onion_skin,
+  TP_ARGS(const origin_circuit_t *, circ, const crypt_path_t *, hop),
+  TP_FIELDS(
+ctf_integer(uint32_t, circ_id, circ->global_identifier)
+ctf_enum(tor_circuit, purpose, int, purpose, TO_CIRCUIT(circ)->purpose)
+ctf_enum(tor_circuit, state, int, state, TO_CIRCUIT(circ)->state)
+ctf_array_hex(char, fingerprint, hop->extend_info->identity_digest,
+  DIGEST_LEN)
+  )
+)
+
+TRACEPOINT_EVENT(tor_circuit, intermediate_onion_skin,
+  TP_ARGS(const origin_circuit_t *, circ, const crypt_path_t *, hop),
+  TP_FIELDS(
+ctf_integer(uint32_t, circ_id, circ->global_identifier)
+ctf_enum(tor_circuit, purpose, int, purpose, TO_CIRCUIT(circ)->purpose)
+ctf_enum(tor_circuit, state, int, state, TO_CIRCUIT(circ)->state)
+ctf_array_hex(char, fingerprint, hop->extend_info->identity_digest,
+  DIGEST_LEN)
+  )
+)
+
 /*
  * General circuit events.
  */



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


[tor-commits] [tor/master] trace: Hook lib/trace as a subsystem

2020-07-10 Thread nickm
commit 70f031528d033562ae93cb97677cab060948fd8e
Author: David Goulet 
Date:   Thu Jan 9 11:41:23 2020 -0500

trace: Hook lib/trace as a subsystem

Signed-off-by: David Goulet 
---
 src/app/main/subsystem_list.c |  3 +++
 src/lib/trace/.may_include|  1 +
 src/lib/trace/include.am  |  6 --
 src/lib/trace/trace.c |  8 +++-
 src/lib/trace/trace.h |  9 +
 src/lib/trace/trace_sys.c | 33 +
 src/lib/trace/trace_sys.h | 14 ++
 7 files changed, 67 insertions(+), 7 deletions(-)

diff --git a/src/app/main/subsystem_list.c b/src/app/main/subsystem_list.c
index e32083537..c6da6f489 100644
--- a/src/app/main/subsystem_list.c
+++ b/src/app/main/subsystem_list.c
@@ -26,6 +26,7 @@
 #include "lib/thread/thread_sys.h"
 #include "lib/time/time_sys.h"
 #include "lib/tls/tortls_sys.h"
+#include "lib/trace/trace_sys.h"
 #include "lib/wallclock/wallclock_sys.h"
 #include "lib/evloop/evloop_sys.h"
 
@@ -47,6 +48,8 @@ const subsys_fns_t *tor_subsystems[] = {
   _logging,
   _threads,
 
+  _tracing,
+
   _time,
 
   _crypto,
diff --git a/src/lib/trace/.may_include b/src/lib/trace/.may_include
index 45cd13676..1ed533cc7 100644
--- a/src/lib/trace/.may_include
+++ b/src/lib/trace/.may_include
@@ -1,3 +1,4 @@
 orconfig.h
 lib/log/*.h
 lib/trace/*.h
+lib/subsys/*.h
diff --git a/src/lib/trace/include.am b/src/lib/trace/include.am
index 1669943dc..312fd4e87 100644
--- a/src/lib/trace/include.am
+++ b/src/lib/trace/include.am
@@ -4,11 +4,13 @@ noinst_LIBRARIES += \
 
 # ADD_C_FILE: INSERT SOURCES HERE.
 LIBTOR_TRACE_A_SOURCES = \
-   src/lib/trace/trace.c
+   src/lib/trace/trace.c   \
+   src/lib/trace/trace_sys.c
 
 # ADD_C_FILE: INSERT HEADERS HERE.
 TRACEHEADERS = \
-   src/lib/trace/trace.h \
+   src/lib/trace/trace.h   \
+   src/lib/trace/trace_sys.h   \
src/lib/trace/events.h
 
 if USE_TRACING_INSTRUMENTATION_LOG_DEBUG
diff --git a/src/lib/trace/trace.c b/src/lib/trace/trace.c
index 4e5c66b4c..10d11c17c 100644
--- a/src/lib/trace/trace.c
+++ b/src/lib/trace/trace.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017-2020, The Tor Project, Inc. */
+/* Copyright (c) 2020, The Tor Project, Inc. */
 /* See LICENSE for licensing information */
 
 /**
@@ -15,3 +15,9 @@ void
 tor_trace_init(void)
 {
 }
+
+/** Free all the tracing library. */
+void
+tor_trace_free_all(void)
+{
+}
diff --git a/src/lib/trace/trace.h b/src/lib/trace/trace.h
index 5e24678c3..94cbbc1e4 100644
--- a/src/lib/trace/trace.h
+++ b/src/lib/trace/trace.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017-2020, The Tor Project, Inc. */
+/* Copyright (c) 2020, The Tor Project, Inc. */
 /* See LICENSE for licensing information */
 
 /**
@@ -6,9 +6,10 @@
  * \brief Header for trace.c
  **/
 
-#ifndef TOR_TRACE_TRACE_H
-#define TOR_TRACE_TRACE_H
+#ifndef TOR_LIB_TRACE_TRACE_H
+#define TOR_LIB_TRACE_TRACE_H
 
 void tor_trace_init(void);
+void tor_trace_free_all(void);
 
-#endif /* !defined(TOR_TRACE_TRACE_H) */
+#endif /* !defined(TOR_LIB_TRACE_TRACE_H) */
diff --git a/src/lib/trace/trace_sys.c b/src/lib/trace/trace_sys.c
new file mode 100644
index 0..d6e59f4c3
--- /dev/null
+++ b/src/lib/trace/trace_sys.c
@@ -0,0 +1,33 @@
+/* Copyright (c) 2018-2019, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file log_sys.c
+ * \brief Setup and tear down the tracing module.
+ **/
+
+#include "lib/subsys/subsys.h"
+
+#include "lib/trace/trace.h"
+#include "lib/trace/trace_sys.h"
+
+static int
+subsys_tracing_initialize(void)
+{
+  tor_trace_init();
+  return 0;
+}
+
+static void
+subsys_tracing_shutdown(void)
+{
+  tor_trace_free_all();
+}
+
+const subsys_fns_t sys_tracing = {
+  .name = "tracing",
+  .supported = true,
+  .level = -85,
+  .initialize = subsys_tracing_initialize,
+  .shutdown = subsys_tracing_shutdown,
+};
diff --git a/src/lib/trace/trace_sys.h b/src/lib/trace/trace_sys.h
new file mode 100644
index 0..e9c97c08f
--- /dev/null
+++ b/src/lib/trace/trace_sys.h
@@ -0,0 +1,14 @@
+/* Copyright (c) 2018-2019, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file log_sys.h
+ * \brief Declare subsystem object for the logging module.
+ **/
+
+#ifndef TOR_TRACE_SYS_H
+#define TOR_TRACE_SYS_H
+
+extern const struct subsys_fns_t sys_tracing;
+
+#endif /* !defined(TOR_TRACE_SYS_H) */



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


[tor-commits] [tor/master] trace: Add LTTng-UST interface support

2020-07-10 Thread nickm
commit 0de543aae636e422bc9fa339efa81e8260b77ae4
Author: David Goulet 
Date:   Tue Feb 11 11:26:04 2020 -0500

trace: Add LTTng-UST interface support

No probes at this point. They are per subsystem and thus in later commits.

Part of #32910
---
 configure.ac   | 29 +
 src/app/include.am |  4 ++--
 src/lib/trace/events.h |  5 +
 src/lib/trace/include.am   |  4 
 src/lib/trace/lttng/include.am |  3 +++
 src/lib/trace/lttng/lttng.h| 28 
 src/test/fuzz/include.am   |  2 +-
 src/test/include.am| 18 ++
 8 files changed, 82 insertions(+), 11 deletions(-)

diff --git a/configure.ac b/configure.ac
index 170d8dc20..8f47ff77b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -258,6 +258,24 @@ AC_ARG_ENABLE(libscrypt,
 
 dnl --- Tracing Options. ---
 
+TOR_TRACE_LIBS=
+
+dnl LTTng instrumentation option.
+AC_ARG_ENABLE(tracing-instrumentation-lttng,
+  AS_HELP_STRING([--enable-tracing-instrumentation-lttng],
+ [build with LTTng-UST instrumentation]))
+AM_CONDITIONAL([USE_TRACING_INSTRUMENTATION_LTTNG],
+   [test "x$enable_tracing_instrumentation_lttng" = "xyes"])
+
+if test "x$enable_tracing_instrumentation_lttng" = "xyes"; then
+  AC_CHECK_HEADERS([lttng/tracepoint.h], [],
+   [AC_MSG_ERROR([LTTng instrumentation headers not found.
+  On Debian, apt install liblttng-ust-dev"])], 
[])
+  AC_DEFINE([USE_TRACING_INSTRUMENTATION_LTTNG], [1], [Using LTTng 
instrumentation])
+  TOR_TRACE_LIBS="-llttng-ust -ldl"
+fi
+
+
 dnl USDT instrumentation option.
 AC_ARG_ENABLE(tracing-instrumentation-usdt,
   AS_HELP_STRING([--enable-tracing-instrumentation-usdt],
@@ -269,6 +287,9 @@ if test "x$enable_tracing_instrumentation_usdt" = "xyes"; 
then
   AC_CHECK_HEADERS([sys/sdt.h], [],
[AC_MSG_ERROR([USDT instrumentation requires sys/sdt.h 
header.
   On Debian, apt install systemtap-sdt-dev])], 
[])
+  dnl LTTng generates USDT probes if the UST library was built with
+  dnl --with-sdt. There is unfortunately no way to check that so we always
+  dnl build the USDT probes even though LTTng instrumentation was requested.
   AC_DEFINE([USE_TRACING_INSTRUMENTATION_USDT], [1], [Using USDT 
instrumentation])
 fi
 
@@ -286,6 +307,11 @@ AM_COND_IF([USE_TRACING_INSTRUMENTATION_LOG_DEBUG],
AC_DEFINE([HAVE_TRACING], [1], [Compiled with tracing support]))
 AM_COND_IF([USE_TRACING_INSTRUMENTATION_USDT],
AC_DEFINE([HAVE_TRACING], [1], [Compiled with tracing support]))
+AM_COND_IF([USE_TRACING_INSTRUMENTATION_LTTNG],
+   AC_DEFINE([HAVE_TRACING], [1], [Compiled with tracing support]))
+
+dnl Finally, define the trace libs.
+AC_SUBST([TOR_TRACE_LIBS])
 
 dnl -- End Tracing Options. --
 
@@ -2750,6 +2776,9 @@ PPRINT_PROP_BOOL([Tracepoints to log_debug() 
(--enable-tracing-instrumentation-l
 test "x$enable_tracing_instrumentation_usdt" = "xyes" && value=1 || value=0
 PPRINT_PROP_BOOL([USDT Instrumentation 
(--enable-tracing-instrumentation-usdt)], $value)
 
+test "x$enable_tracing_instrumentation_lttng" = "xyes" && value=1 || value=0
+PPRINT_PROP_BOOL([LTTng Instrumentation 
(--enable-tracing-instrumentation-lttng)], $value)
+
 AS_ECHO
 PPRINT_SUBTITLE([Install Directories])
 
diff --git a/src/app/include.am b/src/app/include.am
index 97d53ec0f..3caa0bab1 100644
--- a/src/app/include.am
+++ b/src/app/include.am
@@ -20,7 +20,7 @@ src_app_tor_LDADD = $(TOR_INTERNAL_LIBS) \
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ $(TOR_LIBS_CRYPTLIB) 
\
@TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
@CURVE25519_LIBS@ @TOR_SYSTEMD_LIBS@ \
-   @TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@
+   @TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@ @TOR_TRACE_LIBS@
 
 if COVERAGE_ENABLED
 src_app_tor_cov_SOURCES = $(src_app_tor_SOURCES)
@@ -31,5 +31,5 @@ src_app_tor_cov_LDADD = $(TOR_INTERNAL_TESTING_LIBS) \
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ $(TOR_LIBS_CRYPTLIB) 
\
@TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ \
@CURVE25519_LIBS@ @TOR_SYSTEMD_LIBS@ \
-   @TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@
+   @TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@ @TOR_TRACE_LIBS@
 endif
diff --git a/src/lib/trace/events.h b/src/lib/trace/events.h
index fcd31e24e..8cc0136b0 100644
--- a/src/lib/trace/events.h
+++ b/src/lib/trace/events.h
@@ -17,6 +17,7 @@
   do {  \
 TOR_TRACE_LOG_DEBUG(tor_ ## subsystem, event_name); \
 TOR_TRACE_USDT(tor_ ## subsystem, event_name, ## __VA_ARGS__);  \
+TOR_TRACE_LTTNG(tor_ ## subsystem, event_name, ## __VA_ARGS__); \
   } while (0)
 
 /* This corresponds to the --enable-tracing-instrumentation-log-debug
@@ -27,6 +28,10 @@
  * option which will generate USDT probes for each 

[tor-commits] [tor/master] trace: Add single tracepoint in circuit subsystem

2020-07-10 Thread nickm
commit bf0e2ae0d0e8608277f53e0cd687a419bf99de85
Author: David Goulet 
Date:   Tue Feb 11 11:46:34 2020 -0500

trace: Add single tracepoint in circuit subsystem

This is the very first tracepoint in tor. It is in the circuit subsystem for
when a new circuit opens.

LTTng instrumentation requires lot more around a tracepoint than USDT thus
this commit only adds one tracepoint in order to outline a base to add more
tracepoints later.

The idea is that we separate subsystem into what LTTng defines as 
"providers"
so the circuit provider contains the tracepoint definitions for the circuit
subsystem.

Signed-off-by: David Goulet 

Signed-off-by: David Goulet 
---
 scripts/maint/practracker/exceptions.txt |   1 +
 src/core/or/circuituse.c |   3 +
 src/core/or/include.am   |   2 +
 src/core/or/trace_probes_circuit.c   |  27 ++
 src/core/or/trace_probes_circuit.h   | 155 +++
 5 files changed, 188 insertions(+)

diff --git a/scripts/maint/practracker/exceptions.txt 
b/scripts/maint/practracker/exceptions.txt
index 25568f03f..8b4ffccec 100644
--- a/scripts/maint/practracker/exceptions.txt
+++ b/scripts/maint/practracker/exceptions.txt
@@ -324,3 +324,4 @@ problem function-size 
/src/tools/tor-gencert.c:parse_commandline() 111
 problem function-size /src/tools/tor-resolve.c:build_socks5_resolve_request() 
102
 problem function-size /src/tools/tor-resolve.c:do_resolve() 171
 problem function-size /src/tools/tor-resolve.c:main() 112
+problem dependency-violation /src/core/or/trace_probes_circuit.c 1
diff --git a/src/core/or/circuituse.c b/src/core/or/circuituse.c
index 6ff308dae..0e54c28e7 100644
--- a/src/core/or/circuituse.c
+++ b/src/core/or/circuituse.c
@@ -39,6 +39,7 @@
 #include "core/or/connection_edge.h"
 #include "core/or/extendinfo.h"
 #include "core/or/policies.h"
+#include "core/or/trace_probes_circuit.h"
 #include "feature/client/addressmap.h"
 #include "feature/client/bridges.h"
 #include "feature/client/circpathbias.h"
@@ -63,6 +64,7 @@
 #include "feature/stats/predict_ports.h"
 #include "lib/math/fp.h"
 #include "lib/time/tvdiff.h"
+#include "lib/trace/events.h"
 
 #include "core/or/cpath_build_state_st.h"
 #include "feature/dircommon/dir_connection_st.h"
@@ -1683,6 +1685,7 @@ circuit_testing_failed(origin_circuit_t *circ, int 
at_last_hop)
 void
 circuit_has_opened(origin_circuit_t *circ)
 {
+  tor_trace(circuit, opened, circ);
   circuit_event_status(circ, CIRC_EVENT_BUILT, 0);
 
   /* Remember that this circuit has finished building. Now if we start
diff --git a/src/core/or/include.am b/src/core/or/include.am
index af7c5a6f5..819b8ab60 100644
--- a/src/core/or/include.am
+++ b/src/core/or/include.am
@@ -34,6 +34,7 @@ LIBTOR_APP_A_SOURCES +=   \
src/core/or/scheduler_vanilla.c \
src/core/or/sendme.c\
src/core/or/status.c\
+   src/core/or/trace_probes_circuit.c  \
src/core/or/versions.c
 
 # ADD_C_FILE: INSERT HEADERS HERE.
@@ -94,5 +95,6 @@ noinst_HEADERS += \
src/core/or/socks_request_st.h  \
src/core/or/status.h\
src/core/or/tor_version_st.h\
+   src/core/or/trace_probes_circuit.h  \
src/core/or/var_cell_st.h   \
src/core/or/versions.h
diff --git a/src/core/or/trace_probes_circuit.c 
b/src/core/or/trace_probes_circuit.c
new file mode 100644
index 0..f2594f522
--- /dev/null
+++ b/src/core/or/trace_probes_circuit.c
@@ -0,0 +1,27 @@
+/* Copyright (c) 2020, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file trace_probes_circuit.c
+ * \brief Tracepoint provider source file for the circuit subsystem. Probes
+ *are generated within this C file for LTTng-UST
+ **/
+
+#include "orconfig.h"
+
+/*
+ * Following section is specific to LTTng-UST.
+ */
+#ifdef USE_TRACING_INSTRUMENTATION_LTTNG
+
+/* Header files that the probes need. */
+#include "core/or/circuitlist.h"
+#include "core/or/or.h"
+#include "core/or/origin_circuit_st.h"
+
+#define TRACEPOINT_DEFINE
+#define TRACEPOINT_CREATE_PROBES
+
+#include "trace_probes_circuit.h"
+
+#endif /* USE_TRACING_INSTRUMENTATION_LTTNG */
diff --git a/src/core/or/trace_probes_circuit.h 
b/src/core/or/trace_probes_circuit.h
new file mode 100644
index 0..5fc8f01e9
--- /dev/null
+++ b/src/core/or/trace_probes_circuit.h
@@ -0,0 +1,155 @@
+/* Copyright (c) 2020, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file trace_probes_circuit.c
+ * \brief The tracing probes for the circuit subsystem. Currently, only
+ *LTTng-UST probes are available.
+ **/
+
+#include "orconfig.h"
+
+/* We only build the following if LTTng instrumentation has been enabled. */

[tor-commits] [tor/master] Record IPv6 bandwidth history as appropriate.

2020-07-10 Thread dgoulet
commit 27c5cadf7e86551c7d62d27b107098266bb4c11b
Author: Nick Mathewson 
Date:   Fri Jul 10 08:44:46 2020 -0400

Record IPv6 bandwidth history as appropriate.
---
 src/core/mainloop/connection.c | 5 +++--
 src/core/or/circuitlist.c  | 8 +++-
 src/feature/stats/bwhist.c | 8 ++--
 src/feature/stats/bwhist.h | 4 ++--
 4 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c
index 960735fc2..2f3c70365 100644
--- a/src/core/mainloop/connection.c
+++ b/src/core/mainloop/connection.c
@@ -3366,11 +3366,12 @@ record_num_bytes_transferred_impl(connection_t *conn,
 rep_hist_note_or_conn_bytes(conn->global_identifier, num_read,
 num_written, now);
 
+  const bool is_ipv6 = (conn->socket_family == AF_INET6);
   if (num_read > 0) {
-bwhist_note_bytes_read(num_read, now);
+bwhist_note_bytes_read(num_read, now, is_ipv6);
   }
   if (num_written > 0) {
-bwhist_note_bytes_written(num_written, now);
+bwhist_note_bytes_written(num_written, now, is_ipv6);
   }
   if (conn->type == CONN_TYPE_EXIT)
 rep_hist_note_exit_bytes(conn->port, num_written, num_read);
diff --git a/src/core/or/circuitlist.c b/src/core/or/circuitlist.c
index f0f182e5d..28b3fa8ff 100644
--- a/src/core/or/circuitlist.c
+++ b/src/core/or/circuitlist.c
@@ -2167,6 +2167,12 @@ circuit_synchronize_written_or_bandwidth(const circuit_t 
*c,
   else
 cell_size = CELL_MAX_NETWORK_SIZE;
 
+  /* If we know the channel, find out if it's IPv6. */
+  tor_addr_t remote_addr;
+  bool is_ipv6 = chan &&
+channel_get_addr_if_possible(chan, _addr) &&
+tor_addr_family(_addr) == AF_INET6;
+
   /* The missing written bytes are the cell counts times their cell
* size plus TLS per cell overhead */
   written_sync = cells*(cell_size+TLS_PER_CELL_OVERHEAD);
@@ -2174,7 +2180,7 @@ circuit_synchronize_written_or_bandwidth(const circuit_t 
*c,
   /* Report the missing bytes as written, to avoid asymmetry.
* We must use time() for consistency with rephist, even though on
* some very old rare platforms, approx_time() may be faster. */
-  bwhist_note_bytes_written(written_sync, time(NULL));
+  bwhist_note_bytes_written(written_sync, time(NULL), is_ipv6);
 }
 
 /** Mark circ to be closed next time we call
diff --git a/src/feature/stats/bwhist.c b/src/feature/stats/bwhist.c
index 44717f33b..e74a2881f 100644
--- a/src/feature/stats/bwhist.c
+++ b/src/feature/stats/bwhist.c
@@ -205,7 +205,7 @@ bwhist_init(void)
  * earlier than the latest when you've heard of.
  */
 void
-bwhist_note_bytes_written(uint64_t num_bytes, time_t when)
+bwhist_note_bytes_written(uint64_t num_bytes, time_t when, bool ipv6)
 {
 /* Maybe a circular array for recent seconds, and step to a new point
  * every time a new second shows up. Or simpler is to just to have
@@ -216,16 +216,20 @@ bwhist_note_bytes_written(uint64_t num_bytes, time_t when)
  * somewhere. See bwhist_bandwidth_assess() below.
  */
   add_obs(write_array, when, num_bytes);
+  if (ipv6)
+add_obs(write_array_ipv6, when, num_bytes);
 }
 
 /** Remember that we wrote num_bytes bytes in second when.
  * (like bwhist_note_bytes_written() above)
  */
 void
-bwhist_note_bytes_read(uint64_t num_bytes, time_t when)
+bwhist_note_bytes_read(uint64_t num_bytes, time_t when, bool ipv6)
 {
 /* if we're smart, we can make this func and the one above share code */
   add_obs(read_array, when, num_bytes);
+  if (ipv6)
+add_obs(read_array_ipv6, when, num_bytes);
 }
 
 /** Remember that we wrote num_bytes directory bytes in second
diff --git a/src/feature/stats/bwhist.h b/src/feature/stats/bwhist.h
index 17d2a8394..d556f5a02 100644
--- a/src/feature/stats/bwhist.h
+++ b/src/feature/stats/bwhist.h
@@ -15,8 +15,8 @@
 void bwhist_init(void);
 void bwhist_free_all(void);
 
-void bwhist_note_bytes_read(uint64_t num_bytes, time_t when);
-void bwhist_note_bytes_written(uint64_t num_bytes, time_t when);
+void bwhist_note_bytes_read(uint64_t num_bytes, time_t when, bool ipv6);
+void bwhist_note_bytes_written(uint64_t num_bytes, time_t when, bool ipv6);
 void bwhist_note_dir_bytes_read(uint64_t num_bytes, time_t when);
 void bwhist_note_dir_bytes_written(uint64_t num_bytes, time_t when);
 



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


[tor-commits] [tor/master] Split bandwidth history functions into a separate C file.

2020-07-10 Thread dgoulet
commit 8390df917b7e63696c70037765737037cd9162a0
Author: Nick Mathewson 
Date:   Fri Jul 10 07:50:17 2020 -0400

Split bandwidth history functions into a separate C file.

These are logically independent from the rest of rephist, and make
more sense in isolation.  The next patch will rename them too.
---
 src/app/config/statefile.c |   2 +-
 src/app/main/main.c|   2 +
 src/app/main/shutdown.c|   2 +
 src/core/mainloop/connection.c |   1 +
 src/core/or/circuitlist.c  |   1 +
 src/feature/relay/router.c |   1 +
 src/feature/stats/bwhist.c | 588 +
 src/feature/stats/bwhist.h |  40 +++
 src/feature/stats/include.am   |   2 +
 src/feature/stats/rephist.c| 577 
 src/feature/stats/rephist.h|  17 --
 src/test/test_relay.c  |   4 +-
 src/test/test_router.c |   2 +-
 src/test/testing_common.c  |   2 +
 14 files changed, 643 insertions(+), 598 deletions(-)

diff --git a/src/app/config/statefile.c b/src/app/config/statefile.c
index dcc55f189..63205007c 100644
--- a/src/app/config/statefile.c
+++ b/src/app/config/statefile.c
@@ -40,7 +40,7 @@
 #include "feature/control/control_events.h"
 #include "feature/client/entrynodes.h"
 #include "feature/hibernate/hibernate.h"
-#include "feature/stats/rephist.h"
+#include "feature/stats/bwhist.h"
 #include "feature/relay/router.h"
 #include "feature/relay/routermode.h"
 #include "lib/sandbox/sandbox.h"
diff --git a/src/app/main/main.c b/src/app/main/main.c
index 89ba78742..7b6a665b7 100644
--- a/src/app/main/main.c
+++ b/src/app/main/main.c
@@ -53,6 +53,7 @@
 #include "feature/rend/rendcache.h"
 #include "feature/rend/rendservice.h"
 #include "feature/stats/predict_ports.h"
+#include "feature/stats/bwhist.h"
 #include "feature/stats/rephist.h"
 #include "lib/compress/compress.h"
 #include "lib/buf/buffers.h"
@@ -549,6 +550,7 @@ tor_init(int argc, char *argv[])
 
   /* Initialize the history structures. */
   rep_hist_init();
+  bwhist_init();
   /* Initialize the service cache. */
   rend_cache_init();
   addressmap_init(); /* Init the client dns cache. Do it always, since it's
diff --git a/src/app/main/shutdown.c b/src/app/main/shutdown.c
index aac15246b..4a556333d 100644
--- a/src/app/main/shutdown.c
+++ b/src/app/main/shutdown.c
@@ -47,6 +47,7 @@
 #include "feature/relay/relay_config.h"
 #include "feature/rend/rendcache.h"
 #include "feature/rend/rendclient.h"
+#include "feature/stats/bwhist.h"
 #include "feature/stats/geoip_stats.h"
 #include "feature/stats/rephist.h"
 #include "lib/evloop/compat_libevent.h"
@@ -121,6 +122,7 @@ tor_free_all(int postfork)
   rend_cache_free_all();
   rend_service_authorization_free_all();
   rep_hist_free_all();
+  bwhist_free_all();
   circuit_free_all();
   circpad_machines_free();
   entry_guards_free_all();
diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c
index af823335a..7f1b99311 100644
--- a/src/core/mainloop/connection.c
+++ b/src/core/mainloop/connection.c
@@ -106,6 +106,7 @@
 #include "feature/rend/rendclient.h"
 #include "feature/rend/rendcommon.h"
 #include "feature/stats/rephist.h"
+#include "feature/stats/bwhist.h"
 #include "lib/crypt_ops/crypto_util.h"
 #include "lib/geoip/geoip.h"
 
diff --git a/src/core/or/circuitlist.c b/src/core/or/circuitlist.c
index f4d6cd3c1..a6949d943 100644
--- a/src/core/or/circuitlist.c
+++ b/src/core/or/circuitlist.c
@@ -90,6 +90,7 @@
 #include "feature/rend/rendclient.h"
 #include "feature/rend/rendcommon.h"
 #include "feature/stats/predict_ports.h"
+#include "feature/stats/bwhist.h"
 #include "feature/stats/rephist.h"
 #include "feature/nodelist/routerlist.h"
 #include "feature/nodelist/routerset.h"
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index 57da735e8..a55b30067 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -44,6 +44,7 @@
 #include "feature/relay/selftest.h"
 #include "lib/geoip/geoip.h"
 #include "feature/stats/geoip_stats.h"
+#include "feature/stats/bwhist.h"
 #include "feature/stats/rephist.h"
 #include "lib/crypt_ops/crypto_ed25519.h"
 #include "lib/crypt_ops/crypto_format.h"
diff --git a/src/feature/stats/bwhist.c b/src/feature/stats/bwhist.c
new file mode 100644
index 0..a3b971a25
--- /dev/null
+++ b/src/feature/stats/bwhist.c
@@ -0,0 +1,588 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2020, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * @file bwhist.c
+ * @brief Tracking for relay bandwidth history
+ *
+ * This module handles bandwidth usage history, used by relays to
+ * self-report how much bandwidth they've used for different
+ * purposes over last day or so, in order to generate the
+ * {dirreq-,}{read,write}-history lines in that they publish.
+ **/
+
+#define 

[tor-commits] [tor/master] Changes file for ticket 33263

2020-07-10 Thread dgoulet
commit 1a4e475d5d86b0325914000889d5fd0dde42c2ad
Author: Nick Mathewson 
Date:   Fri Jul 10 09:25:11 2020 -0400

Changes file for ticket 33263
---
 changes/ticket33263 | 4 
 1 file changed, 4 insertions(+)

diff --git a/changes/ticket33263 b/changes/ticket33263
new file mode 100644
index 0..ab5d9c969
--- /dev/null
+++ b/changes/ticket33263
@@ -0,0 +1,4 @@
+  o Minor features (statistics, ipv6):
+- Relays now publish their IPv6 read and write statistics over time,
+  if statistics are enabled.
+  Closes ticket 33263.

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


[tor-commits] [tor/master] Refactor bwhist_get_bandwidth_lines()

2020-07-10 Thread dgoulet
commit 11da5229d103fd13300b88a0efbc1da0b3970782
Author: Nick Mathewson 
Date:   Fri Jul 10 08:18:15 2020 -0400

Refactor bwhist_get_bandwidth_lines()

We've done a lot to improve our internal APIs since we wrote this
code, and it shows. We can just use a buf_t to build up the
bandwidth lines, and save a bunch of stack fiddling.

Additionally, we can use a function to format a single line, and
thereby get rid of the cheezy pattern that does

for (i=0;ibuf. */
+static void
+bwhist_get_one_bandwidth_line(buf_t *buf, const char *desc,
+  const bw_array_t *b)
+{
+  /* [dirreq-](read|write)-history -mm-dd HH:MM:SS (n s) n,n,n... */
+  /* The n,n,n part above. Largest representation of a uint64_t is 20 chars
+   * long, plus the comma. */
+#define MAX_HIST_VALUE_LEN (21*NUM_TOTALS)
+
+  char tmp[MAX_HIST_VALUE_LEN];
+  char end[ISO_TIME_LEN+1];
+
+  size_t slen = bwhist_fill_bandwidth_history(tmp, MAX_HIST_VALUE_LEN, b);
+  /* If we don't have anything to write, skip to the next entry. */
+  if (slen == 0)
+return;
+
+  format_iso_time(end, b->next_period-NUM_SECS_BW_SUM_INTERVAL);
+  buf_add_printf(buf, "%s %s (%d s) %s\n",
+ desc, end, NUM_SECS_BW_SUM_INTERVAL, tmp);
+}
+
 /** Allocate and return lines for representing this server's bandwidth
  * history in its descriptor. We publish these lines in our extra-info
  * descriptor.
@@ -331,56 +354,16 @@ bwhist_fill_bandwidth_history(char *buf, size_t len, 
const bw_array_t *b)
 char *
 bwhist_get_bandwidth_lines(void)
 {
-  char *buf, *cp;
-  char t[ISO_TIME_LEN+1];
-  int r;
-  bw_array_t *b = NULL;
-  const char *desc = NULL;
-  size_t len;
+  buf_t *buf = buf_new();
 
-  /* [dirreq-](read|write)-history -mm-dd HH:MM:SS (n s) n,n,n... */
-/* The n,n,n part above. Largest representation of a uint64_t is 20 chars
- * long, plus the comma. */
-#define MAX_HIST_VALUE_LEN (21*NUM_TOTALS)
-  len = (67+MAX_HIST_VALUE_LEN)*4;
-  buf = tor_malloc_zero(len);
-  cp = buf;
-  for (r=0;r<4;++r) {
-char tmp[MAX_HIST_VALUE_LEN];
-size_t slen;
-switch (r) {
-  case 0:
-b = write_array;
-desc = "write-history";
-break;
-  case 1:
-b = read_array;
-desc = "read-history";
-break;
-  case 2:
-b = dir_write_array;
-desc = "dirreq-write-history";
-break;
-  case 3:
-b = dir_read_array;
-desc = "dirreq-read-history";
-break;
-}
-tor_assert(b);
-slen = bwhist_fill_bandwidth_history(tmp, MAX_HIST_VALUE_LEN, b);
-/* If we don't have anything to write, skip to the next entry. */
-if (slen == 0)
-  continue;
-format_iso_time(t, b->next_period-NUM_SECS_BW_SUM_INTERVAL);
-tor_snprintf(cp, len-(cp-buf), "%s %s (%d s) ",
- desc, t, NUM_SECS_BW_SUM_INTERVAL);
-cp += strlen(cp);
-strlcat(cp, tmp, len-(cp-buf));
-cp += slen;
-strlcat(cp, "\n", len-(cp-buf));
-++cp;
-  }
-  return buf;
+  bwhist_get_one_bandwidth_line(buf, "write-history", write_array);
+  bwhist_get_one_bandwidth_line(buf, "read-history", read_array);
+  bwhist_get_one_bandwidth_line(buf, "dirreq-write-history", dir_write_array);
+  bwhist_get_one_bandwidth_line(buf, "dirreq-read-history", dir_read_array);
+
+  char *result = buf_extract(buf, NULL);
+  buf_free(buf);
+  return result;
 }
 
 /** Write a single bw_array_t into the Values, Ends, Interval, and Maximum



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


[tor-commits] [tor/master] Rename public bandwidth-history identifiers to start with "bwhist".

2020-07-10 Thread dgoulet
commit 2fc8257ac4c3b404f5e41eda8ea98eaaad6c3a5c
Author: Nick Mathewson 
Date:   Fri Jul 10 07:54:04 2020 -0400

Rename public bandwidth-history identifiers to start with "bwhist".

This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
rep_hist_note_bytes_read bwhist_note_bytes_read \
rep_hist_note_bytes_written bwhist_note_bytes_written \
rep_hist_note_dir_bytes_read bwhist_note_dir_bytes_read \
rep_hist_note_dir_bytes_written bwhist_note_dir_bytes_written \
rep_hist_get_bandwidth_lines bwhist_get_bandwidth_lines \
rep_hist_update_state bwhist_update_state \
rep_hist_load_state bwhist_load_state \
rep_hist_bandwidth_assess bwhist_bandwidth_assess
---
 src/app/config/statefile.c |  4 ++--
 src/core/mainloop/connection.c |  8 
 src/core/or/circuitlist.c  |  2 +-
 src/feature/relay/router.c |  6 +++---
 src/feature/stats/bwhist.c | 24 
 src/feature/stats/bwhist.h | 16 
 src/test/test_router.c |  4 ++--
 7 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/src/app/config/statefile.c b/src/app/config/statefile.c
index 63205007c..4198c8a38 100644
--- a/src/app/config/statefile.c
+++ b/src/app/config/statefile.c
@@ -324,7 +324,7 @@ or_state_set(or_state_t *new_state)
 tor_free(err);
 ret = -1;
   }
-  if (rep_hist_load_state(global_state, )<0) {
+  if (bwhist_load_state(global_state, )<0) {
 log_warn(LD_GENERAL,"Unparseable bandwidth history state: %s",err);
 tor_free(err);
 ret = -1;
@@ -523,7 +523,7 @@ or_state_save(time_t now)
* to avoid redundant writes. */
   (void) subsystems_flush_state(get_state_mgr(), global_state);
   entry_guards_update_state(global_state);
-  rep_hist_update_state(global_state);
+  bwhist_update_state(global_state);
   circuit_build_times_update_state(get_circuit_build_times(), global_state);
 
   if (accounting_is_enabled(get_options()))
diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c
index 7f1b99311..960735fc2 100644
--- a/src/core/mainloop/connection.c
+++ b/src/core/mainloop/connection.c
@@ -3345,9 +3345,9 @@ record_num_bytes_transferred_impl(connection_t *conn,
   /* Count bytes of answering direct and tunneled directory requests */
   if (conn->type == CONN_TYPE_DIR && conn->purpose == DIR_PURPOSE_SERVER) {
 if (num_read > 0)
-  rep_hist_note_dir_bytes_read(num_read, now);
+  bwhist_note_dir_bytes_read(num_read, now);
 if (num_written > 0)
-  rep_hist_note_dir_bytes_written(num_written, now);
+  bwhist_note_dir_bytes_written(num_written, now);
   }
 
   /* Linked connections and internal IPs aren't counted for statistics or
@@ -3367,10 +3367,10 @@ record_num_bytes_transferred_impl(connection_t *conn,
 num_written, now);
 
   if (num_read > 0) {
-rep_hist_note_bytes_read(num_read, now);
+bwhist_note_bytes_read(num_read, now);
   }
   if (num_written > 0) {
-rep_hist_note_bytes_written(num_written, now);
+bwhist_note_bytes_written(num_written, now);
   }
   if (conn->type == CONN_TYPE_EXIT)
 rep_hist_note_exit_bytes(conn->port, num_written, num_read);
diff --git a/src/core/or/circuitlist.c b/src/core/or/circuitlist.c
index a6949d943..f0f182e5d 100644
--- a/src/core/or/circuitlist.c
+++ b/src/core/or/circuitlist.c
@@ -2174,7 +2174,7 @@ circuit_synchronize_written_or_bandwidth(const circuit_t 
*c,
   /* Report the missing bytes as written, to avoid asymmetry.
* We must use time() for consistency with rephist, even though on
* some very old rare platforms, approx_time() may be faster. */
-  rep_hist_note_bytes_written(written_sync, time(NULL));
+  bwhist_note_bytes_written(written_sync, time(NULL));
 }
 
 /** Mark circ to be closed next time we call
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index a55b30067..b63950ea1 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -2099,7 +2099,7 @@ router_build_fresh_unsigned_routerinfo,(routerinfo_t 
**ri_out))
   ri->bandwidthburst = relay_get_effective_bwburst(options);
 
   /* Report bandwidth, unless we're hibernating or shutting down */
-  ri->bandwidthcapacity = hibernating ? 0 : rep_hist_bandwidth_assess();
+  ri->bandwidthcapacity = hibernating ? 0 : bwhist_bandwidth_assess();
 
   if (dns_seems_to_be_broken() || has_dns_init_failed()) {
 /* DNS is screwed up; don't claim to be an exit. */
@@ -2545,7 +2545,7 @@ check_descriptor_bandwidth_changed(time_t now)
 
   /* Consider ourselves to have zero bandwidth if we're hibernating or
* shutting down. */
-  cur = hibernating ? 0 : rep_hist_bandwidth_assess();
+  cur = hibernating ? 0 : bwhist_bandwidth_assess();
 
   if ((prev != cur && (!prev || !cur)) ||
   cur > (prev * BANDWIDTH_CHANGE_FACTOR) ||
@@ -3209,7 +3209,7 @@ 

[tor-commits] [tor/master] Rename private bandwidth-history identifiers to start with "bwhist".

2020-07-10 Thread dgoulet
commit c5eb601e60760eb56d41ec08970cb151511bf2ea
Author: Nick Mathewson 
Date:   Fri Jul 10 07:54:04 2020 -0400

Rename private bandwidth-history identifiers to start with "bwhist".

This commit is a simple search-and-replace in bwhist.c
---
 src/feature/stats/bwhist.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/feature/stats/bwhist.c b/src/feature/stats/bwhist.c
index 2bc533e66..527f0128f 100644
--- a/src/feature/stats/bwhist.c
+++ b/src/feature/stats/bwhist.c
@@ -280,7 +280,7 @@ bwhist_bandwidth_assess,(void))
  * It returns the number of bytes written.
  */
 static size_t
-rep_hist_fill_bandwidth_history(char *buf, size_t len, const bw_array_t *b)
+bwhist_fill_bandwidth_history(char *buf, size_t len, const bw_array_t *b)
 {
   char *cp = buf;
   int i, n;
@@ -367,7 +367,7 @@ bwhist_get_bandwidth_lines(void)
 break;
 }
 tor_assert(b);
-slen = rep_hist_fill_bandwidth_history(tmp, MAX_HIST_VALUE_LEN, b);
+slen = bwhist_fill_bandwidth_history(tmp, MAX_HIST_VALUE_LEN, b);
 /* If we don't have anything to write, skip to the next entry. */
 if (slen == 0)
   continue;
@@ -386,7 +386,7 @@ bwhist_get_bandwidth_lines(void)
 /** Write a single bw_array_t into the Values, Ends, Interval, and Maximum
  * entries of an or_state_t. Done before writing out a new state file. */
 static void
-rep_hist_update_bwhist_state_section(or_state_t *state,
+bwhist_update_bwhist_state_section(or_state_t *state,
  const bw_array_t *b,
  smartlist_t **s_values,
  smartlist_t **s_maxima,
@@ -449,7 +449,7 @@ void
 bwhist_update_state(or_state_t *state)
 {
 #define UPDATE(arrname,st) \
-  rep_hist_update_bwhist_state_section(state,\
+  bwhist_update_bwhist_state_section(state,\
(arrname),\
>BWHistory ## st ## Values, \
>BWHistory ## st ## Maxima, \
@@ -470,7 +470,7 @@ bwhist_update_state(or_state_t *state)
 /** Load a single bw_array_t from its Values, Ends, Maxima, and Interval
  * entries in an or_state_t. Done while reading the state file. */
 static int
-rep_hist_load_bwhist_state_section(bw_array_t *b,
+bwhist_load_bwhist_state_section(bw_array_t *b,
const smartlist_t *s_values,
const smartlist_t *s_maxima,
const time_t s_begins,
@@ -555,7 +555,7 @@ bwhist_load_state(or_state_t *state, char **err)
   tor_assert(dir_read_array && dir_write_array);
 
 #define LOAD(arrname,st)\
-  if (rep_hist_load_bwhist_state_section(   \
+  if (bwhist_load_bwhist_state_section(   \
 (arrname),  \
 state->BWHistory ## st ## Values,   \
 state->BWHistory ## st ## Maxima,   \



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


[tor-commits] [tor/master] Add IPv6 read and write history to bwhist, state, and extrainfo.

2020-07-10 Thread dgoulet
commit c5db7667d6964344e87fb7ee71df3f2ebe8131e6
Author: Nick Mathewson 
Date:   Fri Jul 10 08:29:24 2020 -0400

Add IPv6 read and write history to bwhist, state, and extrainfo.

These values are stored, persisted, and published.  They are not yet
actually filled with anything.
---
 src/app/config/or_state_st.h |  8 
 src/app/config/statefile.c   |  8 
 src/feature/stats/bwhist.c   | 21 +++--
 3 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/src/app/config/or_state_st.h b/src/app/config/or_state_st.h
index 8c4e9d5e6..31b7f8a98 100644
--- a/src/app/config/or_state_st.h
+++ b/src/app/config/or_state_st.h
@@ -65,6 +65,14 @@ struct or_state_t {
   int BWHistoryWriteInterval;
   struct smartlist_t *BWHistoryWriteValues;
   struct smartlist_t *BWHistoryWriteMaxima;
+  time_t  BWHistoryIPv6ReadEnds;
+  int BWHistoryIPv6ReadInterval;
+  struct smartlist_t *BWHistoryIPv6ReadValues;
+  struct smartlist_t *BWHistoryIPv6ReadMaxima;
+  time_t  BWHistoryIPv6WriteEnds;
+  int BWHistoryIPv6WriteInterval;
+  struct smartlist_t *BWHistoryIPv6WriteValues;
+  struct smartlist_t *BWHistoryIPv6WriteMaxima;
   time_t  BWHistoryDirReadEnds;
   int BWHistoryDirReadInterval;
   struct smartlist_t *BWHistoryDirReadValues;
diff --git a/src/app/config/statefile.c b/src/app/config/statefile.c
index 4198c8a38..b25167d2e 100644
--- a/src/app/config/statefile.c
+++ b/src/app/config/statefile.c
@@ -112,6 +112,14 @@ static const config_var_t state_vars_[] = {
   V(BWHistoryWriteInterval,   POSINT, "900"),
   V(BWHistoryWriteValues, CSV,  ""),
   V(BWHistoryWriteMaxima, CSV,  ""),
+  V(BWHistoryIPv6ReadEnds,ISOTIME,  NULL),
+  V(BWHistoryIPv6ReadInterval,POSINT, "900"),
+  V(BWHistoryIPv6ReadValues,  CSV,  ""),
+  V(BWHistoryIPv6ReadMaxima,  CSV,  ""),
+  V(BWHistoryIPv6WriteEnds,   ISOTIME,  NULL),
+  V(BWHistoryIPv6WriteInterval,   POSINT, "900"),
+  V(BWHistoryIPv6WriteValues, CSV,  ""),
+  V(BWHistoryIPv6WriteMaxima, CSV,  ""),
   V(BWHistoryDirReadEnds, ISOTIME,  NULL),
   V(BWHistoryDirReadInterval, POSINT, "900"),
   V(BWHistoryDirReadValues,   CSV,  ""),
diff --git a/src/feature/stats/bwhist.c b/src/feature/stats/bwhist.c
index fef8a3b2d..44717f33b 100644
--- a/src/feature/stats/bwhist.c
+++ b/src/feature/stats/bwhist.c
@@ -162,10 +162,14 @@ bw_array_free_(bw_array_t *b)
   tor_free(b);
 }
 
-/** Recent history of bandwidth observations for read operations. */
+/** Recent history of bandwidth observations for (all) read operations. */
 static bw_array_t *read_array = NULL;
-/** Recent history of bandwidth observations for write operations. */
+/** Recent history of bandwidth observations for IPv6 read operations. */
+static bw_array_t *read_array_ipv6 = NULL;
+/** Recent history of bandwidth observations for (all) write operations. */
 STATIC bw_array_t *write_array = NULL;
+/** Recent history of bandwidth observations for IPv6 write operations. */
+static bw_array_t *write_array_ipv6 = NULL;
 /** Recent history of bandwidth observations for read operations for the
 directory protocol. */
 static bw_array_t *dir_read_array = NULL;
@@ -179,12 +183,16 @@ void
 bwhist_init(void)
 {
   bw_array_free(read_array);
+  bw_array_free(read_array_ipv6);
   bw_array_free(write_array);
+  bw_array_free(write_array_ipv6);
   bw_array_free(dir_read_array);
   bw_array_free(dir_write_array);
 
   read_array = bw_array_new();
+  read_array_ipv6 = bw_array_new();
   write_array = bw_array_new();
+  write_array_ipv6 = bw_array_new();
   dir_read_array = bw_array_new();
   dir_write_array = bw_array_new();
 }
@@ -358,6 +366,8 @@ bwhist_get_bandwidth_lines(void)
 
   bwhist_get_one_bandwidth_line(buf, "write-history", write_array);
   bwhist_get_one_bandwidth_line(buf, "read-history", read_array);
+  bwhist_get_one_bandwidth_line(buf, "ipv6-write-history", write_array_ipv6);
+  bwhist_get_one_bandwidth_line(buf, "ipv6-read-history", read_array_ipv6);
   bwhist_get_one_bandwidth_line(buf, "dirreq-write-history", dir_write_array);
   bwhist_get_one_bandwidth_line(buf, "dirreq-read-history", dir_read_array);
 
@@ -441,6 +451,8 @@ bwhist_update_state(or_state_t *state)
 
   UPDATE(write_array, Write);
   UPDATE(read_array, Read);
+  UPDATE(write_array_ipv6, IPv6Write);
+  UPDATE(read_array_ipv6, IPv6Read);
   UPDATE(dir_write_array, DirWrite);
   UPDATE(dir_read_array, DirRead);
 
@@ -535,6 +547,7 @@ bwhist_load_state(or_state_t *state, char **err)
 
   /* Assert they already have been malloced */
   tor_assert(read_array && write_array);
+  tor_assert(read_array_ipv6 && write_array_ipv6);
   tor_assert(dir_read_array && dir_write_array);
 
 #define LOAD(arrname,st)\
@@ -548,6 +561,8 @@ 

[tor-commits] [tor/master] Make channel_get_addr_if_possible() take a const channel_t.

2020-07-10 Thread dgoulet
commit a81827d99ffdd36d87ca91637f022558783d44ac
Author: Nick Mathewson 
Date:   Fri Jul 10 08:41:00 2020 -0400

Make channel_get_addr_if_possible() take a const channel_t.

(There is no reason that looking up the address of a channel should
ever change it.)
---
 src/core/or/channel.c| 2 +-
 src/core/or/channel.h| 4 ++--
 src/core/or/channeltls.c | 7 ---
 src/test/test_dos.c  | 2 +-
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/core/or/channel.c b/src/core/or/channel.c
index a05554472..e21f5a12c 100644
--- a/src/core/or/channel.c
+++ b/src/core/or/channel.c
@@ -2849,7 +2849,7 @@ channel_get_canonical_remote_descr,(channel_t *chan))
  * doesn't let us do this.
  */
 MOCK_IMPL(int,
-channel_get_addr_if_possible,(channel_t *chan, tor_addr_t *addr_out))
+channel_get_addr_if_possible,(const channel_t *chan, tor_addr_t *addr_out))
 {
   tor_assert(chan);
   tor_assert(addr_out);
diff --git a/src/core/or/channel.h b/src/core/or/channel.h
index 4968c8714..79e5fea9c 100644
--- a/src/core/or/channel.h
+++ b/src/core/or/channel.h
@@ -335,7 +335,7 @@ struct channel_t {
* provided tor_addr_t *, and return 1 if successful or 0 if no address
* available.
*/
-  int (*get_remote_addr)(channel_t *, tor_addr_t *);
+  int (*get_remote_addr)(const channel_t *, tor_addr_t *);
   int (*get_transport_name)(channel_t *chan, char **transport_out);
 
 #define GRD_FLAG_ORIGINAL 1
@@ -723,7 +723,7 @@ MOCK_DECL(void, channel_dump_statistics, (channel_t *chan, 
int severity));
 void channel_dump_transport_statistics(channel_t *chan, int severity);
 const char * channel_get_actual_remote_descr(channel_t *chan);
 const char * channel_get_actual_remote_address(channel_t *chan);
-MOCK_DECL(int, channel_get_addr_if_possible, (channel_t *chan,
+MOCK_DECL(int, channel_get_addr_if_possible, (const channel_t *chan,
   tor_addr_t *addr_out));
 MOCK_DECL(const char *, channel_get_canonical_remote_descr,(channel_t *chan));
 int channel_has_queued_writes(channel_t *chan);
diff --git a/src/core/or/channeltls.c b/src/core/or/channeltls.c
index 4db373097..ff4505acf 100644
--- a/src/core/or/channeltls.c
+++ b/src/core/or/channeltls.c
@@ -104,7 +104,8 @@ static const char * 
channel_tls_describe_transport_method(channel_t *chan);
 static void channel_tls_free_method(channel_t *chan);
 static double channel_tls_get_overhead_estimate_method(channel_t *chan);
 static int
-channel_tls_get_remote_addr_method(channel_t *chan, tor_addr_t *addr_out);
+channel_tls_get_remote_addr_method(const channel_t *chan,
+   tor_addr_t *addr_out);
 static int
 channel_tls_get_transport_name_method(channel_t *chan, char **transport_out);
 static const char *
@@ -515,10 +516,10 @@ channel_tls_get_overhead_estimate_method(channel_t *chan)
  * succeeds for this transport).
  */
 static int
-channel_tls_get_remote_addr_method(channel_t *chan, tor_addr_t *addr_out)
+channel_tls_get_remote_addr_method(const channel_t *chan, tor_addr_t *addr_out)
 {
   int rv = 0;
-  channel_tls_t *tlschan = BASE_CHAN_TO_TLS(chan);
+  const channel_tls_t *tlschan = BASE_CHAN_TO_TLS((channel_t*) chan);
 
   tor_assert(tlschan);
   tor_assert(addr_out);
diff --git a/src/test/test_dos.c b/src/test/test_dos.c
index 527e5bbe7..3be09047d 100644
--- a/src/test/test_dos.c
+++ b/src/test/test_dos.c
@@ -108,7 +108,7 @@ test_dos_conn_creation(void *arg)
 
 /** Helper mock: Place a fake IP addr for this channel in addr_out */
 static int
-mock_channel_get_addr_if_possible(channel_t *chan, tor_addr_t *addr_out)
+mock_channel_get_addr_if_possible(const channel_t *chan, tor_addr_t *addr_out)
 {
   (void)chan;
   tt_int_op(AF_INET,OP_EQ, tor_addr_parse(addr_out, "18.0.0.1"));



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


[tor-commits] [snowflake-mobile/master] Handled Invalid relay URL error

2020-07-10 Thread cohosh
commit e4ec88fb8bd15f1a9a266769924eded8c5302836
Author: Hashik Donthineni 
Date:   Tue Jul 7 21:40:08 2020 +0530

Handled Invalid relay URL error
---
 .../torproject/snowflake/MyPersistentService.java  | 101 +
 1 file changed, 61 insertions(+), 40 deletions(-)

diff --git 
a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java 
b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
index fe85bea..c5baf30 100644
--- a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
+++ b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
@@ -317,10 +317,9 @@ public class MyPersistentService extends Service {
 
 if (STATE == DataChannel.State.OPEN) {
 updateNotification("Connection Established. Serving one 
client.");
-startWebSocket();
 } else if (STATE == DataChannel.State.CLOSED) {
 updateNotification("Connection is closed. Resending 
offer...");
-closeConnectionAndResend();
+closeConnections(true);
 }
 }
 });
@@ -340,6 +339,7 @@ public class MyPersistentService extends Service {
 public void onCreateSuccess(SessionDescription sessionDescription) 
{
 mainPeerConnection.setLocalDescription(new 
SimpleSdpObserver("Local"), sessionDescription);
 //Wait till ICE Gathering/ Trickling is finished to send the 
answer.
+startWebSocket(); //While waiting, opening the WebSocket 
connection.
 }
 
 @Override
@@ -441,7 +441,7 @@ public class MyPersistentService extends Service {
 private void answerResponseSuccess(AnsResponse ansResponse) {
 if (ansResponse.getStatus().equals(BrokerConstants.CLIENT_GONE)) {
 Log.d(TAG, "answerResponseSuccess: Client Gone");
-closeConnectionAndResend();
+closeConnections(true);
 } else {
 Log.d(TAG, "answerResponseSuccess: Sending Success");
 }
@@ -459,12 +459,25 @@ public class MyPersistentService extends Service {
 
 /**
  * Closing the connection and resending the request to get SDP.
+ *
+ * @param resend If the service should resend the request or not.
  */
-private void closeConnectionAndResend() {
-Log.d(TAG, "closeConnectionAndResend: Closing connection and resending 
request.");
-//Closing both to avoid memory leak.
-mainDataChannel.close();
-mainPeerConnection.close();
+private void closeConnections(boolean resend) {
+if (!resend) { //If you don't want to resend
+Log.d(TAG, "closeConnection: Closing connection");
+//Closing both to avoid memory leak.
+if (mainDataChannel != null)
+mainDataChannel.close();
+if (mainPeerConnection != null)
+mainPeerConnection.close();
+if (webSocket != null && isWebSocketOpen){
+webSocket.close(1000, "Normal closure");
+isWebSocketOpen = false;
+}
+
+return;
+}
+Log.d(TAG, "closeConnection: Connections closed. Resending request for 
offer...");
 isConnectionAlive = false;
 }
 
@@ -472,38 +485,46 @@ public class MyPersistentService extends Service {
 
 private void startWebSocket() {
 OkHttpClient client = new OkHttpClient();
-webSocket = client.newWebSocket(new 
Request.Builder().url(GlobalApplication.getWebSocketUrl()).build()
-, new WebSocketListener() {
-@Override
-public void onClosed(@NotNull WebSocket webSocket, int 
code, @NotNull String reason) {
-Log.d(TAG, "WebSocketListener: onClosed: ");
-isWebSocketOpen = false;
-}
-
-@Override
-public void onClosing(@NotNull WebSocket webSocket, int 
code, @NotNull String reason) {
-Log.d(TAG, "WebSocketListener: onClosing: ");
-isWebSocketOpen = false;
-}
-
-@Override
-public void onFailure(@NotNull WebSocket webSocket, 
@NotNull Throwable t, @org.jetbrains.annotations.Nullable Response response) {
-Log.d(TAG, "WebSocketListener: onFailure: ");
-isWebSocketOpen = false;
-}
-
-@Override
-public void onMessage(@NotNull WebSocket webSocket, 
@NotNull ByteString bytes) {
-Log.d(TAG, "WebSocketListener: onMessage: Bytes");
-
mainDataChannel.send(RelaySerialization.torToClient(bytes));
-}
-
-@Override
-public void onOpen(@NotNull WebSocket webSocket, @NotNull 
Response 

[tor-commits] [snowflake-mobile/master] Finally implemented the custom URLs in to the service

2020-07-10 Thread cohosh
commit edaa544f29cbead7a8fc976fd958bccd57deedf9
Author: Hashik Donthineni 
Date:   Sun Jun 28 19:32:14 2020 +0530

Finally implemented the custom URLs in to the service
---
 app/src/main/AndroidManifest.xml   |  1 +
 .../torproject/snowflake/GlobalApplication.java| 30 ++
 .../torproject/snowflake/MyPersistentService.java  |  5 +++-
 3 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 6b366fb..67e8537 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -9,6 +9,7 @@
 
 
 http://10.0.2.2:8080;; 
//10.0.2.2 is used to access computer's local host from Android Emulator.
 private final static String WEBSOCKET_URL = 
"wss://snowflake.freehaven.net:443";
+private static SharedPreferences sharedPreferences;
 
 public static String getBrokerUrl() {
+//Checking to see if the switch is turned on.
+if (sharedPreferences.getBoolean(SettingsConstants.BROKER_SWITCH, 
false))
+//Send the custom Broker URL, if the key is not found send default.
+return sharedPreferences.getString(SettingsConstants.BROKER_ET, 
BROKER_URL);
 return BROKER_URL;
 }
 
 public static String getWebSocketUrl() {
+//Checking to see if the switch is turned on.
+if (sharedPreferences.getBoolean(SettingsConstants.RELAY_SWITCH, 
false))
+//Send the custom Socket URL, if the key is not found send default.
+return sharedPreferences.getString(SettingsConstants.RELAY_ET, 
WEBSOCKET_URL);
 return WEBSOCKET_URL;
 }
 
+public static String getSTUN() {
+//Checking to see if the switch is turned on.
+if (sharedPreferences.getBoolean(SettingsConstants.STUN_SWITCH, false))
+return sharedPreferences.getString(SettingsConstants.STUN_ET, 
null); //Send the custom STUN if it's turned on.
+return null;
+}
+
 public static Map getHeadersMap() {
 HashMap map = new HashMap<>();
 map.put("Content-type", "application/json");
@@ -24,4 +47,11 @@ public class GlobalApplication extends Application {
 map.put("Host", getBrokerUrl().replace("http://;, ""));
 return map;
 }
+
+@Override
+public void onCreate() {
+Log.d(TAG, "onCreate: ");
+super.onCreate();
+sharedPreferences = getDefaultSharedPreferences(this);
+}
 }
diff --git 
a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java 
b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
index 29fdad6..fe85bea 100644
--- a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
+++ b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
@@ -276,7 +276,10 @@ public class MyPersistentService extends Service {
 private PeerConnection createPeerConnection(PeerConnectionFactory factory) 
{
 Log.d(TAG, "createPeerConnection: Creating a new peer connection");
 List iceServers = new LinkedList<>();
-//
iceServers.add(PeerConnection.IceServer.builder("stun:stun.l.google.com:19302").createIceServer());
 To Add custom ICE servers.
+if (GlobalApplication.getSTUN() != null) {
+
iceServers.add(PeerConnection.IceServer.builder(GlobalApplication.getSTUN())
+.createIceServer()); //Adding custom ICE server.
+}
 PeerConnection.RTCConfiguration rtcConfiguration = new 
PeerConnection.RTCConfiguration(iceServers);
 PeerConnection.Observer pcObserver = new MyPeerConnectionObserver(TAG, 
new PeerConnectionObserverCallback() {
 



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


[tor-commits] [snowflake-mobile/master] Removed IDE auto-generated fragment string resource

2020-07-10 Thread cohosh
commit 8ab616c27d5b64617e601780b01058bb6b25e224
Author: Hashik Donthineni 
Date:   Tue Jul 7 20:23:43 2020 +0530

Removed IDE auto-generated fragment string resource
---
 app/src/main/res/values/strings.xml | 2 --
 1 file changed, 2 deletions(-)

diff --git a/app/src/main/res/values/strings.xml 
b/app/src/main/res/values/strings.xml
index c26d83e..d737520 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -5,6 +5,4 @@
 This Channel should not be muted. The 
Android system will consider Snowflake not import and will kill the service if 
it\'s muted.
 initial_run
 Snowflake Service
-
-Hello blank fragment
 



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


[tor-commits] [snowflake-mobile/master] Fixed the bug of EditText deactivated when app restarts

2020-07-10 Thread cohosh
commit 5078bbb0325b25c01c58bbf7a282f6218fd9ddb1
Author: Hashik Donthineni 
Date:   Sun Jun 28 18:46:14 2020 +0530

Fixed the bug of EditText deactivated when app restarts
---
 .../snowflake/constants/SettingsConstants.java | 24 ++
 .../snowflake/fragments/AppSettingsFragment.java   | 20 --
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git 
a/app/src/main/java/org/torproject/snowflake/constants/SettingsConstants.java 
b/app/src/main/java/org/torproject/snowflake/constants/SettingsConstants.java
new file mode 100644
index 000..6b6026e
--- /dev/null
+++ 
b/app/src/main/java/org/torproject/snowflake/constants/SettingsConstants.java
@@ -0,0 +1,24 @@
+package org.torproject.snowflake.constants;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class SettingsConstants {
+//Switches
+public static final String STUN_SWITCH = "stun_switch";
+public static final String BROKER_SWITCH = "broker_switch";
+public static final String RELAY_SWITCH = "relay_switch";
+
+//Edit Texts
+public static final String STUN_ET = "stun_edit_text";
+public static final String BROKER_ET = "broker_edit_text";
+public static final String RELAY_ET = "relay_edit_text";
+
+public static Map getSettingMap(){
+return new HashMap(){{
+put(STUN_SWITCH, STUN_ET);
+put(BROKER_SWITCH, BROKER_ET);
+put(RELAY_SWITCH, RELAY_ET);
+}};
+}
+}
diff --git 
a/app/src/main/java/org/torproject/snowflake/fragments/AppSettingsFragment.java 
b/app/src/main/java/org/torproject/snowflake/fragments/AppSettingsFragment.java
index 526f0c8..87c2df9 100644
--- 
a/app/src/main/java/org/torproject/snowflake/fragments/AppSettingsFragment.java
+++ 
b/app/src/main/java/org/torproject/snowflake/fragments/AppSettingsFragment.java
@@ -8,6 +8,10 @@ import androidx.preference.Preference;
 import androidx.preference.PreferenceFragmentCompat;
 
 import org.torproject.snowflake.R;
+import org.torproject.snowflake.constants.SettingsConstants;
+
+import java.util.Iterator;
+import java.util.Map;
 
 public class AppSettingsFragment extends PreferenceFragmentCompat implements 
SharedPreferences.OnSharedPreferenceChangeListener {
 
@@ -21,7 +25,19 @@ public class AppSettingsFragment extends 
PreferenceFragmentCompat implements Sha
 @Override
 public void onCreatePreferences(Bundle savedInstanceState, String rootKey) 
{
 setPreferencesFromResource(R.xml.app_settings, rootKey);
-
getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
+SharedPreferences sharedPreferences = 
getPreferenceManager().getSharedPreferences();
+sharedPreferences.registerOnSharedPreferenceChangeListener(this);
+
+//When the fragment is started we have to check and set the EditTexts' 
to active.
+Map settingMap = SettingsConstants.getSettingMap();
+for(String button: settingMap.keySet()){
+String editT = settingMap.get(button);
+
+boolean isEnabled = sharedPreferences.getBoolean(button, false);
+findPreference(editT).setEnabled(isEnabled);
+findPreference(editT).setSummary(
+sharedPreferences.getString(editT, "Default Value"));
+}
 }
 
 @Override
@@ -49,7 +65,7 @@ public class AppSettingsFragment extends 
PreferenceFragmentCompat implements Sha
 //It's an Edit Text
 String editValue = sharedPreferences.getString(key, "");
 if (!editValue.equals(""))
-findPreference(key).setSummary(editValue); //Setting Edit text 
to edited value
+findPreference(key).setSummary(editValue.trim()); //Setting 
Edit text to edited value
 else
 findPreference(key).setSummary("Using Default"); //Setting 
Edit text to Default because user left it empty.
 }



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


[tor-commits] [snowflake-mobile/master] Reformated the exception block in startWebSocket function

2020-07-10 Thread cohosh
commit 70093a2e65ae50557887cda37f91ea0f2fa36bc4
Author: Hashik Donthineni 
Date:   Thu Jul 9 00:10:37 2020 +0530

Reformated the exception block in startWebSocket function
---
 .../torproject/snowflake/MyPersistentService.java  | 73 +++---
 1 file changed, 38 insertions(+), 35 deletions(-)

diff --git 
a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java 
b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
index c007e72..6e5fe23 100644
--- a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
+++ b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
@@ -504,48 +504,51 @@ public class MyPersistentService extends Service {
 /// Web Socket 
 
 private void startWebSocket() {
-OkHttpClient client = new OkHttpClient();
+Request req;
 try {
-Request req = new 
Request.Builder().url(GlobalApplication.getWebSocketUrl()).build();
-webSocket = client.newWebSocket(req,
-new WebSocketListener() {
-@Override
-public void onClosed(@NotNull WebSocket webSocket, int 
code, @NotNull String reason) {
-Log.d(TAG, "WebSocketListener: onClosed: ");
-isWebSocketOpen = false;
-}
-
-@Override
-public void onClosing(@NotNull WebSocket webSocket, 
int code, @NotNull String reason) {
-Log.d(TAG, "WebSocketListener: onClosing: ");
-isWebSocketOpen = false;
-}
-
-@Override
-public void onFailure(@NotNull WebSocket webSocket, 
@NotNull Throwable t, @org.jetbrains.annotations.Nullable Response response) {
-Log.d(TAG, "WebSocketListener: onFailure: ");
-isWebSocketOpen = false;
-}
-
-@Override
-public void onMessage(@NotNull WebSocket webSocket, 
@NotNull ByteString bytes) {
-Log.d(TAG, "WebSocketListener: onMessage: Bytes");
-
mainDataChannel.send(RelaySerialization.torToClient(bytes));
-}
-
-@Override
-public void onOpen(@NotNull WebSocket webSocket, 
@NotNull Response response) {
-Log.d(TAG, "WebSocketListener: onOpen: ");
-isWebSocketOpen = true;
-}
-});
+req = new 
Request.Builder().url(GlobalApplication.getWebSocketUrl()).build();
 } catch (IllegalArgumentException e) {
 updateNotification("Incorrect Relay URL entered. Please verify and 
restart.");
 e.printStackTrace();
-//We don't want to resend the request for offer unless user gives 
a valid URL and restarts the service.
+//We don't want to resend the request for offer unless user gives 
a valid URL and restart the service.
 closeConnections(false);
+return;
 }
 
+OkHttpClient client = new OkHttpClient();
+webSocket = client.newWebSocket(req,
+new WebSocketListener() {
+@Override
+public void onClosed(@NotNull WebSocket webSocket, int 
code, @NotNull String reason) {
+Log.d(TAG, "WebSocketListener: onClosed: ");
+isWebSocketOpen = false;
+}
+
+@Override
+public void onClosing(@NotNull WebSocket webSocket, int 
code, @NotNull String reason) {
+Log.d(TAG, "WebSocketListener: onClosing: ");
+isWebSocketOpen = false;
+}
+
+@Override
+public void onFailure(@NotNull WebSocket webSocket, 
@NotNull Throwable t, @org.jetbrains.annotations.Nullable Response response) {
+Log.d(TAG, "WebSocketListener: onFailure: ");
+isWebSocketOpen = false;
+}
+
+@Override
+public void onMessage(@NotNull WebSocket webSocket, 
@NotNull ByteString bytes) {
+Log.d(TAG, "WebSocketListener: onMessage: Bytes");
+
mainDataChannel.send(RelaySerialization.torToClient(bytes));
+}
+
+@Override
+public void onOpen(@NotNull WebSocket webSocket, @NotNull 
Response response) {
+Log.d(TAG, "WebSocketListener: onOpen: ");
+isWebSocketOpen = true;
+}
+});
+
 

[tor-commits] [snowflake-mobile/master] Bug fix: Settings showing as using default servers on app restart even tho they are not

2020-07-10 Thread cohosh
commit 76a349a7e9b5f4948a8342c5f44fd3c7d809a562
Author: Hashik Donthineni 
Date:   Sun Jun 28 21:37:18 2020 +0530

Bug fix: Settings showing as using default servers on app restart even tho 
they are not
---
 .../snowflake/constants/SettingsConstants.java |  6 --
 .../snowflake/fragments/AppSettingsFragment.java   | 23 --
 app/src/main/res/xml/app_settings.xml  |  4 
 3 files changed, 17 insertions(+), 16 deletions(-)

diff --git 
a/app/src/main/java/org/torproject/snowflake/constants/SettingsConstants.java 
b/app/src/main/java/org/torproject/snowflake/constants/SettingsConstants.java
index 6b6026e..95b3ede 100644
--- 
a/app/src/main/java/org/torproject/snowflake/constants/SettingsConstants.java
+++ 
b/app/src/main/java/org/torproject/snowflake/constants/SettingsConstants.java
@@ -14,8 +14,10 @@ public class SettingsConstants {
 public static final String BROKER_ET = "broker_edit_text";
 public static final String RELAY_ET = "relay_edit_text";
 
-public static Map getSettingMap(){
-return new HashMap(){{
+public static final String DEFAULT = "Using Default";
+
+public static Map getSettingMap() {
+return new HashMap() {{
 put(STUN_SWITCH, STUN_ET);
 put(BROKER_SWITCH, BROKER_ET);
 put(RELAY_SWITCH, RELAY_ET);
diff --git 
a/app/src/main/java/org/torproject/snowflake/fragments/AppSettingsFragment.java 
b/app/src/main/java/org/torproject/snowflake/fragments/AppSettingsFragment.java
index 87c2df9..409625a 100644
--- 
a/app/src/main/java/org/torproject/snowflake/fragments/AppSettingsFragment.java
+++ 
b/app/src/main/java/org/torproject/snowflake/fragments/AppSettingsFragment.java
@@ -10,7 +10,6 @@ import androidx.preference.PreferenceFragmentCompat;
 import org.torproject.snowflake.R;
 import org.torproject.snowflake.constants.SettingsConstants;
 
-import java.util.Iterator;
 import java.util.Map;
 
 public class AppSettingsFragment extends PreferenceFragmentCompat implements 
SharedPreferences.OnSharedPreferenceChangeListener {
@@ -30,13 +29,17 @@ public class AppSettingsFragment extends 
PreferenceFragmentCompat implements Sha
 
 //When the fragment is started we have to check and set the EditTexts' 
to active.
 Map settingMap = SettingsConstants.getSettingMap();
-for(String button: settingMap.keySet()){
-String editT = settingMap.get(button);
+for (String settingSwitch : settingMap.keySet()) {
+String editT = settingMap.get(settingSwitch);
 
-boolean isEnabled = sharedPreferences.getBoolean(button, false);
-findPreference(editT).setEnabled(isEnabled);
-findPreference(editT).setSummary(
-sharedPreferences.getString(editT, "Default Value"));
+boolean isEnabled = sharedPreferences.getBoolean(settingSwitch, 
false);
+if (!isEnabled)
+
findPreference(settingSwitch).setSummary(SettingsConstants.DEFAULT);
+
+Preference editText = findPreference(editT);
+editText.setEnabled(isEnabled);
+editText.setSummary(
+sharedPreferences.getString(editT, 
SettingsConstants.DEFAULT));
 }
 }
 
@@ -57,9 +60,9 @@ public class AppSettingsFragment extends 
PreferenceFragmentCompat implements Sha
 if (!previousValue.equals(""))
 editTextPreference.setSummary(previousValue); //When 
Switch is turned on set the summary to previously set Value.
 else
-editTextPreference.setSummary("Using Default"); //If there 
is no previous value, then using null.
+editTextPreference.setSummary(SettingsConstants.DEFAULT); 
//If there is no previous value, then using null.
 } else {
-findPreference(key).setSummary("Using Default"); //Default is 
shown when switch is off.
+findPreference(key).setSummary(SettingsConstants.DEFAULT); 
//Default is shown when switch is off.
 }
 } else {
 //It's an Edit Text
@@ -67,7 +70,7 @@ public class AppSettingsFragment extends 
PreferenceFragmentCompat implements Sha
 if (!editValue.equals(""))
 findPreference(key).setSummary(editValue.trim()); //Setting 
Edit text to edited value
 else
-findPreference(key).setSummary("Using Default"); //Setting 
Edit text to Default because user left it empty.
+findPreference(key).setSummary(SettingsConstants.DEFAULT); 
//Setting Edit text to Default because user left it empty.
 }
 }
 
diff --git a/app/src/main/res/xml/app_settings.xml 
b/app/src/main/res/xml/app_settings.xml
index a8d08d8..d3a110e 100644
--- a/app/src/main/res/xml/app_settings.xml
+++ b/app/src/main/res/xml/app_settings.xml
@@ -7,7 +7,6 @@
 app:iconSpaceReserved="false">
 
 
 
 
 




[tor-commits] [snowflake-mobile/master] Handled ICE connection failed state

2020-07-10 Thread cohosh
commit fecb5fa01746bf4fc3541bb2da908751dd715ae8
Author: Hashik Donthineni 
Date:   Tue Jul 7 22:50:41 2020 +0530

Handled ICE connection failed state
---
 .../main/java/org/torproject/snowflake/MyPeerConnectionObserver.java   | 3 ++-
 app/src/main/java/org/torproject/snowflake/MyPersistentService.java| 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/app/src/main/java/org/torproject/snowflake/MyPeerConnectionObserver.java 
b/app/src/main/java/org/torproject/snowflake/MyPeerConnectionObserver.java
index 5d96dae..260833a 100644
--- a/app/src/main/java/org/torproject/snowflake/MyPeerConnectionObserver.java
+++ b/app/src/main/java/org/torproject/snowflake/MyPeerConnectionObserver.java
@@ -26,7 +26,8 @@ public class MyPeerConnectionObserver implements 
PeerConnection.Observer {
 @Override
 public void onIceConnectionChange(PeerConnection.IceConnectionState 
iceConnectionState) {
 Log.d(TAG, "onIceConnectionChange: " + iceConnectionState);
-//TODO:Handle Connection Failure.
+if (iceConnectionState == PeerConnection.IceConnectionState.FAILED)
+peerconnectionObserverCallback.iceConnectionFailed();
 }
 
 @Override
diff --git 
a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java 
b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
index 07fc37c..c007e72 100644
--- a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
+++ b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
@@ -308,7 +308,8 @@ public class MyPersistentService extends Service {
 @Override
 public void iceConnectionFailed() {
 Log.d(TAG, "iceConnectionFailed: ");
-//TODO: Figuring out with trac ticket.
+//Connection is terminated when ICE connection reaches FAILED 
state.
+closeConnections(true);
 }
 
 @Override



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


[tor-commits] [snowflake-mobile/master] Disposed all threads when we don't want to resend request

2020-07-10 Thread cohosh
commit b83fc18a490f151c6c67217019a8828f44519d86
Author: Hashik Donthineni 
Date:   Tue Jul 7 22:16:44 2020 +0530

Disposed all threads when we don't want to resend request
---
 app/src/main/java/org/torproject/snowflake/MyPersistentService.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git 
a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java 
b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
index 62f1d3f..07fc37c 100644
--- a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
+++ b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
@@ -491,6 +491,8 @@ public class MyPersistentService extends Service {
 webSocket.close(1000, "Normal closure");
 isWebSocketOpen = false;
 }
+if (compositeDisposable != null)
+compositeDisposable.dispose(); //Disposing all the threads. 
Including network calls.
 
 return;
 }



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


[tor-commits] [snowflake-mobile/master] Removed button auto-click in testing env, to avoid confusion

2020-07-10 Thread cohosh
commit 531630460a4cb5d504d2afbc561e81bda06bc06f
Author: Hashik Donthineni 
Date:   Tue Jul 7 20:25:07 2020 +0530

Removed button auto-click in testing env, to avoid confusion
---
 app/src/main/java/org/torproject/snowflake/fragments/MainFragment.java | 2 --
 1 file changed, 2 deletions(-)

diff --git 
a/app/src/main/java/org/torproject/snowflake/fragments/MainFragment.java 
b/app/src/main/java/org/torproject/snowflake/fragments/MainFragment.java
index 0b11c22..0ac2407 100644
--- a/app/src/main/java/org/torproject/snowflake/fragments/MainFragment.java
+++ b/app/src/main/java/org/torproject/snowflake/fragments/MainFragment.java
@@ -55,8 +55,6 @@ public class MainFragment extends Fragment {
 else
 
callback.serviceToggle(ForegroundServiceConstants.ACTION_START);
 });
-if (BuildConfig.DEBUG)
-startButton.performClick(); //To perform an automatic click in 
testing environment.
 
 // Inflate the layout for this fragment
 return rootView;



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


[tor-commits] [snowflake-mobile/master] Added functionality to Settings

2020-07-10 Thread cohosh
commit 83bcdb97b462bdae7e55744d062d2a469ed73702
Author: Hashik Donthineni 
Date:   Sun Jun 28 17:43:17 2020 +0530

Added functionality to Settings
---
 .../torproject/snowflake/AppSettingsFragment.java  | 51 +-
 app/src/main/res/xml/app_settings.xml  | 11 +++--
 2 files changed, 57 insertions(+), 5 deletions(-)

diff --git 
a/app/src/main/java/org/torproject/snowflake/AppSettingsFragment.java 
b/app/src/main/java/org/torproject/snowflake/AppSettingsFragment.java
index 33bc456..bfc0631 100644
--- a/app/src/main/java/org/torproject/snowflake/AppSettingsFragment.java
+++ b/app/src/main/java/org/torproject/snowflake/AppSettingsFragment.java
@@ -1,10 +1,15 @@
 package org.torproject.snowflake;
 
+import android.content.SharedPreferences;
 import android.os.Bundle;
+import android.util.Log;
 
+import androidx.preference.Preference;
 import androidx.preference.PreferenceFragmentCompat;
 
-public class AppSettingsFragment extends PreferenceFragmentCompat {
+public class AppSettingsFragment extends PreferenceFragmentCompat implements 
SharedPreferences.OnSharedPreferenceChangeListener {
+
+private static final String TAG = "AppSettingsFragment";
 
 public static AppSettingsFragment newInstance() {
 AppSettingsFragment fragment = new AppSettingsFragment();
@@ -14,5 +19,49 @@ public class AppSettingsFragment extends 
PreferenceFragmentCompat {
 @Override
 public void onCreatePreferences(Bundle savedInstanceState, String rootKey) 
{
 setPreferencesFromResource(R.xml.app_settings, rootKey);
+
getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
+}
+
+@Override
+public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, 
String key) {
+Log.d(TAG, "onSharedPreferenceChanged: Key:" + key);
+if (key.contains("switch")) {
+//It's a switch
+boolean val = sharedPreferences.getBoolean(key, false);
+String edit_text = key.replace("switch", "edit_text");
+Preference editTextPreference = findPreference(edit_text);
+editTextPreference.setEnabled(val);
+
+if (val) {
+findPreference(key).setSummary(""); //Summary of switch is 
null when turned on.
+
+String previousValue = sharedPreferences.getString(edit_text, 
"");
+if (!previousValue.equals(""))
+editTextPreference.setSummary(previousValue); //When 
Switch is turned on set the summary to previously set Value.
+else
+editTextPreference.setSummary("Using Default"); //If there 
is no previous value, then using null.
+} else {
+findPreference(key).setSummary("Using Default"); //Default is 
shown when switch is off.
+}
+} else {
+//It's an Edit Text
+String editValue = sharedPreferences.getString(key, "");
+if (!editValue.equals(""))
+findPreference(key).setSummary(editValue); //Setting Edit text 
to edited value
+else
+findPreference(key).setSummary("Using Default"); //Setting 
Edit text to Default because user left it empty.
+}
+}
+
+@Override
+public void onResume() {
+super.onResume();
+
getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
+}
+
+@Override
+public void onPause() {
+super.onPause();
+
getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
 }
 }
diff --git a/app/src/main/res/xml/app_settings.xml 
b/app/src/main/res/xml/app_settings.xml
index ae85095..a8d08d8 100644
--- a/app/src/main/res/xml/app_settings.xml
+++ b/app/src/main/res/xml/app_settings.xml
@@ -7,6 +7,7 @@
 app:iconSpaceReserved="false">
 
 
 
 
 
 
 
 https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [snowflake-mobile/master] Handled Invalid STUD URL

2020-07-10 Thread cohosh
commit fba786cd9c4d8f35f22b277228f2757eebc34dda
Author: Hashik Donthineni 
Date:   Tue Jul 7 22:07:58 2020 +0530

Handled Invalid STUD URL
---
 .../main/java/org/torproject/snowflake/MyPersistentService.java| 7 +++
 1 file changed, 7 insertions(+)

diff --git 
a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java 
b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
index 2e98501..62f1d3f 100644
--- a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
+++ b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
@@ -417,8 +417,15 @@ public class MyPersistentService extends Service {
  * @param t
  */
 public void offerRequestFailure(Throwable t) {
+if (t instanceof NullPointerException) {
+//We don't want to resend the request for offer unless user gives 
a valid URL and restarts the service.
+updateNotification("Invalid STUN server assigned. Please verify 
and restart.");
+closeConnections(false);
+return;
+}
 updateNotification("Request failed, retrying...");
 Log.d(TAG, "requestFailure: " + t.getMessage());
+t.printStackTrace();
 isConnectionAlive = false;
 }
 



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


[tor-commits] [snowflake-mobile/master] Handled Invalid Broker URL

2020-07-10 Thread cohosh
commit 23595b83b3132b85ef470fad34f499e21124093c
Author: Hashik Donthineni 
Date:   Tue Jul 7 21:47:24 2020 +0530

Handled Invalid Broker URL
---
 .../org/torproject/snowflake/MyPersistentService.java| 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git 
a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java 
b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
index c5baf30..2e98501 100644
--- a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
+++ b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
@@ -365,7 +365,17 @@ public class MyPersistentService extends Service {
 isConnectionAlive = true; //Considering connection is alive from 
now on, until it is set to false.
 Log.d(TAG, "fetchOffer: Fetching offer from broker.");
 ///Retrofit call
-final GetOfferService getOfferService = 
RetroServiceGenerator.createService(GetOfferService.class);
+final GetOfferService getOfferService;
+try {
+getOfferService = 
RetroServiceGenerator.createService(GetOfferService.class);
+} catch (IllegalArgumentException e) {
+updateNotification("Incorrect Broker URL entered. Please 
verify and restart.");
+//We don't want to resend the request for offer unless user 
gives a valid URL and restarts the service.
+closeConnections(false);
+e.printStackTrace();
+return;
+}
+
 Observable offer = 
getOfferService.getOffer(GlobalApplication.getHeadersMap(), new 
OfferRequestBody(sidHelper.generateSid()));
 compositeDisposable.add(
 offer.subscribeOn(Schedulers.io())
@@ -470,7 +480,7 @@ public class MyPersistentService extends Service {
 mainDataChannel.close();
 if (mainPeerConnection != null)
 mainPeerConnection.close();
-if (webSocket != null && isWebSocketOpen){
+if (webSocket != null && isWebSocketOpen) {
 webSocket.close(1000, "Normal closure");
 isWebSocketOpen = false;
 }
@@ -520,7 +530,7 @@ public class MyPersistentService extends Service {
 }
 });
 } catch (IllegalArgumentException e) {
-updateNotification("Invalid Relay URL entered. Verify and 
restart.");
+updateNotification("Incorrect Relay URL entered. Please verify and 
restart.");
 e.printStackTrace();
 //We don't want to resend the request for offer unless user gives 
a valid URL and restarts the service.
 closeConnections(false);



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


[tor-commits] [snowflake-mobile/master] Moved main activity code in to MainFragment to make way for up comming settings fragment

2020-07-10 Thread cohosh
commit ec410a4b728cc5a3a4038ba46c32a7c6d66615c9
Author: Hashik Donthineni 
Date:   Sun Jun 28 15:14:20 2020 +0530

Moved main activity code in to MainFragment to make way for up comming 
settings fragment
---
 app/build.gradle   |  1 +
 .../org/torproject/snowflake/MainActivity.java | 20 ++-
 .../org/torproject/snowflake/MainFragment.java | 68 ++
 .../snowflake/interfaces/MainFragmentCallback.java |  6 ++
 app/src/main/res/layout/activity_main.xml  | 11 
 app/src/main/res/layout/fragment_main_fragment.xml | 17 ++
 app/src/main/res/values/strings.xml|  2 +
 7 files changed, 99 insertions(+), 26 deletions(-)

diff --git a/app/build.gradle b/app/build.gradle
index 4d13970..964695b 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -33,6 +33,7 @@ dependencies {
 implementation 'androidx.appcompat:appcompat:1.1.0'
 implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
 implementation 'androidx.preference:preference:1.1.1'
+implementation 'androidx.legacy:legacy-support-v4:1.0.0'
 testImplementation 'junit:junit:4.12'
 androidTestImplementation 'androidx.test.ext:junit:1.1.1'
 androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
diff --git a/app/src/main/java/org/torproject/snowflake/MainActivity.java 
b/app/src/main/java/org/torproject/snowflake/MainActivity.java
index 1ac43dd..d412944 100644
--- a/app/src/main/java/org/torproject/snowflake/MainActivity.java
+++ b/app/src/main/java/org/torproject/snowflake/MainActivity.java
@@ -8,16 +8,16 @@ import android.content.SharedPreferences;
 import android.graphics.Color;
 import android.os.Build;
 import android.os.Bundle;
-import android.widget.Button;
 
 import androidx.appcompat.app.AppCompatActivity;
 
 import org.torproject.snowflake.constants.ForegroundServiceConstants;
+import org.torproject.snowflake.interfaces.MainFragmentCallback;
 
 /**
  * MainActivity is the main UI of the application.
  */
-public class MainActivity extends AppCompatActivity {
+public class MainActivity extends AppCompatActivity implements 
MainFragmentCallback {
 private static final String TAG = "MainActivity";
 private SharedPreferences sharedPreferences;
 
@@ -25,7 +25,7 @@ public class MainActivity extends AppCompatActivity {
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
-
+setSupportActionBar(findViewById(R.id.toolbar));
 sharedPreferences = 
getSharedPreferences(getString(R.string.sharedpreference_file), MODE_PRIVATE);
 
 //Creating notification channel if app is being run for the first time
@@ -34,16 +34,6 @@ public class MainActivity extends AppCompatActivity {
 //Setting initial run to false.
 
sharedPreferences.edit().putBoolean(getString(R.string.initial_run_boolean), 
false).apply();
 }
-
-Button startButton = findViewById(R.id.start_button);
-startButton.setOnClickListener(v -> {
-if (isServiceRunning()) //Toggling the service.
-serviceToggle(ForegroundServiceConstants.ACTION_STOP);
-else
-serviceToggle(ForegroundServiceConstants.ACTION_START);
-});
-if (BuildConfig.DEBUG)
-startButton.performClick(); //To perform an automatic click in 
testing environment.
 }
 
 /**
@@ -51,7 +41,7 @@ public class MainActivity extends AppCompatActivity {
  *
  * @param action An Action from ForegroundServiceConstants.
  */
-private void serviceToggle(String action) {
+public void serviceToggle(String action) {
 Intent serviceIntent = new Intent(MainActivity.this, 
MyPersistentService.class);
 serviceIntent.setAction(action);
 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
@@ -66,7 +56,7 @@ public class MainActivity extends AppCompatActivity {
  *
  * @return boolean whether the service is running or not.
  */
-private boolean isServiceRunning() {
+public boolean isServiceRunning() {
 return 
sharedPreferences.getBoolean(getString(R.string.is_service_running_bool), 
false);
 }
 
diff --git a/app/src/main/java/org/torproject/snowflake/MainFragment.java 
b/app/src/main/java/org/torproject/snowflake/MainFragment.java
new file mode 100644
index 000..f850277
--- /dev/null
+++ b/app/src/main/java/org/torproject/snowflake/MainFragment.java
@@ -0,0 +1,68 @@
+package org.torproject.snowflake;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+
+import androidx.annotation.NonNull;
+import androidx.fragment.app.Fragment;
+
+import org.torproject.snowflake.constants.ForegroundServiceConstants;
+import 

[tor-commits] [snowflake-mobile/master] Moved files in to fragments package

2020-07-10 Thread cohosh
commit bb53d2eb3f12e09e62ffa0de7c0d3c04387ee703
Author: Hashik Donthineni 
Date:   Sun Jun 28 17:46:17 2020 +0530

Moved files in to fragments package
---
 app/src/main/java/org/torproject/snowflake/MainActivity.java  | 2 ++
 .../org/torproject/snowflake/{ => fragments}/AppSettingsFragment.java | 4 +++-
 .../java/org/torproject/snowflake/{ => fragments}/MainFragment.java   | 4 +++-
 app/src/main/res/layout/fragment_main_fragment.xml| 2 +-
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/app/src/main/java/org/torproject/snowflake/MainActivity.java 
b/app/src/main/java/org/torproject/snowflake/MainActivity.java
index 7bafaf4..1f8070f 100644
--- a/app/src/main/java/org/torproject/snowflake/MainActivity.java
+++ b/app/src/main/java/org/torproject/snowflake/MainActivity.java
@@ -17,6 +17,8 @@ import androidx.fragment.app.Fragment;
 
 import org.torproject.snowflake.constants.ForegroundServiceConstants;
 import org.torproject.snowflake.constants.FragmentConstants;
+import org.torproject.snowflake.fragments.AppSettingsFragment;
+import org.torproject.snowflake.fragments.MainFragment;
 import org.torproject.snowflake.interfaces.MainFragmentCallback;
 
 /**
diff --git 
a/app/src/main/java/org/torproject/snowflake/AppSettingsFragment.java 
b/app/src/main/java/org/torproject/snowflake/fragments/AppSettingsFragment.java
similarity index 97%
rename from app/src/main/java/org/torproject/snowflake/AppSettingsFragment.java
rename to 
app/src/main/java/org/torproject/snowflake/fragments/AppSettingsFragment.java
index bfc0631..526f0c8 100644
--- a/app/src/main/java/org/torproject/snowflake/AppSettingsFragment.java
+++ 
b/app/src/main/java/org/torproject/snowflake/fragments/AppSettingsFragment.java
@@ -1,4 +1,4 @@
-package org.torproject.snowflake;
+package org.torproject.snowflake.fragments;
 
 import android.content.SharedPreferences;
 import android.os.Bundle;
@@ -7,6 +7,8 @@ import android.util.Log;
 import androidx.preference.Preference;
 import androidx.preference.PreferenceFragmentCompat;
 
+import org.torproject.snowflake.R;
+
 public class AppSettingsFragment extends PreferenceFragmentCompat implements 
SharedPreferences.OnSharedPreferenceChangeListener {
 
 private static final String TAG = "AppSettingsFragment";
diff --git a/app/src/main/java/org/torproject/snowflake/MainFragment.java 
b/app/src/main/java/org/torproject/snowflake/fragments/MainFragment.java
similarity index 94%
rename from app/src/main/java/org/torproject/snowflake/MainFragment.java
rename to app/src/main/java/org/torproject/snowflake/fragments/MainFragment.java
index 520436c..0b11c22 100644
--- a/app/src/main/java/org/torproject/snowflake/MainFragment.java
+++ b/app/src/main/java/org/torproject/snowflake/fragments/MainFragment.java
@@ -1,4 +1,4 @@
-package org.torproject.snowflake;
+package org.torproject.snowflake.fragments;
 
 import android.content.Context;
 import android.os.Bundle;
@@ -10,6 +10,8 @@ import android.widget.Button;
 import androidx.annotation.NonNull;
 import androidx.fragment.app.Fragment;
 
+import org.torproject.snowflake.BuildConfig;
+import org.torproject.snowflake.R;
 import org.torproject.snowflake.constants.ForegroundServiceConstants;
 import org.torproject.snowflake.interfaces.MainFragmentCallback;
 
diff --git a/app/src/main/res/layout/fragment_main_fragment.xml 
b/app/src/main/res/layout/fragment_main_fragment.xml
index 6e9c225..bd6a855 100644
--- a/app/src/main/res/layout/fragment_main_fragment.xml
+++ b/app/src/main/res/layout/fragment_main_fragment.xml
@@ -3,7 +3,7 @@
 xmlns:tools="http://schemas.android.com/tools;
 android:layout_width="match_parent"
 android:layout_height="match_parent"
-tools:context=".MainFragment">
+tools:context=".fragments.MainFragment">
 
 
 https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [snowflake-mobile/master] Started MainFragment from MainActivity

2020-07-10 Thread cohosh
commit 272ca20f2ea2d7f6869da4e4a6f8a66b2f97c8bb
Author: Hashik Donthineni 
Date:   Sun Jun 28 15:26:42 2020 +0530

Started MainFragment from MainActivity
---
 .../main/java/org/torproject/snowflake/MainActivity.java | 16 
 .../main/java/org/torproject/snowflake/MainFragment.java |  5 +++--
 app/src/main/res/layout/activity_main.xml|  6 ++
 app/src/main/res/layout/fragment_main_fragment.xml   |  4 ++--
 4 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/app/src/main/java/org/torproject/snowflake/MainActivity.java 
b/app/src/main/java/org/torproject/snowflake/MainActivity.java
index d412944..642fe21 100644
--- a/app/src/main/java/org/torproject/snowflake/MainActivity.java
+++ b/app/src/main/java/org/torproject/snowflake/MainActivity.java
@@ -10,6 +10,7 @@ import android.os.Build;
 import android.os.Bundle;
 
 import androidx.appcompat.app.AppCompatActivity;
+import androidx.fragment.app.Fragment;
 
 import org.torproject.snowflake.constants.ForegroundServiceConstants;
 import org.torproject.snowflake.interfaces.MainFragmentCallback;
@@ -34,6 +35,21 @@ public class MainActivity extends AppCompatActivity 
implements MainFragmentCallb
 //Setting initial run to false.
 
sharedPreferences.edit().putBoolean(getString(R.string.initial_run_boolean), 
false).apply();
 }
+
+//Starting the MainFragment.
+startFragment(MainFragment.newInstance());
+}
+
+/**
+ * Used to  replace the fragment in the "fragment_container"
+ *
+ * @param fragment New Fragment that is to be placed in the container.
+ */
+private void startFragment(Fragment fragment) {
+getSupportFragmentManager()
+.beginTransaction()
+.replace(R.id.fragment_container,
+fragment).commit();
 }
 
 /**
diff --git a/app/src/main/java/org/torproject/snowflake/MainFragment.java 
b/app/src/main/java/org/torproject/snowflake/MainFragment.java
index f850277..e30923b 100644
--- a/app/src/main/java/org/torproject/snowflake/MainFragment.java
+++ b/app/src/main/java/org/torproject/snowflake/MainFragment.java
@@ -46,7 +46,8 @@ public class MainFragment extends Fragment {
 @Override
 public View onCreateView(LayoutInflater inflater, ViewGroup container,
  Bundle savedInstanceState) {
-Button startButton = container.findViewById(R.id.start_button);
+View rootView = inflater.inflate(R.layout.fragment_main_fragment, 
container, false);
+Button startButton = rootView.findViewById(R.id.start_button);
 startButton.setOnClickListener(v -> {
 if (callback.isServiceRunning()) //Toggling the service.
 callback.serviceToggle(ForegroundServiceConstants.ACTION_STOP);
@@ -57,7 +58,7 @@ public class MainFragment extends Fragment {
 startButton.performClick(); //To perform an automatic click in 
testing environment.
 
 // Inflate the layout for this fragment
-return inflater.inflate(R.layout.fragment_main_fragment, container, 
false);
+return rootView;
 }
 
 @Override
diff --git a/app/src/main/res/layout/activity_main.xml 
b/app/src/main/res/layout/activity_main.xml
index abc7268..c9f27a2 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -38,4 +38,10 @@
 android:foreground="?android:attr/selectableItemBackground" />
 
 
+
+
 
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_main_fragment.xml 
b/app/src/main/res/layout/fragment_main_fragment.xml
index 7523126..6e9c225 100644
--- a/app/src/main/res/layout/fragment_main_fragment.xml
+++ b/app/src/main/res/layout/fragment_main_fragment.xml
@@ -1,5 +1,5 @@
 
-http://schemas.android.com/apk/res/android;
+http://schemas.android.com/apk/res/android;
 xmlns:tools="http://schemas.android.com/tools;
 android:layout_width="match_parent"
 android:layout_height="match_parent"
@@ -14,4 +14,4 @@
 android:foreground="?android:attr/selectableItemBackground"
 android:text="Service Toggle" />
 
-
\ No newline at end of file
+
\ No newline at end of file



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


[tor-commits] [snowflake-mobile/master] Added settings UI and handled button click

2020-07-10 Thread cohosh
commit 18f453de453981d3f5105d661efe40905aca5cc9
Author: Hashik Donthineni 
Date:   Sun Jun 28 16:05:44 2020 +0530

Added settings UI and handled button click
---
 .../torproject/snowflake/AppSettingsFragment.java  | 18 +
 .../org/torproject/snowflake/MainActivity.java | 13 ++
 .../org/torproject/snowflake/MainFragment.java |  1 -
 app/src/main/res/layout/activity_main.xml  |  9 +++--
 app/src/main/res/values/arrays.xml | 12 ++
 app/src/main/res/xml/app_settings.xml  | 47 --
 6 files changed, 83 insertions(+), 17 deletions(-)

diff --git 
a/app/src/main/java/org/torproject/snowflake/AppSettingsFragment.java 
b/app/src/main/java/org/torproject/snowflake/AppSettingsFragment.java
new file mode 100644
index 000..33bc456
--- /dev/null
+++ b/app/src/main/java/org/torproject/snowflake/AppSettingsFragment.java
@@ -0,0 +1,18 @@
+package org.torproject.snowflake;
+
+import android.os.Bundle;
+
+import androidx.preference.PreferenceFragmentCompat;
+
+public class AppSettingsFragment extends PreferenceFragmentCompat {
+
+public static AppSettingsFragment newInstance() {
+AppSettingsFragment fragment = new AppSettingsFragment();
+return fragment;
+}
+
+@Override
+public void onCreatePreferences(Bundle savedInstanceState, String rootKey) 
{
+setPreferencesFromResource(R.xml.app_settings, rootKey);
+}
+}
diff --git a/app/src/main/java/org/torproject/snowflake/MainActivity.java 
b/app/src/main/java/org/torproject/snowflake/MainActivity.java
index 642fe21..a1eb34d 100644
--- a/app/src/main/java/org/torproject/snowflake/MainActivity.java
+++ b/app/src/main/java/org/torproject/snowflake/MainActivity.java
@@ -8,6 +8,8 @@ import android.content.SharedPreferences;
 import android.graphics.Color;
 import android.os.Build;
 import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
 
 import androidx.appcompat.app.AppCompatActivity;
 import androidx.fragment.app.Fragment;
@@ -21,12 +23,15 @@ import 
org.torproject.snowflake.interfaces.MainFragmentCallback;
 public class MainActivity extends AppCompatActivity implements 
MainFragmentCallback {
 private static final String TAG = "MainActivity";
 private SharedPreferences sharedPreferences;
+private Button settingsButton;
 
 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 setSupportActionBar(findViewById(R.id.toolbar));
+settingsButton = findViewById(R.id.settings_button);
+
 sharedPreferences = 
getSharedPreferences(getString(R.string.sharedpreference_file), MODE_PRIVATE);
 
 //Creating notification channel if app is being run for the first time
@@ -36,6 +41,14 @@ public class MainActivity extends AppCompatActivity 
implements MainFragmentCallb
 
sharedPreferences.edit().putBoolean(getString(R.string.initial_run_boolean), 
false).apply();
 }
 
+settingsButton.setOnClickListener(new View.OnClickListener() {
+@Override
+public void onClick(View v) {
+//Starting Settings Activity.
+startFragment(AppSettingsFragment.newInstance());
+}
+});
+
 //Starting the MainFragment.
 startFragment(MainFragment.newInstance());
 }
diff --git a/app/src/main/java/org/torproject/snowflake/MainFragment.java 
b/app/src/main/java/org/torproject/snowflake/MainFragment.java
index e30923b..520436c 100644
--- a/app/src/main/java/org/torproject/snowflake/MainFragment.java
+++ b/app/src/main/java/org/torproject/snowflake/MainFragment.java
@@ -34,7 +34,6 @@ public class MainFragment extends Fragment {
 
 public static MainFragment newInstance() {
 MainFragment fragment = new MainFragment();
-Bundle bundle = new Bundle();
 return fragment;
 }
 
diff --git a/app/src/main/res/layout/activity_main.xml 
b/app/src/main/res/layout/activity_main.xml
index c9f27a2..d095c62 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,5 +1,5 @@
 
-http://schemas.android.com/apk/res/android;
+http://schemas.android.com/apk/res/android;
 xmlns:app="http://schemas.android.com/apk/res-auto;
 xmlns:tools="http://schemas.android.com/tools;
 android:layout_width="match_parent"
@@ -29,6 +29,7 @@
 android:textSize="16sp" />
 
 
 
 
-
\ No newline at end of file
+android:layout_below="@id/toolbar" />
+
\ No newline at end of file
diff --git a/app/src/main/res/values/arrays.xml 
b/app/src/main/res/values/arrays.xml
new file mode 100644
index 000..6cf9ed4
--- /dev/null
+++ b/app/src/main/res/values/arrays.xml
@@ -0,0 +1,12 @@
+
+
+
+Reply
+Reply to all
+
+
+
+reply
+reply_all
+
+
\ No newline at end of file
diff 

[tor-commits] [snowflake-mobile/master] Handled back press from fragments

2020-07-10 Thread cohosh
commit a9548589575a7bc6dc443df09189e5eef27b4c1c
Author: Hashik Donthineni 
Date:   Sun Jun 28 16:19:23 2020 +0530

Handled back press from fragments
---
 .../java/org/torproject/snowflake/MainActivity.java  | 20 
 .../snowflake/constants/FragmentConstants.java   |  6 ++
 2 files changed, 26 insertions(+)

diff --git a/app/src/main/java/org/torproject/snowflake/MainActivity.java 
b/app/src/main/java/org/torproject/snowflake/MainActivity.java
index a1eb34d..7bafaf4 100644
--- a/app/src/main/java/org/torproject/snowflake/MainActivity.java
+++ b/app/src/main/java/org/torproject/snowflake/MainActivity.java
@@ -8,6 +8,7 @@ import android.content.SharedPreferences;
 import android.graphics.Color;
 import android.os.Build;
 import android.os.Bundle;
+import android.util.Log;
 import android.view.View;
 import android.widget.Button;
 
@@ -15,6 +16,7 @@ import androidx.appcompat.app.AppCompatActivity;
 import androidx.fragment.app.Fragment;
 
 import org.torproject.snowflake.constants.ForegroundServiceConstants;
+import org.torproject.snowflake.constants.FragmentConstants;
 import org.torproject.snowflake.interfaces.MainFragmentCallback;
 
 /**
@@ -22,6 +24,7 @@ import 
org.torproject.snowflake.interfaces.MainFragmentCallback;
  */
 public class MainActivity extends AppCompatActivity implements 
MainFragmentCallback {
 private static final String TAG = "MainActivity";
+int currentFragment;
 private SharedPreferences sharedPreferences;
 private Button settingsButton;
 
@@ -59,6 +62,14 @@ public class MainActivity extends AppCompatActivity 
implements MainFragmentCallb
  * @param fragment New Fragment that is to be placed in the container.
  */
 private void startFragment(Fragment fragment) {
+if (fragment instanceof MainFragment) {
+currentFragment = FragmentConstants.MAIN_FRAGMENT;
+} else {
+currentFragment = FragmentConstants.APP_SETTINGS_FRAGMENT;
+}
+
+Log.d(TAG, "startFragment: " + currentFragment);
+
 getSupportFragmentManager()
 .beginTransaction()
 .replace(R.id.fragment_container,
@@ -107,4 +118,13 @@ public class MainActivity extends AppCompatActivity 
implements MainFragmentCallb
 notificationManager.createNotificationChannel(channel);
 }
 }
+
+@Override
+public void onBackPressed() {
+//If the back is pressed on AppSettingsFragment take it back to 
MainFragment.
+if(currentFragment == FragmentConstants.APP_SETTINGS_FRAGMENT)
+startFragment(MainFragment.newInstance());
+else
+super.onBackPressed();
+}
 }
diff --git 
a/app/src/main/java/org/torproject/snowflake/constants/FragmentConstants.java 
b/app/src/main/java/org/torproject/snowflake/constants/FragmentConstants.java
new file mode 100644
index 000..00942b8
--- /dev/null
+++ 
b/app/src/main/java/org/torproject/snowflake/constants/FragmentConstants.java
@@ -0,0 +1,6 @@
+package org.torproject.snowflake.constants;
+
+public class FragmentConstants {
+public static final int MAIN_FRAGMENT = 0;
+public static final int APP_SETTINGS_FRAGMENT = 1;
+}



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


[tor-commits] [snowflake-mobile/master] Fixed webscoket NullPointerException when there is no connection

2020-07-10 Thread cohosh
commit a5b26df61b802840766a68984c1fe639ef44a032
Author: Hashik Donthineni 
Date:   Sun Jun 28 14:42:57 2020 +0530

Fixed webscoket NullPointerException when there is no connection
---
 app/src/main/java/org/torproject/snowflake/MyPersistentService.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java 
b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
index c02276e..29fdad6 100644
--- a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
+++ b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
@@ -123,8 +123,8 @@ public class MyPersistentService extends Service {
 mainPeerConnection.close();
 mainPeerConnection.dispose();
 }
-
-webSocket.close(1000, "Normal closure");
+if (webSocket != null)
+webSocket.close(1000, "Normal closure");
 
mNotificationManager.cancel(ForegroundServiceConstants.DEF_NOTIFICATION_ID);
 Log.d(TAG, "onDestroy: Service Destroyed");
 super.onDestroy();



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


[tor-commits] [snowflake-mobile/master] Added custom toobar

2020-07-10 Thread cohosh
commit 2cdd98f866fa17149b081a0e0f4bc517423cb670
Author: Hashik Donthineni 
Date:   Sun Jun 28 14:07:17 2020 +0530

Added custom toobar
---
 app/src/main/res/layout/activity_main.xml | 19 +++
 app/src/main/res/values/styles.xml|  2 +-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/app/src/main/res/layout/activity_main.xml 
b/app/src/main/res/layout/activity_main.xml
index 1c42128..0320e22 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -6,6 +6,25 @@
 android:layout_height="match_parent"
 tools:context=".MainActivity">
 
+
+
+
+
+
 
 
 
-

[tor-commits] [snowflake-mobile/master] Addedd preferences library to gradle

2020-07-10 Thread cohosh
commit aa8b875ea957fbf8b7273d9be7303580043f1da3
Author: Hashik Donthineni 
Date:   Sun Jun 28 13:48:03 2020 +0530

Addedd preferences library to gradle
---
 app/build.gradle | 1 +
 1 file changed, 1 insertion(+)

diff --git a/app/build.gradle b/app/build.gradle
index 9580614..4d13970 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -32,6 +32,7 @@ dependencies {
 
 implementation 'androidx.appcompat:appcompat:1.1.0'
 implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+implementation 'androidx.preference:preference:1.1.1'
 testImplementation 'junit:junit:4.12'
 androidTestImplementation 'androidx.test.ext:junit:1.1.1'
 androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'



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


[tor-commits] [snowflake-mobile/master] Addedd settings button

2020-07-10 Thread cohosh
commit 54434b020ade324ada26d073f9ab14e486bff402
Author: Hashik Donthineni 
Date:   Sun Jun 28 14:41:50 2020 +0530

Addedd settings button
---
 app/src/main/res/drawable/ic_baseline_settings.xml |  5 
 app/src/main/res/layout/activity_main.xml  | 35 +++---
 2 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/app/src/main/res/drawable/ic_baseline_settings.xml 
b/app/src/main/res/drawable/ic_baseline_settings.xml
new file mode 100644
index 000..b240b83
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_settings.xml
@@ -0,0 +1,5 @@
+http://schemas.android.com/apk/res/android;>
+
+
diff --git a/app/src/main/res/layout/activity_main.xml 
b/app/src/main/res/layout/activity_main.xml
index 0320e22..916b433 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -9,26 +9,41 @@
 
 
-
+
+
+
+
+
+
 
 
 https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [snowflake-mobile/master] Addex settings XML file

2020-07-10 Thread cohosh
commit 2b1c5272d125dc9edf1b6103dca28ae298a4100f
Author: Hashik Donthineni 
Date:   Sun Jun 28 13:57:27 2020 +0530

Addex settings XML file
---
 app/src/main/res/xml/app_settings.xml | 25 +
 1 file changed, 25 insertions(+)

diff --git a/app/src/main/res/xml/app_settings.xml 
b/app/src/main/res/xml/app_settings.xml
new file mode 100644
index 000..6685708
--- /dev/null
+++ b/app/src/main/res/xml/app_settings.xml
@@ -0,0 +1,25 @@
+
+http://schemas.android.com/apk/res/android;>
+
+
+
+
+
+
+
+
\ No newline at end of file



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


[tor-commits] [snowflake/master] Use STUN server compatable with RFC 5780 in proxy

2020-07-10 Thread cohosh
commit 8c875f0ba7775519b13118458d350dcae478af6a
Author: Cecylia Bocovich 
Date:   Thu Jul 9 09:55:41 2020 -0400

Use STUN server compatable with RFC 5780 in proxy
---
 proxy/snowflake.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxy/snowflake.go b/proxy/snowflake.go
index a1886c2..464fbb0 100644
--- a/proxy/snowflake.go
+++ b/proxy/snowflake.go
@@ -29,7 +29,7 @@ import (
 
 const defaultBrokerURL = "https://snowflake-broker.bamsoftware.com/;
 const defaultRelayURL = "wss://snowflake.bamsoftware.com/"
-const defaultSTUNURL = "stun:stun.l.google.com:19302"
+const defaultSTUNURL = "stun:stun.stunprotocol.org:3478"
 const pollInterval = 5 * time.Second
 const (
NATUnknown  = "unknown"

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


[tor-commits] [translation/whisperback_completed] https://gitweb.torproject.org/translation.git/commit/?h=whisperback_completed

2020-07-10 Thread translation
commit 996793150e6952b0f314fdf5d358024c0b229e8b
Author: Translation commit bot 
Date:   Fri Jul 10 09:48:18 2020 +


https://gitweb.torproject.org/translation.git/commit/?h=whisperback_completed
---
 hr/hr.po | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hr/hr.po b/hr/hr.po
index e9c59ae0b7..3eed498def 100644
--- a/hr/hr.po
+++ b/hr/hr.po
@@ -3,8 +3,8 @@
 # This file is distributed under the same license as the PACKAGE package.
 # 
 # Translators:
-# Milo Ivir , 2020
-# Milo Ivir , 2020
+# milotype , 2020
+# milotype , 2020
 # Nikola Parsifal , 2014
 # Vlado V. , 2015
 msgid ""
@@ -13,7 +13,7 @@ msgstr ""
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2019-04-29 12:08+0200\n"
 "PO-Revision-Date: 2020-04-10 13:45+\n"
-"Last-Translator: Milo Ivir \n"
+"Last-Translator: milotype \n"
 "Language-Team: Croatian 
(http://www.transifex.com/otf/torproject/language/hr/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"

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


[tor-commits] [translation/tor-and-https_completed] https://gitweb.torproject.org/translation.git/commit/?h=tor-and-https_completed

2020-07-10 Thread translation
commit 5db263f5764efbbd79270e7db8ad9c0b46166c72
Author: Translation commit bot 
Date:   Fri Jul 10 09:47:24 2020 +


https://gitweb.torproject.org/translation.git/commit/?h=tor-and-https_completed
---
 hr.po | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hr.po b/hr.po
index f8c99a4924..897738f2c1 100644
--- a/hr.po
+++ b/hr.po
@@ -1,14 +1,14 @@
 # 
 # Translators:
 # Igor , 2016
-# Milo Ivir , 2020
+# milotype , 2020
 # Vlado V. , 2015
 msgid ""
 msgstr ""
 "Project-Id-Version: Tor Project\n"
 "POT-Creation-Date: 2014-07-17 14:23+\n"
 "PO-Revision-Date: 2020-04-10 14:14+\n"
-"Last-Translator: Milo Ivir \n"
+"Last-Translator: milotype \n"
 "Language-Team: Croatian 
(http://www.transifex.com/otf/torproject/language/hr/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"

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


[tor-commits] [translation/torcheck_completed] https://gitweb.torproject.org/translation.git/commit/?h=torcheck_completed

2020-07-10 Thread translation
commit 7230d3e37a105730b41cf9363ce429a12560dc98
Author: Translation commit bot 
Date:   Fri Jul 10 09:47:58 2020 +

https://gitweb.torproject.org/translation.git/commit/?h=torcheck_completed
---
 hr/torcheck.po | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hr/torcheck.po b/hr/torcheck.po
index 1296453734..0271a02632 100644
--- a/hr/torcheck.po
+++ b/hr/torcheck.po
@@ -3,7 +3,7 @@
 # 
 # Translators:
 # cisterna, 2012
-# Milo Ivir , 2020
+# milotype , 2020
 # nvucinic , 2012
 # 0Ensó0 , 2015
 msgid ""
@@ -11,7 +11,7 @@ msgstr ""
 "Project-Id-Version: Tor Project\n"
 "POT-Creation-Date: 2012-02-16 20:28+PDT\n"
 "PO-Revision-Date: 2020-04-10 15:47+\n"
-"Last-Translator: Milo Ivir \n"
+"Last-Translator: milotype \n"
 "Language-Team: Croatian 
(http://www.transifex.com/otf/torproject/language/hr/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"

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


[tor-commits] [translation/tbmanual-contentspot] https://gitweb.torproject.org/translation.git/commit/?h=tbmanual-contentspot

2020-07-10 Thread translation
commit a945ecbae5d687fa5f495965a8c4d4acf3c94d4e
Author: Translation commit bot 
Date:   Fri Jul 10 09:47:11 2020 +

https://gitweb.torproject.org/translation.git/commit/?h=tbmanual-contentspot
---
 contents+hr.po | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contents+hr.po b/contents+hr.po
index 7916b36be3..983f9b60ca 100644
--- a/contents+hr.po
+++ b/contents+hr.po
@@ -3,7 +3,7 @@
 # erinm, 2019
 # Josip Domšić , 2019
 # Emma Peel, 2020
-# Milo Ivir , 2020
+# milotype , 2020
 # 
 msgid ""
 msgstr ""
@@ -11,7 +11,7 @@ msgstr ""
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2020-04-12 08:00+CET\n"
 "PO-Revision-Date: 2018-11-14 12:31+\n"
-"Last-Translator: Milo Ivir , 2020\n"
+"Last-Translator: milotype , 2020\n"
 "Language-Team: Croatian (https://www.transifex.com/otf/teams/1519/hr/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"

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


[tor-commits] [translation/tails-persistence-setup_completed] https://gitweb.torproject.org/translation.git/commit/?h=tails-persistence-setup_completed

2020-07-10 Thread translation
commit 0306dc47f4bb7e1ab7425bc46e3dce107fbdcf6c
Author: Translation commit bot 
Date:   Fri Jul 10 09:47:05 2020 +


https://gitweb.torproject.org/translation.git/commit/?h=tails-persistence-setup_completed
---
 hr/hr.po | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hr/hr.po b/hr/hr.po
index 0ca4a3b4c6..9f85065949 100644
--- a/hr/hr.po
+++ b/hr/hr.po
@@ -3,7 +3,7 @@
 # This file is distributed under the same license as the PACKAGE package.
 # 
 # Translators:
-# Milo Ivir , 2020
+# milotype , 2020
 # Vlado V. , 2015
 msgid ""
 msgstr ""
@@ -11,7 +11,7 @@ msgstr ""
 "Report-Msgid-Bugs-To: Tails developers \n"
 "POT-Creation-Date: 2019-10-21 09:06+0200\n"
 "PO-Revision-Date: 2020-04-09 21:53+\n"
-"Last-Translator: Milo Ivir \n"
+"Last-Translator: milotype \n"
 "Language-Team: Croatian 
(http://www.transifex.com/otf/torproject/language/hr/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"

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


[tor-commits] [translation/tails-iuk_completed] https://gitweb.torproject.org/translation.git/commit/?h=tails-iuk_completed

2020-07-10 Thread translation
commit 1f29d1c23c254243491677437a584b2f87ee0533
Author: Translation commit bot 
Date:   Fri Jul 10 09:46:42 2020 +

https://gitweb.torproject.org/translation.git/commit/?h=tails-iuk_completed
---
 hr.po | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hr.po b/hr.po
index 4d8f2a5f11..f4a7a05ea1 100644
--- a/hr.po
+++ b/hr.po
@@ -3,7 +3,7 @@
 # This file is distributed under the same license as the PACKAGE package.
 # 
 # Translators:
-# Milo Ivir , 2020
+# milotype , 2020
 # Nikola Parsifal , 2014
 # Vlado V. , 2015
 msgid ""
@@ -12,7 +12,7 @@ msgstr ""
 "Report-Msgid-Bugs-To: Tails developers \n"
 "POT-Creation-Date: 2019-11-28 16:51+0100\n"
 "PO-Revision-Date: 2020-04-10 13:29+\n"
-"Last-Translator: Milo Ivir \n"
+"Last-Translator: milotype \n"
 "Language-Team: Croatian 
(http://www.transifex.com/otf/torproject/language/hr/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"

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


[tor-commits] [translation/tbmanual-contentspot_completed] https://gitweb.torproject.org/translation.git/commit/?h=tbmanual-contentspot_completed

2020-07-10 Thread translation
commit b6d73ba6b7ddfed031b5356bbc7e8c88b9b6b172
Author: Translation commit bot 
Date:   Fri Jul 10 09:47:16 2020 +


https://gitweb.torproject.org/translation.git/commit/?h=tbmanual-contentspot_completed
---
 contents+hr.po | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contents+hr.po b/contents+hr.po
index 7916b36be3..983f9b60ca 100644
--- a/contents+hr.po
+++ b/contents+hr.po
@@ -3,7 +3,7 @@
 # erinm, 2019
 # Josip Domšić , 2019
 # Emma Peel, 2020
-# Milo Ivir , 2020
+# milotype , 2020
 # 
 msgid ""
 msgstr ""
@@ -11,7 +11,7 @@ msgstr ""
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2020-04-12 08:00+CET\n"
 "PO-Revision-Date: 2018-11-14 12:31+\n"
-"Last-Translator: Milo Ivir , 2020\n"
+"Last-Translator: milotype , 2020\n"
 "Language-Team: Croatian (https://www.transifex.com/otf/teams/1519/hr/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"

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


[tor-commits] [translation/tails-perl5lib_completed] https://gitweb.torproject.org/translation.git/commit/?h=tails-perl5lib_completed

2020-07-10 Thread translation
commit 52838295bacd49b9b60734b89987527c35938c1b
Author: Translation commit bot 
Date:   Fri Jul 10 09:46:49 2020 +


https://gitweb.torproject.org/translation.git/commit/?h=tails-perl5lib_completed
---
 hr.po | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hr.po b/hr.po
index 51bd9acdba..e0f7f41cfa 100644
--- a/hr.po
+++ b/hr.po
@@ -3,7 +3,7 @@
 # This file is distributed under the same license as the PACKAGE package.
 # 
 # Translators:
-# Milo Ivir , 2020
+# milotype , 2020
 # Nives Miletic , 2017
 msgid ""
 msgstr ""
@@ -11,7 +11,7 @@ msgstr ""
 "Report-Msgid-Bugs-To: Tails developers \n"
 "POT-Creation-Date: 2019-10-21 09:04+0200\n"
 "PO-Revision-Date: 2020-04-09 22:40+\n"
-"Last-Translator: Milo Ivir \n"
+"Last-Translator: milotype \n"
 "Language-Team: Croatian 
(http://www.transifex.com/otf/torproject/language/hr/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"

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


[tor-commits] [translation/tails-greeter-2_completed] https://gitweb.torproject.org/translation.git/commit/?h=tails-greeter-2_completed

2020-07-10 Thread translation
commit dfb4af366748953a343507c5388c34b0e1336246
Author: Translation commit bot 
Date:   Fri Jul 10 09:46:55 2020 +


https://gitweb.torproject.org/translation.git/commit/?h=tails-greeter-2_completed
---
 hr/hr.po | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hr/hr.po b/hr/hr.po
index 6ac9b8b243..3c03272536 100644
--- a/hr/hr.po
+++ b/hr/hr.po
@@ -7,7 +7,7 @@
 # Josip Domšić , 2018
 # Igor , 2018
 # erinm, 2019
-# Milo Ivir , 2020
+# milotype , 2020
 # 
 #, fuzzy
 msgid ""
@@ -16,7 +16,7 @@ msgstr ""
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2019-05-11 00:25+0200\n"
 "PO-Revision-Date: 2016-11-18 21:29+\n"
-"Last-Translator: Milo Ivir , 2020\n"
+"Last-Translator: milotype , 2020\n"
 "Language-Team: Croatian (https://www.transifex.com/otf/teams/1519/hr/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"

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


[tor-commits] [translation/tails-misc_release] https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_release

2020-07-10 Thread translation
commit 2ff9644c112fa59c1f5f4abe7eccb4aefafd438c
Author: Translation commit bot 
Date:   Fri Jul 10 09:46:36 2020 +

https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_release
---
 hr.po | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hr.po b/hr.po
index 7e494e0616..ccc5b1aa27 100644
--- a/hr.po
+++ b/hr.po
@@ -4,7 +4,7 @@
 # 
 # Translators:
 # Emma Peel, 2020
-# Milo Ivir , 2020
+# milotype , 2020
 # Vlado V. , 2015
 msgid ""
 msgstr ""
@@ -12,7 +12,7 @@ msgstr ""
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2020-06-19 19:37+0200\n"
 "PO-Revision-Date: 2020-07-08 12:09+\n"
-"Last-Translator: Milo Ivir \n"
+"Last-Translator: milotype \n"
 "Language-Team: Croatian 
(http://www.transifex.com/otf/torproject/language/hr/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"

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


[tor-commits] [translation/liveusb-creator_completed] https://gitweb.torproject.org/translation.git/commit/?h=liveusb-creator_completed

2020-07-10 Thread translation
commit f73cd1e0824aeba7ef146849467da93c58539930
Author: Translation commit bot 
Date:   Fri Jul 10 09:45:32 2020 +


https://gitweb.torproject.org/translation.git/commit/?h=liveusb-creator_completed
---
 hr/hr.po | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hr/hr.po b/hr/hr.po
index 2e61efde74..8f15aa6c9e 100644
--- a/hr/hr.po
+++ b/hr/hr.po
@@ -4,7 +4,7 @@
 # 
 # Translators:
 # Emma Peel, 2019
-# Milo Ivir , 2020
+# milotype , 2020
 # Niksa Makitan , 2018
 # Nives Miletic , 2018
 # Vlado V. , 2015
@@ -14,7 +14,7 @@ msgstr ""
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2019-10-21 09:03+0200\n"
 "PO-Revision-Date: 2020-04-09 22:33+\n"
-"Last-Translator: Milo Ivir \n"
+"Last-Translator: milotype \n"
 "Language-Team: Croatian 
(http://www.transifex.com/otf/torproject/language/hr/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"

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


[tor-commits] [translation/tails-misc_completed] https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_completed

2020-07-10 Thread translation
commit eef22296b27f59d38487f790c97a66db638f267d
Author: Translation commit bot 
Date:   Fri Jul 10 09:45:55 2020 +

https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_completed
---
 hr.po | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hr.po b/hr.po
index 7e494e0616..ccc5b1aa27 100644
--- a/hr.po
+++ b/hr.po
@@ -4,7 +4,7 @@
 # 
 # Translators:
 # Emma Peel, 2020
-# Milo Ivir , 2020
+# milotype , 2020
 # Vlado V. , 2015
 msgid ""
 msgstr ""
@@ -12,7 +12,7 @@ msgstr ""
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2020-06-19 19:37+0200\n"
 "PO-Revision-Date: 2020-07-08 12:09+\n"
-"Last-Translator: Milo Ivir \n"
+"Last-Translator: milotype \n"
 "Language-Team: Croatian 
(http://www.transifex.com/otf/torproject/language/hr/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"

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


[tor-commits] [translation/communitytpo-contentspot] https://gitweb.torproject.org/translation.git/commit/?h=communitytpo-contentspot

2020-07-10 Thread translation
commit 9da712499b0e5f958a4e155c8de1d7ad77edf5c4
Author: Translation commit bot 
Date:   Fri Jul 10 09:45:13 2020 +


https://gitweb.torproject.org/translation.git/commit/?h=communitytpo-contentspot
---
 contents+hr.po | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contents+hr.po b/contents+hr.po
index 3265da1587..161d903b0e 100644
--- a/contents+hr.po
+++ b/contents+hr.po
@@ -3,7 +3,7 @@
 # Karlo Prikratki , 2019
 # erinm, 2019
 # Emma Peel, 2019
-# Milo Ivir , 2020
+# milotype , 2020
 # 
 msgid ""
 msgstr ""
@@ -11,7 +11,7 @@ msgstr ""
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2019-12-11 12:15+CET\n"
 "PO-Revision-Date: 2019-12-11 10:50+\n"
-"Last-Translator: Milo Ivir , 2020\n"
+"Last-Translator: milotype , 2020\n"
 "Language-Team: Croatian (https://www.transifex.com/otf/teams/1519/hr/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"

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


[tor-commits] [translation/mat-gui_completed] https://gitweb.torproject.org/translation.git/commit/?h=mat-gui_completed

2020-07-10 Thread translation
commit 38c9656903c348f7e66caa4ae61595242e0f8f44
Author: Translation commit bot 
Date:   Fri Jul 10 09:45:41 2020 +

https://gitweb.torproject.org/translation.git/commit/?h=mat-gui_completed
---
 hr.po | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hr.po b/hr.po
index 07d9c94124..44201629c8 100644
--- a/hr.po
+++ b/hr.po
@@ -3,7 +3,7 @@
 # This file is distributed under the same license as the PACKAGE package.
 # 
 # Translators:
-# Milo Ivir , 2020
+# milotype , 2020
 # Vlado V. , 2015
 msgid ""
 msgstr ""
@@ -11,7 +11,7 @@ msgstr ""
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-02-10 23:06+0100\n"
 "PO-Revision-Date: 2020-04-10 13:15+\n"
-"Last-Translator: Milo Ivir \n"
+"Last-Translator: milotype \n"
 "Language-Team: Croatian 
(http://www.transifex.com/otf/torproject/language/hr/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"

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