[tor-dev] Named pipes with tor

carlo von lynX lynX at time.to.get.psyced.org
Mon Apr 14 09:32:14 UTC 2014

Hiya. Been around the tor dev community a bit, but
today is my first day on the legendary tor-dev
mailing list. I am asking if it makes sense to apply
a minor patch to Tor source, but first, the use case:

tor is very adamant at scrubbing the addresses that
are being connected to in the logs, but I have the
opposite wish case were I would like to have a
terminal show me the addresses my tor is connecting
to in real-time.

Could be that the "arm" app would be able to do that
without taking up the screen space that vidalia takes,
but for some irrelevant reasons I am not using that.

What I do is "Log [app]debug file /dev/shm/tor-log.txt",
then run "tail -f /dev/shm/tor-log.txt | grep asked" to
extract the "Client asked for <hostname>:<port>" lines,
so I even get to see DNS requests independently from
actual virtual circuits. I also have "SafeLogging" set

Needless to say, the RAM disk fills up quickly, so the
usefulness is limited. This is a case screaming for
unix named pipes as follows:

	mkfifo /dev/tor-log
	grep asked /dev/tor-log

But tor refuses to write to such a FIFO pipe because it
can't seek to the end of it.

Couldn't open file for 'Log /dev/tor-log': Illegal seek

./or/config.c calls ./common/log.c's add_file_log which
calls ./common/compat.c's tor_fd_seekend to make sure the
stuff is appended at the end of a log.

In the case of a FIFO pipe this returns an ESPIPE code which
currently makes tor throw up. In my understanding it should
be safe to ignore it, instead. We should expect the user to
know what she is doing if she puts a pipe where the log
should be. Or am I missing something?

There is also a similar case of calling tor_fd_seekend in
./common/util.c which suggests there may be other use cases
of mkfifo which are currently impeded by this.

So the question is, would it be okay to catch ESPIPE in
all cases, thus having it ignored in tor_fd_seekend,
or just catch it in add_file_log? Or is there a reason to
impede the use of unix named pipes under all circumstances?

Best sockets from Berlin, CvL.


More information about the tor-dev mailing list