[tor-dev] Event at NEXA center and next OONI dev meeting
Hello Oonitarians! We skipped this weeks meeting due to a lot of us being busy with an event at the NEXA center. It was a very interesting opportunity to meet a lot of great network measurement and network neutrality researchers and discuss possible areas of collaboration. I will give a brief summary of some of the most relevant things WRT OONI. # Libight hackfest On the first day we did a hackfest on libight. At the end of it we were able to produce a build of libight for iOS [1] as well as a mockup of the GUI [2]. We also finished the integration of the SOCKS client [3] that will allow us to use tor from libight. Overall we are quite close to having a working prototype for iOS and soon also for Android. # NNTools meeting Enrico Gregori and Valerio Luconi from Italian National Research Council presented their work on Portolan, that is trying to map BGP interconnections with traceroutes. They have developed a desktop and mobile application that is very cool and works well! Later we discussed about possible collaborations, in particular deploying their tests as part of our raspberry pi deployment. For the full schedule of events see: http://nexa.polito.it/nntools2015 Regarding the next developer meeting I am going to suggest we do it as usual on Monday at 19:00 CET (18:00 UTC). That's it, until next week! Have fun! ~ Arturo [1] https://github.com/alemela/libight_iOS [2] https://people.torproject.org/~art/ooni/mockups/ooni-ight-assets.zip [3] https://github.com/TheTorProject/libight/pull/71 ___ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev
Re: [tor-dev] Obfsproxy Address Translation
Hello, Sorry for the delay, I finnally set on the quest to understand obfsproxy. So with the help of pdb and a few questions here and there I got to some places, and with a lot of more questions to ask. ## Studying the client The client launches a connection on obfsproxy/pyofsproxypy do_external_mode() the launch_transport.launch_transport_listener method is where the socks listeners is set. Right after that the Twisted library reactor module is initiated with reactor.run() on line 107 of the file obfsproxy/pyobfsproxy.py After that the Twisted event loop is started and it will listen to events that are set on methods like listenTCP() the wiki page about servers[1] I've set a pdb.set_trace() on the buildProtocol() method in the file obfsproxy/network/socks.py and the backtrace looks like. (Pdb) bt /usr/lib/python2.7/runpy.py(162)_run_module_as_main() -> "__main__", fname, loader, pkg_name) /usr/lib/python2.7/runpy.py(72)_run_code() -> exec code in run_globals /usr/lib/python2.7/pdb.py(1338)() -> pdb.main() /usr/lib/python2.7/pdb.py(1314)main() -> pdb._runscript(mainpyfile) /usr/lib/python2.7/pdb.py(1233)_runscript() -> self.run(statement) /usr/lib/python2.7/bdb.py(400)run() -> exec cmd in globals, locals (1)() /home/masterkorp/Public/obfsproxy/bin/obfsproxy(16)() -> run() /home/masterkorp/Public/obfsproxy/obfsproxy/pyobfsproxy.py(207)run() -> pyobfsproxy() /home/masterkorp/Public/obfsproxy/obfsproxy/pyobfsproxy.py(189)pyobfsproxy() -> do_external_mode(args) /home/masterkorp/Public/obfsproxy/obfsproxy/pyobfsproxy.py(108)do_external_mode() -> reactor.run() /usr/lib/python2.7/site-packages/twisted/internet/base.py(1192)run() -> self.mainLoop() /usr/lib/python2.7/site-packages/twisted/internet/base.py(1204)mainLoop() -> self.doIteration(t) /usr/lib/python2.7/site-packages/twisted/internet/epollreactor.py(396)doPoll() -> log.callWithLogger(selectable, _drdw, selectable, fd, event) /usr/lib/python2.7/site-packages/twisted/python/log.py(88)callWithLogger() -> return callWithContext({"system": lp}, func, *args, **kw) /usr/lib/python2.7/site-packages/twisted/python/log.py(73)callWithContext() -> return context.call({ILogContext: newCtx}, func, *args, **kw) /usr/lib/python2.7/site-packages/twisted/python/context.py(118)callWithContext() -> return self.currentContext().callWithContext(ctx, func, *args, **kw) /usr/lib/python2.7/site-packages/twisted/python/context.py(81)callWithContext() -> return func(*args,**kw) /usr/lib/python2.7/site-packages/twisted/internet/posixbase.py(614)_doReadOrWrite() -> why = selectable.doRead() /usr/lib/python2.7/site-packages/twisted/internet/tcp.py(1062)doRead() -> protocol = self.factory.buildProtocol(self._buildAddr(addr)) /home/masterkorp/Public/obfsproxy/obfsproxy/network/socks.py(183)buildProtocol() -> circuit = network.Circuit(self.transport_class()) It goes directly to this method from Twistedm, which confirms that all the SOCKS is set. This creates a new Circuit. And the like the documentation says a Circuit is a pair of connections between and the obfsproxy client and openvpn client (in this case) or obfsproxy server and OpenVPN server. Then I set a pdb.set_trace() dataReceived() on obfsproxy/network/network.py well because of the name. And a backtrace looks like: (Pdb) bt /usr/lib/python2.7/runpy.py(162)_run_module_as_main() -> "__main__", fname, loader, pkg_name) /usr/lib/python2.7/runpy.py(72)_run_code() -> exec code in run_globals /usr/lib/python2.7/pdb.py(1338)() -> pdb.main() /usr/lib/python2.7/pdb.py(1314)main() -> pdb._runscript(mainpyfile) /usr/lib/python2.7/pdb.py(1233)_runscript() -> self.run(statement) /usr/lib/python2.7/bdb.py(400)run() -> exec cmd in globals, locals (1)() /home/masterkorp/Public/obfsproxy/bin/obfsproxy(3)() -> import sys, os /home/masterkorp/Public/obfsproxy/obfsproxy/pyobfsproxy.py(205)run() -> pyobfsproxy() /home/masterkorp/Public/obfsproxy/obfsproxy/pyobfsproxy.py(187)pyobfsproxy() -> do_external_mode(args) /home/masterkorp/Public/obfsproxy/obfsproxy/pyobfsproxy.py(106)do_external_mode() -> reactor.run() /usr/lib/python2.7/site-packages/twisted/internet/base.py(1192)run() -> self.mainLoop() /usr/lib/python2.7/site-packages/twisted/internet/base.py(1204)mainLoop() -> self.doIteration(t) /usr/lib/python2.7/site-packages/twisted/internet/epollreactor.py(396)doPoll() -> log.callWithLogger(selectable, _drdw, selectable,fd, event) /usr/lib/python2.7/site-packages/twisted/python/log.py(88)callWithLogger() -> return callWithContext({"system": lp}, func,*args, **kw) /usr/lib/python2.7/site-packages/twisted/python/log.py(73)callWithContext() -> return context.call({ILogContext: newCtx},func, *args, **kw) /usr/lib/python2.7/site-packages/twisted/python/context.py(118)callWithContext() -> return self.currentContext().callWithContext(ctx,func, *args, **kw) /usr/lib/python2.7/site-packages/twisted/python/context.py(81)callWithContext() -> return func(*args,**
[tor-dev] [PATCH] Fix clang warning in test code
There are still 5 reports from clang analyzer. They are either false positives or (in the test code) 'easy-to-read' programming by purpose (easy to get rid of, but absolutely no need to do). Tim From 5e8bd25a38ffb4b72ab85b6c855720bd9e35ec04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim Rühsen?= Date: Fri, 23 Jan 2015 11:01:42 +0100 Subject: [PATCH] Fix clang report: Result of operation is garbage or undefined --- tests/test_fd_passing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_fd_passing.c b/tests/test_fd_passing.c index f4950bd..b4786b8 100644 --- a/tests/test_fd_passing.c +++ b/tests/test_fd_passing.c @@ -387,7 +387,7 @@ error: static void *thread_send(void *data) { - int sock, fds[3], pipe_fds[2]; + int sock, fds[3], pipe_fds[2] = { -1, -1 }; ssize_t len; sock = connect_unix_sock(sockpath); -- 2.1.4 signature.asc Description: This is a digitally signed message part. ___ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev
[tor-dev] [PATCH] Fix some compiler warnings (torsocks)
I fixed some compiler warnings that came up with my standard gcc flags, nothing serious. BTW, the code uses some gcc extensions which are not compatible through compilers and/or systems: - pointer arithmetic with void * - function pointer and void * assignments - gcc variadic macro extensions FYI, my gcc flags are -std=gnu99 -pedantic -O2 -g -Wall -Wextra -Wstrict-prototypes -Wold-style- definition -Wwrite-strings -Wshadow -Wformat -Wformat-security -Wunreachable- code -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition - Wlogical-op -Wsuggest-attribute=noreturn -Wsuggest-attribute=format - D_FORTIFY_SOURCE=2 Regards, Tim From f0caa430619c4b39184e5e3c5057f4f79f0d2f78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim Rühsen?= Date: Fri, 23 Jan 2015 10:31:33 +0100 Subject: [PATCH] Fix some compiler warnings --- src/common/connection.c | 4 ++-- src/common/connection.h | 2 +- src/common/log.h| 2 +- src/common/onion.c | 6 +++--- src/lib/recv.c | 5 +++-- src/lib/torsocks.h | 2 +- tests/test_fd_passing.c | 4 ++-- tests/utils/tap/tap.c | 12 ++-- tests/utils/tap/tap.h | 8 9 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/common/connection.c b/src/common/connection.c index 4c75579..0a75241 100644 --- a/src/common/connection.c +++ b/src/common/connection.c @@ -84,9 +84,9 @@ static inline unsigned int conn_hash_fct(struct connection *c) */ static HT_HEAD(connection_registry, connection) connection_registry_root; HT_PROTOTYPE(connection_registry, connection, node, conn_hash_fct, - conn_equal_fct); + conn_equal_fct) HT_GENERATE(connection_registry, connection, node, conn_hash_fct, - conn_equal_fct, 0.5, malloc, realloc, free); + conn_equal_fct, 0.5, malloc, realloc, free) /* * Acquire connection registry mutex. diff --git a/src/common/connection.h b/src/common/connection.h index 379f158..8db253e 100644 --- a/src/common/connection.h +++ b/src/common/connection.h @@ -30,7 +30,7 @@ enum connection_domain { CONNECTION_DOMAIN_INET = 1, CONNECTION_DOMAIN_INET6 = 2, - CONNECTION_DOMAIN_NAME = 3, + CONNECTION_DOMAIN_NAME = 3 }; /* diff --git a/src/common/log.h b/src/common/log.h index 0423aee..92eb659 100644 --- a/src/common/log.h +++ b/src/common/log.h @@ -43,7 +43,7 @@ */ enum log_time_status { LOG_TIME_NONE = 0, - LOG_TIME_ADD = 1, + LOG_TIME_ADD = 1 }; extern int tsocks_loglevel; diff --git a/src/common/onion.c b/src/common/onion.c index 67b4297..73d17c6 100644 --- a/src/common/onion.c +++ b/src/common/onion.c @@ -141,7 +141,7 @@ error: ATTR_HIDDEN void onion_pool_destroy(struct onion_pool *pool) { - int i; + unsigned i; assert(pool); @@ -220,7 +220,7 @@ ATTR_HIDDEN struct onion_entry *onion_entry_find_by_name(const char *onion_name, struct onion_pool *pool) { - int i; + unsigned i; struct onion_entry *entry = NULL; assert(onion_name); @@ -251,7 +251,7 @@ ATTR_HIDDEN struct onion_entry *onion_entry_find_by_addr(const struct sockaddr *sa, struct onion_pool *pool) { - int i; + unsigned i; struct onion_entry *entry = NULL; const struct sockaddr_in *sin; diff --git a/src/lib/recv.c b/src/lib/recv.c index 6e8a20a..972a884 100644 --- a/src/lib/recv.c +++ b/src/lib/recv.c @@ -39,7 +39,7 @@ TSOCKS_LIBC_DECL(recvmsg, LIBC_RECVMSG_RET_TYPE, LIBC_RECVMSG_SIG) */ static void close_fds(int *fds, size_t count) { - int i; + unsigned i; for (i = 0; i < count; i++) { tsocks_libc_close(fds[i]); @@ -125,7 +125,8 @@ LIBC_RECVMSG_RET_TYPE tsocks_recvmsg(LIBC_RECVMSG_SIG) * stack memory. */ size_t sizeof_fds = (cmsg->cmsg_len - sizeof(*cmsg)) / sizeof(int); - int i, fds[sizeof_fds]; + int fds[sizeof_fds]; + unsigned i; memcpy(&fds, CMSG_DATA(cmsg), sizeof(fds)); diff --git a/src/lib/torsocks.h b/src/lib/torsocks.h index 3b9cda2..c30efb2 100644 --- a/src/lib/torsocks.h +++ b/src/lib/torsocks.h @@ -405,7 +405,7 @@ TSOCKS_DECL(listen, LIBC_LISTEN_RET_TYPE, LIBC_LISTEN_SIG) */ enum tsocks_sym_action { TSOCKS_SYM_DO_NOTHING = 0, - TSOCKS_SYM_EXIT_NOT_FOUND = 1, + TSOCKS_SYM_EXIT_NOT_FOUND = 1 }; /* Global configuration. Initialized once in the library constructor. */ diff --git a/tests/test_fd_passing.c b/tests/test_fd_passing.c index 1803126..f4950bd 100644 --- a/tests/test_fd_passing.c +++ b/tests/test_fd_passing.c @@ -324,7 +324,7 @@ static int accept_unix_sock(int sock) return new_fd; } -void *thread_recv(void *data) +static void *thread_recv(void *data) { int ret, new_sock, sock, fds[3] = {-1, -1, -1}; char buf[4]; @@ -385,7 +385,7 @@ error: return NULL; } -void *thread_send(void *data) +static void *thread_send(void *data) { int sock, fds[3], pipe_fds[2]; ssize_t len; diff --git a/tests/utils/tap/tap.c b/tests/utils/tap/tap.c index d52cb03..a785295 100644 --- a/tests/utils/tap/tap.c +++ b/tests/utils/tap/tap.c @@ -39,7 +39,7 @@ static unsigned int test_count = 0; /* Number of tests that have been run */ static unsigned int e_tests = 0;