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

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Aug 29 19:32:11 UTC 2013


#7952: Control port method to get the exit policy
-----------------------------+------------------------------------------
     Reporter:  atagar       |      Owner:
         Type:  enhancement  |     Status:  needs_review
     Priority:  normal       |  Milestone:  Tor: 0.2.5.x-final
    Component:  Tor          |    Version:
   Resolution:               |   Keywords:  tor-relay easy small-feature
Actual Points:               |  Parent ID:
       Points:               |
-----------------------------+------------------------------------------

Comment (by nickm):

 Replying to [comment:10 cypherpunks]:
 > Can you provide a review of current practices regarding unit testing? It
 seems that Tor codebase does not rely on external frameworks/libraries for
 unit testing and has its own testing infrastructure.
 >
 > To implement unit test, do I need to create several instances of
 `routerinfo_t` structs, process them with
 `router_dump_exit_policy_to_string()` and use `tor_assert()` to see if I
 am getting the correct output? Should this code be placed in
 test/test_dir.c?

 That sounds about right.  But instead of using tor_assert, use tt_assert.
 The test framework we use is "tinytest", in src/ext/tinytest* ; the
 tinytest_demo.h file should explain how it works and give some idea of how
 to work with it.

 Creating a new test/test_policies.c might also be a good idea.  Also,
 there's no need to generate a full routerinfo_t here; filling in the
 policies structure should be enough.

 Let me know if

 > Regarding IPv6 exit policies, do we need to implement `GETINFO exit-
 policy/ipv6`? What if torrc define both IPv4 and IPv6 exit policy entries?
 Maybe we need to implement `GETINFO exit-policy/ipv4` to get IPv4-only
 entries as well. In that case, `GETINFO exit-policy` should return all
 (both IPv4 and IPv6) entries.

 Yes, this all sounds quite reasonable to me.

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


More information about the tor-bugs mailing list