[or-cvs] r22169: {arm} Few issues discovered while testing on freebsd. - fixed cras (in arm/trunk: interface util)

Damian Johnson atagar1 at gmail.com
Sun Apr 11 01:17:40 UTC 2010


Author: atagar
Date: 2010-04-11 01:17:40 +0000 (Sun, 11 Apr 2010)
New Revision: 22169

Modified:
   arm/trunk/interface/controller.py
   arm/trunk/util/connections.py
Log:
Few issues discovered while testing on freebsd.
- fixed crashing error when failing to find event types
- noted connection querying problems for freebsd
  - netstat lacks an equivilant for the -p flag, making it useless to arm
  - ss belongs to a spreadsheet program instead (this had me a bit speachless)



Modified: arm/trunk/interface/controller.py
===================================================================
--- arm/trunk/interface/controller.py	2010-04-10 12:48:07 UTC (rev 22168)
+++ arm/trunk/interface/controller.py	2010-04-11 01:17:40 UTC (rev 22169)
@@ -256,7 +256,7 @@
   
   return selection
 
-def setEventListening(loggedEvents, conn):
+def setEventListening(loggedEvents, conn, isBlindMode):
   """
   Tries to set events being listened for, displaying error for any event
   types that aren't supported (possibly due to version issues). This returns 
@@ -413,7 +413,7 @@
   conn.add_event_listener(sighupTracker)
   
   # tells Tor to listen to the events we're interested
-  loggedEvents = setEventListening(loggedEvents, conn)
+  loggedEvents = setEventListening(loggedEvents, conn, isBlindMode)
   panels["log"].loggedEvents = loggedEvents # strips any that couldn't be set
   
   # directs logged TorCtl events to log panel
@@ -770,7 +770,7 @@
         if eventsInput != "":
           try:
             expandedEvents = logPanel.expandEvents(eventsInput)
-            loggedEvents = setEventListening(expandedEvents, conn)
+            loggedEvents = setEventListening(expandedEvents, conn, isBlindMode)
             panels["log"].loggedEvents = loggedEvents
           except ValueError, exc:
             panels["control"].setMsg("Invalid flags: %s" % str(exc), curses.A_STANDOUT)

Modified: arm/trunk/util/connections.py
===================================================================
--- arm/trunk/util/connections.py	2010-04-10 12:48:07 UTC (rev 22168)
+++ arm/trunk/util/connections.py	2010-04-11 01:17:40 UTC (rev 22169)
@@ -6,7 +6,9 @@
 - ss        ss -p | grep "\"<process>\",<pid>"
 - lsof      lsof -nPi | grep "<process>\s*<pid>.*(ESTABLISHED)"
 
-all queries dump its stderr (directing it to /dev/null).
+all queries dump its stderr (directing it to /dev/null). Unfortunately FreeBSD
+lacks support for the needed netstat flags, and has a completely different
+program for 'ss', so this is quite likely to fail there.
 """
 
 import os
@@ -25,11 +27,14 @@
 # n = prevents dns lookups, p = include process, t = tcp only
 # output:
 # tcp  0  0  127.0.0.1:9051  127.0.0.1:53308  ESTABLISHED 9912/tor
+# *note: bsd uses a different variant ('-t' => '-p tcp', but worse an
+#   equivilant -p doesn't exist so this can't function)
 RUN_NETSTAT = "netstat -npt 2> /dev/null | grep %s/%s 2> /dev/null"
 
 # p = include process
 # output:
 # ESTAB  0  0  127.0.0.1:9051  127.0.0.1:53308  users:(("tor",9912,20))
+# *note: under freebsd this command belongs to a spreadsheet program
 RUN_SS = "ss -p 2> /dev/null | grep \"\\\"%s\\\",%s\" 2> /dev/null"
 
 # n = prevent dns lookups, P = show port numbers (not names), i = ip only



More information about the tor-commits mailing list