[tor-commits] [nyx/master] Port of zero causes stacktrace

atagar at torproject.org atagar at torproject.org
Tue Sep 22 17:08:39 UTC 2015


commit d85d1561bee357eee7a84f8fdbd8c454db31a108
Author: Damian Johnson <atagar at torproject.org>
Date:   Mon Jul 6 10:01:41 2015 -0700

    Port of zero causes stacktrace
    
    Somehow an entry of '0.0.0.0:0' is among my outbound connections. Proper fix
    will be to figure out where that's coming from, but for now just making a quick
    hack so we don't error...
    
      File "/home/atagar/Desktop/nyx/nyx/connections/conn_entry.py", line 469, in get_type
        if is_exiting_allowed(controller, self.foreign.get_address(), self.foreign.get_port()):
      File "/home/atagar/Desktop/nyx/nyx/connections/conn_entry.py", line 1035, in is_exiting_allowed
        result = our_policy and our_policy.can_exit_to(ip_address, port)
      File "/home/atagar/Desktop/nyx/stem/util/lru_cache.py", line 135, in wrapper
        result = user_function(*args, **kwds)
      File "/home/atagar/Desktop/nyx/stem/exit_policy.py", line 286, in can_exit_to
        if rule.is_match(address, port, strict):
      File "/home/atagar/Desktop/nyx/stem/exit_policy.py", line 749, in is_match
        raise ValueError("'%s' isn't a valid port" % port)
      ValueError: '0' isn't a valid port
---
 nyx/connections/conn_entry.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nyx/connections/conn_entry.py b/nyx/connections/conn_entry.py
index 7d41a8a..562a4b4 100644
--- a/nyx/connections/conn_entry.py
+++ b/nyx/connections/conn_entry.py
@@ -466,7 +466,7 @@ class ConnectionLine(entries.ConnectionPanelLine):
         if destination_fingerprint == 'UNKNOWN':
           # Not a known relay. This might be an exit connection.
 
-          if is_exiting_allowed(controller, self.foreign.get_address(), self.foreign.get_port()):
+          if is_exiting_allowed(controller, self.foreign.get_address(), self.foreign.get_port() if self.foreign.get_port() else None):
             self.cached_type = Category.EXIT
         elif self._possible_client or self._possible_directory:
           # This belongs to a known relay. If we haven't eliminated ourselves as





More information about the tor-commits mailing list