[or-cvs] r17245: {tor} Add PURPOSE= field to getinfo circuit-status. With luck, con (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Tue Nov 11 15:59:26 UTC 2008


Author: nickm
Date: 2008-11-11 10:59:24 -0500 (Tue, 11 Nov 2008)
New Revision: 17245

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/or/control.c
Log:
Add PURPOSE= field to getinfo circuit-status.  With luck, controllers are ignoring extra fields (like they are supposed to) and this will not break any controllers.

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2008-11-11 15:29:40 UTC (rev 17244)
+++ tor/trunk/ChangeLog	2008-11-11 15:59:24 UTC (rev 17245)
@@ -3,6 +3,9 @@
     - Get file locking working on win32.  Bugfix on 0.2.1.6-alpha.  Fixes
       bug 859.
 
+  o Minor features (controller):
+    - Return circuit purposes in response to GETINFO circuit-status.  Fixes
+      bug 858.
 
 Changes in version 0.2.1.7-alpha - 2008-11-08
   o Security fixes:

Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c	2008-11-11 15:29:40 UTC (rev 17244)
+++ tor/trunk/src/or/control.c	2008-11-11 15:59:24 UTC (rev 17245)
@@ -1631,6 +1631,7 @@
       char *s, *path;
       size_t slen;
       const char *state;
+      const char *purpose;
       if (! CIRCUIT_IS_ORIGIN(circ) || circ->marked_for_close)
         continue;
       if (control_conn->use_long_names)
@@ -1644,11 +1645,12 @@
       else
         state = "LAUNCHED";
 
-      slen = strlen(path)+strlen(state)+20;
+      purpose = circuit_purpose_to_controller_string(circ->purpose);
+      slen = strlen(path)+strlen(state)+strlen(purpose)+30;
       s = tor_malloc(slen+1);
-      tor_snprintf(s, slen, "%lu %s%s%s",
+      tor_snprintf(s, slen, "%lu %s%s%s PURPOSE=%s",
                    (unsigned long)TO_ORIGIN_CIRCUIT(circ)->global_identifier,
-                   state, *path ? " " : "", path);
+                   state, *path ? " " : "", path, purpose);
       smartlist_add(status, s);
       tor_free(path);
     }



More information about the tor-commits mailing list