[tor-bugs] #23900 [Core Tor/Tor]: Let programs call tor_main with a preconstructed control socket

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Nov 1 15:56:40 UTC 2017


#23900: Let programs call tor_main with a preconstructed control socket
-------------------------------------------------+-------------------------
 Reporter:  nickm                                |          Owner:  nickm
     Type:  enhancement                          |         Status:
                                                 |  merge_ready
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  0.3.3.x-final
Component:  Core Tor/Tor                         |        Version:
 Severity:  Normal                               |     Resolution:
 Keywords:  tor-mobile, review-group-24, s8-api  |  Actual Points:
Parent ID:  #23684                               |         Points:
 Reviewer:                                       |        Sponsor:
                                                 |  Sponsor8
-------------------------------------------------+-------------------------

Comment (by nickm):

 Replying to [comment:9 hellais]:
 > sbs and I looked at this.
 >
 > The torspec and tor diffs look good.
 >
 > One thing to be careful about though is that when the socket is closed
 (as per TAKEOWNERSHIP behavior), when you "shut down" Tor, you must not
 call `exit()`.
 > This may be differ from how `OwningControllerProcess` behaves.

 Right!  All of the exit handling is in a different ticket, #23848.

 > Moreover lack of windows support may be an issue for us (as that is also
 a target platform for Measurement Kit), but I guess for the time being we
 can avoid using this option there.

 So, this actually _will_ work on windows, but not from the command line.
 You have to construct a socketpair instead, and you can't pass those
 around between processes as fd's... but in-process, it will work fine.

 > Also as mentioned in
 https://trac.torproject.org/projects/tor/ticket/23845#comment:12, it would
 be useful to document that for non windows platforms it's recommended to
 set this option when constructing a `tor_main_configuration_t` to pass to
 `tor_run_main`.

 I'm waiting for the #23845 merge for that.  I think, as a followup, it
 would make sense to actually have a C API to set this up without having to
 use the command line.  Fortunately, tor_run_main() is extensible.

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


More information about the tor-bugs mailing list