[tor-commits] [nyx/master] IPv6 addresses caused connection panel sorting to error

atagar at torproject.org atagar at torproject.org
Fri Jul 15 17:33:39 UTC 2016


commit 19b60afb3c008102e5d9bb4c04b44e0267e1e916
Author: Damian Johnson <atagar at torproject.org>
Date:   Fri Jul 15 10:32:21 2016 -0700

    IPv6 addresses caused connection panel sorting to error
    
    Our connection panel converts addresses to integers to sort its lines. This
    assumed addresses were IPv4, causing a stacktrace if you had connections
    to/from any IPv6 addresses.
---
 nyx/panel/connection.py | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/nyx/panel/connection.py b/nyx/panel/connection.py
index cac6490..afcf457 100644
--- a/nyx/panel/connection.py
+++ b/nyx/panel/connection.py
@@ -135,13 +135,9 @@ class Entry(object):
     if attr == SortAttr.IP_ADDRESS:
       if self.is_private():
         return 255 ** 4  # orders at the end
-
-      ip_value = 0
-
-      for octet in line.connection.remote_address.split('.'):
-        ip_value = ip_value * 255 + int(octet)
-
-      return ip_value * 65536 + line.connection.remote_port
+      else:
+        address_int = connection.address_to_int(line.connection.remote_address)
+        return address_int * 65536 + line.connection.remote_port
     elif attr == SortAttr.PORT:
       return line.connection.remote_port
     elif attr == SortAttr.FINGERPRINT:



More information about the tor-commits mailing list