[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [nyx/master] Avoid double counting connections



commit 7a4d21bcc12648f5ed2521b20e96c9925c290427
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Fri Jan 11 10:39:52 2019 -0800

    Avoid double counting connections
    
    When a guard, bridge, or exit we scrub sensitive connection data but also
    aggregate it into graphs that present the client locales we're being used
    from or exit ports.
    
    In reviewing this for an old ticket [1] realized we're counting each
    connection made with us rather than unique clients or exit usage. As
    such, limiting our counts to one per a remote address.
    
    [1] https://trac.torproject.org/projects/tor/ticket/4281
---
 nyx/panel/connection.py  | 6 +++---
 web/changelog/index.html | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/nyx/panel/connection.py b/nyx/panel/connection.py
index f306278..167ad7b 100644
--- a/nyx/panel/connection.py
+++ b/nyx/panel/connection.py
@@ -104,7 +104,7 @@ class Entry(object):
     """
     Provides individual lines of connection information.
 
-    :returns: **list** of **ConnectionLine** concerning this entry
+    :returns: **list** of :class:`nyx.panel.connection.Line` concerning this entry
     """
 
     if self._lines is None:
@@ -534,13 +534,13 @@ class ConnectionPanel(nyx.panel.DaemonPanel):
       if self._halt:
         return
 
-      if entry.is_private() and line.connection not in self._counted_connections:
+      if entry.is_private() and line.connection.remote_address not in self._counted_connections:
         if entry.get_type() == Category.INBOUND and line.locale:
           self._client_locale_usage[line.locale] = self._client_locale_usage.get(line.locale, 0) + 1
         elif entry.get_type() == Category.EXIT:
           self._exit_port_usage[line.connection.remote_port] = self._exit_port_usage.get(line.connection.remote_port, 0) + 1
 
-        self._counted_connections.add(line.connection)
+        self._counted_connections.add(line.connection.remote_address)
 
     self._entries = sorted(new_entries, key = lambda entry: [entry.sort_value(attr) for attr in self._sort_order])
     self._last_resource_fetch = resolution_count
diff --git a/web/changelog/index.html b/web/changelog/index.html
index f5787e2..c0f823f 100644
--- a/web/changelog/index.html
+++ b/web/changelog/index.html
@@ -98,6 +98,7 @@
             <li>Geoip information unavailable for inbound connections</li>
             <li>Dialog showing exit statistics crashed when no data was available (<a href="https://trac.torproject.org/projects/tor/ticket/25801";>ticket</a>)</li>
             <li>More strictly scrub sensitive connection information (<a href="https://trac.torproject.org/projects/tor/ticket/27475";>ticket</a>)</li>
+            <li>Client and exit port usage dialogs counted each connection rather than unique clients and destinations (<a href="https://trac.torproject.org/projects/tor/ticket/4281";>ticket</a>)</li>
           </ul>
         </li>
 

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