[tor-bugs] #7952 [Tor]: Control port method to get the exit policy

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Jan 14 04:11:10 UTC 2013


#7952: Control port method to get the exit policy
----------------------------+-----------------------------------------------
 Reporter:  atagar          |          Owner:                    
     Type:  enhancement     |         Status:  new               
 Priority:  normal          |      Milestone:  Tor: 0.2.4.x-final
Component:  Tor             |        Version:                    
 Keywords:  tor-relay easy  |         Parent:                    
   Points:                  |   Actualpoints:                    
----------------------------+-----------------------------------------------

Comment(by arma):

 Here's the code from router_dump_router_to_string() that generates the
 string:

 {{{
     int i;
     for (i = 0; i < smartlist_len(router->exit_policy); ++i) {
       addr_policy_t *tmpe = smartlist_get(router->exit_policy, i);
       if (tor_addr_family(&tmpe->addr) == AF_INET6)
         continue; /* Don't include IPv6 parts of address policy */
       result = policy_write_item(s+written, maxlen-written, tmpe, 1);
       if (result < 0) {
         log_warn(LD_BUG,"descriptor policy_write_item ran out of room!");
         return -1;
       }
       tor_assert(result == (int)strlen(s+written));
       written += result;
       if (written+2 > maxlen) {
         log_warn(LD_BUG,"descriptor policy_write_item ran out of room
 (2)!");
         return -1;
       }
       s[written++] = '\n';
     }
 }}}

 It would be smart to break that into its own function, so it can be called
 from that function and also from control.c.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/7952#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list