diff options
42 files changed, 744 insertions, 2498 deletions
diff --git a/Win32Build/mingw/CHANGES-libevent b/Win32Build/mingw/CHANGES-libevent deleted file mode 100644 index e723d9755f..0000000000 --- a/Win32Build/mingw/CHANGES-libevent +++ /dev/null @@ -1,80 +0,0 @@ -Changes related to compilation under MinGW/any sane win32 gcc -============================================================= - -* event.c -- If gcc include "WIN32-Code/misc.h" instead of "misc.h" - -* WIN32-Code/misc.h -- Add struct prototypes for timeval and timezone - -* buffer.c -- changed type of "i" from "u_int" to "unsigned int". My MinGW wasn't - recognizing it. (u_int is normally typedef'ed to unsigned int, right?) - -* evbuffer.c -- removed incorrect win32 error checking, see bufferevent_writecb(). - (this needs to be fixed by anyone planning to use evbuffer on win32) - -* log.c -- If gcc include "WIN32-Code/misc.h" instead of "misc.h" - -* WIN32-Code/misc.c -- if gcc, include "misc.h" -- added newline at end of file to shut up gcc - -* WIN32-Code/win32.c -- Altered the prototypes of win32_*() so their argument types didn't conflict - with the function definitions. -- Casted types of win32_* to void inside win32ops so that it didn't conflict - with the definition of eventops (gcc doesn't like this) -- Altered prototype of signal_handler to be static since definition is static - (why wasn't it like this before) -- Casted the second argument of signal() to be void*, some reason my MinGW - doesn't have sighandler_t typedef'ed. - -* configure.in -- some code to check if we are compiling for WIN32. - -* Makefile.am -- if BUILD_WIN32 is defined, include WIN32-Code/misc.c and - WIN32-Code/win32.c as source files. -- if WIN32, do not build test stuff. (not windows friendly) -- if WIN32, explicitly link to ws2_32.dll - -Notes ------ -- We assume that if __GNUC__ is undefined we are building with MSVC -- If the user wishes to build a dll, they are on their own, the syntax is - compiler specific. -- Getting this warning from libtool, no idea why - "libtool: link: warning: undefined symbols not allowed in i686-pc-mingw32 - shared libraries" - - -Changes related to "custom eventops" -==================================== - -* configure.in -- add argument --enable-custom-eventops, sets USE_CUSTOM_EVENTOPS in config.h -- add argument --enable-custom-code, sets USE_CUSTOM_CODE in Makefile - -* Makefile.am -- if USE_CUSTOM_CODE, include custom/custom.c as a source file. - (I can't think of a way to pass a string to Makefile.am, so I'm stuck naming - the new source file custom.c. It just seems simpler this way, but I'm open - to suggestions) - -* event.c -- if USE_CUSTOM_EVENTOPS, use eventops as defined in custom-eventops.h - -Notes ------ -Just in case it isn't completely obvious, the goal of "custom eventops" is to -allow the user to include their own event processing system without requiring a -fork. This is accomplished through two parts. Firstly, by allowing the user to -redefine eventops. (for example, the user may wish to use epoll() exclusively). -Secondly, by allowing the user to include their own code to support a private -eventop (note, this may not be necessary, as the user may choose to include -already defined eventop's. - - diff --git a/Win32Build/mingw/README b/Win32Build/mingw/README deleted file mode 100644 index 67e75cd27e..0000000000 --- a/Win32Build/mingw/README +++ /dev/null @@ -1,8 +0,0 @@ -The current SVN version of Tor should compile with MinGW. - -OpenSSL and libz both compile on MinGW out of the box. - -libevent 1.1b will not build unless you apply the diff in this directory. - - - diff --git a/Win32Build/mingw/libevent-1.1b-mingw-custom.diff b/Win32Build/mingw/libevent-1.1b-mingw-custom.diff deleted file mode 100644 index 350586e35f..0000000000 --- a/Win32Build/mingw/libevent-1.1b-mingw-custom.diff +++ /dev/null @@ -1,338 +0,0 @@ -Only in libevent-1.1b: CHANGES -Only in libevent-1.1b: Makefile -diff -uwr libevent-1.1b-old/Makefile.am libevent-1.1b/Makefile.am ---- libevent-1.1b-old/Makefile.am Wed Aug 9 22:16:35 2006 -+++ libevent-1.1b/Makefile.am Sat Sep 2 03:49:26 2006 -@@ -1,6 +1,5 @@ - AUTOMAKE_OPTIONS = foreign no-dependencies - --SUBDIRS = . sample test - - EXTRA_DIST = acconfig.h event.h event-internal.h log.h evsignal.h event.3 \ - kqueue.c epoll_sub.c epoll.c select.c rtsig.c poll.c signal.c \ -@@ -20,8 +19,29 @@ - - lib_LTLIBRARIES = libevent.la - --libevent_la_SOURCES = event.c buffer.c evbuffer.c log.c --libevent_la_LIBADD = @LTLIBOBJS@ -+ -+if BUILD_WIN32 -+ -+SUBDIRS = . sample -+SYS_LIBS = -lws2_32 -+SYS_SRC = WIN32-Code/misc.c WIN32-Code/win32.c -+ -+else -+ -+SUBDIRS = . sample test -+SYS_LIBS = -+SYS_SRC = -+ -+endif -+ -+if USE_CUSTOM_CODE -+CUST_SRC = custom/custom.c -+else -+CUST_SRC = -+endif -+ -+libevent_la_SOURCES = event.c buffer.c evbuffer.c log.c $(CUST_SRC) $(SYS_SRC) -+libevent_la_LIBADD = @LTLIBOBJS@ $(SYS_LIBS) - libevent_la_LDFLAGS = -release @VERSION@ -version-info 1:2:0 - - include_HEADERS = event.h -Only in libevent-1.1b: Makefile.in -diff -uwr libevent-1.1b-old/WIN32-Code/misc.c libevent-1.1b/WIN32-Code/misc.c ---- libevent-1.1b-old/WIN32-Code/misc.c Wed Aug 9 21:01:14 2006 -+++ libevent-1.1b/WIN32-Code/misc.c Fri Sep 1 22:21:31 2006 -@@ -4,6 +4,12 @@ - #include <sys/timeb.h> - #include <time.h> - -+#ifdef __GNUC__ -+/*our prototypes for timeval and timezone are in here, just in case the above -+ headers don't have them*/ -+#include "misc.h" -+#endif -+ - /**************************************************************************** - * - * Function: gettimeofday(struct timeval *, struct timezone *) -diff -uwr libevent-1.1b-old/WIN32-Code/misc.h libevent-1.1b/WIN32-Code/misc.h ---- libevent-1.1b-old/WIN32-Code/misc.h Wed Aug 9 21:01:14 2006 -+++ libevent-1.1b/WIN32-Code/misc.h Fri Sep 1 18:47:09 2006 -@@ -1,6 +1,9 @@ - #ifndef MISC_H - #define MISC_H - -+struct timezone; -+struct timeval; -+ - int gettimeofday(struct timeval *,struct timezone *); - - #endif -diff -uwr libevent-1.1b-old/WIN32-Code/win32.c libevent-1.1b/WIN32-Code/win32.c ---- libevent-1.1b-old/WIN32-Code/win32.c Wed Aug 9 21:25:48 2006 -+++ libevent-1.1b/WIN32-Code/win32.c Sat Sep 2 00:45:55 2006 -@@ -60,7 +60,8 @@ - /* MSDN says this is required to handle SIGFPE */ - volatile double SIGFPE_REQ = 0.0f; - --int signal_handler(int sig); -+static int signal_handler(int sig); -+ - void signal_process(void); - int signal_recalc(void); - -@@ -77,20 +78,21 @@ - }; - - void *win32_init (void); --int win32_insert (void *, struct event *); --int win32_del (void *, struct event *); -+int win32_insert (struct win32op *, struct event *); -+int win32_del (struct win32op *, struct event *); - int win32_recalc (struct event_base *base, void *, int); --int win32_dispatch (struct event_base *base, void *, struct timeval *); -+int win32_dispatch (struct event_base *base, struct win32op *, struct timeval *); - - struct eventop win32ops = { - "win32", - win32_init, -- win32_insert, -- win32_del, -+ (int (*) (void*, struct event*)) win32_insert, -+ (int (*) (void*, struct event*)) win32_del, - win32_recalc, -- win32_dispatch -+ (int (*) (struct event_base*, void*, struct timeval*)) win32_dispatch - }; - -+ - #define FD_SET_ALLOC_SIZE(n) ((sizeof(struct win_fd_set) + ((n)-1)*sizeof(SOCKET))) - - static int -@@ -213,7 +215,13 @@ - if (ev->ev_events & (EV_READ|EV_WRITE)) - event_errx(1, "%s: EV_SIGNAL incompatible use", - __func__); -+ -+#ifndef __GNUC__ - if((int)signal(EVENT_SIGNAL(ev), signal_handler) == -1) -+#else -+ if((int)signal(EVENT_SIGNAL(ev), (void*) signal_handler) == -1) -+#endif -+ - return (-1); - - return (0); -@@ -382,8 +390,13 @@ - - /* Reinstall our signal handler. */ - TAILQ_FOREACH(ev, &signalqueue, ev_signal_next) { -+#ifndef __GNUC__ - if((int)signal(EVENT_SIGNAL(ev), signal_handler) == -1) -+#else -+ if((int)signal(EVENT_SIGNAL(ev), (void*) signal_handler) == -1) -+#endif - return (-1); -+ - } - return (0); - } -Only in libevent-1.1b-old/: aclocal.m4 -Only in libevent-1.1b: autom4te.cache -diff -uwr libevent-1.1b-old/buffer.c libevent-1.1b/buffer.c ---- libevent-1.1b-old/buffer.c Wed Aug 9 22:01:40 2006 -+++ libevent-1.1b/buffer.c Fri Sep 1 18:52:56 2006 -@@ -197,7 +197,7 @@ - u_char *data = EVBUFFER_DATA(buffer); - size_t len = EVBUFFER_LENGTH(buffer); - char *line; -- u_int i; -+ unsigned int i; - - for (i = 0; i < len; i++) { - if (data[i] == '\r' || data[i] == '\n') -Only in libevent-1.1b: config.guess -Only in libevent-1.1b: config.h -diff -uwr libevent-1.1b-old/config.h.in libevent-1.1b/config.h.in ---- libevent-1.1b-old/config.h.in Wed Aug 9 21:27:37 2006 -+++ libevent-1.1b/config.h.in Sat Sep 2 02:23:17 2006 -@@ -223,6 +223,9 @@ - /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ - #undef TIME_WITH_SYS_TIME - -+/* Define to 1 if you want to use a custom eventops variable */ -+#undef USE_CUSTOM_EVENTOPS -+ - /* Version number of package */ - #undef VERSION - -@@ -232,11 +235,9 @@ - /* Define to empty if `const' does not conform to ANSI C. */ - #undef const - --/* Define to `__inline__' or `__inline' if that's what the C compiler -- calls it, or to nothing if 'inline' is not supported under any name. */ --#ifndef __cplusplus -+/* Define as `__inline' if that's what the C compiler calls it, or to nothing -+ if it is not supported. */ - #undef inline --#endif - - /* Define to `int' if <sys/types.h> does not define. */ - #undef pid_t -Only in libevent-1.1b: config.h.in~ -Only in libevent-1.1b: config.log -Only in libevent-1.1b: config.status -Only in libevent-1.1b: configure -diff -uwr libevent-1.1b-old/configure.in libevent-1.1b/configure.in ---- libevent-1.1b-old/configure.in Wed Aug 9 22:05:17 2006 -+++ libevent-1.1b/configure.in Sat Sep 2 03:40:15 2006 -@@ -21,6 +21,18 @@ - CFLAGS="$CFLAGS -Wall" - fi - -+AC_ARG_ENABLE(custom-eventops, -+ [ --enable-custom-eventops Use custom eventops variable], -+ AC_DEFINE([USE_CUSTOM_EVENTOPS],[1], -+ [Define to 1 to use a custom eventops variable]) -+ ,) -+AC_ARG_ENABLE(custom-code, -+ [ --enable-custom-code Use custom code from custom/], -+ customcodev=true, -+ customcodev=false) -+ -+AM_CONDITIONAL(USE_CUSTOM_CODE, test x$customcodev = xtrue) -+ - AC_PROG_LIBTOOL - - dnl Uncomment "AC_DISABLE_SHARED" to make shared librraries not get -@@ -110,6 +122,22 @@ - AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no) - ) - fi -+ -+dnl - check if the macro WIN32 is defined on this compiler. -+dnl - (this is how we check for a windows version of GCC) -+AC_MSG_CHECKING(for WIN32) -+AC_TRY_COMPILE(, -+ [ -+ #ifndef WIN32 -+ #error -+ #endif -+ ], -+ bwin32=true; AC_MSG_RESULT(yes), -+ bwin32=false; AC_MSG_RESULT(no), -+) -+ -+AM_CONDITIONAL(BUILD_WIN32, test x$bwin32 = xtrue) -+ - - dnl Checks for typedefs, structures, and compiler characteristics. - AC_C_CONST -diff -uwr libevent-1.1b-old/evbuffer.c libevent-1.1b/evbuffer.c ---- libevent-1.1b-old/evbuffer.c Wed Aug 9 21:01:14 2006 -+++ libevent-1.1b/evbuffer.c Fri Sep 1 19:18:13 2006 -@@ -154,12 +154,20 @@ - if (EVBUFFER_LENGTH(bufev->output)) { - res = evbuffer_write(bufev->output, fd); - if (res == -1) { -+#ifndef WIN32 -+/*todo. evbuffer uses WriteFile when WIN32 is set. WIN32 system calls do not -+ *set errno. thus this error checking is not portable*/ - if (errno == EAGAIN || - errno == EINTR || - errno == EINPROGRESS) - goto reschedule; - /* error case */ - what |= EVBUFFER_ERROR; -+ -+#else -+ goto reschedule; -+#endif -+ - } else if (res == 0) { - /* eof case */ - what |= EVBUFFER_EOF; -@@ -181,6 +189,7 @@ - return; - - reschedule: -+ - if (EVBUFFER_LENGTH(bufev->output) != 0) - bufferevent_add(&bufev->ev_write, bufev->timeout_write); - return; -diff -uwr libevent-1.1b-old/event.c libevent-1.1b/event.c ---- libevent-1.1b-old/event.c Wed Aug 9 21:25:48 2006 -+++ libevent-1.1b/event.c Sat Sep 2 04:22:05 2006 -@@ -30,8 +30,14 @@ - #define WIN32_LEAN_AND_MEAN - #include <windows.h> - #undef WIN32_LEAN_AND_MEAN -+ -+#ifdef __GNUC__ -+#include "WIN32-Code/misc.h" -+#else - #include "misc.h" - #endif -+ -+#endif - #include <sys/types.h> - #include <sys/tree.h> - #ifdef HAVE_SYS_TIME_H -@@ -53,6 +59,7 @@ - #include "event-internal.h" - #include "log.h" - -+ - #ifdef HAVE_SELECT - extern const struct eventop selectops; - #endif -@@ -75,6 +82,8 @@ - extern const struct eventop win32ops; - #endif - -+#ifndef USE_CUSTOM_EVENTOPS -+ - /* In order of preference */ - const struct eventop *eventops[] = { - #ifdef HAVE_WORKING_KQUEUE -@@ -101,6 +110,11 @@ - NULL - }; - -+#else -+#include "custom-eventops.h" -+#endif //USE_CUSTOM_EVENTOPS -+ -+ - /* Global state */ - struct event_list signalqueue; - -Only in libevent-1.1b: libtool -diff -uwr libevent-1.1b-old/log.c libevent-1.1b/log.c ---- libevent-1.1b-old/log.c Wed Aug 9 21:01:14 2006 -+++ libevent-1.1b/log.c Fri Sep 1 19:09:45 2006 -@@ -45,8 +45,14 @@ - #define WIN32_LEAN_AND_MEAN - #include <windows.h> - #undef WIN32_LEAN_AND_MEAN -+ -+#ifdef __GNUC__ -+#include "WIN32-Code/misc.h" -+#else - #include "misc.h" - #endif -+ -+#endif - #include <sys/types.h> - #include <sys/tree.h> - #ifdef HAVE_SYS_TIME_H -Only in libevent-1.1b/sample: Makefile -Only in libevent-1.1b/sample: Makefile.in -Only in libevent-1.1b: stamp-h1 -Only in libevent-1.1b/test: Makefile -Only in libevent-1.1b/test: Makefile.in diff --git a/Win32Build/mingw/libevent-1.1b-mingw.diff b/Win32Build/mingw/libevent-1.1b-mingw.diff deleted file mode 100644 index c7cea5b326..0000000000 --- a/Win32Build/mingw/libevent-1.1b-mingw.diff +++ /dev/null @@ -1,221 +0,0 @@ -=== Makefile.am -================================================================== ---- Makefile.am (revision 8794) -+++ Makefile.am (local) -@@ -1,6 +1,5 @@ - AUTOMAKE_OPTIONS = foreign no-dependencies - --SUBDIRS = . sample test - - EXTRA_DIST = acconfig.h event.h event-internal.h log.h evsignal.h event.3 \ - kqueue.c epoll_sub.c epoll.c select.c rtsig.c poll.c signal.c \ -@@ -20,13 +19,29 @@ - - lib_LTLIBRARIES = libevent.la - --libevent_la_SOURCES = event.c buffer.c evbuffer.c log.c --libevent_la_LIBADD = @LTLIBOBJS@ -+if BUILD_WIN32 -+ -+SUBDIRS = . sample -+SYS_LIBS = -lws2_32 -+SYS_SRC = WIN32-Code/misc.c WIN32-Code/win32.c -+SYS_INCLUDES = -IWIN32-Code -+ -+else -+ -+SUBDIRS = . sample test -+SYS_LIBS = -+SYS_SRC = -+SYS_INCLUDES = -+ -+endif -+ -+libevent_la_SOURCES = event.c buffer.c evbuffer.c log.c $(SYS_SRC) -+libevent_la_LIBADD = @LTLIBOBJS@ $(SYS_LIBS) - libevent_la_LDFLAGS = -release @VERSION@ -version-info 1:2:0 - - include_HEADERS = event.h - --INCLUDES = -Icompat -+INCLUDES = -Icompat $(SYS_INCLUDES) - - man_MANS = event.3 - -=== WIN32-Code/misc.c -================================================================== ---- WIN32-Code/misc.c (revision 8794) -+++ WIN32-Code/misc.c (local) -@@ -4,6 +4,12 @@ - #include <sys/timeb.h> - #include <time.h> - -+#ifdef __GNUC__ -+/*our prototypes for timeval and timezone are in here, just in case the above -+ headers don't have them*/ -+#include "misc.h" -+#endif -+ - /**************************************************************************** - * - * Function: gettimeofday(struct timeval *, struct timezone *) -@@ -17,6 +23,7 @@ - * - ****************************************************************************/ - -+#ifndef HAVE_GETTIMEOFDAY - int gettimeofday(struct timeval *tv, struct timezone *tz) { - struct _timeb tb; - -@@ -28,6 +35,7 @@ - tv->tv_usec = ((int) tb.millitm) * 1000; - return 0; - } -+#endif - - int - win_read(int fd, void *buf, unsigned int length) -=== WIN32-Code/misc.h -================================================================== ---- WIN32-Code/misc.h (revision 8794) -+++ WIN32-Code/misc.h (local) -@@ -1,6 +1,11 @@ - #ifndef MISC_H - #define MISC_H - -+struct timezone; -+struct timeval; -+ -+#ifndef HAVE_GETTIMEOFDAY - int gettimeofday(struct timeval *,struct timezone *); -+#endif - - #endif -=== WIN32-Code/win32.c -================================================================== ---- WIN32-Code/win32.c (revision 8794) -+++ WIN32-Code/win32.c (local) -@@ -60,7 +60,8 @@ - /* MSDN says this is required to handle SIGFPE */ - volatile double SIGFPE_REQ = 0.0f; - --int signal_handler(int sig); -+static void signal_handler(int sig); -+ - void signal_process(void); - int signal_recalc(void); - -@@ -205,8 +206,9 @@ - } - - int --win32_insert(struct win32op *win32op, struct event *ev) -+win32_insert(void *op, struct event *ev) - { -+ struct win32op *win32op = op; - int i; - - if (ev->ev_events & EV_SIGNAL) { -@@ -251,8 +253,9 @@ - } - - int --win32_del(struct win32op *win32op, struct event *ev) -+win32_del(void *op, struct event *ev) - { -+ struct win32op *win32op = op; - int i, found; - - if (ev->ev_events & EV_SIGNAL) -@@ -302,9 +305,10 @@ - */ - - int --win32_dispatch(struct event_base *base, struct win32op *win32op, -+win32_dispatch(struct event_base *base, void *op, - struct timeval *tv) - { -+ struct win32op *win32op = op; - int res = 0; - int i; - int fd_count; -@@ -366,13 +370,11 @@ - } - - --static int -+static void - signal_handler(int sig) - { - evsigcaught[sig]++; - signal_caught = 1; -- -- return 0; - } - - int -=== buffer.c -================================================================== ---- buffer.c (revision 8794) -+++ buffer.c (local) -@@ -197,7 +197,7 @@ - u_char *data = EVBUFFER_DATA(buffer); - size_t len = EVBUFFER_LENGTH(buffer); - char *line; -- u_int i; -+ unsigned int i; - - for (i = 0; i < len; i++) { - if (data[i] == '\r' || data[i] == '\n') -=== configure.in -================================================================== ---- configure.in (revision 8794) -+++ configure.in (local) -@@ -111,6 +111,21 @@ - ) - fi - -+dnl - check if the macro WIN32 is defined on this compiler. -+dnl - (this is how we check for a windows version of GCC) -+AC_MSG_CHECKING(for WIN32) -+AC_TRY_COMPILE(, -+ [ -+ #ifndef WIN32 -+ #error -+ #endif -+ ], -+ bwin32=true; AC_MSG_RESULT(yes), -+ bwin32=false; AC_MSG_RESULT(no), -+) -+ -+AM_CONDITIONAL(BUILD_WIN32, test x$bwin32 = xtrue) -+ - dnl Checks for typedefs, structures, and compiler characteristics. - AC_C_CONST - AC_C_INLINE -=== evbuffer.c -================================================================== ---- evbuffer.c (revision 8794) -+++ evbuffer.c (local) -@@ -154,12 +154,20 @@ - if (EVBUFFER_LENGTH(bufev->output)) { - res = evbuffer_write(bufev->output, fd); - if (res == -1) { -+#ifndef WIN32 -+/*todo. evbuffer uses WriteFile when WIN32 is set. WIN32 system calls do not -+ *set errno. thus this error checking is not portable*/ - if (errno == EAGAIN || - errno == EINTR || - errno == EINPROGRESS) - goto reschedule; - /* error case */ - what |= EVBUFFER_ERROR; -+ -+#else -+ goto reschedule; -+#endif -+ - } else if (res == 0) { - /* eof case */ - what |= EVBUFFER_EOF; - diff --git a/Win32Build/mingw/libevent-svn-mingw.diff b/Win32Build/mingw/libevent-svn-mingw.diff deleted file mode 100644 index af4ffbbbb5..0000000000 --- a/Win32Build/mingw/libevent-svn-mingw.diff +++ /dev/null @@ -1,210 +0,0 @@ -=== Makefile.am -================================================================== ---- Makefile.am (revision 8794) -+++ Makefile.am (local) -@@ -1,6 +1,5 @@ - AUTOMAKE_OPTIONS = foreign no-dependencies - --SUBDIRS = . sample test - - bin_SCRIPTS = event_rpcgen.py - -@@ -22,18 +21,34 @@ - - lib_LTLIBRARIES = libevent.la - -+if BUILD_WIN32 -+ -+SUBDIRS = . sample -+SYS_LIBS = -lws2_32 -+SYS_SRC = WIN32-Code/misc.c WIN32-Code/win32.c -+SYS_INCLUDES = -IWIN32-Code -+ -+else -+ -+SUBDIRS = . sample test -+SYS_LIBS = -+SYS_SRC = -+SYS_INCLUDES = -+ -+endif -+ - libevent_la_SOURCES = event.c buffer.c evbuffer.c log.c event_tagging.c \ -- http.c evhttp.h http-internal.h evdns.c evdns.h --libevent_la_LIBADD = @LTLIBOBJS@ -+ http.c evhttp.h http-internal.h evdns.c evdns.h $(SYS_SRC) -+libevent_la_LIBADD = @LTLIBOBJS@ $(SYS_LIBS) - libevent_la_LDFLAGS = -release @VERSION@ -version-info 1:3:0 - - include_HEADERS = event.h evhttp.h evdns.h - --INCLUDES = -Icompat -+INCLUDES = -Icompat $(SYS_INCLUDES) - - man_MANS = event.3 - - verify: libevent.la -- cd $(srcdir)/test && make verify -+ cd $(srcdir)/test && make verify - - DISTCLEANFILES = *~ -=== WIN32-Code/misc.c -================================================================== ---- WIN32-Code/misc.c (revision 8794) -+++ WIN32-Code/misc.c (local) -@@ -4,6 +4,12 @@ - #include <sys/timeb.h> - #include <time.h> - -+#ifdef __GNUC__ -+/*our prototypes for timeval and timezone are in here, just in case the above -+ headers don't have them*/ -+#include "misc.h" -+#endif -+ - /**************************************************************************** - * - * Function: gettimeofday(struct timeval *, struct timezone *) -=== WIN32-Code/misc.h -================================================================== ---- WIN32-Code/misc.h (revision 8794) -+++ WIN32-Code/misc.h (local) -@@ -1,6 +1,9 @@ - #ifndef MISC_H - #define MISC_H - -+struct timezone; -+struct timeval; -+ - int gettimeofday(struct timeval *,struct timezone *); - - #endif -=== WIN32-Code/win32.c -================================================================== ---- WIN32-Code/win32.c (revision 8794) -+++ WIN32-Code/win32.c (local) -@@ -60,7 +60,8 @@ - /* MSDN says this is required to handle SIGFPE */ - volatile double SIGFPE_REQ = 0.0f; - --int signal_handler(int sig); -+static void signal_handler(int sig); -+ - void signal_process(void); - int signal_recalc(void); - -@@ -207,8 +208,9 @@ - } - - int --win32_insert(struct win32op *win32op, struct event *ev) -+win32_insert(void *op, struct event *ev) - { -+ struct win32op *win32op = op; - int i; - - if (ev->ev_events & EV_SIGNAL) { -@@ -253,8 +255,9 @@ - } - - int --win32_del(struct win32op *win32op, struct event *ev) -+win32_del(void *op, struct event *ev) - { -+ struct win32op *win32op = op; - int i, found; - - if (ev->ev_events & EV_SIGNAL) -@@ -304,9 +307,10 @@ - */ - - int --win32_dispatch(struct event_base *base, struct win32op *win32op, -+win32_dispatch(struct event_base *base, void *op, - struct timeval *tv) - { -+ struct win32op *win32op = op; - int res = 0; - int i; - int fd_count; -@@ -389,13 +393,11 @@ - free(win32op); - } - --static int -+static void - signal_handler(int sig) - { - evsigcaught[sig]++; - signal_caught = 1; -- -- return 0; - } - - int -=== buffer.c -================================================================== ---- buffer.c (revision 8794) -+++ buffer.c (local) -@@ -197,7 +197,7 @@ - u_char *data = EVBUFFER_DATA(buffer); - size_t len = EVBUFFER_LENGTH(buffer); - char *line; -- u_int i; -+ unsigned int i; - - for (i = 0; i < len; i++) { - if (data[i] == '\r' || data[i] == '\n') -=== configure.in -================================================================== ---- configure.in (revision 8794) -+++ configure.in (local) -@@ -111,6 +111,22 @@ - ) - fi - -+dnl - check if the macro WIN32 is defined on this compiler. -+dnl - (this is how we check for a windows version of GCC) -+AC_MSG_CHECKING(for WIN32) -+AC_TRY_COMPILE(, -+ [ -+ #ifndef WIN32 -+ #error -+ #endif -+ ], -+ bwin32=true; AC_MSG_RESULT(yes), -+ bwin32=false; AC_MSG_RESULT(no), -+) -+ -+AM_CONDITIONAL(BUILD_WIN32, test x$bwin32 = xtrue) -+ -+ - dnl Checks for typedefs, structures, and compiler characteristics. - AC_C_CONST - AC_C_INLINE -=== evbuffer.c -================================================================== ---- evbuffer.c (revision 8794) -+++ evbuffer.c (local) -@@ -163,12 +162,20 @@ - if (EVBUFFER_LENGTH(bufev->output)) { - res = evbuffer_write(bufev->output, fd); - if (res == -1) { -+#ifndef WIN32 -+/*todo. evbuffer uses WriteFile when WIN32 is set. WIN32 system calls do not -+ *set errno. thus this error checking is not portable*/ - if (errno == EAGAIN || - errno == EINTR || - errno == EINPROGRESS) - goto reschedule; - /* error case */ - what |= EVBUFFER_ERROR; -+ -+#else -+ goto reschedule; -+#endif -+ - } else if (res == 0) { - /* eof case */ - what |= EVBUFFER_EOF; - diff --git a/Win32Build/vc6/Tor.dsw b/Win32Build/vc6/Tor.dsw deleted file mode 100644 index 3999da18c2..0000000000 --- a/Win32Build/vc6/Tor.dsw +++ /dev/null @@ -1,41 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "tor"=".\tor\tor.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "tor_resolve"=".\tor_resolve\tor_resolve.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/Win32Build/vc6/tor/Tor.dsp b/Win32Build/vc6/tor/Tor.dsp deleted file mode 100644 index f05e04931d..0000000000 --- a/Win32Build/vc6/tor/Tor.dsp +++ /dev/null @@ -1,398 +0,0 @@ -# Microsoft Developer Studio Project File - Name="tor" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=tor - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "tor.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "tor.mak" CFG="tor - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "tor - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "tor - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "tor - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\src\win32" /I "c:\openssl\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib ssleay32.lib libeay32.lib /nologo /subsystem:console /machine:I386 /libpath:"c:\openssl\lib\vc" - -!ELSEIF "$(CFG)" == "tor - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\src\win32" /I "c:\openssl\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 wsock32.lib ssleay32.lib libeay32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"c:\openssl\lib\vc" - -!ENDIF - -# Begin Target - -# Name "tor - Win32 Release" -# Name "tor - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Group "common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\src\common\aes.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\compat.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\container.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\crypto.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\log.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\log.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\torgzip.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\tortls.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\util.c -# End Source File -# End Group -# Begin Group "zlib" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\adler32.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\compress.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\crc32.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\crc32.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\deflate.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\deflate.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\gzio.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\infback.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\inffast.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\inffast.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\inffixed.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\inflate.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\inflate.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\inftrees.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\inftrees.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\trees.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\trees.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\uncompr.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\zconf.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\zlib.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\zutil.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\contrib\zlib\zutil.h -# End Source File -# End Group -# Begin Group "or" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\src\or\buffers.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\circuitbuild.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\circuitlist.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\circuituse.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\command.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\config.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\connection.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\connection_edge.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\connection_or.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\control.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\cpuworker.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\directory.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\dirserv.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\dns.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\hibernate.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\main.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\onion.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\policies.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\relay.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\rendclient.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\rendcommon.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\rendmid.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\rendservice.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\rephist.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\router.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\routerlist.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\routerparse.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\tor_main.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\tree.h -# End Source File -# End Group -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\..\src\common\aes.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\compat.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\container.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\crypto.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\fakepoll.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\or\or.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\win32\orconfig.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\test.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\torgzip.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\torint.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\tortls.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\util.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/Win32Build/vc6/tor_resolve/tor_resolve.dsp b/Win32Build/vc6/tor_resolve/tor_resolve.dsp deleted file mode 100644 index 63f406b9e1..0000000000 --- a/Win32Build/vc6/tor_resolve/tor_resolve.dsp +++ /dev/null @@ -1,134 +0,0 @@ -# Microsoft Developer Studio Project File - Name="tor_resolve" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=tor_resolve - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "tor_resolve.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "tor_resolve.mak" CFG="tor_resolve - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "tor_resolve - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "tor_resolve - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "tor_resolve - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\src\win32" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "tor_resolve - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\src\win32" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "tor_resolve - Win32 Release" -# Name "tor_resolve - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\..\src\common\compat.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\log.c -# End Source File -# Begin Source File - -SOURCE="..\..\..\src\tools\tor-resolve.c" -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\util.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\..\src\common\compat.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\log.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\win32\orconfig.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\torint.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\src\common\util.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/Win32Build/vc7/Tor/Tor.sln b/Win32Build/vc7/Tor/Tor.sln deleted file mode 100644 index 3087e26cc1..0000000000 --- a/Win32Build/vc7/Tor/Tor.sln +++ /dev/null @@ -1,45 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tor", "Tor.vcproj", "{63A6B170-E742-400C-B3A0-9CCED3699043}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tor_resolve", "..\tor_resolve\tor_resolve.vcproj", "{E2D2762A-26BD-4A28-BD72-DDAB181324B4}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unittests", "..\unittests\unittests.vcproj", "{F1F64693-11A9-4992-8B4B-2A67C07BD8C8}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libevent", "..\..\..\contrib\libevent\WIN32-Prj\libevent.vcproj", "{52BBFCA6-6F82-4596-BBAD-0BCFBC637B80}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {63A6B170-E742-400C-B3A0-9CCED3699043}.Debug.ActiveCfg = Debug|Win32 - {63A6B170-E742-400C-B3A0-9CCED3699043}.Debug.Build.0 = Debug|Win32 - {63A6B170-E742-400C-B3A0-9CCED3699043}.Release.ActiveCfg = Release|Win32 - {63A6B170-E742-400C-B3A0-9CCED3699043}.Release.Build.0 = Release|Win32 - {E2D2762A-26BD-4A28-BD72-DDAB181324B4}.Debug.ActiveCfg = Debug|Win32 - {E2D2762A-26BD-4A28-BD72-DDAB181324B4}.Debug.Build.0 = Debug|Win32 - {E2D2762A-26BD-4A28-BD72-DDAB181324B4}.Release.ActiveCfg = Release|Win32 - {E2D2762A-26BD-4A28-BD72-DDAB181324B4}.Release.Build.0 = Release|Win32 - {F1F64693-11A9-4992-8B4B-2A67C07BD8C8}.Debug.ActiveCfg = Debug|Win32 - {F1F64693-11A9-4992-8B4B-2A67C07BD8C8}.Debug.Build.0 = Debug|Win32 - {F1F64693-11A9-4992-8B4B-2A67C07BD8C8}.Release.ActiveCfg = Release|Win32 - {F1F64693-11A9-4992-8B4B-2A67C07BD8C8}.Release.Build.0 = Release|Win32 - {52BBFCA6-6F82-4596-BBAD-0BCFBC637B80}.Debug.ActiveCfg = Debug|Win32 - {52BBFCA6-6F82-4596-BBAD-0BCFBC637B80}.Debug.Build.0 = Debug|Win32 - {52BBFCA6-6F82-4596-BBAD-0BCFBC637B80}.Release.ActiveCfg = Release|Win32 - {52BBFCA6-6F82-4596-BBAD-0BCFBC637B80}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/Win32Build/vc7/Tor/Tor.vcproj b/Win32Build/vc7/Tor/Tor.vcproj deleted file mode 100644 index 307521e89d..0000000000 --- a/Win32Build/vc7/Tor/Tor.vcproj +++ /dev/null @@ -1,357 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="7.10" - Name="Tor" - ProjectGUID="{63A6B170-E742-400C-B3A0-9CCED3699043}" - Keyword="Win32Proj"> - <Platforms> - <Platform - Name="Win32"/> - </Platforms> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="Debug" - IntermediateDirectory="Debug" - ConfigurationType="1" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="c:\openssl\include;..\..\..\src\win32;..\..\..\contrib\libevent" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" - IgnoreStandardIncludePath="FALSE" - MinimalRebuild="TRUE" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="FALSE" - DebugInformationFormat="4" - CompileAs="1"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="wsock32.lib t:\openssl\install\lib\vc\ssleay32.lib t:\openssl\install\lib\vc\libeay32.lib ..\..\..\contrib\libevent\win32-prj\Debug\libevent.lib ws2_32.lib" - OutputFile="$(OutDir)/Tor.exe" - LinkIncremental="2" - IgnoreDefaultLibraryNames="LIBCD" - DelayLoadDLLs="advapi32.dll" - GenerateDebugInformation="TRUE" - ProgramDatabaseFile="$(OutDir)/Tor.pdb" - SubSystem="1" - TargetMachine="1"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="Release" - IntermediateDirectory="Release" - ConfigurationType="1" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="c:\openssl\include;..\..\..\src\win32;..\..\..\contrib\libevent" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" - IgnoreStandardIncludePath="FALSE" - RuntimeLibrary="0" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3" - CompileAs="1"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="wsock32.lib c:\openssl\lib\vc\ssleay32.lib c:\openssl\lib\vc\libeay32.lib" - OutputFile="$(OutDir)/Tor.exe" - LinkIncremental="1" - DelayLoadDLLs="advapi32.dll" - GenerateDebugInformation="TRUE" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="1"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> - <File - RelativePath="..\..\..\src\common\aes.c"> - </File> - <File - RelativePath="..\..\..\src\or\buffers.c"> - </File> - <File - RelativePath="..\..\..\src\or\circuitbuild.c"> - </File> - <File - RelativePath="..\..\..\src\or\circuitlist.c"> - </File> - <File - RelativePath="..\..\..\src\or\circuituse.c"> - </File> - <File - RelativePath="..\..\..\src\or\command.c"> - </File> - <File - RelativePath="..\..\..\src\common\compat.c"> - </File> - <File - RelativePath="..\..\..\src\or\config.c"> - </File> - <File - RelativePath="..\..\..\src\or\connection.c"> - </File> - <File - RelativePath="..\..\..\src\or\connection_edge.c"> - </File> - <File - RelativePath="..\..\..\src\or\connection_or.c"> - </File> - <File - RelativePath="..\..\..\src\common\container.c"> - </File> - <File - RelativePath="..\..\..\src\or\control.c"> - </File> - <File - RelativePath="..\..\..\src\or\cpuworker.c"> - </File> - <File - RelativePath="..\..\..\src\common\crypto.c"> - </File> - <File - RelativePath="..\..\..\src\or\directory.c"> - </File> - <File - RelativePath="..\..\..\src\or\dirserv.c"> - </File> - <File - RelativePath="..\..\..\src\or\dns.c"> - </File> - <File - RelativePath="..\..\..\src\or\hibernate.c"> - </File> - <File - RelativePath="..\..\..\src\common\log.c"> - </File> - <File - RelativePath="..\..\..\src\or\main.c"> - </File> - <File - RelativePath="..\..\..\src\or\onion.c"> - </File> - <File - RelativePath="..\..\..\src\or\or.h"> - </File> - <File - RelativePath="..\..\..\src\win32\orconfig.h"> - </File> - <File - RelativePath="..\..\..\src\or\policies.c"> - </File> - <File - RelativePath="..\..\..\src\or\relay.c"> - </File> - <File - RelativePath="..\..\..\src\or\rendclient.c"> - </File> - <File - RelativePath="..\..\..\src\or\rendcommon.c"> - </File> - <File - RelativePath="..\..\..\src\or\rendmid.c"> - </File> - <File - RelativePath="..\..\..\src\or\rendservice.c"> - </File> - <File - RelativePath="..\..\..\src\or\rephist.c"> - </File> - <File - RelativePath="..\..\..\src\or\router.c"> - </File> - <File - RelativePath="..\..\..\src\or\routerlist.c"> - </File> - <File - RelativePath="..\..\..\src\or\routerparse.c"> - </File> - <File - RelativePath="..\..\..\src\or\tor_main.c"> - </File> - <File - RelativePath="..\..\..\src\common\torgzip.c"> - </File> - <File - RelativePath="..\..\..\src\common\torint.h"> - </File> - <File - RelativePath="..\..\..\src\common\tortls.c"> - </File> - <File - RelativePath="..\..\..\src\common\util.c"> - </File> - <Filter - Name="zlib" - Filter=""> - <File - RelativePath="..\..\..\contrib\zlib\adler32.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\compress.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\crc32.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\crc32.h"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\deflate.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\deflate.h"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\gzio.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\infback.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\inffast.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\inffast.h"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\inffixed.h"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\inflate.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\inflate.h"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\inftrees.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\inftrees.h"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\trees.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\trees.h"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\uncompr.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\zconf.h"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\zlib.h"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\zutil.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\zutil.h"> - </File> - </Filter> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> - <File - RelativePath="..\..\..\src\common\aes.h"> - </File> - <File - RelativePath="..\..\..\src\common\compat.h"> - </File> - <File - RelativePath="..\..\..\src\common\container.h"> - </File> - <File - RelativePath="..\..\..\src\common\crypto.h"> - </File> - <File - RelativePath="..\..\..\src\common\log.h"> - </File> - <File - RelativePath="..\..\..\src\common\torgzip.h"> - </File> - <File - RelativePath="..\..\..\src\common\tortls.h"> - </File> - <File - RelativePath="..\..\..\src\or\tree.h"> - </File> - <File - RelativePath="..\..\..\src\common\util.h"> - </File> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> - </Filter> - <File - RelativePath=".\ReadMe.txt"> - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/Win32Build/vc7/tor_resolve/tor_resolve.vcproj b/Win32Build/vc7/tor_resolve/tor_resolve.vcproj deleted file mode 100644 index a44f1ac66a..0000000000 --- a/Win32Build/vc7/tor_resolve/tor_resolve.vcproj +++ /dev/null @@ -1,169 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="7.10" - Name="tor_resolve" - ProjectGUID="{E2D2762A-26BD-4A28-BD72-DDAB181324B4}" - Keyword="Win32Proj"> - <Platforms> - <Platform - Name="Win32"/> - </Platforms> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="Debug" - IntermediateDirectory="Debug" - ConfigurationType="1" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\..\..\contrib\libevent;..\..\..\src\win32" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" - MinimalRebuild="TRUE" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="FALSE" - DebugInformationFormat="4"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="wsock32.lib ..\..\..\contrib\libevent\win32-prj\Debug\libevent.lib" - OutputFile="$(OutDir)/tor_resolve.exe" - LinkIncremental="2" - GenerateDebugInformation="TRUE" - ProgramDatabaseFile="$(OutDir)/tor_resolve.pdb" - SubSystem="1" - TargetMachine="1"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="Release" - IntermediateDirectory="Release" - ConfigurationType="1" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\..\..\contrib\libevent;..\..\..\src\win32" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" - RuntimeLibrary="0" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="FALSE" - DebugInformationFormat="3"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="wsock32.lib ..\..\..\contrib\libevent\win32-prj\Debug\libevent.lib" - OutputFile="$(OutDir)/tor_resolve.exe" - LinkIncremental="1" - GenerateDebugInformation="TRUE" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="1"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> - <File - RelativePath="..\..\..\src\common\compat.c"> - </File> - <File - RelativePath="..\..\..\src\common\compat.h"> - </File> - <File - RelativePath="..\..\..\src\common\container.c"> - </File> - <File - RelativePath="..\..\..\src\common\container.h"> - </File> - <File - RelativePath="..\..\..\src\common\log.c"> - </File> - <File - RelativePath="..\..\..\src\common\log.h"> - </File> - <File - RelativePath="..\..\..\src\win32\orconfig.h"> - </File> - <File - RelativePath="..\..\..\src\tools\tor-resolve.c"> - </File> - <File - RelativePath="..\..\..\src\common\torint.h"> - </File> - <File - RelativePath="..\..\..\src\common\util.c"> - </File> - <File - RelativePath="..\..\..\src\common\util.h"> - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> - </Filter> - <File - RelativePath=".\ReadMe.txt"> - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/Win32Build/vc7/unittests/unittests.vcproj b/Win32Build/vc7/unittests/unittests.vcproj deleted file mode 100644 index 3dffa786cc..0000000000 --- a/Win32Build/vc7/unittests/unittests.vcproj +++ /dev/null @@ -1,342 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="7.10" - Name="unittests" - ProjectGUID="{F1F64693-11A9-4992-8B4B-2A67C07BD8C8}" - Keyword="Win32Proj"> - <Platforms> - <Platform - Name="Win32"/> - </Platforms> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="Debug" - IntermediateDirectory="Debug" - ConfigurationType="1" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\..\..\src\win32;c:\openssl\include;..\..\..\contrib\libevent" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" - MinimalRebuild="TRUE" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="FALSE" - DebugInformationFormat="4"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="wsock32.lib t:\openssl\install\lib\vc\libeay32.lib t:\openssl\install\lib\vc\ssleay32.lib ws2_32.lib ..\..\..\contrib\libevent\win32-prj\Debug\libevent.lib" - OutputFile="$(OutDir)/unittests.exe" - LinkIncremental="2" - IgnoreDefaultLibraryNames="LIBCD" - GenerateDebugInformation="TRUE" - ProgramDatabaseFile="$(OutDir)/unittests.pdb" - SubSystem="1" - TargetMachine="1"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="Release" - IntermediateDirectory="Release" - ConfigurationType="1" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\..\..\src\win32;c:\openssl\include;..\..\..\contrib\libevent" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" - RuntimeLibrary="0" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="FALSE" - DebugInformationFormat="3"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="wsock32.lib c:\openssl\lib\vc\libeay32.lib c:\openssl\lib\vc\ssleay32.lib" - OutputFile="$(OutDir)/unittests.exe" - LinkIncremental="1" - GenerateDebugInformation="TRUE" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="1"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> - <File - RelativePath="..\..\..\src\common\aes.c"> - </File> - <File - RelativePath="..\..\..\src\or\buffers.c"> - </File> - <File - RelativePath="..\..\..\src\or\circuitbuild.c"> - </File> - <File - RelativePath="..\..\..\src\or\circuitlist.c"> - </File> - <File - RelativePath="..\..\..\src\or\circuituse.c"> - </File> - <File - RelativePath="..\..\..\src\or\command.c"> - </File> - <File - RelativePath="..\..\..\src\common\compat.c"> - </File> - <File - RelativePath="..\..\..\src\or\config.c"> - </File> - <File - RelativePath="..\..\..\src\or\connection.c"> - </File> - <File - RelativePath="..\..\..\src\or\connection_edge.c"> - </File> - <File - RelativePath="..\..\..\src\or\connection_or.c"> - </File> - <File - RelativePath="..\..\..\src\common\container.c"> - </File> - <File - RelativePath="..\..\..\src\or\control.c"> - </File> - <File - RelativePath="..\..\..\src\or\cpuworker.c"> - </File> - <File - RelativePath="..\..\..\src\common\crypto.c"> - </File> - <File - RelativePath="..\..\..\src\or\directory.c"> - </File> - <File - RelativePath="..\..\..\src\or\dirserv.c"> - </File> - <File - RelativePath="..\..\..\src\or\dns.c"> - </File> - <File - RelativePath="..\..\..\src\or\hibernate.c"> - </File> - <File - RelativePath="..\..\..\src\common\log.c"> - </File> - <File - RelativePath="..\..\..\src\or\main.c"> - </File> - <File - RelativePath="..\..\..\src\or\onion.c"> - </File> - <File - RelativePath="..\..\..\src\or\or.h"> - </File> - <File - RelativePath="..\..\..\src\win32\orconfig.h"> - </File> - <File - RelativePath="..\..\..\src\or\policies.c"> - </File> - <File - RelativePath="..\..\..\src\or\relay.c"> - </File> - <File - RelativePath="..\..\..\src\or\rendclient.c"> - </File> - <File - RelativePath="..\..\..\src\or\rendcommon.c"> - </File> - <File - RelativePath="..\..\..\src\or\rendmid.c"> - </File> - <File - RelativePath="..\..\..\src\or\rendservice.c"> - </File> - <File - RelativePath="..\..\..\src\or\rephist.c"> - </File> - <File - RelativePath="..\..\..\src\or\router.c"> - </File> - <File - RelativePath="..\..\..\src\or\routerlist.c"> - </File> - <File - RelativePath="..\..\..\src\or\routerparse.c"> - </File> - <File - RelativePath="..\..\..\src\or\test.c"> - </File> - <File - RelativePath="..\..\..\src\common\torgzip.c"> - </File> - <File - RelativePath="..\..\..\src\common\torint.h"> - </File> - <File - RelativePath="..\..\..\src\common\tortls.c"> - </File> - <File - RelativePath="..\..\..\src\common\util.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\zutil.h"> - </File> - <Filter - Name="zlib"> - <File - RelativePath="..\..\..\contrib\zlib\adler32.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\compress.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\crc32.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\crc32.h"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\deflate.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\deflate.h"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\gzio.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\infback.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\inffast.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\inffast.h"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\inffixed.h"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\inflate.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\inflate.h"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\inftrees.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\inftrees.h"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\trees.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\trees.h"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\uncompr.c"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\zconf.h"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\zlib.h"> - </File> - <File - RelativePath="..\..\..\contrib\zlib\zutil.c"> - </File> - </Filter> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> - <File - RelativePath="..\..\..\src\common\aes.h"> - </File> - <File - RelativePath="..\..\..\src\common\compat.h"> - </File> - <File - RelativePath="..\..\..\src\common\container.h"> - </File> - <File - RelativePath="..\..\..\src\common\crypto.h"> - </File> - <File - RelativePath="..\..\..\src\common\log.h"> - </File> - <File - RelativePath="..\..\..\src\common\torgzip.h"> - </File> - <File - RelativePath="..\..\..\src\common\tortls.h"> - </File> - <File - RelativePath="..\..\..\src\or\tree.h"> - </File> - <File - RelativePath="..\..\..\src\common\util.h"> - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/changes/bug1751 b/changes/bug1751 new file mode 100644 index 0000000000..58ea9a225f --- /dev/null +++ b/changes/bug1751 @@ -0,0 +1,5 @@ + o Major features: + - Exit relays now try harder to block exit attempts from unknown + relays, to make it harder for people to use them as one-hop proxies. + Controlled by the refuseunknownexits consensus parameter, or you + can override it with the RefuseUnknownExits torrc option. diff --git a/changes/bug1805 b/changes/bug1805 new file mode 100644 index 0000000000..fdd03fb985 --- /dev/null +++ b/changes/bug1805 @@ -0,0 +1,4 @@ + o Minor bugfixes: + - Make sure we don't warn about not having bandwidth weights when + choosing bridges or other relays not in the consensus. Bugfix + on 0.2.2.10-alpha; fixes bug 1805. diff --git a/changes/bug1882 b/changes/bug1882 new file mode 100644 index 0000000000..d495d2f418 --- /dev/null +++ b/changes/bug1882 @@ -0,0 +1,4 @@ + o Minor features: + - If we've configured EntryNodes and our network goes away and/or all + our entrynodes get marked down, optimistically retry them all when + a new socks application request appears. Fixes bug 1882. diff --git a/changes/bug1952 b/changes/bug1952 new file mode 100644 index 0000000000..e6784aa3d3 --- /dev/null +++ b/changes/bug1952 @@ -0,0 +1,5 @@ + o Major bugfixes: + - Alter how consensus bandwidth-weights are computed using new constraints + that should succeed in all cases. Also alter directory authorities to not + include the bandwidth-weights line if they fail to produce valid values. + Fixes bug 1952; bugfix on 0.2.2.10-alpha. diff --git a/changes/bug1954_loadlib b/changes/bug1954_loadlib new file mode 100644 index 0000000000..901d9baa5c --- /dev/null +++ b/changes/bug1954_loadlib @@ -0,0 +1,4 @@ + o Major bugfixes + - Always search the windows system directory for system DLLs, and + nowhere else. Fixes bug 1954. + diff --git a/changes/bug1964 b/changes/bug1964 new file mode 100644 index 0000000000..d100094eba --- /dev/null +++ b/changes/bug1964 @@ -0,0 +1,3 @@ + o Major bugfixes: + - Fix a segfault that can happen when using bridges. Fixes bug 1964; + bugfix on 0.2.2.15-alpha. diff --git a/changes/bug1981 b/changes/bug1981 new file mode 100644 index 0000000000..3e5e1d36fb --- /dev/null +++ b/changes/bug1981 @@ -0,0 +1,6 @@ + o Major bugfixes: + - When you use bridges and your network goes away and your bridges + get marked as down, recover when you attempt a new socks connection + (if the network is back) rather than waiting up to an hour to try + fetching new descriptors for your bridges. Bugfix on 0.2.0.3-alpha; + fixes bug 1981. diff --git a/changes/torrc_continuation b/changes/torrc_continuation new file mode 100644 index 0000000000..5b6e086e6f --- /dev/null +++ b/changes/torrc_continuation @@ -0,0 +1,6 @@ + o Minor features: + - Support line continuations in torrc. If a line ends with a + single backslash character, the newline is ignored, and the + configuration value is treated as continuing on the next line. + Resolves bug 1929. + diff --git a/doc/spec/dir-spec.txt b/doc/spec/dir-spec.txt index e2ad056d47..6e35deb00e 100644 --- a/doc/spec/dir-spec.txt +++ b/doc/spec/dir-spec.txt @@ -1177,6 +1177,12 @@ 0.2.2.14-alpha looked for bwconnrate and bwconnburst, but then did the wrong thing with them; see bug 1830 for details.) + "refuseunknownexits" -- if set and non-zero, exit relays look at + the previous hop of circuits that ask to open an exit stream, + and refuse to exit if they don't recognize it as a relay. The + goal is to make it harder for people to use them as one-hop + proxies. See trac entry 1751 for details. + See also "2.4.5. Consensus parameters governing behavior" in path-spec.txt for a series of circuit build time related consensus params. @@ -1632,6 +1638,7 @@ "7" -- Provides keyword=integer pairs of consensus parameters "8" -- Provides microdescriptor summaries "9" -- Provides weights for selecting flagged routers in paths + "10" -- Fixes edge case bugs in router flag selection weights Before generating a consensus, an authority must decide which consensus method to use. To do this, it looks for the highest version number @@ -1694,22 +1701,25 @@ Wme*E + Wee*E == E (aka: Wee = 1-Wme) We are short 2 constraints with the above set. The remaining constraints - come from examining different cases of network load. + come from examining different cases of network load. The following + constraints are used in consensus method 10 and above. There are another + incorrect and obsolete set of constraints used for these same cases in + consensus method 9. For those, see dir-spec.txt in Tor 0.2.2.10-alpha + to 0.2.2.16-alpha. Case 1: E >= T/3 && G >= T/3 (Neither Exit nor Guard Scarce) - In this case, the additional two constraints are: Wme*E == Wmd*D and - Wgd == 0, which maximizes Exit-flagged bandwidth in the middle position. + In this case, the additional two constraints are: Wmg == Wmd, + Wed == 1/3. This leads to the solution: - - Wgg = (weight_scale*(D+E+G+M))/(3*G) - Wmd = (weight_scale*(2*D + 2*E - G - M))/(6*D) - Wme = (weight_scale*(2*D + 2*E - G - M))/(6*E) - Wee = (weight_scale*(-2*D + 4*E + G + M))/(6*E) - Wmg = weight_scale - Wgg - Wed = weight_scale - Wmd - Wgd = 0 + Wgd = weight_scale/3 + Wed = weight_scale/3 + Wmd = weight_scale/3 + Wee = (weight_scale*(E+G+M))/(3*E) + Wme = weight_scale - Wee + Wmg = (weight_scale*(2*G-E-M))/(3*G) + Wgg = weight_scale - Wmg Case 2: E < T/3 && G < T/3 (Both are scarce) @@ -1733,25 +1743,35 @@ Subcase b: R+D >= S In this case, if M <= T/3, we have enough bandwidth to try to achieve - a balancing condition, and add the constraints Wgg == 1 and - Wme*E == Wmd*D: + a balancing condition. - Wgg = weight_scale - Wgd = (weight_scale*(D + E - 2*G + M))/(3*D) (T/3 >= G (Ok)) - Wmd = (weight_scale*(D + E + G - 2*M))/(6*D) (T/3 >= M) - Wme = (weight_scale*(D + E + G - 2*M))/(6*E) - Wee = (weight_scale*(-D + 5*E - G + 2*M))/(6*E) (2E+M >= T/3) - Wmg = 0; - Wed = weight_scale - Wgd - Wmd + Add constraints Wgg = 1, Wmd == Wgd to maximize bandwidth in the guard + position while still allowing exits to be used as middle nodes: - If M >= T/3, the above solution will not be valid (one of the weights - will be < 0 or > 1). In this case, we use: + Wee = (weight_scale*(E - G + M))/E + Wed = (weight_scale*(D - 2*E + 4*G - 2*M))/(3*D) + Wme = (weight_scale*(G-M))/E + Wmg = 0 + Wgg = weight_scale + Wmd = (weight_scale - Wed)/2 + Wgd = (weight_scale - Wed)/2 + + If this system ends up with any values out of range (ie negative, or + above weight_scale), use the constraints Wgg == 1 and Wee == 1, since + both those positions are scarce: Wgg = weight_scale Wee = weight_scale - Wmg = Wme = Wmd = 0 - Wgd = (weight_scale*(D+E-G))/(2*D) - Wed = weight_scale - Wgd + Wed = (weight_scale*(D - 2*E + G + M))/(3*D) + Wmd = (weight_Scale*(D - 2*M + G + E))/(3*D) + Wme = 0 + Wmg = 0 + Wgd = weight_scale - Wed - Wmd + + If M > T/3, then the Wmd weight above will become negative. Set it to 0 + in this case: + Wmd = 0 + Wgd = weight_scale - Wed Case 3: One of E < T/3 or G < T/3 @@ -1759,36 +1779,44 @@ Subcase a: (S+D) < T/3: if G=S: - Wgg = Wgd = weight_scale; - Wmd = Wed = Wmg = 0; - Wme = (weight_scale*(E-M))/(2*E); - Wee = weight_scale-Wme; + Wgg = Wgd = weight_scale; + Wmd = Wed = Wmg = 0; + // Minor subcase, if E is more scarce than M, + // keep its bandwidth in place. + if (E < M) Wme = 0; + else Wme = (weight_scale*(E-M))/(2*E); + Wee = weight_scale-Wme; if E=S: - Wee = Wed = weight_scale; - Wmd = Wgd = Wmg = 0; - Wmg = (weight_scale*(G-M))/(2*G); - Wgg = weight_scale-Wmg; + Wee = Wed = weight_scale; + Wmd = Wgd = Wme = 0; + // Minor subcase, if G is more scarce than M, + // keep its bandwidth in place. + if (G < M) Wmg = 0; + else Wmg = (weight_scale*(G-M))/(2*G); + Wgg = weight_scale-Wmg; Subcase b: (S+D) >= T/3 if G=S: - Add constraints Wmg = 0, Wme*E == Wmd*D to maximize exit bandwidth - in the middle position: - Wgd = (weight_scale*(D + E - 2*G + M))/(3*D); - Wmd = (weight_scale*(D + E + G - 2*M))/(6*D); - Wme = (weight_scale*(D + E + G - 2*M))/(6*E); - Wee = (weight_scale*(-D + 5*E - G + 2*M))/(6*E); - Wgg = weight_scale; - Wmg = 0; - Wed = weight_scale - Wgd - Wmd; + Add constraints Wgg = 1, Wmd == Wed to maximize bandwidth + in the guard position, while still allowing exits to be + used as middle nodes: + Wgg = weight_scale + Wgd = (weight_scale*(D - 2*G + E + M))/(3*D) + Wmg = 0 + Wee = (weight_scale*(E+M))/(2*E) + Wme = weight_scale - Wee + Wmd = (weight_scale - Wgd)/2 + Wed = (weight_scale - Wgd)/2 if E=S: - Add constraints Wgd = 0, Wme*E == Wmd*D: - Wgg = (weight_scale*(D + E + G + M))/(3*G); - Wmd = (weight_scale*(2*D + 2*E - G - M))/(6*D); - Wme = (weight_scale*(2*D + 2*E - G - M))/(6*E); - Wee = (weight_scale*(-2*D + 4*E + G + M))/(6*E); - Wgd = 0; + Add constraints Wee == 1, Wmd == Wgd to maximize bandwidth + in the exit position: + Wee = weight_scale; + Wed = (weight_scale*(D - 2*E + G + M))/(3*D); + Wme = 0; + Wgg = (weight_scale*(G+M))/(2*G); Wmg = weight_scale - Wgg; - Wed = weight_scale - Wmd; + Wmd = (weight_scale - Wed)/2; + Wgd = (weight_scale - Wed)/2; To ensure consensus, all calculations are performed using integer math with a fixed precision determined by the bwweightscale consensus diff --git a/doc/tor.1.txt b/doc/tor.1.txt index 235d04be82..620f938741 100644 --- a/doc/tor.1.txt +++ b/doc/tor.1.txt @@ -65,7 +65,10 @@ Other options can be specified either on the command-line (--option value), or in the configuration file (option value or option "value"). Options are case-insensitive. C-style escaped characters are allowed inside quoted values. Options on the command line take precedence over - options found in the configuration file. + options found in the configuration file, except indicated otherwise. To + split one configuration entry into multiple lines, use a single \ before + the end of the line. Comments can be used in such multiline entries, but + they must start at the beginning of a line. **BandwidthRate** __N__ **bytes**|**KB**|**MB**|**GB**:: A token bucket limits the average incoming bandwidth usage on this node to @@ -905,6 +908,12 @@ is non-zero): the next day. All times are local, and given in 24-hour time. (Defaults to "month 1 0:00".) +**RefuseUnknownExits** **0**|**1**|**auto**:: + Prevent nodes that don't appear in the consensus from exiting using this + relay. If the option is 1, we always block exit attempts from such + nodes; if it's 0, we never do, and if the option is "auto", then we do + whatever the authorities suggest in the consensus. (Defaults to auto.) + **ServerDNSResolvConfFile** __filename__:: Overrides the default DNS configuration with the configuration in __filename__. The file format is the same as the standard Unix diff --git a/src/common/util.c b/src/common/util.c index 1d770458f7..b4f3052e19 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -26,6 +26,7 @@ #include <io.h> #include <direct.h> #include <process.h> +#include <tchar.h> #else #include <dirent.h> #include <pwd.h> @@ -2284,7 +2285,40 @@ unescape_string(const char *s, char **result, size_t *size_out) const char * parse_config_line_from_str(const char *line, char **key_out, char **value_out) { + /* I believe the file format here is supposed to be: + FILE = (EMPTYLINE | LINE)* (EMPTYLASTLINE | LASTLINE)? + + EMPTYLASTLINE = SPACE* | COMMENT + EMPTYLINE = EMPTYLASTLINE NL + SPACE = ' ' | '\r' | '\t' + COMMENT = '#' NOT-NL* + NOT-NL = Any character except '\n' + NL = '\n' + + LASTLINE = SPACE* KEY SPACE* VALUES + LINE = LASTLINE NL + KEY = KEYCHAR+ + KEYCHAR = Any character except ' ', '\r', '\n', '\t', '#', "\" + + VALUES = QUOTEDVALUE | NORMALVALUE + QUOTEDVALUE = QUOTE QVITEM* QUOTE EOLSPACE? + QUOTE = '"' + QVCHAR = KEYCHAR | ESC ('n' | 't' | 'r' | '"' | ESC |'\'' | OCTAL | HEX) + ESC = "\\" + OCTAL = ODIGIT (ODIGIT ODIGIT?)? + HEX = ('x' | 'X') HEXDIGIT HEXDIGIT + ODIGIT = '0' .. '7' + HEXDIGIT = '0'..'9' | 'a' .. 'f' | 'A' .. 'F' + EOLSPACE = SPACE* COMMENT? + + NORMALVALUE = (VALCHAR | ESC ESC_IGNORE | CONTINUATION)* EOLSPACE? + VALCHAR = Any character except ESC, '#', and '\n' + ESC_IGNORE = Any character except '#' or '\n' + CONTINUATION = ESC NL ( COMMENT NL )* + */ + const char *key, *val, *cp; + int continuation = 0; tor_assert(key_out); tor_assert(value_out); @@ -2308,9 +2342,10 @@ parse_config_line_from_str(const char *line, char **key_out, char **value_out) return line; } - /* Skip until the next space. */ + /* Skip until the next space or \ followed by newline. */ key = line; - while (*line && !TOR_ISSPACE(*line) && *line != '#') + while (*line && !TOR_ISSPACE(*line) && *line != '#' && + ! (line[0] == '\\' && line[1] == '\n')) ++line; *key_out = tor_strndup(key, line-key); @@ -2321,7 +2356,7 @@ parse_config_line_from_str(const char *line, char **key_out, char **value_out) val = line; /* Find the end of the line. */ - if (*line == '\"') { + if (*line == '\"') { // XXX No continuation handling is done here if (!(line = unescape_string(line, value_out, NULL))) return NULL; while (*line == ' ' || *line == '\t') @@ -2329,18 +2364,53 @@ parse_config_line_from_str(const char *line, char **key_out, char **value_out) if (*line && *line != '#' && *line != '\n') return NULL; } else { - while (*line && *line != '\n' && *line != '#') - ++line; + /* Look for the end of the line. */ + while (*line && *line != '\n' && (*line != '#' || continuation)) { + if (*line == '\\' && line[1] == '\n') { + continuation = 1; + line += 2; + } else if (*line == '#') { + do { + ++line; + } while (*line && *line != '\n'); + if (*line == '\n') + ++line; + } else { + ++line; + } + } + if (*line == '\n') { cp = line++; } else { cp = line; } + /* Now back cp up to be the last nonspace character */ while (cp>val && TOR_ISSPACE(*(cp-1))) --cp; tor_assert(cp >= val); + + /* Now copy out and decode the value. */ *value_out = tor_strndup(val, cp-val); + if (continuation) { + char *v_out, *v_in; + v_out = v_in = *value_out; + while (*v_in) { + if (*v_in == '#') { + do { + ++v_in; + } while (*v_in && *v_in != '\n'); + if (*v_in == '\n') + ++v_in; + } else if (v_in[0] == '\\' && v_in[1] == '\n') { + v_in += 2; + } else { + *v_out++ = *v_in++; + } + } + *v_out = '\0'; + } } if (*line == '#') { @@ -2793,3 +2863,17 @@ write_pidfile(char *filename) } } +#ifdef MS_WINDOWS +HANDLE +load_windows_system_library(const TCHAR *library_name) +{ + TCHAR path[MAX_PATH]; + unsigned n; + n = GetSystemDirectory(path, MAX_PATH); + if (n == 0 || n + _tcslen(library_name) + 2 >= MAX_PATH) + return 0; + _tcscat(path, TEXT("\\")); + _tcscat(path, library_name); + return LoadLibrary(path); +} +#endif diff --git a/src/common/util.h b/src/common/util.h index 4a31c277e3..833fd904c7 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -340,6 +340,10 @@ void start_daemon(void); void finish_daemon(const char *desired_cwd); void write_pidfile(char *filename); +#ifdef MS_WINDOWS +HANDLE load_windows_system_library(const TCHAR *library_name); +#endif + const char *libor_get_digests(void); #endif diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index be435b950a..fde2e7f494 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -3228,8 +3228,6 @@ entry_guard_set_status(entry_guard_t *e, routerinfo_t *ri, char buf[HEX_DIGEST_LEN+1]; int changed = 0; - tor_assert(options); - *reason = NULL; /* Do we want to mark this guard as bad? */ @@ -3487,9 +3485,8 @@ add_an_entry_guard(routerinfo_t *chosen, int reset_status) /** If the use of entry guards is configured, choose more entry guards * until we have enough in the list. */ static void -pick_entry_guards(void) +pick_entry_guards(or_options_t *options) { - or_options_t *options = get_options(); int changed = 0; tor_assert(entry_guards); @@ -3521,10 +3518,9 @@ entry_guard_free(entry_guard_t *e) * or which was selected by a version of Tor that's known to select * entry guards badly. */ static int -remove_obsolete_entry_guards(void) +remove_obsolete_entry_guards(time_t now) { int changed = 0, i; - time_t now = time(NULL); for (i = 0; i < smartlist_len(entry_guards); ++i) { entry_guard_t *entry = smartlist_get(entry_guards, i); @@ -3584,11 +3580,10 @@ remove_obsolete_entry_guards(void) * long that we don't think they'll come up again. Return 1 if we * removed any, or 0 if we did nothing. */ static int -remove_dead_entry_guards(void) +remove_dead_entry_guards(time_t now) { char dbuf[HEX_DIGEST_LEN+1]; char tbuf[ISO_TIME_LEN+1]; - time_t now = time(NULL); int i; int changed = 0; @@ -3623,23 +3618,18 @@ remove_dead_entry_guards(void) * think that things are unlisted. */ void -entry_guards_compute_status(void) +entry_guards_compute_status(or_options_t *options, time_t now) { - time_t now; int changed = 0; int severity = LOG_DEBUG; - or_options_t *options; digestmap_t *reasons; if (! entry_guards) return; - options = get_options(); if (options->EntryNodes) /* reshuffle the entry guard list if needed */ entry_nodes_should_be_added(); - now = time(NULL); - reasons = digestmap_new(); SMARTLIST_FOREACH_BEGIN(entry_guards, entry_guard_t *, entry) { @@ -3655,7 +3645,7 @@ entry_guards_compute_status(void) } SMARTLIST_FOREACH_END(entry); - if (remove_dead_entry_guards()) + if (remove_dead_entry_guards(now)) changed = 1; severity = changed ? LOG_DEBUG : LOG_INFO; @@ -3820,9 +3810,8 @@ entry_nodes_should_be_added(void) /** Add all nodes in EntryNodes that aren't currently guard nodes to the list * of guard nodes, at the front. */ static void -entry_guards_prepend_from_config(void) +entry_guards_prepend_from_config(or_options_t *options) { - or_options_t *options = get_options(); smartlist_t *entry_routers, *entry_fps; smartlist_t *old_entry_guards_on_list, *old_entry_guards_not_on_list; tor_assert(entry_guards); @@ -3950,11 +3939,11 @@ choose_random_entry(cpath_build_state_t *state) entry_guards = smartlist_create(); if (should_add_entry_nodes) - entry_guards_prepend_from_config(); + entry_guards_prepend_from_config(options); if (!entry_list_is_constrained(options) && smartlist_len(entry_guards) < options->NumEntryGuards) - pick_entry_guards(); + pick_entry_guards(options); retry: smartlist_clear(live_entry_guards); @@ -4183,7 +4172,7 @@ entry_guards_parse_state(or_state_t *state, int set, char **msg) entry_guards_dirty = 0; /* XXX022 hand new_entry_guards to this func, and move it up a * few lines, so we don't have to re-dirty it */ - if (remove_obsolete_entry_guards()) + if (remove_obsolete_entry_guards(now)) entry_guards_dirty = 1; } digestmap_free(added_by, _tor_free); @@ -4488,9 +4477,8 @@ retry_bridge_descriptor_fetch_directly(const char *digest) * descriptor, fetch a new copy of its descriptor -- either directly * from the bridge or via a bridge authority. */ void -fetch_bridge_descriptors(time_t now) +fetch_bridge_descriptors(or_options_t *options, time_t now) { - or_options_t *options = get_options(); int num_bridge_auths = get_n_authorities(BRIDGE_AUTHORITY); int ask_bridge_directly; int can_use_bridge_authority; @@ -4570,6 +4558,10 @@ learned_bridge_descriptor(routerinfo_t *ri, int from_cache) add_an_entry_guard(ri, 1); log_notice(LD_DIR, "new bridge descriptor '%s' (%s)", ri->nickname, from_cache ? "cached" : "fresh"); + /* set entry->made_contact so if it goes down we don't drop it from + * our entry node list */ + entry_guard_register_connect_status(ri->cache_info.identity_digest, + 1, 0, now); if (first) routerlist_retry_directory_downloads(now); } @@ -4610,48 +4602,63 @@ any_pending_bridge_descriptor_fetches(void) return 0; } -/** Return 1 if we have at least one descriptor for a bridge and - * all descriptors we know are down. Else return 0. If <b>act</b> is - * 1, then mark the down bridges up; else just observe and report. */ +/** Return 1 if we have at least one descriptor for an entry guard + * (bridge or member of EntryNodes) and all descriptors we know are + * down. Else return 0. If <b>act</b> is 1, then mark the down guards + * up; else just observe and report. */ static int -bridges_retry_helper(int act) +entries_retry_helper(or_options_t *options, int act) { routerinfo_t *ri; int any_known = 0; int any_running = 0; + int purpose = options->UseBridges ? + ROUTER_PURPOSE_BRIDGE : ROUTER_PURPOSE_GENERAL; if (!entry_guards) entry_guards = smartlist_create(); SMARTLIST_FOREACH(entry_guards, entry_guard_t *, e, { ri = router_get_by_digest(e->identity); - if (ri && ri->purpose == ROUTER_PURPOSE_BRIDGE) { + if (ri && ri->purpose == purpose) { any_known = 1; if (ri->is_running) - any_running = 1; /* some bridge is both known and running */ - else if (act) { /* mark it for retry */ - ri->is_running = 1; + any_running = 1; /* some entry is both known and running */ + else if (act) { + /* Mark all current connections to this OR as unhealthy, since + * otherwise there could be one that started 30 seconds + * ago, and in 30 seconds it will time out, causing us to mark + * the node down and undermine the retry attempt. We mark even + * the established conns, since if the network just came back + * we'll want to attach circuits to fresh conns. */ + connection_or_set_bad_connections(ri->cache_info.identity_digest, 1); + + /* mark this entry node for retry */ + router_set_status(ri->cache_info.identity_digest, 1); e->can_retry = 1; e->bad_since = 0; } } }); - log_debug(LD_DIR, "any_known %d, any_running %d", any_known, any_running); + log_debug(LD_DIR, "%d: any_known %d, any_running %d", + act, any_known, any_running); return any_known && !any_running; } -/** Do we know any descriptors for our bridges, and are they all - * down? */ +/** Do we know any descriptors for our bridges / entrynodes, and are + * all the ones we have descriptors for down? */ int -bridges_known_but_down(void) +entries_known_but_down(or_options_t *options) { - return bridges_retry_helper(0); + tor_assert(entry_list_is_constrained(options)); + return entries_retry_helper(options, 0); } -/** Mark all down known bridges up. */ +/** Mark all down known bridges / entrynodes up. */ void -bridges_retry_all(void) +entries_retry_all(or_options_t *options) { - bridges_retry_helper(1); + tor_assert(entry_list_is_constrained(options)); + entries_retry_helper(options, 1); } /** Release all storage held by the list of entry guards and related diff --git a/src/or/circuitbuild.h b/src/or/circuitbuild.h index 7cc5c2877a..9a8e4c3879 100644 --- a/src/or/circuitbuild.h +++ b/src/or/circuitbuild.h @@ -50,7 +50,7 @@ void extend_info_free(extend_info_t *info); routerinfo_t *build_state_get_exit_router(cpath_build_state_t *state); const char *build_state_get_exit_nickname(cpath_build_state_t *state); -void entry_guards_compute_status(void); +void entry_guards_compute_status(or_options_t *options, time_t now); int entry_guard_register_connect_status(const char *digest, int succeeded, int mark_relay_status, time_t now); void entry_nodes_should_be_added(void); @@ -69,12 +69,12 @@ learned_router_identity(tor_addr_t *addr, uint16_t port, const char *digest); void bridge_add_from_config(const tor_addr_t *addr, uint16_t port, char *digest); void retry_bridge_descriptor_fetch_directly(const char *digest); -void fetch_bridge_descriptors(time_t now); +void fetch_bridge_descriptors(or_options_t *options, time_t now); void learned_bridge_descriptor(routerinfo_t *ri, int from_cache); int any_bridge_descriptors_known(void); int any_pending_bridge_descriptor_fetches(void); -int bridges_known_but_down(void); -void bridges_retry_all(void); +int entries_known_but_down(or_options_t *options); +void entries_retry_all(or_options_t *options); void entry_guards_free_all(void); diff --git a/src/or/circuituse.c b/src/or/circuituse.c index d9c16c139e..36dc1c1643 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -974,8 +974,19 @@ circuit_build_failed(origin_circuit_t *circ) * to blame, blame it. Also, avoid this relay for a while, and * fail any one-hop directory fetches destined for it. */ const char *n_conn_id = circ->cpath->extend_info->identity_digest; + int already_marked = 0; if (circ->_base.n_conn) { or_connection_t *n_conn = circ->_base.n_conn; + if (n_conn->is_bad_for_new_circs) { + /* We only want to blame this router when a fresh healthy + * connection fails. So don't mark this router as newly failed, + * since maybe this was just an old circuit attempt that's + * finally timing out now. Also, there's no need to blow away + * circuits/streams/etc, since the failure of an unhealthy conn + * doesn't tell us much about whether a healthy conn would + * succeed. */ + already_marked = 1; + } log_info(LD_OR, "Our circuit failed to get a response from the first hop " "(%s:%d). I'm going to try to rotate to a better connection.", @@ -985,7 +996,7 @@ circuit_build_failed(origin_circuit_t *circ) log_info(LD_OR, "Our circuit died before the first hop with no connection"); } - if (n_conn_id) { + if (n_conn_id && !already_marked) { entry_guard_register_connect_status(n_conn_id, 0, 1, time(NULL)); /* if there are any one-hop streams waiting on this circuit, fail * them now so they can retry elsewhere. */ @@ -1211,11 +1222,13 @@ circuit_get_open_circ_or_launch(edge_connection_t *conn, int severity = LOG_NOTICE; /* FFFF if this is a tunneled directory fetch, don't yell * as loudly. the user doesn't even know it's happening. */ - if (options->UseBridges && bridges_known_but_down()) { + if (entry_list_is_constrained(options) && + entries_known_but_down(options)) { log_fn(severity, LD_APP|LD_DIR, "Application request when we haven't used client functionality " - "lately. Optimistically trying known bridges again."); - bridges_retry_all(); + "lately. Optimistically trying known %s again.", + options->UseBridges ? "bridges" : "entrynodes"); + entries_retry_all(options); } else if (!options->UseBridges || any_bridge_descriptors_known()) { log_fn(severity, LD_APP|LD_DIR, "Application request when we haven't used client functionality " diff --git a/src/or/config.c b/src/or/config.c index 8febe7a56b..d66f9136b7 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -327,7 +327,7 @@ static config_var_t _option_vars[] = { V(RecommendedClientVersions, LINELIST, NULL), V(RecommendedServerVersions, LINELIST, NULL), OBSOLETE("RedirectExit"), - V(RefuseUnknownExits, BOOL, "0"), + V(RefuseUnknownExits, STRING, "auto"), V(RejectPlaintextPorts, CSV, ""), V(RelayBandwidthBurst, MEMUNIT, "0"), V(RelayBandwidthRate, MEMUNIT, "0"), @@ -1231,6 +1231,18 @@ options_act(or_options_t *old_options) if (accounting_is_enabled(options)) configure_accounting(time(NULL)); + /* parse RefuseUnknownExits tristate */ + if (!strcmp(options->RefuseUnknownExits, "0")) + options->RefuseUnknownExits_ = 0; + else if (!strcmp(options->RefuseUnknownExits, "1")) + options->RefuseUnknownExits_ = 1; + else if (!strcmp(options->RefuseUnknownExits, "auto")) + options->RefuseUnknownExits_ = -1; + else { + /* Should have caught this in options_validate */ + return -1; + } + /* Change the cell EWMA settings */ cell_ewma_set_scale_factor(options, networkstatus_get_latest_consensus()); @@ -2997,6 +3009,12 @@ options_validate(or_options_t *old_options, or_options_t *options, REJECT("Failed to resolve/guess local address. See logs for details."); } + if (strcmp(options->RefuseUnknownExits, "0") && + strcmp(options->RefuseUnknownExits, "1") && + strcmp(options->RefuseUnknownExits, "auto")) { + REJECT("RefuseUnknownExits must be 0, 1, or auto"); + } + #ifndef MS_WINDOWS if (options->RunAsDaemon && torrc_fname && path_is_relative(torrc_fname)) REJECT("Can't use a relative path to torrc when RunAsDaemon is set."); diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 6a3a5ef0a9..da0fc1856c 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -2488,6 +2488,7 @@ connection_exit_begin_conn(cell_t *cell, circuit_t *circ) char *address=NULL; uint16_t port; or_circuit_t *or_circ = NULL; + or_options_t *options = get_options(); assert_circuit_ok(circ); if (!CIRCUIT_IS_ORIGIN(circ)) @@ -2500,7 +2501,7 @@ connection_exit_begin_conn(cell_t *cell, circuit_t *circ) * that we have a stream connected to a circuit, and we don't connect to a * circuit until we have a pending/successful resolve. */ - if (!server_mode(get_options()) && + if (!server_mode(options) && circ->purpose != CIRCUIT_PURPOSE_S_REND_JOINED) { log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, "Relay begin cell at non-server. Closing."); @@ -2533,19 +2534,16 @@ connection_exit_begin_conn(cell_t *cell, circuit_t *circ) tor_free(address); return 0; } - if (or_circ && or_circ->p_conn && !get_options()->AllowSingleHopExits && + if (or_circ && or_circ->p_conn && !options->AllowSingleHopExits && (or_circ->is_first_hop || (!connection_or_digest_is_known_relay( or_circ->p_conn->identity_digest) && -// XXX022 commented out so we can test it first in 0.2.2.11 -RD -// networkstatus_get_param(NULL, "refuseunknownexits", 1)))) { - get_options()->RefuseUnknownExits))) { + should_refuse_unknown_exits(options)))) { /* Don't let clients use us as a single-hop proxy, unless the user * has explicitly allowed that in the config. It attracts attackers * and users who'd be better off with, well, single-hop proxies. */ -// log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, - log_notice(LD_PROTOCOL, + log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, "Attempt by %s to open a stream %s. Closing.", safe_str(or_circ->p_conn->_base.address), or_circ->is_first_hop ? "on first hop of circuit" : @@ -2559,7 +2557,7 @@ connection_exit_begin_conn(cell_t *cell, circuit_t *circ) return 0; } } else if (rh.command == RELAY_COMMAND_BEGIN_DIR) { - if (!directory_permits_begindir_requests(get_options()) || + if (!directory_permits_begindir_requests(options) || circ->purpose != CIRCUIT_PURPOSE_OR) { relay_send_end_cell_from_edge(rh.stream_id, circ, END_STREAM_REASON_NOTDIRECTORY, NULL); diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 6b648b124d..09f310a3df 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -606,11 +606,24 @@ connection_or_get_for_extend(const char *digest, #define TIME_BEFORE_OR_CONN_IS_TOO_OLD (60*60*24*7) /** Given the head of the linked list for all the or_connections with a given - * identity, set elements of that list as is_bad_for_new_circs() as - * appropriate. Helper for connection_or_set_bad_connections(). + * identity, set elements of that list as is_bad_for_new_circs as + * appropriate. Helper for connection_or_set_bad_connections(). + * + * Specifically, we set the is_bad_for_new_circs flag on: + * - all connections if <b>force</b> is true. + * - all connections that are too old. + * - all open non-canonical connections for which a canonical connection + * exists to the same router. + * - all open canonical connections for which a 'better' canonical + * connection exists to the same router. + * - all open non-canonical connections for which a 'better' non-canonical + * connection exists to the same router at the same address. + * + * See connection_or_is_better() for our idea of what makes one OR connection + * better than another. */ static void -connection_or_group_set_badness(or_connection_t *head) +connection_or_group_set_badness(or_connection_t *head, int force) { or_connection_t *or_conn = NULL, *best = NULL; int n_old = 0, n_inprogress = 0, n_canonical = 0, n_other = 0; @@ -622,8 +635,9 @@ connection_or_group_set_badness(or_connection_t *head) if (or_conn->_base.marked_for_close || or_conn->is_bad_for_new_circs) continue; - if (or_conn->_base.timestamp_created + TIME_BEFORE_OR_CONN_IS_TOO_OLD - < now) { + if (force || + or_conn->_base.timestamp_created + TIME_BEFORE_OR_CONN_IS_TOO_OLD + < now) { log_info(LD_OR, "Marking OR conn to %s:%d as too old for new circuits " "(fd %d, %d secs old).", @@ -718,27 +732,20 @@ connection_or_group_set_badness(or_connection_t *head) } } -/** Go through all the OR connections, and set the is_bad_for_new_circs - * flag on: - * - all connections that are too old. - * - all open non-canonical connections for which a canonical connection - * exists to the same router. - * - all open canonical connections for which a 'better' canonical - * connection exists to the same router. - * - all open non-canonical connections for which a 'better' non-canonical - * connection exists to the same router at the same address. - * - * See connection_or_is_better() for our idea of what makes one OR connection - * better than another. +/** Go through all the OR connections (or if <b>digest</b> is non-NULL, just + * the OR connections with that digest), and set the is_bad_for_new_circs + * flag based on the rules in connection_or_group_set_badness() (or just + * always set it if <b>force</b> is true). */ void -connection_or_set_bad_connections(void) +connection_or_set_bad_connections(const char *digest, int force) { if (!orconn_identity_map) return; DIGESTMAP_FOREACH(orconn_identity_map, identity, or_connection_t *, conn) { - connection_or_group_set_badness(conn); + if (!digest || !memcmp(digest, conn->identity_digest, DIGEST_LEN)) + connection_or_group_set_badness(conn, force); } DIGESTMAP_FOREACH_END; } diff --git a/src/or/connection_or.h b/src/or/connection_or.h index 717630217c..216a9bd648 100644 --- a/src/or/connection_or.h +++ b/src/or/connection_or.h @@ -18,7 +18,7 @@ or_connection_t *connection_or_get_for_extend(const char *digest, const tor_addr_t *target_addr, const char **msg_out, int *launch_out); -void connection_or_set_bad_connections(void); +void connection_or_set_bad_connections(const char *digest, int force); int connection_or_reached_eof(or_connection_t *conn); int connection_or_process_inbuf(or_connection_t *conn); diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 3fcf1783d7..8ae03424a2 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -1153,18 +1153,21 @@ directory_fetches_from_authorities(or_options_t *options) { routerinfo_t *me; uint32_t addr; + int refuseunknown; if (options->FetchDirInfoEarly) return 1; if (options->BridgeRelay == 1) return 0; if (server_mode(options) && router_pick_published_address(options, &addr)<0) return 1; /* we don't know our IP address; ask an authority. */ - if (options->DirPort == 0 && !options->RefuseUnknownExits) + refuseunknown = router_my_exit_policy_is_reject_star() && + should_refuse_unknown_exits(options); + if (options->DirPort == 0 && !refuseunknown) return 0; if (!server_mode(options) || !advertised_server_mode()) return 0; me = router_get_my_routerinfo(); - if (!me || (!me->dir_port && !options->RefuseUnknownExits)) + if (!me || (!me->dir_port && !refuseunknown)) return 0; /* if dirport not advertised, return 0 too */ return 1; } @@ -1208,7 +1211,10 @@ directory_caches_dir_info(or_options_t *options) return 1; if (!server_mode(options) || !advertised_server_mode()) return 0; - return options->RefuseUnknownExits; + /* We need an up-to-date view of network info if we're going to try to + * block exit attempts from unknown relays. */ + return router_my_exit_policy_is_reject_star() && + should_refuse_unknown_exits(options); } /** Return 1 if we want to allow remote people to ask us directory diff --git a/src/or/dirvote.c b/src/or/dirvote.c index eae3bc8a40..dd36a0f911 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -50,7 +50,7 @@ static int dirvote_publish_consensus(void); static char *make_consensus_method_list(int low, int high, const char *sep); /** The highest consensus method that we currently support. */ -#define MAX_SUPPORTED_CONSENSUS_METHOD 9 +#define MAX_SUPPORTED_CONSENSUS_METHOD 10 /** Lowest consensus method that contains a 'directory-footer' marker */ #define MIN_METHOD_FOR_FOOTER 9 @@ -766,15 +766,275 @@ networkstatus_check_weights(int64_t Wgg, int64_t Wgd, int64_t Wmg, if (berr) { log_info(LD_DIR, "Bw weight mismatch %d. G="I64_FORMAT" M="I64_FORMAT - " E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT, + " E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT + " Wmd=%d Wme=%d Wmg=%d Wed=%d Wee=%d" + " Wgd=%d Wgg=%d Wme=%d Wmg=%d", berr, I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), - I64_PRINTF_ARG(D), I64_PRINTF_ARG(T)); + I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), + (int)Wmd, (int)Wme, (int)Wmg, (int)Wed, (int)Wee, + (int)Wgd, (int)Wgg, (int)Wme, (int)Wmg); } return berr; } +/** + * This function computes the bandwidth weights for consensus method 10. + * + * It returns true if weights could be computed, false otherwise. + */ +static int +networkstatus_compute_bw_weights_v10(smartlist_t *chunks, int64_t G, + int64_t M, int64_t E, int64_t D, + int64_t T, int64_t weight_scale) +{ + bw_weights_error_t berr = 0; + int64_t Wgg = -1, Wgd = -1; + int64_t Wmg = -1, Wme = -1, Wmd = -1; + int64_t Wed = -1, Wee = -1; + const char *casename; + char buf[512]; + int r; + + if (G <= 0 || M <= 0 || E <= 0 || D <= 0) { + log_warn(LD_DIR, "Consensus with empty bandwidth: " + "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT + " D="I64_FORMAT" T="I64_FORMAT, + I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), + I64_PRINTF_ARG(D), I64_PRINTF_ARG(T)); + return 0; + } + + /* + * Computed from cases in 3.4.3 of dir-spec.txt + * + * 1. Neither are scarce + * 2. Both Guard and Exit are scarce + * a. R+D <= S + * b. R+D > S + * 3. One of Guard or Exit is scarce + * a. S+D < T/3 + * b. S+D >= T/3 + */ + if (3*E >= T && 3*G >= T) { // E >= T/3 && G >= T/3 + /* Case 1: Neither are scarce. */ + casename = "Case 1 (Wgd=Wmd=Wed)"; + Wgd = weight_scale/3; + Wed = weight_scale/3; + Wmd = weight_scale/3; + Wee = (weight_scale*(E+G+M))/(3*E); + Wme = weight_scale - Wee; + Wmg = (weight_scale*(2*G-E-M))/(3*G); + Wgg = weight_scale - Wmg; + + berr = networkstatus_check_weights(Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed, + weight_scale, G, M, E, D, T, 10, 1); + + if (berr) { + log_warn(LD_DIR, + "Bw Weights error %d for %s v10. G="I64_FORMAT" M="I64_FORMAT + " E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT + " Wmd=%d Wme=%d Wmg=%d Wed=%d Wee=%d" + " Wgd=%d Wgg=%d Wme=%d Wmg=%d weight_scale=%d", + berr, casename, + I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), + I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), + (int)Wmd, (int)Wme, (int)Wmg, (int)Wed, (int)Wee, + (int)Wgd, (int)Wgg, (int)Wme, (int)Wmg, (int)weight_scale); + return 0; + } + } else if (3*E < T && 3*G < T) { // E < T/3 && G < T/3 + int64_t R = MIN(E, G); + int64_t S = MAX(E, G); + /* + * Case 2: Both Guards and Exits are scarce + * Balance D between E and G, depending upon + * D capacity and scarcity. + */ + if (R+D < S) { // Subcase a + Wgg = weight_scale; + Wee = weight_scale; + Wmg = 0; + Wme = 0; + Wmd = 0; + if (E < G) { + casename = "Case 2a (E scarce)"; + Wed = weight_scale; + Wgd = 0; + } else { /* E >= G */ + casename = "Case 2a (G scarce)"; + Wed = 0; + Wgd = weight_scale; + } + } else { // Subcase b: R+D >= S + casename = "Case 2b1 (Wgg=1, Wmd=Wgd)"; + Wee = (weight_scale*(E - G + M))/E; + Wed = (weight_scale*(D - 2*E + 4*G - 2*M))/(3*D); + Wme = (weight_scale*(G-M))/E; + Wmg = 0; + Wgg = weight_scale; + Wmd = (weight_scale - Wed)/2; + Wgd = (weight_scale - Wed)/2; + + berr = networkstatus_check_weights(Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed, + weight_scale, G, M, E, D, T, 10, 1); + + if (berr) { + casename = "Case 2b2 (Wgg=1, Wee=1)"; + Wgg = weight_scale; + Wee = weight_scale; + Wed = (weight_scale*(D - 2*E + G + M))/(3*D); + Wmd = (weight_scale*(D - 2*M + G + E))/(3*D); + Wme = 0; + Wmg = 0; + + if (Wmd < 0) { // Can happen if M > T/3 + casename = "Case 2b3 (Wmd=0)"; + Wmd = 0; + log_warn(LD_DIR, + "Too much Middle bandwidth on the network to calculate " + "balanced bandwidth-weights. Consider increasing the " + "number of Guard nodes by lowering the requirements."); + } + Wgd = weight_scale - Wed - Wmd; + berr = networkstatus_check_weights(Wgg, Wgd, Wmg, Wme, Wmd, Wee, + Wed, weight_scale, G, M, E, D, T, 10, 1); + } + if (berr != BW_WEIGHTS_NO_ERROR && + berr != BW_WEIGHTS_BALANCE_MID_ERROR) { + log_warn(LD_DIR, + "Bw Weights error %d for %s v10. G="I64_FORMAT" M="I64_FORMAT + " E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT + " Wmd=%d Wme=%d Wmg=%d Wed=%d Wee=%d" + " Wgd=%d Wgg=%d Wme=%d Wmg=%d weight_scale=%d", + berr, casename, + I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), + I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), + (int)Wmd, (int)Wme, (int)Wmg, (int)Wed, (int)Wee, + (int)Wgd, (int)Wgg, (int)Wme, (int)Wmg, (int)weight_scale); + return 0; + } + } + } else { // if (E < T/3 || G < T/3) { + int64_t S = MIN(E, G); + // Case 3: Exactly one of Guard or Exit is scarce + if (!(3*E < T || 3*G < T) || !(3*G >= T || 3*E >= T)) { + log_warn(LD_BUG, + "Bw-Weights Case 3 v10 but with G="I64_FORMAT" M=" + I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT, + I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), + I64_PRINTF_ARG(D), I64_PRINTF_ARG(T)); + } + + if (3*(S+D) < T) { // Subcase a: S+D < T/3 + if (G < E) { + casename = "Case 3a (G scarce)"; + Wgg = Wgd = weight_scale; + Wmd = Wed = Wmg = 0; + // Minor subcase, if E is more scarce than M, + // keep its bandwidth in place. + if (E < M) Wme = 0; + else Wme = (weight_scale*(E-M))/(2*E); + Wee = weight_scale-Wme; + } else { // G >= E + casename = "Case 3a (E scarce)"; + Wee = Wed = weight_scale; + Wmd = Wgd = Wme = 0; + // Minor subcase, if G is more scarce than M, + // keep its bandwidth in place. + if (G < M) Wmg = 0; + else Wmg = (weight_scale*(G-M))/(2*G); + Wgg = weight_scale-Wmg; + } + } else { // Subcase b: S+D >= T/3 + // D != 0 because S+D >= T/3 + if (G < E) { + casename = "Case 3bg (G scarce, Wgg=1, Wmd == Wed)"; + Wgg = weight_scale; + Wgd = (weight_scale*(D - 2*G + E + M))/(3*D); + Wmg = 0; + Wee = (weight_scale*(E+M))/(2*E); + Wme = weight_scale - Wee; + Wmd = (weight_scale - Wgd)/2; + Wed = (weight_scale - Wgd)/2; + + berr = networkstatus_check_weights(Wgg, Wgd, Wmg, Wme, Wmd, Wee, + Wed, weight_scale, G, M, E, D, T, 10, 1); + } else { // G >= E + casename = "Case 3be (E scarce, Wee=1, Wmd == Wgd)"; + Wee = weight_scale; + Wed = (weight_scale*(D - 2*E + G + M))/(3*D); + Wme = 0; + Wgg = (weight_scale*(G+M))/(2*G); + Wmg = weight_scale - Wgg; + Wmd = (weight_scale - Wed)/2; + Wgd = (weight_scale - Wed)/2; + + berr = networkstatus_check_weights(Wgg, Wgd, Wmg, Wme, Wmd, Wee, + Wed, weight_scale, G, M, E, D, T, 10, 1); + } + if (berr) { + log_warn(LD_DIR, + "Bw Weights error %d for %s v10. G="I64_FORMAT" M="I64_FORMAT + " E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT + " Wmd=%d Wme=%d Wmg=%d Wed=%d Wee=%d" + " Wgd=%d Wgg=%d Wme=%d Wmg=%d weight_scale=%d", + berr, casename, + I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), + I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), + (int)Wmd, (int)Wme, (int)Wmg, (int)Wed, (int)Wee, + (int)Wgd, (int)Wgg, (int)Wme, (int)Wmg, (int)weight_scale); + return 0; + } + } + } + + /* We cast down the weights to 32 bit ints on the assumption that + * weight_scale is ~= 10000. We need to ensure a rogue authority + * doesn't break this assumption to rig our weights */ + tor_assert(0 < weight_scale && weight_scale < INT32_MAX); + + /* + * Provide Wgm=Wgg, Wmm=1, Wem=Wee, Weg=Wed. May later determine + * that middle nodes need different bandwidth weights for dirport traffic, + * or that weird exit policies need special weight, or that bridges + * need special weight. + * + * NOTE: This list is sorted. + */ + r = tor_snprintf(buf, sizeof(buf), + "bandwidth-weights Wbd=%d Wbe=%d Wbg=%d Wbm=%d " + "Wdb=%d " + "Web=%d Wed=%d Wee=%d Weg=%d Wem=%d " + "Wgb=%d Wgd=%d Wgg=%d Wgm=%d " + "Wmb=%d Wmd=%d Wme=%d Wmg=%d Wmm=%d\n", + (int)Wmd, (int)Wme, (int)Wmg, (int)weight_scale, + (int)weight_scale, + (int)weight_scale, (int)Wed, (int)Wee, (int)Wed, (int)Wee, + (int)weight_scale, (int)Wgd, (int)Wgg, (int)Wgg, + (int)weight_scale, (int)Wmd, (int)Wme, (int)Wmg, (int)weight_scale); + if (r<0) { + log_warn(LD_BUG, + "Not enough space in buffer for bandwidth-weights line."); + *buf = '\0'; + return 0; + } + smartlist_add(chunks, tor_strdup(buf)); + + log_notice(LD_CIRC, "Computed bandwidth weights for %s with v10: " + "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT + " T="I64_FORMAT, + casename, + I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), + I64_PRINTF_ARG(D), I64_PRINTF_ARG(T)); + return 1; +} +/** + * This function computes the bandwidth weights for consensus method 9. + * + * It has been obsoleted in favor of consensus method 10. + */ static void networkstatus_compute_bw_weights_v9(smartlist_t *chunks, int64_t G, int64_t M, int64_t E, int64_t D, int64_t T, @@ -1064,7 +1324,7 @@ networkstatus_compute_bw_weights_v9(smartlist_t *chunks, int64_t G, int64_t M, *buf = '\0'; } smartlist_add(chunks, tor_strdup(buf)); - log_notice(LD_CIRC, "Computed bandwidth weights for %s: " + log_notice(LD_CIRC, "Computed bandwidth weights for %s with v9: " "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT " T="I64_FORMAT, casename, @@ -1101,6 +1361,7 @@ networkstatus_compute_consensus(smartlist_t *votes, const routerstatus_format_type_t rs_format = flavor == FLAV_NS ? NS_V3_CONSENSUS : NS_V3_CONSENSUS_MICRODESC; char *params = NULL; + int added_weights = 0; tor_assert(flavor == FLAV_NS || flavor == FLAV_MICRODESC); tor_assert(total_authorities >= smartlist_len(votes)); @@ -1783,7 +2044,13 @@ networkstatus_compute_consensus(smartlist_t *votes, } } - networkstatus_compute_bw_weights_v9(chunks, G, M, E, D, T, weight_scale); + if (consensus_method < 10) { + networkstatus_compute_bw_weights_v9(chunks, G, M, E, D, T, weight_scale); + added_weights = 1; + } else { + added_weights = networkstatus_compute_bw_weights_v10(chunks, G, M, E, D, + T, weight_scale); + } } /* Add a signature. */ @@ -1873,7 +2140,7 @@ networkstatus_compute_consensus(smartlist_t *votes, return NULL; } // Verify balancing parameters - if (consensus_method >= MIN_METHOD_FOR_BW_WEIGHTS) { + if (consensus_method >= MIN_METHOD_FOR_BW_WEIGHTS && added_weights) { networkstatus_verify_bw_weights(c); } networkstatus_vote_free(c); diff --git a/src/or/eventdns.c b/src/or/eventdns.c index 8ebfb79353..b929303fd5 100644 --- a/src/or/eventdns.c +++ b/src/or/eventdns.c @@ -3131,8 +3131,7 @@ load_nameservers_with_getnetworkparams(void) IP_ADDR_STRING *ns; GetNetworkParams_fn_t fn; - /* XXXX Possibly, we should hardcode the location of this DLL. */ - if (!(handle = LoadLibrary(TEXT("iphlpapi.dll")))) { + if (!(handle = load_windows_system_library(TEXT("iphlpapi.dll")))) { log(EVDNS_LOG_WARN, "Could not open iphlpapi.dll"); /* right now status = 0, doesn't that mean "good" - mikec */ status = -1; diff --git a/src/or/geoip.c b/src/or/geoip.c index 7f1052e98d..ee8d72ee1d 100644 --- a/src/or/geoip.c +++ b/src/or/geoip.c @@ -254,6 +254,8 @@ geoip_get_country_by_ip(uint32_t ipaddr) int geoip_get_n_countries(void) { + if (!geoip_countries) + init_geoip_countries(); return (int) smartlist_len(geoip_countries); } diff --git a/src/or/main.c b/src/or/main.c index 477a274d54..582a1c287b 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -710,7 +710,7 @@ directory_info_has_arrived(time_t now, int from_cache) /* if we have enough dir info, then update our guard status with * whatever we just learned. */ - entry_guards_compute_status(); + entry_guards_compute_status(options, now); /* Don't even bother trying to get extrainfo until the rest of our * directory info is up-to-date */ if (options->DownloadExtraInfo) @@ -912,7 +912,7 @@ run_scheduled_events(time_t now) update_router_descriptor_downloads(now); update_extrainfo_downloads(now); if (options->UseBridges) - fetch_bridge_descriptors(now); + fetch_bridge_descriptors(options, now); if (router_have_minimum_dir_info()) time_to_try_getting_descriptors = now + LAZY_DESCRIPTOR_RETRY_INTERVAL; else @@ -1173,7 +1173,7 @@ run_scheduled_events(time_t now) circuit_expire_old_circuits_serverside(now); /** 5. We do housekeeping for each connection... */ - connection_or_set_bad_connections(); + connection_or_set_bad_connections(NULL, 0); for (i=0;i<smartlist_len(connection_array);i++) { run_connection_housekeeping(i, now); } diff --git a/src/or/ntmain.c b/src/or/ntmain.c index 0b611f0bf1..46e7afb78b 100644 --- a/src/or/ntmain.c +++ b/src/or/ntmain.c @@ -138,8 +138,7 @@ nt_service_loadlibrary(void) if (service_fns.loaded) return; - /* XXXX Possibly, we should hardcode the location of this DLL. */ - if (!(library = LoadLibrary(TEXT("advapi32.dll")))) { + if (!(library = load_windows_system_library(TEXT("advapi32.dll")))) { log_err(LD_GENERAL, "Couldn't open advapi32.dll. Are you trying to use " "NT services on Windows 98? That doesn't work."); goto err; diff --git a/src/or/or.h b/src/or/or.h index 2399ecff39..69b0d6be29 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1047,7 +1047,10 @@ typedef struct or_connection_t { * NETINFO cell listed the address we're connected to as recognized. */ unsigned int is_canonical:1; /** True iff this connection shouldn't get any new circs attached to it, - * because the connection is too old, or because there's a better one, etc. + * because the connection is too old, or because there's a better one. + * More generally, this flag is used to note an unhealthy connection; + * for example, if a bad connection fails we shouldn't assume that the + * router itself has a problem. */ unsigned int is_bad_for_new_circs:1; uint8_t link_proto; /**< What protocol version are we using? 0 for @@ -2472,10 +2475,13 @@ typedef struct { int ConstrainedSockets; /**< Shrink xmit and recv socket buffers. */ uint64_t ConstrainedSockSize; /**< Size of constrained buffers. */ - /** Whether we should drop exit streams from Tors that we don't know - * are relays. XXX022 In here for 0.2.2.11 as a temporary test before - * we switch over to putting it in consensusparams. -RD */ - int RefuseUnknownExits; + /** Whether we should drop exit streams from Tors that we don't know are + * relays. One of "0" (never refuse), "1" (always refuse), or "auto" (do + * what the consensus says, defaulting to 'refuse' if the consensus says + * nothing). */ + char *RefuseUnknownExits; + /** Parsed version of RefuseUnknownExits. -1 for auto. */ + int RefuseUnknownExits_; /** Application ports that require all nodes in circ to have sufficient * uptime. */ diff --git a/src/or/router.c b/src/or/router.c index 978078bf78..621cbaace5 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -18,6 +18,7 @@ #include "geoip.h" #include "hibernate.h" #include "main.h" +#include "networkstatus.h" #include "policies.h" #include "relay.h" #include "rephist.h" @@ -975,6 +976,19 @@ server_mode(or_options_t *options) return (options->ORPort != 0 || options->ORListenAddress); } +/** Return true iff the combination of options in <b>options</b> and parameters + * in the consensus mean that we don't want to allow exits from circuits + * we got from addresses not known to be servers. */ +int +should_refuse_unknown_exits(or_options_t *options) +{ + if (options->RefuseUnknownExits_ != -1) { + return options->RefuseUnknownExits_; + } else { + return networkstatus_get_param(NULL, "refuseunknownexits", 1); + } +} + /** Remember if we've advertised ourselves to the dirservers. */ static int server_is_advertised=0; @@ -1137,6 +1151,17 @@ router_compare_to_my_exit_policy(edge_connection_t *conn) desc_routerinfo->exit_policy) != ADDR_POLICY_ACCEPTED; } +/** Return true iff my exit policy is reject *:*. Return -1 if we don't + * have a descriptor */ +int +router_my_exit_policy_is_reject_star(void) +{ + if (!router_get_my_routerinfo()) /* make sure desc_routerinfo exists */ + return -1; + + return desc_routerinfo->policy_is_reject_star; +} + /** Return true iff I'm a server and <b>digest</b> is equal to * my identity digest. */ int @@ -1300,6 +1325,8 @@ router_rebuild_descriptor(int force) policies_parse_exit_policy(options->ExitPolicy, &ri->exit_policy, options->ExitPolicyRejectPrivate, ri->address, !options->BridgeRelay); + ri->policy_is_reject_star = + policy_is_reject_star(ri->exit_policy); if (desc_routerinfo) { /* inherit values */ ri->is_valid = desc_routerinfo->is_valid; diff --git a/src/or/router.h b/src/or/router.h index d90a7cff90..c17fc78bd0 100644 --- a/src/or/router.h +++ b/src/or/router.h @@ -51,6 +51,7 @@ int server_mode(or_options_t *options); int advertised_server_mode(void); int proxy_mode(or_options_t *options); void consider_publishable_server(int force); +int should_refuse_unknown_exits(or_options_t *options); void router_upload_dir_desc_to_dirservers(int force); void mark_my_descriptor_dirty_if_older_than(time_t when); @@ -60,6 +61,7 @@ void check_descriptor_ipaddress_changed(time_t now); void router_new_address_suggestion(const char *suggestion, const dir_connection_t *d_conn); int router_compare_to_my_exit_policy(edge_connection_t *conn); +int router_my_exit_policy_is_reject_star(void); routerinfo_t *router_get_my_routerinfo(void); extrainfo_t *router_get_my_extrainfo(void); const char *router_get_my_descriptor(void); diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 5fb4fe13c2..a6ca03cde3 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1610,6 +1610,7 @@ smartlist_choose_by_bandwidth_weights(smartlist_t *sl, double *bandwidths; double tmp = 0; unsigned int i; + int have_unknown = 0; /* true iff sl contains element not in consensus. */ /* Can't choose exit and guard at same time */ tor_assert(rule == NO_WEIGHTING || @@ -1726,6 +1727,7 @@ smartlist_choose_by_bandwidth_weights(smartlist_t *sl, this_bw = kb_to_bytes(rs->bandwidth); } else { /* bridge or other descriptor not in our consensus */ this_bw = router_get_advertised_bandwidth_capped(router); + have_unknown = 1; } if (router_digest_is_me(router->cache_info.identity_digest)) is_me = 1; @@ -1756,9 +1758,11 @@ smartlist_choose_by_bandwidth_weights(smartlist_t *sl, /* If there is no bandwidth, choose at random */ if (DBL_TO_U64(weighted_bw) == 0) { - log_warn(LD_CIRC, - "Weighted bandwidth is %lf in node selection for rule %s", - weighted_bw, bandwidth_weight_rule_to_string(rule)); + /* Don't warn when using bridges/relays not in the consensus */ + if (!have_unknown) + log_warn(LD_CIRC, + "Weighted bandwidth is %lf in node selection for rule %s", + weighted_bw, bandwidth_weight_rule_to_string(rule)); tor_free(bandwidths); return smartlist_choose(sl); } @@ -4782,7 +4786,7 @@ update_router_have_minimum_dir_info(void) count_usable_descriptors(&num_present, &num_usable, consensus, options, now, options->EntryNodes); - if (num_usable && (num_present == 0)) { + if (!num_usable || !num_present) { tor_snprintf(dir_info_status, sizeof(dir_info_status), "We have only %d/%d usable entry node descriptors.", num_present, num_usable); diff --git a/src/test/test_util.c b/src/test/test_util.c index 8a13597978..a14d548b8e 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -100,6 +100,15 @@ test_util_config_line(void) "k4#a\n" "k5#abc\n" "k6 val #with comment\n" "kseven \"a quoted 'string\"\n" "k8 \"a \\x71uoted\\n\\\"str\\\\ing\\t\\001\\01\\1\\\"\"\n" + "k9 a line that\\\n spans two lines.\n\n" + "k10 more than\\\n one contin\\\nuation\n" + "k11 \\\ncontinuation at the start\n" + "k12 line with a\\\n#comment\n embedded\n" + "k13\\\ncontinuation at the very start\n" + "k14 a line that has a comment and # ends with a slash \\\n" + "k15 this should be the next new line\n" + "k16 a line that has a comment and # ends without a slash \n" + "k17 this should be the next new line\n" , sizeof(buf)); str = buf; @@ -161,7 +170,54 @@ test_util_config_line(void) test_streq(k, "k8"); test_streq(v, "a quoted\n\"str\\ing\t\x01\x01\x01\""); tor_free(k); tor_free(v); + + str = parse_config_line_from_str(str, &k, &v); + test_streq(k, "k9"); + test_streq(v, "a line that spans two lines."); + tor_free(k); tor_free(v); + + str = parse_config_line_from_str(str, &k, &v); + test_streq(k, "k10"); + test_streq(v, "more than one continuation"); + tor_free(k); tor_free(v); + + str = parse_config_line_from_str(str, &k, &v); + test_streq(k, "k11"); + test_streq(v, "continuation at the start"); + tor_free(k); tor_free(v); + + str = parse_config_line_from_str(str, &k, &v); + test_streq(k, "k12"); + test_streq(v, "line with a embedded"); + tor_free(k); tor_free(v); + + str = parse_config_line_from_str(str, &k, &v); + test_streq(k, "k13"); + test_streq(v, "continuation at the very start"); + tor_free(k); tor_free(v); + + str = parse_config_line_from_str(str, &k, &v); + test_streq(k, "k14"); + test_streq(v, "a line that has a comment and" ); + tor_free(k); tor_free(v); + + str = parse_config_line_from_str(str, &k, &v); + test_streq(k, "k15"); + test_streq(v, "this should be the next new line"); + tor_free(k); tor_free(v); + + str = parse_config_line_from_str(str, &k, &v); + test_streq(k, "k16"); + test_streq(v, "a line that has a comment and" ); + tor_free(k); tor_free(v); + + str = parse_config_line_from_str(str, &k, &v); + test_streq(k, "k17"); + test_streq(v, "this should be the next new line"); + tor_free(k); tor_free(v); + test_streq(str, ""); + done: tor_free(k); tor_free(v); @@ -1139,6 +1195,19 @@ test_util_listdir(void *ptr) } } +#ifdef MS_WINDOWS +static void +test_util_load_win_lib(void *ptr) +{ + HANDLE h = load_windows_system_library("advapi32.dll"); + + tt_assert(h); + done: + if (h) + CloseHandle(h); +} +#endif + #define UTIL_LEGACY(name) \ { #name, legacy_test_helper, 0, &legacy_setup, test_util_ ## name } @@ -1162,6 +1231,9 @@ struct testcase_t util_tests[] = { UTIL_TEST(find_str_at_start_of_line, 0), UTIL_TEST(asprintf, 0), UTIL_TEST(listdir, 0), +#ifdef MS_WINDOWS + UTIL_TEST(load_win_lib, 0), +#endif END_OF_TESTCASES }; |