aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/Makefile.nmake40
-rw-r--r--src/common/address.c26
-rw-r--r--src/common/address.h11
-rw-r--r--src/common/aes.c14
-rw-r--r--src/common/compat.c95
-rw-r--r--src/common/compat.h5
-rw-r--r--src/common/crypto.c16
-rw-r--r--src/common/tortls.c9
-rw-r--r--src/common/util.c35
-rw-r--r--src/config/geoip748
-rw-r--r--src/config/torrc.bridge.in175
-rw-r--r--src/or/Makefile.nmake56
-rw-r--r--src/or/buffers.c2
-rw-r--r--src/or/circuitbuild.c25
-rw-r--r--src/or/circuitbuild.h3
-rw-r--r--src/or/command.c3
-rw-r--r--src/or/config.c91
-rw-r--r--src/or/config.h3
-rw-r--r--src/or/connection.c3
-rw-r--r--src/or/connection_edge.c40
-rw-r--r--src/or/connection_edge.h3
-rw-r--r--src/or/connection_or.c23
-rw-r--r--src/or/control.c15
-rw-r--r--src/or/dirserv.c9
-rw-r--r--src/or/dirserv.h1
-rw-r--r--src/or/dirvote.c10
-rw-r--r--src/or/dns.c4
-rw-r--r--src/or/main.c8
-rw-r--r--src/or/networkstatus.c4
-rw-r--r--src/or/or.h5
-rw-r--r--src/or/rendmid.c13
-rw-r--r--src/or/rephist.c63
-rw-r--r--src/or/rephist.h3
-rw-r--r--src/or/router.c73
-rw-r--r--src/or/router.h1
-rw-r--r--src/or/routerlist.c11
-rw-r--r--src/or/routerparse.c27
-rw-r--r--src/or/routerparse.h2
-rw-r--r--src/or/transports.c79
-rw-r--r--src/test/Makefile.nmake20
-rw-r--r--src/test/test.c3
-rw-r--r--src/test/test_pt.c8
-rw-r--r--src/test/test_util.c159
-rw-r--r--src/tools/Makefile.nmake19
-rw-r--r--src/tools/tor-gencert.c2
-rw-r--r--src/win32/orconfig.h3
46 files changed, 1388 insertions, 580 deletions
diff --git a/src/common/Makefile.nmake b/src/common/Makefile.nmake
index c8b5988666..e548273670 100644
--- a/src/common/Makefile.nmake
+++ b/src/common/Makefile.nmake
@@ -1,20 +1,20 @@
-all: libor.lib libor-crypto.lib libor-event.lib
-
-CFLAGS = /I ..\win32 /I ..\..\..\build-alpha\include
-
-LIBOR_OBJECTS = address.obj compat.obj container.obj di_ops.obj \
- log.obj memarea.obj mempool.obj procmon.obj util.obj \
- util_codedigest.obj
-
-LIBOR_CRYPTO_OBJECTS = aes.obj crypto.obj torgzip.obj tortls.obj
-
-LIBOR_EVENT_OBJECTS = compat_libevent.obj
-
-libor.lib: $(LIBOR_OBJECTS)
- lib $(LIBOR_OBJECTS) /out:libor.lib
-
-libor-crypto.lib: $(LIBOR_CRYPTO_OBJECTS)
- lib $(LIBOR_CRYPTO_OBJECTS) /out:libor-crypto.lib
-
-libor-event.lib: $(LIBOR_EVENT_OBJECTS)
- lib $(LIBOR_EVENT_OBJECTS) /out:libor-event.lib
+all: libor.lib libor-crypto.lib libor-event.lib
+
+CFLAGS = /I ..\win32 /I ..\..\..\build-alpha\include
+
+LIBOR_OBJECTS = address.obj compat.obj container.obj di_ops.obj \
+ log.obj memarea.obj mempool.obj procmon.obj util.obj \
+ util_codedigest.obj
+
+LIBOR_CRYPTO_OBJECTS = aes.obj crypto.obj torgzip.obj tortls.obj
+
+LIBOR_EVENT_OBJECTS = compat_libevent.obj
+
+libor.lib: $(LIBOR_OBJECTS)
+ lib $(LIBOR_OBJECTS) /out:libor.lib
+
+libor-crypto.lib: $(LIBOR_CRYPTO_OBJECTS)
+ lib $(LIBOR_CRYPTO_OBJECTS) /out:libor-crypto.lib
+
+libor-event.lib: $(LIBOR_EVENT_OBJECTS)
+ lib $(LIBOR_EVENT_OBJECTS) /out:libor-event.lib
diff --git a/src/common/address.c b/src/common/address.c
index 676c485897..e444ef1934 100644
--- a/src/common/address.c
+++ b/src/common/address.c
@@ -986,16 +986,21 @@ tor_dup_addr(const tor_addr_t *addr)
}
}
-/** Return a string representing the address <b>addr</b>. This string is
- * statically allocated, and must not be freed. Each call to
- * <b>fmt_addr</b> invalidates the last result of the function. This
- * function is not thread-safe. */
+/** Return a string representing the address <b>addr</b>. This string
+ * is statically allocated, and must not be freed. Each call to
+ * <b>fmt_addr_impl</b> invalidates the last result of the function.
+ * This function is not thread-safe. If <b>decorate</b> is set, add
+ * brackets to IPv6 addresses.
+ *
+ * It's better to use the wrapper macros of this function:
+ * <b>fmt_addr()</b> and <b>fmt_and_decorate_addr()</b>.
+ */
const char *
-fmt_addr(const tor_addr_t *addr)
+fmt_addr_impl(const tor_addr_t *addr, int decorate)
{
static char buf[TOR_ADDR_BUF_LEN];
if (!addr) return "<null>";
- if (tor_addr_to_str(buf, addr, sizeof(buf), 0))
+ if (tor_addr_to_str(buf, addr, sizeof(buf), decorate))
return buf;
else
return "???";
@@ -1682,3 +1687,12 @@ get_interface_address(int severity, uint32_t *addr)
return r;
}
+/** Return true if we can tell that <b>name</b> is a canonical name for the
+ * loopback address. */
+int
+tor_addr_hostname_is_local(const char *name)
+{
+ return !strcasecmp(name, "localhost") ||
+ !strcasecmp(name, "local") ||
+ !strcasecmpend(name, ".local");
+}
diff --git a/src/common/address.h b/src/common/address.h
index ede035d642..2afec564be 100644
--- a/src/common/address.h
+++ b/src/common/address.h
@@ -135,7 +135,14 @@ tor_addr_eq_ipv4h(const tor_addr_t *a, uint32_t u)
int tor_addr_lookup(const char *name, uint16_t family, tor_addr_t *addr_out);
char *tor_dup_addr(const tor_addr_t *addr) ATTR_MALLOC;
-const char *fmt_addr(const tor_addr_t *addr);
+
+/** Wrapper function of fmt_addr_impl(). It does not decorate IPv6
+ * addresses. */
+#define fmt_addr(a) fmt_addr_impl((a), 0)
+/** Wrapper function of fmt_addr_impl(). It decorates IPv6
+ * addresses. */
+#define fmt_and_decorate_addr(a) fmt_addr_impl((a), 1)
+const char *fmt_addr_impl(const tor_addr_t *addr, int decorate);
const char * fmt_addr32(uint32_t addr);
int get_interface_address6(int severity, sa_family_t family, tor_addr_t *addr);
@@ -193,6 +200,8 @@ int tor_addr_is_loopback(const tor_addr_t *addr);
int tor_addr_port_split(int severity, const char *addrport,
char **address_out, uint16_t *port_out);
+int tor_addr_hostname_is_local(const char *name);
+
/* IPv4 helpers */
int is_internal_IP(uint32_t ip, int for_listening);
int addr_port_lookup(int severity, const char *addrport, char **address,
diff --git a/src/common/aes.c b/src/common/aes.c
index c6bc2a821e..1cb6b86a82 100644
--- a/src/common/aes.c
+++ b/src/common/aes.c
@@ -10,6 +10,20 @@
**/
#include "orconfig.h"
+
+#ifdef _WIN32 /*wrkard for dtls1.h >= 0.9.8m of "#include <winsock.h>"*/
+ #ifndef _WIN32_WINNT
+ #define _WIN32_WINNT 0x0501
+ #endif
+ #define WIN32_LEAN_AND_MEAN
+ #if defined(_MSC_VER) && (_MSC_VER < 1300)
+ #include <winsock.h>
+ #else
+ #include <winsock2.h>
+ #include <ws2tcpip.h>
+ #endif
+#endif
+
#include <openssl/opensslv.h>
#include <assert.h>
#include <stdlib.h>
diff --git a/src/common/compat.c b/src/common/compat.c
index 0e8d144f56..d40e5036ff 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -129,7 +129,7 @@ tor_open_cloexec(const char *path, int flags, unsigned mode)
if (fd >= 0)
return fd;
/* If we got an error, see if it is EINVAL. EINVAL might indicate that,
- * event though we were built on a system with O_CLOEXEC support, we
+ * even though we were built on a system with O_CLOEXEC support, we
* are running on one without. */
if (errno != EINVAL)
return -1;
@@ -554,25 +554,43 @@ const char TOR_TOLOWER_TABLE[256] = {
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,
};
+/** Helper for tor_strtok_r_impl: Advances cp past all characters in
+ * <b>sep</b>, and returns its new value. */
+static char *
+strtok_helper(char *cp, const char *sep)
+{
+ if (sep[1]) {
+ while (*cp && strchr(sep, *cp))
+ ++cp;
+ } else {
+ while (*cp && *cp == *sep)
+ ++cp;
+ }
+ return cp;
+}
+
/** Implementation of strtok_r for platforms whose coders haven't figured out
* how to write one. Hey guys! You can use this code here for free! */
char *
tor_strtok_r_impl(char *str, const char *sep, char **lasts)
{
char *cp, *start;
- if (str)
+ tor_assert(*sep);
+ if (str) {
+ str = strtok_helper(str, sep);
+ if (!*str)
+ return NULL;
start = cp = *lasts = str;
- else if (!*lasts)
+ } else if (!*lasts || !**lasts) {
return NULL;
- else
+ } else {
start = cp = *lasts;
+ }
- tor_assert(*sep);
if (sep[1]) {
while (*cp && !strchr(sep, *cp))
++cp;
} else {
- tor_assert(strlen(sep) == 1);
cp = strchr(cp, *sep);
}
@@ -580,7 +598,7 @@ tor_strtok_r_impl(char *str, const char *sep, char **lasts)
*lasts = NULL;
} else {
*cp++ = '\0';
- *lasts = cp;
+ *lasts = strtok_helper(cp, sep);
}
return start;
}
@@ -980,7 +998,7 @@ tor_open_socket(int domain, int type, int protocol)
if (SOCKET_OK(s))
goto socket_ok;
/* If we got an error, see if it is EINVAL. EINVAL might indicate that,
- * event though we were built on a system with SOCK_CLOEXEC support, we
+ * even though we were built on a system with SOCK_CLOEXEC support, we
* are running on one without. */
if (errno != EINVAL)
return s;
@@ -1013,10 +1031,11 @@ tor_accept_socket(tor_socket_t sockfd, struct sockaddr *addr, socklen_t *len)
s = accept4(sockfd, addr, len, SOCK_CLOEXEC);
if (SOCKET_OK(s))
goto socket_ok;
- /* If we got an error, see if it is EINVAL. EINVAL might indicate that,
- * event though we were built on a system with accept4 support, we
- * are running on one without. */
- if (errno != EINVAL)
+ /* If we got an error, see if it is ENOSYS. ENOSYS indicates that,
+ * even though we were built on a system with accept4 support, we
+ * are running on one without. Also, check for EINVAL, which indicates that
+ * we are missing SOCK_CLOEXEC support. */
+ if (errno != EINVAL && errno != ENOSYS)
return s;
#endif
@@ -1091,7 +1110,7 @@ tor_socketpair(int family, int type, int protocol, tor_socket_t fd[2])
if (r == 0)
goto sockets_ok;
/* If we got an error, see if it is EINVAL. EINVAL might indicate that,
- * event though we were built on a system with SOCK_CLOEXEC support, we
+ * even though we were built on a system with SOCK_CLOEXEC support, we
* are running on one without. */
if (errno != EINVAL)
return -errno;
@@ -1712,7 +1731,7 @@ make_path_absolute(char *fname)
}
#ifndef HAVE__NSGETENVIRON
-#ifndef HAVE_EXTERN_ENVIRON_DECLARED__
+#ifndef HAVE_EXTERN_ENVIRON_DECLARED
/* Some platforms declare environ under some circumstances, others don't. */
extern char **environ;
#endif
@@ -2011,8 +2030,7 @@ get_uname(void)
#ifdef HAVE_UNAME
if (uname(&u) != -1) {
/* (Linux says 0 is success, Solaris says 1 is success) */
- tor_snprintf(uname_result, sizeof(uname_result), "%s %s",
- u.sysname, u.machine);
+ strlcpy(uname_result, u.sysname, sizeof(uname_result));
} else
#endif
{
@@ -2020,8 +2038,6 @@ get_uname(void)
OSVERSIONINFOEX info;
int i;
const char *plat = NULL;
- const char *extra = NULL;
- char acsd[MAX_PATH] = {0};
static struct {
unsigned major; unsigned minor; const char *version;
} win_version_table[] = {
@@ -2046,20 +2062,11 @@ get_uname(void)
uname_result_is_set = 1;
return uname_result;
}
-#ifdef UNICODE
- wcstombs(acsd, info.szCSDVersion, MAX_PATH);
-#else
- strlcpy(acsd, info.szCSDVersion, sizeof(acsd));
-#endif
if (info.dwMajorVersion == 4 && info.dwMinorVersion == 0) {
if (info.dwPlatformId == VER_PLATFORM_WIN32_NT)
plat = "Windows NT 4.0";
else
plat = "Windows 95";
- if (acsd[1] == 'B')
- extra = "OSR2 (B)";
- else if (acsd[1] == 'C')
- extra = "OSR2 (C)";
} else {
for (i=0; win_version_table[i].major>0; ++i) {
if (win_version_table[i].major == info.dwMajorVersion &&
@@ -2069,39 +2076,25 @@ get_uname(void)
}
}
}
- if (plat && !strcmp(plat, "Windows 98")) {
- if (acsd[1] == 'A')
- extra = "SE (A)";
- else if (acsd[1] == 'B')
- extra = "SE (B)";
- }
if (plat) {
- if (!extra)
- extra = acsd;
- tor_snprintf(uname_result, sizeof(uname_result), "%s %s",
- plat, extra);
+ strlcpy(uname_result, plat, sizeof(uname_result));
} else {
if (info.dwMajorVersion > 6 ||
(info.dwMajorVersion==6 && info.dwMinorVersion>2))
tor_snprintf(uname_result, sizeof(uname_result),
- "Very recent version of Windows [major=%d,minor=%d] %s",
- (int)info.dwMajorVersion,(int)info.dwMinorVersion,
- acsd);
+ "Very recent version of Windows [major=%d,minor=%d]",
+ (int)info.dwMajorVersion,(int)info.dwMinorVersion);
else
tor_snprintf(uname_result, sizeof(uname_result),
- "Unrecognized version of Windows [major=%d,minor=%d] %s",
- (int)info.dwMajorVersion,(int)info.dwMinorVersion,
- acsd);
+ "Unrecognized version of Windows [major=%d,minor=%d]",
+ (int)info.dwMajorVersion,(int)info.dwMinorVersion);
}
#if !defined (WINCE)
-#ifdef VER_SUITE_BACKOFFICE
- if (info.wProductType == VER_NT_DOMAIN_CONTROLLER) {
- strlcat(uname_result, " [domain controller]", sizeof(uname_result));
- } else if (info.wProductType == VER_NT_SERVER) {
- strlcat(uname_result, " [server]", sizeof(uname_result));
- } else if (info.wProductType == VER_NT_WORKSTATION) {
- strlcat(uname_result, " [workstation]", sizeof(uname_result));
- }
+#ifdef VER_NT_SERVER
+ if (info.wProductType == VER_NT_SERVER ||
+ info.wProductType == VER_NT_DOMAIN_CONTROLLER) {
+ strlcat(uname_result, " [server]", sizeof(uname_result));
+ }
#endif
#endif
#else
diff --git a/src/common/compat.h b/src/common/compat.h
index 65e6cb49e0..b0ef63badf 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -9,11 +9,8 @@
#include "orconfig.h"
#include "torint.h"
#ifdef _WIN32
-#ifndef WIN32_WINNT
-#define WIN32_WINNT 0x400
-#endif
#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x400
+#define _WIN32_WINNT 0x0501
#endif
#define WIN32_LEAN_AND_MEAN
#if defined(_MSC_VER) && (_MSC_VER < 1300)
diff --git a/src/common/crypto.c b/src/common/crypto.c
index e37b282757..8feac95acf 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -13,11 +13,8 @@
#include "orconfig.h"
#ifdef _WIN32
-#ifndef WIN32_WINNT
-#define WIN32_WINNT 0x400
-#endif
#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x400
+#define _WIN32_WINNT 0x0501
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -1809,7 +1806,6 @@ crypto_get_stored_dynamic_dh_modulus(const char *fname)
char *contents = NULL;
const char *contents_tmp = NULL;
int dh_codes;
- char *fname_new = NULL;
DH *stored_dh = NULL;
BIGNUM *dynamic_dh_modulus = NULL;
int length = 0;
@@ -1884,12 +1880,10 @@ crypto_get_stored_dynamic_dh_modulus(const char *fname)
err:
- { /* move broken prime to $filename.broken */
- fname_new = tor_malloc(strlen(fname) + 8);
-
- /* no can do if these functions return error */
- strlcpy(fname_new, fname, strlen(fname) + 8);
- strlcat(fname_new, ".broken", strlen(fname) + 8);
+ {
+ /* move broken prime to $filename.broken */
+ char *fname_new=NULL;
+ tor_asprintf(&fname_new, "%s.broken", fname);
log_warn(LD_CRYPTO, "Moving broken dynamic DH prime to '%s'.", fname_new);
diff --git a/src/common/tortls.c b/src/common/tortls.c
index cffba2e6ce..1120f3e8be 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -22,11 +22,8 @@
#include <assert.h>
#ifdef _WIN32 /*wrkard for dtls1.h >= 0.9.8m of "#include <winsock.h>"*/
- #ifndef WIN32_WINNT
- #define WIN32_WINNT 0x400
- #endif
#ifndef _WIN32_WINNT
- #define _WIN32_WINNT 0x400
+ #define _WIN32_WINNT 0x0501
#endif
#define WIN32_LEAN_AND_MEAN
#if defined(_MSC_VER) && (_MSC_VER < 1300)
@@ -1370,7 +1367,9 @@ tor_tls_server_info_callback(const SSL *ssl, int type, int val)
/* Now check the cipher list. */
if (tor_tls_client_is_using_v2_ciphers(ssl, ADDR(tls))) {
- /*XXXX_TLS keep this from happening more than once! */
+ if (tls->wasV2Handshake)
+ return; /* We already turned this stuff off for the first handshake;
+ * This is a renegotiation. */
/* Yes, we're casting away the const from ssl. This is very naughty of us.
* Let's hope openssl doesn't notice! */
diff --git a/src/common/util.c b/src/common/util.c
index 276c6dd13b..e7979d85b5 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -870,6 +870,9 @@ tor_digest256_is_zero(const char *digest)
/* Helper: common code to check whether the result of a strtol or strtoul or
* strtoll is correct. */
#define CHECK_STRTOX_RESULT() \
+ /* Did an overflow occur? */ \
+ if (errno == ERANGE) \
+ goto err; \
/* Was at least one character converted? */ \
if (endptr == s) \
goto err; \
@@ -911,6 +914,8 @@ tor_parse_long(const char *s, int base, long min, long max,
*ok = 0;
return 0;
}
+
+ errno = 0;
r = strtol(s, &endptr, base);
CHECK_STRTOX_RESULT();
}
@@ -928,6 +933,8 @@ tor_parse_ulong(const char *s, int base, unsigned long min,
*ok = 0;
return 0;
}
+
+ errno = 0;
r = strtoul(s, &endptr, base);
CHECK_STRTOX_RESULT();
}
@@ -939,6 +946,7 @@ tor_parse_double(const char *s, double min, double max, int *ok, char **next)
char *endptr;
double r;
+ errno = 0;
r = strtod(s, &endptr);
CHECK_STRTOX_RESULT();
}
@@ -958,6 +966,7 @@ tor_parse_uint64(const char *s, int base, uint64_t min,
return 0;
}
+ errno = 0;
#ifdef HAVE_STRTOULL
r = (uint64_t)strtoull(s, &endptr, base);
#elif defined(_WIN32)
@@ -1383,7 +1392,7 @@ format_rfc1123_time(char *buf, time_t t)
tor_assert(tm.tm_wday >= 0);
tor_assert(tm.tm_wday <= 6);
memcpy(buf, WEEKDAY_NAMES[tm.tm_wday], 3);
- tor_assert(tm.tm_wday >= 0);
+ tor_assert(tm.tm_mon >= 0);
tor_assert(tm.tm_mon <= 11);
memcpy(buf+8, MONTH_NAMES[tm.tm_mon], 3);
}
@@ -1413,7 +1422,8 @@ parse_rfc1123_time(const char *buf, time_t *t)
tor_free(esc);
return -1;
}
- if (tm_mday > 31 || tm_hour > 23 || tm_min > 59 || tm_sec > 61) {
+ if (tm_mday < 1 || tm_mday > 31 || tm_hour > 23 || tm_min > 59 ||
+ tm_sec > 60) {
char *esc = esc_for_log(buf);
log_warn(LD_GENERAL, "Got invalid RFC1123 time %s", esc);
tor_free(esc);
@@ -1503,7 +1513,7 @@ int
parse_iso_time(const char *cp, time_t *t)
{
struct tm st_tm;
- unsigned int year=0, month=0, day=0, hour=100, minute=100, second=100;
+ unsigned int year=0, month=0, day=0, hour=0, minute=0, second=0;
if (tor_sscanf(cp, "%u-%2u-%2u %2u:%2u:%2u", &year, &month,
&day, &hour, &minute, &second) < 6) {
char *esc = esc_for_log(cp);
@@ -1512,7 +1522,7 @@ parse_iso_time(const char *cp, time_t *t)
return -1;
}
if (year < 1970 || month < 1 || month > 12 || day < 1 || day > 31 ||
- hour > 23 || minute > 59 || second > 61) {
+ hour > 23 || minute > 59 || second > 60) {
char *esc = esc_for_log(cp);
log_warn(LD_GENERAL, "ISO time %s was nonsensical", esc);
tor_free(esc);
@@ -1552,12 +1562,15 @@ parse_http_time(const char *date, struct tm *tm)
/* First, try RFC1123 or RFC850 format: skip the weekday. */
if ((cp = strchr(date, ','))) {
++cp;
- if (tor_sscanf(date, "%2u %3s %4u %2u:%2u:%2u GMT",
+ if (*cp != ' ')
+ return -1;
+ ++cp;
+ if (tor_sscanf(cp, "%2u %3s %4u %2u:%2u:%2u GMT",
&tm_mday, month, &tm_year,
&tm_hour, &tm_min, &tm_sec) == 6) {
/* rfc1123-date */
tm_year -= 1900;
- } else if (tor_sscanf(date, "%2u-%3s-%2u %2u:%2u:%2u GMT",
+ } else if (tor_sscanf(cp, "%2u-%3s-%2u %2u:%2u:%2u GMT",
&tm_mday, month, &tm_year,
&tm_hour, &tm_min, &tm_sec) == 6) {
/* rfc850-date */
@@ -1582,18 +1595,20 @@ parse_http_time(const char *date, struct tm *tm)
month[3] = '\0';
/* Okay, now decode the month. */
+ /* set tm->tm_mon to dummy value so the check below fails. */
+ tm->tm_mon = -1;
for (i = 0; i < 12; ++i) {
if (!strcasecmp(MONTH_NAMES[i], month)) {
- tm->tm_mon = i+1;
+ tm->tm_mon = i;
}
}
if (tm->tm_year < 0 ||
- tm->tm_mon < 1 || tm->tm_mon > 12 ||
- tm->tm_mday < 0 || tm->tm_mday > 31 ||
+ tm->tm_mon < 0 || tm->tm_mon > 11 ||
+ tm->tm_mday < 1 || tm->tm_mday > 31 ||
tm->tm_hour < 0 || tm->tm_hour > 23 ||
tm->tm_min < 0 || tm->tm_min > 59 ||
- tm->tm_sec < 0 || tm->tm_sec > 61)
+ tm->tm_sec < 0 || tm->tm_sec > 60)
return -1; /* Out of range, or bad month. */
return 0;
diff --git a/src/config/geoip b/src/config/geoip
index a4223eafb0..ebaf7cee4c 100644
--- a/src/config/geoip
+++ b/src/config/geoip
@@ -1,4 +1,4 @@
-# Last updated based on April 3 2012 Maxmind GeoLite Country
+# Last updated based on May 1 2012 Maxmind GeoLite Country
# wget http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip
# cut -d, -f3-5 < GeoIPCountryWhois.csv|sed 's/"//g' > geoip
16777216,16777471,AU
@@ -217,6 +217,37 @@
72348928,72349055,US
72349056,72349119,BM
72349120,83886079,US
+83886080,83951615,SY
+83951616,83959807,UA
+83959808,83961855,ES
+83961856,83963903,CY
+83963904,83965951,RU
+83965952,83967999,CZ
+83968000,83976191,DE
+83976192,83978239,CH
+83978240,83980287,IQ
+83980288,83982335,CH
+83982336,84017151,DE
+84017152,84021247,IT
+84021248,84023295,GB
+84023296,84025343,ES
+84025344,84033535,RU
+84033536,84037631,NL
+84041728,84049919,GB
+84049920,84082687,RO
+84082688,84148223,RU
+84148224,84410367,DE
+84410368,84443135,RU
+84443136,84451327,LB
+84451328,84457471,RU
+84457472,84459519,ES
+84459520,84471807,RU
+84471808,84473855,IQ
+84473856,84475903,HU
+84475904,84541439,DE
+84557824,84574207,NL
+84672512,84934655,RO
+84934656,85196799,RU
100663296,121195295,US
121195296,121195327,IT
121195328,134693119,US
@@ -648,6 +679,7 @@
387164416,387164671,CA
387164672,387825663,US
387825664,387833855,CA
+387833856,387842047,US
387973120,390332415,US
402653184,405012479,US
405012480,405143551,CA
@@ -743,6 +775,7 @@
411172864,411303935,US
411303936,411369471,NL
411369472,411435007,TR
+411435008,411500543,DE
411566080,411639807,US
411639808,411643903,CA
411648000,411664383,CA
@@ -872,7 +905,6 @@
456554496,456555519,PK
456555520,456556543,JP
456556544,456560639,AU
-456560640,456562687,IN
456562688,456564735,CN
456564736,456572927,IN
456572928,456589311,CN
@@ -2745,6 +2777,7 @@
622870528,622874623,AZ
622874624,622878719,IT
622878720,622880767,FR
+622880768,622882815,IT
622882816,622886911,IR
622886912,622919679,GR
622919680,622985215,FI
@@ -4588,10 +4621,130 @@
634503168,634505215,GB
634505216,634507263,IT
634507264,634511359,GB
+634511360,634517503,RU
+634517504,634519551,LB
634519552,634650623,QA
634650624,634912767,BY
634912768,635043839,RO
635043840,635076607,ES
+635076608,635092991,KG
+635092992,635097087,TR
+635097088,635101183,PS
+635101184,635103231,AE
+635103232,635105279,HU
+635105280,635107327,NL
+635107328,635109375,DE
+635109376,635174911,FI
+635174912,635183103,GB
+635183104,635185151,NL
+635185152,635187199,IT
+635187200,635191295,FR
+635191296,635195391,RS
+635195392,635197439,RU
+635197440,635203583,GB
+635203584,635207679,JO
+635207680,635211775,HU
+635211776,635213823,NL
+635213824,635217919,RU
+635217920,635219967,NL
+635219968,635224063,RU
+635224064,635240447,HU
+635240448,635256831,IR
+635256832,635273215,GB
+635273216,635281407,UA
+635281408,635285503,RO
+635285504,635287551,ME
+635287552,635289599,RU
+635289600,635291647,DE
+635291648,635293695,RU
+635293696,635295743,HU
+635295744,635297791,GB
+635297792,635299839,SE
+635299840,635301887,ES
+635301888,635305983,CZ
+635305984,635437055,NL
+635437056,635502591,RO
+635502592,635568127,PL
+635568128,635699199,IT
+635699200,635715583,PL
+635715584,635717631,KZ
+635717632,635719679,NL
+635719680,635723775,RU
+635723776,635725823,ES
+635727872,635729919,RU
+635729920,635731967,GB
+635731968,635748351,DE
+635748352,635764735,IE
+635764736,635830271,UA
+635830272,635842559,DE
+635842560,635846655,GB
+635846656,635854847,ES
+635854848,635856895,NL
+635856896,635858943,TR
+635858944,635860991,LU
+635860992,635863039,BE
+635863040,635895807,RU
+635895808,635961343,KW
+635961344,635994111,GE
+635994112,636026879,RU
+636026880,636043263,MD
+636043264,636047359,SE
+636047360,636049407,RU
+636049408,636051455,FI
+636051456,636055551,PL
+636055552,636057599,RU
+636057600,636059647,CH
+636059648,636092415,GE
+636092416,636157951,HU
+636157952,636159999,AT
+636160000,636162047,NL
+636162048,636166143,IR
+636166144,636168191,ES
+636168192,636170239,GB
+636170240,636174335,AT
+636174336,636176383,RU
+636176384,636178431,TR
+636178432,636180479,NL
+636180480,636182527,FR
+636182528,636186623,CZ
+636186624,636188671,NL
+636188672,636190719,GB
+636190720,636223487,RU
+636223488,636485631,IQ
+636485632,636747775,SA
+636747776,636780543,DE
+636780544,636813311,HR
+636813312,636878847,AE
+636878848,636944383,MD
+636944384,636952575,SE
+636952576,636956671,NL
+636956672,636958719,IT
+636958720,636960767,PL
+636960768,636968959,DE
+636968960,636975103,TR
+636975104,636977151,ES
+636977152,637140991,PL
+637140992,637206527,SE
+637206528,637239295,NL
+637239296,637272063,RO
+637272064,637276159,GB
+637276160,637278207,RU
+637278208,637288447,GB
+637288448,637296639,AM
+637296640,637298687,ES
+637298688,637300735,DE
+637300736,637302783,NO
+637304832,637313023,CH
+637313024,637317119,EU
+637317120,637319167,CH
+637319168,637321215,AT
+637321216,637323263,GB
+637323264,637325311,FR
+637325312,637327359,NO
+637327360,637329407,IR
+637329408,637337599,AT
+637337600,637403135,NO
+637403136,637534207,IR
637534208,644067391,US
644067392,644067455,CA
644067456,644835071,US
@@ -4625,6 +4778,8 @@
691621888,691625983,LR
691625984,691630079,KE
691630080,691631103,ZA
+691632128,691633151,NG
+691633152,691634175,ZW
691634176,691650559,ZA
691650560,691666943,GH
691666944,691732479,NG
@@ -4741,6 +4896,8 @@
692955136,692957183,NG
692957184,692959231,DZ
692959232,692961279,GN
+692961280,692963327,TZ
+692963328,692965375,ZA
692967424,692968447,NG
692968448,692969471,CD
692969472,692971519,TZ
@@ -13580,6 +13737,9 @@
1045748480,1045748735,SE
1045748736,1045749503,GB
1045749504,1045749759,SE
+1045749760,1045753855,SI
+1045753856,1045755903,NL
+1045755904,1045757951,UA
1045757952,1045790719,LV
1045790720,1045798911,FR
1045798912,1045889023,IT
@@ -43398,6 +43558,7 @@
1307189248,1307191295,DE
1307191296,1307193343,CZ
1307193344,1307195391,NO
+1307195392,1307197439,CH
1307197440,1307205631,HU
1307205632,1307213823,FI
1307213824,1307219239,SI
@@ -52207,6 +52368,7 @@
1398833152,1398840447,NL
1398840448,1398840575,GB
1398840576,1398865919,NL
+1398865920,1398867967,CZ
1398867968,1398870015,NL
1398870016,1398872063,PL
1398872064,1398874111,BG
@@ -63230,7 +63392,7 @@
1539711744,1539711999,DE
1539712000,1539712255,UA
1539712256,1539712511,NL
-1539712512,1539712767,RU
+1539712512,1539713023,RU
1539713024,1539713279,UA
1539713280,1539713535,FR
1539713536,1539713791,DK
@@ -63273,6 +63435,7 @@
1539724032,1539724287,UA
1539724288,1539724543,IT
1539724544,1539724799,RU
+1539724800,1539725055,GB
1539725056,1539725311,NL
1539725312,1539725567,FR
1539725568,1539725823,PL
@@ -63318,6 +63481,7 @@
1539736576,1539736831,BG
1539736832,1539737087,UA
1539737088,1539737343,KW
+1539737344,1539737599,SE
1539737600,1539737855,RO
1539737856,1539738111,DE
1539738112,1539738367,DK
@@ -63576,6 +63740,7 @@
1539807744,1539807999,GB
1539808000,1539808255,HU
1539808256,1539808511,RU
+1539808512,1539808767,GB
1539808768,1539809023,DE
1539809024,1539809279,GB
1539809280,1539809535,EU
@@ -65203,6 +65368,7 @@
1540743680,1540743935,PL
1540743936,1540744191,CH
1540744192,1540744447,GR
+1540744448,1540744703,FR
1540744704,1540744959,GB
1540744960,1540745215,UA
1540745216,1540745471,DE
@@ -65415,7 +65581,6 @@
1540906752,1540907007,BG
1540907008,1540907263,RU
1540907264,1540907519,MD
-1540907520,1540907775,CZ
1540907776,1540908031,PL
1540908032,1540908287,NL
1540908288,1540908543,DK
@@ -66027,6 +66192,7 @@
1541195264,1541195519,UA
1541195520,1541195775,GB
1541195776,1541196031,FR
+1541196032,1541196287,CZ
1541196288,1541196543,RU
1541196544,1541197055,UA
1541197056,1541197311,PL
@@ -66120,6 +66286,8 @@
1541233664,1541234175,SK
1541234176,1541234687,RO
1541234688,1541235199,NL
+1541235200,1541235455,RU
+1541235456,1541235711,CZ
1541235712,1541236223,AT
1541236224,1541236735,RU
1541236736,1541237247,DE
@@ -66801,7 +66969,7 @@
1541631488,1541631999,SI
1541632000,1541632511,RU
1541632512,1541632767,NL
-1541633024,1541634303,PL
+1541632768,1541634303,PL
1541634304,1541634559,MD
1541634560,1541635071,PL
1541635072,1541636095,GB
@@ -67869,6 +68037,7 @@
1542253056,1542253567,RU
1542253568,1542253823,LB
1542253824,1542254079,RO
+1542254080,1542254335,RU
1542254336,1542254591,FR
1542254592,1542255615,RO
1542255616,1542256127,BE
@@ -67975,8 +68144,131 @@
1542315008,1542316031,RU
1542316032,1542317567,PL
1542317568,1542317823,RU
+1542317824,1542318079,GB
1542318080,1542319103,UA
-1542319104,1542320127,CZ
+1542319104,1542321151,CZ
+1542321152,1542322175,UA
+1542322176,1542322431,EU
+1542322432,1542322687,CZ
+1542322688,1542322943,UA
+1542322944,1542323199,IL
+1542323200,1542323711,RU
+1542323712,1542324479,IR
+1542324480,1542325247,RU
+1542325248,1542325503,EU
+1542325504,1542325759,UA
+1542325760,1542326271,RS
+1542326272,1542326527,GB
+1542326528,1542326783,UA
+1542326784,1542327295,RU
+1542327296,1542328319,CZ
+1542328320,1542328831,UA
+1542328832,1542329087,TR
+1542329088,1542329343,AT
+1542329344,1542329855,RU
+1542329856,1542330111,GB
+1542330112,1542330367,UA
+1542330368,1542331903,RU
+1542331904,1542332671,BE
+1542332672,1542332927,RU
+1542332928,1542333439,CZ
+1542333440,1542333695,PL
+1542333696,1542335487,RO
+1542335488,1542337023,RU
+1542337024,1542337279,RO
+1542337280,1542337535,SE
+1542337536,1542339839,PL
+1542339840,1542340095,RS
+1542340096,1542340607,PL
+1542340608,1542342143,RU
+1542342144,1542342655,RO
+1542342656,1542343167,FR
+1542343168,1542343679,UA
+1542343680,1542344447,PL
+1542344448,1542345215,RU
+1542345216,1542345727,UA
+1542345728,1542345983,CZ
+1542345984,1542346239,PL
+1542346240,1542346751,RU
+1542346752,1542348287,CZ
+1542348288,1542348799,MD
+1542348800,1542349823,RU
+1542349824,1542351359,CZ
+1542351360,1542351615,BG
+1542351616,1542351871,PL
+1542351872,1542352895,RU
+1542352896,1542353151,CZ
+1542353152,1542353407,SA
+1542353408,1542353663,UA
+1542353664,1542353919,RU
+1542353920,1542354943,IT
+1542354944,1542355711,RU
+1542355712,1542355967,GB
+1542355968,1542356479,PL
+1542356480,1542356735,ES
+1542356736,1542356991,RU
+1542356992,1542357503,CZ
+1542357504,1542357759,GB
+1542357760,1542358015,FR
+1542358016,1542358271,UA
+1542358272,1542358527,CZ
+1542358528,1542359039,PL
+1542359040,1542360063,CZ
+1542360064,1542360319,RU
+1542360320,1542360575,NL
+1542360576,1542361087,PL
+1542361088,1542361343,CH
+1542361344,1542361599,PL
+1542361600,1542362111,UA
+1542362112,1542362623,EU
+1542362624,1542363135,FR
+1542363136,1542363647,DK
+1542363648,1542364159,NL
+1542364160,1542365183,CZ
+1542365184,1542366719,GB
+1542366720,1542367231,PL
+1542367232,1542368255,CZ
+1542368256,1542369279,PL
+1542369280,1542369791,NL
+1542369792,1542370303,PL
+1542370304,1542370815,DE
+1542370816,1542371839,RU
+1542371840,1542372351,RO
+1542372352,1542373375,RU
+1542373376,1542374399,CZ
+1542374400,1542375167,GB
+1542375168,1542375423,BG
+1542375424,1542376447,RU
+1542376448,1542376959,BG
+1542377216,1542377471,RU
+1542377472,1542377983,GB
+1542377984,1542378495,RU
+1542378496,1542378751,DK
+1542378752,1542379007,RU
+1542379008,1542379519,GB
+1542379520,1542379775,PL
+1542379776,1542380031,RU
+1542380032,1542380287,EU
+1542380288,1542380543,BE
+1542380544,1542380799,FR
+1542381056,1542381823,RU
+1542381824,1542382079,AT
+1542382080,1542382335,BE
+1542382336,1542383615,RU
+1542383616,1542384639,PL
+1542384640,1542384895,DE
+1542384896,1542385151,RU
+1542385152,1542385663,CH
+1542385664,1542386687,PL
+1542386688,1542387199,CZ
+1542387200,1542387711,PL
+1542387712,1542387967,CZ
+1542387968,1542388223,RU
+1542388224,1542388479,IT
+1542388480,1542388735,BG
+1542388736,1542389247,RU
+1542389248,1542389503,PL
+1542389504,1542389759,BG
1543503872,1545601023,GB
1545601024,1545673167,SE
1545673168,1545673175,FI
@@ -72860,7 +73152,7 @@
1680539648,1680564223,US
1680564224,1680572415,CA
1680572416,1681915903,US
-1686110208,1687158783,US
+1686110208,1688207359,US
1694498816,1694499839,CN
1694499840,1694500863,ID
1694500864,1694507007,JP
@@ -73371,8 +73663,78 @@
1728561152,1728562175,AU
1728562176,1728562431,VN
1728562432,1728562687,VU
+1728562688,1728563199,JP
1728563200,1728564223,SG
1728564224,1728565247,IN
+1728565248,1728566271,JP
+1728566272,1728569343,CN
+1728569344,1728569599,PH
+1728569600,1728571391,ID
+1728571392,1728572415,AU
+1728572416,1728573439,JP
+1728573440,1728574463,HK
+1728574464,1728575487,KR
+1728575488,1728576511,BD
+1728576512,1728577535,BT
+1728577536,1728578559,KH
+1728578560,1728580607,CN
+1728580608,1728580863,ID
+1728580864,1728581119,VN
+1728581120,1728581631,PK
+1728581632,1728582655,NZ
+1728582656,1728583679,JP
+1728583680,1728584703,MY
+1728584704,1728585215,AU
+1728585216,1728585727,SG
+1728585728,1728586751,CN
+1728586752,1728589823,IN
+1728589824,1728590847,JP
+1728590848,1728591871,CN
+1728591872,1728592895,ID
+1728592896,1728593151,MN
+1728593152,1728593407,AU
+1728593408,1728593663,IN
+1728593664,1728593919,ID
+1728593920,1728595967,JP
+1728595968,1728596479,NZ
+1728596480,1728598015,ID
+1728598016,1728599039,NZ
+1728599040,1728602111,JP
+1728602112,1728603135,ID
+1728603136,1728604159,KR
+1728604160,1728605183,TW
+1728605184,1728606207,CN
+1728606208,1728607231,PK
+1728607232,1728608255,IN
+1728608256,1728608511,SG
+1728608512,1728608767,IN
+1728608768,1728609023,ID
+1728609024,1728610303,IN
+1728610304,1728611327,TH
+1728611328,1728613375,AU
+1728613376,1728614399,NZ
+1728614400,1728615423,MY
+1728615424,1728616447,IN
+1728616448,1728617471,SG
+1728617472,1728618495,CN
+1728618496,1728619519,MY
+1728619520,1728620543,IN
+1728620544,1728622591,AU
+1728622592,1728624639,SG
+1728624640,1728625663,JP
+1728625664,1728626175,IN
+1728626176,1728626431,JP
+1728626432,1728626687,HK
+1728626688,1728627711,IN
+1728627712,1728628735,JP
+1728628736,1728630783,CN
+1728630784,1728631807,TH
+1728631808,1728632319,SG
+1728632320,1728632575,PK
+1728632576,1728633855,IN
+1728633856,1728634879,CN
+1728634880,1728636159,ID
+1728636160,1728636415,AU
1728708608,1728709631,CN
1728709632,1728710655,TW
1728710656,1728710911,AU
@@ -74000,7 +74362,7 @@
1796263168,1796325375,US
1796325376,1796325631,PR
1796325632,1803550719,US
-1809842176,1815805951,US
+1807745024,1815805951,US
1815805952,1815806207,FR
1815806208,1815806253,US
1815806254,1815806261,FR
@@ -76746,7 +77108,7 @@
2001559552,2001567743,KR
2001567744,2001600511,TW
2001600512,2001797119,CN
-2001797120,2001862655,HK
+2001797120,2001862655,SG
2001862656,2001864703,AU
2001864704,2001870847,JP
2001870848,2001879039,KR
@@ -77085,7 +77447,9 @@
2053515264,2053519359,ID
2053519360,2053521407,JP
2053521408,2053529599,CN
-2053529600,2053533695,AU
+2053529600,2053532671,AU
+2053532672,2053533183,NZ
+2053533184,2053533695,AU
2053533696,2053534719,VN
2053534720,2053537791,IN
2053537792,2053636095,JP
@@ -78397,7 +78761,40 @@
2258305024,2258370559,DE
2258370560,2258436095,US
2258436096,2258567167,FR
-2258567168,2258632703,HK
+2258567168,2258567679,US
+2258567680,2258567935,HK
+2258567936,2258583551,US
+2258583552,2258591743,GB
+2258591744,2258593375,AU
+2258593376,2258593535,HK
+2258593536,2258594303,AU
+2258594304,2258594559,HK
+2258594560,2258596095,AU
+2258596096,2258596607,HK
+2258596608,2258597375,AU
+2258597376,2258597439,HK
+2258597440,2258598079,AU
+2258598080,2258598087,TW
+2258598088,2258598639,AU
+2258598640,2258598655,TW
+2258598656,2258601471,AU
+2258601472,2258601983,JP
+2258601984,2258602431,AU
+2258602432,2258602447,HK
+2258602448,2258602879,AU
+2258602880,2258603007,HK
+2258603008,2258604863,AU
+2258604864,2258604927,HK
+2258604928,2258606079,AU
+2258606080,2258606335,HK
+2258606336,2258607871,AU
+2258607872,2258609151,HK
+2258609152,2258609407,AU
+2258609408,2258610303,HK
+2258610304,2258610431,IN
+2258610432,2258610943,HK
+2258610944,2258611071,JP
+2258611072,2258632703,HK
2258632704,2258698239,JP
2258698240,2259222527,US
2259222528,2259288063,DE
@@ -78459,7 +78856,9 @@
2264924160,2264989695,CA
2264989696,2265710591,US
2265710592,2265776127,CA
-2265776128,2276786175,US
+2265776128,2266169343,US
+2266169344,2266234879,CA
+2266234880,2276786175,US
2276786176,2276851711,CA
2276851712,2277769215,US
2277769216,2277834751,GB
@@ -79235,7 +79634,7 @@
2382364672,2385903615,CA
2385903616,2385915903,US
2385915904,2385919999,CA
-2385952768,2385969151,US
+2385920000,2385969151,US
2385969152,2386067455,CA
2386067456,2386083839,US
2386083840,2386624511,CA
@@ -82627,6 +83026,7 @@
2870585344,2870587391,UA
2870587392,2870587647,CZ
2870587648,2870587903,RU
+2870587904,2870588159,DE
2870588160,2870588415,NL
2870588416,2870588927,HU
2870588928,2870589439,PL
@@ -82698,6 +83098,8 @@
2899378176,2899443711,GB
2899443712,2899574783,FR
2899574784,2899902463,GB
+2899902464,2899967999,US
+2899968000,2900099071,CA
2902458368,2902461439,A1
2902461440,2902461695,US
2902461696,2902462463,A1
@@ -89448,7 +89850,6 @@
2946367488,2946375679,KR
2946375680,2946383871,ID
2946383872,2946392063,IN
-2946392064,2946393087,BD
2946394112,2946396159,AU
2946396160,2946400255,JP
2946400256,2946416639,NC
@@ -92480,7 +92881,8 @@
2959763456,2959765503,PL
2959765504,2959767551,RU
2959767552,2959769599,RS
-2959773696,2959777791,RU
+2959769600,2959771647,CZ
+2959771648,2959777791,RU
2959777792,2959783935,LV
2959783936,2959785983,SK
2959785984,2959794175,UA
@@ -92561,6 +92963,26 @@
2960207872,2960211967,RU
2960211968,2960224255,RO
2960224256,2960228351,RU
+2960228352,2960232447,CZ
+2960232448,2960240639,UA
+2960240640,2960244735,RO
+2960244736,2960248831,PL
+2960248832,2960252927,UA
+2960252928,2960261119,EU
+2960261120,2960265215,UA
+2960265216,2960269311,CZ
+2960269312,2960273407,UA
+2960273408,2960275455,CZ
+2960275456,2960277503,RO
+2960277504,2960285695,RU
+2960285696,2960289791,RO
+2960289792,2960320511,CZ
+2960320512,2960322559,PL
+2960322560,2960326655,CZ
+2960326656,2960334847,PL
+2960334848,2960347135,CZ
+2960347136,2960349183,PL
+2960349184,2960361471,CZ
2961178624,2965372927,FR
2965372928,2965766143,RU
2965766144,2965897215,DE
@@ -98920,6 +99342,8 @@
3047424000,3047686143,AR
3047948288,3048079359,CL
3048210432,3048275967,PE
+3048341504,3048472575,PA
+3048472576,3048734719,VE
3053453312,3054501887,ID
3054501888,3054534655,HK
3054534656,3054537727,PH
@@ -100298,7 +100722,9 @@
3120840704,3120857087,AR
3120857088,3120922623,EC
3120922624,3120930815,PA
-3120939008,3120947199,AR
+3120939008,3120949247,AR
+3120949248,3120951295,CL
+3120951296,3120955391,AR
3120955392,3121086463,DO
3121086464,3121151999,UY
3121152000,3121348607,CL
@@ -100315,9 +100741,13 @@
3122298880,3122331647,VE
3122331648,3122364415,BO
3122364416,3122659327,CO
-3122659328,3122675711,GT
-3122675712,3122683903,SV
-3122683904,3122724863,GT
+3122659328,3122675711,CR
+3122675712,3122692095,SV
+3122692096,3122700287,HN
+3122700288,3122716671,CR
+3122716672,3122720767,HN
+3122720768,3122722815,GT
+3122722816,3122724863,SV
3122724864,3122741247,AR
3122741248,3122757631,DO
3122757632,3122774015,EC
@@ -102570,11 +103000,9 @@
3188473856,3188482047,PE
3188482048,3188490239,AR
3188490240,3188498431,CO
-3188498432,3188516351,AR
-3188516352,3188516607,US
-3188516608,3188517119,AR
-3188517120,3188517375,US
-3188517376,3188523007,AR
+3188498432,3188517119,AR
+3188517120,3188517247,US
+3188517248,3188523007,AR
3188523008,3188539391,CO
3188539392,3188543487,CL
3188543488,3188545535,PA
@@ -102615,14 +103043,16 @@
3191091200,3191093247,BO
3191093248,3191095295,AR
3191095296,3191099391,EC
+3191099392,3191103487,AR
3191107584,3191111679,PE
3191111680,3191128063,PY
3191128064,3191132159,EC
3191132160,3191136255,AR
3191136256,3191144447,DO
-3191144448,3191193599,SV
-3191193600,3191197695,HN
-3191197696,3191209983,SV
+3191144448,3191156735,SV
+3191156736,3191169023,HN
+3191169024,3191193599,SV
+3191193600,3191209983,HN
3191209984,3191275519,CL
3191275520,3191341055,AR
3191341056,3191406591,GT
@@ -102642,7 +103072,6 @@
3192946688,3192979455,DO
3192979456,3193044991,PE
3193044992,3193110527,CL
-3193110528,3193143295,CO
3193143296,3193176063,TT
3193176064,3193307135,CO
3193307136,3193438207,SV
@@ -102690,7 +103119,7 @@
3194130432,3194134527,BR
3194134528,3194142719,AR
3194142720,3194159103,CL
-3194159104,3194165247,GT
+3194159104,3194165247,HN
3194165248,3194175487,SV
3194175488,3194177535,AR
3194177536,3194179583,EC
@@ -102715,6 +103144,7 @@
3194441728,3194445823,AR
3194445824,3194454015,CO
3194454016,3194458111,AR
+3194458112,3194462207,CL
3194466304,3194467327,AR
3194467328,3194468351,DO
3194468352,3194469375,US
@@ -102739,13 +103169,14 @@
3194609664,3194613759,AR
3194613760,3194617855,PE
3194617856,3194626047,NI
-3194626048,3194628095,AR
+3194626048,3194630143,AR
3194630144,3194634239,NI
3194634240,3194638335,CR
3194638336,3194640383,AR
+3194640384,3194642431,BZ
3194642432,3194646527,AR
3194646528,3194648575,DO
-3194650624,3194659839,AR
+3194648576,3194659839,AR
3194659840,3194660095,US
3194660096,3194663167,AR
3194663168,3194663423,US
@@ -102754,6 +103185,7 @@
3194666240,3194667007,AR
3194667008,3194675199,GT
3194675200,3194679295,PA
+3194679296,3194683391,BO
3194683392,3194687487,CU
3194687488,3194691583,CO
3194691584,3194699775,BO
@@ -102785,6 +103217,7 @@
3194929152,3194937343,EC
3194937344,3194945535,AR
3194945536,3194953727,GT
+3194953728,3194961919,AR
3194961920,3194970111,EC
3194970112,3194974207,PA
3194974208,3194976255,AR
@@ -102844,7 +103277,7 @@
3195756544,3195763711,AR
3195763712,3195764735,BO
3195764736,3195768831,CR
-3195772928,3195777023,VE
+3195772928,3195781119,VE
3195781120,3195797503,PA
3195797504,3195801599,AR
3195805696,3195807743,NI
@@ -102895,10 +103328,11 @@
3198877696,3198894079,CR
3198910464,3198926847,CL
3198943232,3199467519,AR
-3199500288,3199516671,AR
+3199504384,3199505407,AR
3199533056,3199549439,BO
3199549440,3199565823,AR
3199565824,3199582207,NI
+3199582208,3199598591,HN
3199598592,3199631359,CO
3199631360,3199729663,AR
3199729664,3199762431,NI
@@ -103040,7 +103474,9 @@
3222075136,3222075391,CH
3222075392,3222274047,US
3222290432,3222305535,US
-3222305536,3222313727,SE
+3222305536,3222309119,SE
+3222309120,3222309375,DE
+3222309376,3222313727,SE
3222313728,3222316799,CH
3222316800,3222319615,US
3222319616,3222320127,JP
@@ -103473,7 +103909,9 @@
3224798976,3224799231,AU
3224799744,3224799999,US
3224800000,3224800255,DE
-3224800256,3224820735,FR
+3224800256,3224816639,FR
+3224816640,3224816895,IL
+3224816896,3224820735,FR
3224820736,3224820991,PL
3224820992,3224821247,DE
3224821248,3224822015,US
@@ -103500,7 +103938,9 @@
3224855808,3224856063,IT
3224856064,3224856575,US
3224856832,3224857087,NL
-3224857088,3224858623,US
+3224857088,3224857855,US
+3224857856,3224858111,PL
+3224858368,3224858623,US
3224858624,3224858879,AU
3224858880,3224859391,US
3224859392,3224859647,NL
@@ -103579,6 +104019,7 @@
3225423872,3225424383,US
3225426944,3225427199,AT
3225429504,3225429759,CA
+3225431040,3225431551,CZ
3225431552,3225433087,US
3225436160,3225444607,US
3225445376,3225446399,BE
@@ -103680,7 +104121,8 @@
3225687808,3225688063,GB
3225688064,3225689343,US
3225689600,3225689855,US
-3225689856,3225695231,NL
+3225689856,3225694975,NL
+3225694976,3225695231,PL
3225695232,3225695487,US
3225695488,3225701119,CA
3225701120,3225701375,US
@@ -104236,6 +104678,7 @@
3227443712,3227443967,EU
3227443968,3227444223,AU
3227444224,3227445503,US
+3227445504,3227445759,CZ
3227445760,3227446015,US
3227446016,3227446271,GB
3227446272,3227446783,US
@@ -105252,7 +105695,9 @@
3231050496,3231051263,US
3231051264,3231051519,GB
3231051776,3231070463,US
-3231070720,3231077631,SE
+3231070720,3231077119,SE
+3231077120,3231077375,PL
+3231077376,3231077631,SE
3231078144,3231078655,US
3231078656,3231078911,GB
3231078912,3231079423,CA
@@ -105611,6 +106056,7 @@
3231761408,3231763711,US
3231763712,3231763967,AU
3231763968,3231768575,US
+3231768576,3231768831,RU
3231768832,3231769087,NO
3231769344,3231769855,US
3231769856,3231770111,AU
@@ -106530,7 +106976,23 @@
3238018304,3238018559,UA
3238018560,3238018815,FR
3238018816,3238019071,DE
-3238019072,3238035455,PL
+3238019072,3238035711,PL
+3238035712,3238036479,RU
+3238036480,3238037503,CZ
+3238037504,3238039039,LV
+3238039040,3238039551,RU
+3238039552,3238039807,PL
+3238051840,3238053375,PL
+3238053376,3238053631,CZ
+3238053632,3238053887,GB
+3238053888,3238055935,CZ
+3238055936,3238056959,PL
+3238056960,3238057215,CZ
+3238057216,3238057471,BG
+3238057472,3238057983,RU
+3238057984,3238059519,CZ
+3238059520,3238059775,NO
+3238059776,3238060031,CZ
3238060032,3238060287,CH
3238060288,3238060543,RO
3238060544,3238060799,HU
@@ -106712,6 +107174,7 @@
3239108096,3239109887,DE
3239109888,3239110143,PL
3239110144,3239110655,DE
+3239110656,3239110911,RU
3239110912,3239111167,UA
3239111168,3239111423,NL
3239111424,3239111935,DE
@@ -107230,6 +107693,7 @@
3239859712,3239859967,HU
3239859968,3239860223,CA
3239860224,3239860479,DE
+3239860480,3239860735,FI
3239860736,3239860991,DE
3239860992,3239861247,AT
3239861248,3239861503,UA
@@ -107339,7 +107803,7 @@
3239968768,3239969023,NO
3239969024,3239974911,DE
3239974912,3239975935,GB
-3239975936,3239978751,DE
+3239976960,3239978751,DE
3239978752,3239979007,RU
3239979008,3239979263,UA
3239979264,3239979519,GB
@@ -107560,6 +108024,8 @@
3240278016,3240278527,RU
3240278528,3240279039,GB
3240279040,3240279551,CH
+3240279552,3240279807,RU
+3240279808,3240280063,CZ
3240280064,3240280191,DE
3240280192,3240280319,SE
3240280320,3240280447,PL
@@ -107902,6 +108368,7 @@
3240861696,3240866815,IT
3240866816,3240867071,RU
3240867072,3240867327,PL
+3240867328,3240867583,RU
3240867584,3240867839,CH
3240867840,3240873983,IT
3240873984,3240874495,RU
@@ -108415,6 +108882,7 @@
3244834048,3244834303,CH
3244834304,3244834559,IL
3244834560,3244834815,GB
+3244834816,3244835071,RU
3244835072,3244835327,AT
3244835328,3244835583,DE
3244835584,3244835839,UA
@@ -108423,6 +108891,7 @@
3244836608,3244836863,PL
3244836864,3244837119,FR
3244837120,3244837375,RO
+3244837376,3244837631,CZ
3244837632,3244837887,RU
3244837888,3244838143,CY
3244838144,3244838399,IL
@@ -108485,7 +108954,6 @@
3244853760,3244854015,TR
3244854016,3244854271,NL
3244854272,3244854527,GB
-3244854528,3244854783,CZ
3244854784,3244855295,RU
3244855296,3244855551,GB
3244855552,3244855807,UA
@@ -108576,7 +109044,6 @@
3244879872,3244880127,SI
3244880128,3244880383,RU
3244880384,3244880639,UA
-3244880640,3244880895,CZ
3244880896,3244881151,PL
3244881152,3244881407,RU
3244881408,3244881663,DK
@@ -108605,6 +109072,7 @@
3244887296,3244887551,GB
3244887552,3244887807,RU
3244887808,3244888063,BE
+3244888064,3244888319,PL
3244888320,3244888575,DE
3244888576,3244888831,FR
3244888832,3244889087,DE
@@ -109150,6 +109618,7 @@
3245211136,3245211647,GB
3245211648,3245212159,RU
3245212160,3245212671,NG
+3245212672,3245213183,GB
3245213184,3245213695,DE
3245213696,3245214207,LV
3245214208,3245214719,AT
@@ -109480,7 +109949,6 @@
3247054592,3247054847,DE
3247054848,3247063039,SI
3247063040,3247063295,FR
-3247063296,3247063551,GR
3247063552,3247063807,DE
3247063808,3247064063,BG
3247064064,3247064319,DE
@@ -109492,6 +109960,7 @@
3247065600,3247065855,SE
3247065856,3247066111,GB
3247066112,3247066367,DK
+3247066368,3247066623,LV
3247066624,3247066879,CZ
3247066880,3247067135,RU
3247067136,3247067647,DE
@@ -109523,7 +109992,7 @@
3247074560,3247074815,SE
3247074816,3247075071,PL
3247075072,3247075327,IE
-3247075328,3247075839,DE
+3247075328,3247076095,DE
3247076096,3247076351,DK
3247076352,3247076607,RU
3247076608,3247076863,DE
@@ -110371,6 +110840,7 @@
3249722112,3249722367,GB
3249722368,3249722623,FR
3249722624,3249723135,PL
+3249723136,3249723391,RU
3249723392,3249723647,IT
3249723648,3249723903,GB
3249723904,3249724159,TR
@@ -111008,7 +111478,6 @@
3251213696,3251213759,LV
3251213760,3251213823,TR
3251213824,3251213887,GB
-3251213952,3251214015,FI
3251214016,3251214079,UA
3251214080,3251214143,FR
3251214144,3251214207,AF
@@ -111024,6 +111493,7 @@
3251215488,3251215615,SE
3251215616,3251215743,TR
3251215744,3251215871,GB
+3251215872,3251216127,RO
3251216128,3251216255,FI
3251216256,3251216383,RU
3251216384,3251216639,GB
@@ -111973,6 +112443,9 @@
3253602304,3253603327,DE
3253603328,3253605375,PL
3253605376,3253606399,UA
+3253606400,3253606655,PL
+3253606656,3253606911,TR
+3253606912,3253607167,DE
3253607424,3253608447,NG
3253608448,3253610495,UA
3253610496,3253611519,PL
@@ -112079,7 +112552,6 @@
3253710848,3253711359,DK
3253711360,3253712383,UA
3253712384,3253712895,MD
-3253712896,3253713407,GR
3253713408,3253713919,NL
3253713920,3253714431,AT
3253714432,3253714943,RO
@@ -112101,7 +112573,6 @@
3253723648,3253724159,AT
3253724160,3253724671,UA
3253724672,3253725183,RO
-3253725184,3253725695,EU
3253725696,3253726207,UA
3253726208,3253726719,RO
3253726720,3253727231,UA
@@ -112162,9 +112633,7 @@
3253964800,3253965311,SE
3253965312,3253966335,PL
3253966336,3253966847,DE
-3253966848,3253967359,UA
-3253967360,3253967871,GR
-3253967872,3253968895,UA
+3253966848,3253968895,UA
3253968896,3253969407,DE
3253969408,3253969919,AT
3253969920,3253970431,NL
@@ -112398,8 +112867,12 @@
3254788096,3254788351,BG
3254788352,3254789119,ES
3254789120,3254789375,FR
+3254789376,3254789631,BE
3254789632,3254790655,TK
3254790656,3254790911,LU
+3254790912,3254791423,BE
+3254791424,3254791679,SK
+3254791680,3254792191,DK
3254796288,3254797311,SE
3254797312,3254798335,RU
3254798336,3254799359,AT
@@ -112565,6 +113038,7 @@
3254892288,3254892543,BE
3254892544,3254892799,RU
3254892800,3254893567,SK
+3254893568,3254894079,CZ
3254894080,3254894335,CH
3254894336,3254894591,SK
3254894592,3254894847,DK
@@ -113096,6 +113570,7 @@
3255544576,3255544831,AT
3255544832,3255558143,CH
3255558144,3255558399,BE
+3255558400,3255558655,UA
3255558656,3255564031,CH
3255564032,3255564287,RU
3255564288,3255566335,CH
@@ -113384,7 +113859,10 @@
3256864768,3256870911,DE
3256870912,3256871167,RU
3256871168,3256875007,DE
-3256877056,3256915455,GB
+3256877056,3256898559,GB
+3256898560,3256899071,TR
+3256899072,3256899583,CZ
+3256899584,3256915455,GB
3256915456,3256915967,SE
3256915968,3256945663,GB
3256945664,3256945919,UA
@@ -113413,6 +113891,10 @@
3257059072,3257139199,GB
3257139200,3257139455,DK
3257139456,3257143295,GB
+3257143296,3257143807,RU
+3257143808,3257144063,DE
+3257144064,3257144319,RU
+3257144320,3257144575,AT
3257144576,3257144831,GB
3257144832,3257145087,FR
3257145088,3257180159,GB
@@ -114355,7 +114837,12 @@
3257987584,3257991167,AT
3257991168,3258003967,DE
3258003968,3258004479,RU
-3258004480,3258056703,DE
+3258004480,3258021887,DE
+3258021888,3258022911,RU
+3258022912,3258023167,PL
+3258023168,3258023679,DE
+3258023680,3258023935,RU
+3258023936,3258056703,DE
3258056704,3258056959,UA
3258056960,3258058239,CZ
3258058240,3258058495,RU
@@ -114951,7 +115438,12 @@
3259814400,3259814655,AT
3259814656,3259821823,DE
3259821824,3259822079,AT
-3259822080,3259851823,DE
+3259822080,3259823103,DE
+3259823104,3259823359,RO
+3259823360,3259823615,EU
+3259823616,3259823871,NO
+3259823872,3259824127,IE
+3259824128,3259851823,DE
3259851824,3259851831,GB
3259851832,3259891711,DE
3259891712,3259957247,BE
@@ -115151,6 +115643,8 @@
3261697024,3261698047,RO
3261698048,3261698559,UA
3261698560,3261699071,DE
+3261699072,3261699327,RU
+3261699328,3261699583,GB
3261699584,3261700095,NL
3261700096,3261700607,FR
3261700608,3261701119,GB
@@ -118274,7 +118768,6 @@
3263087104,3263087871,DE
3263087872,3263088127,SI
3263088128,3263088383,DE
-3263088384,3263088639,GB
3263088640,3263089151,CH
3263089152,3263089407,RO
3263089408,3263089663,RU
@@ -118677,7 +119170,11 @@
3264447744,3264447999,DE
3264448000,3264463871,CH
3264463872,3264466943,LI
-3264466944,3264483071,CH
+3264466944,3264476671,CH
+3264476672,3264477183,CZ
+3264477184,3264477439,PL
+3264477440,3264477695,RU
+3264477696,3264483071,CH
3264483072,3264483327,LI
3264483328,3264486527,CH
3264486528,3264486559,LI
@@ -119074,6 +119571,7 @@
3265603328,3265603583,MD
3265603584,3265603839,DE
3265603840,3265604095,PL
+3265604096,3265604351,IL
3265604352,3265604607,FR
3265604608,3265604863,CH
3265604864,3265605119,RU
@@ -122033,6 +122531,7 @@
3273437184,3273437695,RO
3273437696,3273438207,PL
3273438208,3273438719,IL
+3273438720,3273439231,CZ
3273439232,3273439743,RO
3273439744,3273440255,DE
3273440256,3273440767,RO
@@ -130132,6 +130631,7 @@
3279078912,3279084543,ES
3279084544,3279085567,IT
3279085568,3279089663,NL
+3279089664,3279093759,KG
3279093760,3279103103,FR
3279103104,3279103135,GB
3279103136,3279119295,FR
@@ -130630,6 +131130,8 @@
3280595968,3280596479,DK
3280596480,3280596991,AT
3280596992,3280597503,UA
+3280597504,3280597759,NL
+3280597760,3280598015,BE
3280598016,3280598527,UA
3280598528,3280599039,PL
3280599040,3280599551,FR
@@ -130657,7 +131159,7 @@
3280653056,3280653311,CH
3280653312,3280653823,GB
3280653824,3280654079,RU
-3280654336,3280654591,PL
+3280654080,3280654591,PL
3280654592,3280654847,ES
3280654848,3280655103,RU
3280655104,3280655359,PL
@@ -130973,6 +131475,7 @@
3280996608,3280996863,PL
3280996864,3280997119,NL
3280997120,3280997375,FR
+3280997376,3280997631,PL
3280997632,3280997887,SE
3280997888,3280998143,UA
3280998144,3280998399,DE
@@ -131399,8 +131902,7 @@
3283226112,3283226623,DK
3283226624,3283227135,RU
3283227136,3283227647,UA
-3283227648,3283228159,RU
-3283228672,3283229183,RU
+3283227648,3283229183,RU
3283229184,3283229695,PL
3283229696,3283230207,IT
3283230208,3283230719,UA
@@ -131460,7 +131962,6 @@
3283484672,3283484927,UA
3283484928,3283485183,NL
3283485184,3283485439,DE
-3283485440,3283485695,RU
3283485696,3283485951,GB
3283485952,3283486207,US
3283486208,3283486463,AT
@@ -134066,7 +134567,6 @@
3286326272,3286327295,PL
3286327296,3286329343,NL
3286329344,3286330367,DE
-3286330368,3286331391,EU
3286331392,3286332415,UA
3286332416,3286333439,CH
3286333440,3286334463,PL
@@ -135173,6 +135673,7 @@
3291211776,3291212287,NG
3291212288,3291212543,MZ
3291212544,3291212799,NG
+3291212800,3291213055,MA
3291216896,3291217919,MU
3291217920,3291230207,ZA
3291230208,3291234303,GH
@@ -135357,7 +135858,9 @@
3302490624,3302491135,MU
3302492160,3302494207,MW
3302494208,3302496255,ZA
-3302498304,3302506495,NA
+3302498304,3302502399,NA
+3302502400,3302503423,AO
+3302503424,3302506495,NA
3302506496,3302514687,KE
3302522880,3302523903,KE
3302525952,3302526975,EG
@@ -135448,12 +135951,16 @@
3315400704,3315417087,UG
3315417088,3315425279,ZA
3315425280,3315433471,SC
+3315433472,3315449855,RW
3315449856,3315450879,BI
3315450880,3315451903,AO
3315451904,3315452927,LS
3315452928,3315453951,ZW
3315453952,3315454975,CD
-3315463168,3315464191,MU
+3315454976,3315455999,RW
+3315456000,3315457023,NG
+3315457024,3315458047,ZA
+3315458048,3315459071,SL
3315466240,3315482623,MZ
3315531776,3315539967,CM
3315539968,3315548159,ZA
@@ -135493,9 +136000,11 @@
3320643584,3320709119,KE
3320709120,3320774655,ZA
3320840192,3320905727,NG
+3320987648,3320995839,ZA
3320995840,3321004031,NG
3321004032,3321008127,GM
3321008128,3321012223,ZA
+3321012224,3321016319,MZ
3321036800,3321069567,RW
3321069568,3321102335,NA
3321102336,3321167871,NG
@@ -135617,15 +136126,14 @@
3324259840,3324260095,US
3324264448,3324379135,US
3324379136,3324380159,CA
-3324380160,3324391423,US
-3324395520,3324399615,US
+3324380160,3324403711,US
3324411904,3324470271,US
3324470272,3324473599,GB
3324473600,3324473855,US
3324473856,3324474367,GB
3324474368,3324579839,US
3324583936,3324588031,CL
-3324592128,3324596223,US
+3324588032,3324600319,US
3324641280,3324642303,US
3324642304,3324642559,CA
3324642560,3324645887,US
@@ -135858,8 +136366,7 @@
3328433664,3328433919,CH
3328433920,3328475135,US
3328475136,3328477183,CA
-3328507904,3328524287,US
-3328573440,3328617983,US
+3328507904,3328617983,US
3328617984,3328618239,CA
3328618240,3328630783,US
3328630784,3328631807,CA
@@ -135943,7 +136450,9 @@
3331102464,3331102719,CA
3331102720,3331194879,US
3331194880,3331260415,AU
-3331260416,3331563519,US
+3331260416,3331362815,US
+3331362816,3331366911,CA
+3331366912,3331563519,US
3331563520,3331563775,CH
3331563776,3331633407,US
3331633408,3331633919,CH
@@ -135955,7 +136464,10 @@
3331798272,3331798527,AU
3331798528,3331818495,US
3331818496,3331818751,MX
-3331818752,3332440063,US
+3331818752,3332001791,US
+3332001792,3332005887,CA
+3332014080,3332030463,US
+3332046848,3332440063,US
3332440064,3332460543,CA
3332460544,3332460799,US
3332460800,3332461311,CA
@@ -136076,7 +136588,8 @@
3337653760,3337654783,CH
3337654784,3337655039,AU
3337655040,3337682943,CH
-3337682944,3337961471,US
+3337682944,3337957375,US
+3337957376,3337961471,CA
3337977856,3337980671,US
3337980672,3337980927,PR
3337980928,3337986047,US
@@ -136169,7 +136682,10 @@
3338271488,3338271743,CA
3338271744,3338271999,US
3338272000,3338272255,CA
-3338272256,3338686463,US
+3338272256,3338348543,US
+3338350592,3338354687,CA
+3338371072,3338403839,CA
+3338403840,3338686463,US
3338686464,3338688511,AW
3338688512,3338770431,US
3338770432,3338772479,PR
@@ -136991,8 +137507,7 @@
3349645312,3349647359,CA
3349647360,3349649407,US
3349649408,3349653503,CA
-3349653504,3349692415,US
-3349708800,3349723260,US
+3349653504,3349723260,US
3349723261,3349723265,CA
3349723266,3349723360,US
3349723361,3349723367,CA
@@ -137014,16 +137529,17 @@
3350042880,3350043135,KW
3350043136,3350134783,US
3350134784,3350146047,CA
-3350146048,3350147071,US
-3350151168,3350181887,CA
+3350146048,3350150143,US
+3350150144,3350181887,CA
3350181888,3350182911,US
3350182912,3350200319,CA
3350200320,3350469119,US
3350469632,3350470655,CA
3350470656,3350475775,US
3350475776,3350476799,CA
-3350476800,3350478847,US
-3350495232,3350495577,US
+3350476800,3350487039,US
+3350487040,3350488063,CA
+3350488064,3350495577,US
3350495578,3350495585,GB
3350495586,3350495602,US
3350495603,3350495604,BD
@@ -137044,9 +137560,22 @@
3350514656,3350515135,US
3350515136,3350515167,GB
3350515168,3350593535,US
-3350593536,3350609919,CA
-3350614016,3350618111,US
-3350626304,3350790143,US
+3350593536,3350605823,CA
+3350605824,3350606847,US
+3350606848,3350607871,CA
+3350607872,3350618111,US
+3350618112,3350619135,CA
+3350619136,3350623231,US
+3350623232,3350624255,CA
+3350624256,3350626303,US
+3350626304,3350628351,CA
+3350628352,3350642687,US
+3350642688,3350643711,TC
+3350643712,3350645759,US
+3350645760,3350646783,CA
+3350646784,3350648831,US
+3350648832,3350649855,CA
+3350650880,3350790143,US
3350790144,3350825727,CA
3350825728,3350825983,GB
3350825984,3350855679,CA
@@ -137058,7 +137587,7 @@
3350979584,3350980607,CA
3350980608,3350994943,US
3350994944,3350998015,CA
-3350998016,3350999039,US
+3350998016,3351001087,US
3351019520,3351026439,US
3351026440,3351026447,CA
3351026448,3351030783,US
@@ -137277,7 +137806,9 @@
3354066944,3354132479,CA
3354132480,3354591231,US
3354591232,3354656767,CA
-3354656768,3354782719,US
+3354656768,3354770687,US
+3354770688,3354770943,CA
+3354770944,3354782719,US
3354782720,3354782975,CA
3354782976,3354788095,US
3354788096,3354806399,CA
@@ -138008,7 +138539,9 @@
3358151272,3358151423,AR
3358151424,3358151551,EC
3358151552,3358151679,AR
-3358151680,3358152191,PE
+3358151680,3358151807,PE
+3358151808,3358151935,AR
+3358151936,3358152191,PE
3358152192,3358152559,AR
3358152560,3358152575,PE
3358152576,3358152703,AR
@@ -138253,9 +138786,7 @@
3360687984,3360687999,AR
3360688000,3360688127,CO
3360688128,3360688383,AR
-3360688384,3360688639,CO
-3360688640,3360688767,AR
-3360688768,3360690623,CO
+3360688384,3360690623,CO
3360690624,3360690687,AR
3360690688,3360690703,CO
3360690704,3360690719,AR
@@ -138458,7 +138989,7 @@
3363601920,3363602175,AR
3363602176,3363602431,PA
3363602432,3363610623,AN
-3363618816,3363622911,UY
+3363618816,3363627007,UY
3363627008,3363635199,EC
3363635200,3363651583,UY
3363651584,3363667967,AR
@@ -138505,7 +139036,8 @@
3386548224,3386556415,CR
3386556416,3386572799,PA
3386572800,3386589183,EC
-3386589184,3386605567,AR
+3386589184,3386601471,AR
+3386601472,3386605567,CO
3386605568,3386613759,CL
3386613760,3386621951,AR
3386621952,3386630143,CO
@@ -138879,7 +139411,7 @@
3389661184,3389669375,IN
3389669376,3389673471,CN
3389673472,3389677567,AU
-3389677568,3389685759,JP
+3389677568,3389681663,JP
3389685760,3389718527,AU
3389718528,3389784063,JP
3389784064,3389784319,NZ
@@ -139872,7 +140404,7 @@
3394634752,3394635775,IN
3394635776,3394637823,KR
3394637824,3394641919,AF
-3394646016,3394648063,AU
+3394641920,3394648063,AU
3394648064,3394650111,JP
3394650112,3394658303,HK
3394658304,3394662399,NZ
@@ -141410,9 +141942,7 @@
3407089920,3407090175,CN
3407090176,3407095807,AU
3407095808,3407096319,CN
-3407096320,3407096831,AU
-3407096832,3407097087,JP
-3407097088,3407097855,AU
+3407096320,3407097855,AU
3407097856,3407098111,CN
3407098112,3407101183,AU
3407101184,3407101439,CN
@@ -142488,7 +143018,9 @@
3411509248,3411542015,PH
3411542016,3411550207,IN
3411550208,3411558399,CN
-3411558400,3411566591,HK
+3411558400,3411561727,HK
+3411561728,3411561983,AU
+3411561984,3411566591,HK
3411566592,3411570687,BD
3411570688,3411574783,AU
3411574784,3411582975,IN
@@ -142825,7 +143357,9 @@
3414670592,3414670847,SG
3414670848,3414671359,MY
3414671360,3415080959,JP
-3415080960,3415089151,SG
+3415080960,3415083007,SG
+3415083008,3415083519,AU
+3415083520,3415089151,SG
3415089152,3415097343,MY
3415097344,3415103487,ID
3415103488,3415113727,HK
@@ -143168,7 +143702,8 @@
3418206208,3418208255,IN
3418208256,3418210303,LK
3418210304,3418218495,CN
-3418218496,3418227711,BD
+3418218496,3418220543,BD
+3418226688,3418227711,BD
3418227712,3418228735,KR
3418228736,3418230783,BD
3418230784,3418232831,TW
@@ -145449,9 +145984,13 @@
3449222656,3449224959,CA
3449224960,3449225471,US
3449225472,3449254143,CA
-3449254144,3449254399,US
-3449254912,3449290751,CA
-3449290752,3449598207,US
+3449254144,3449254911,US
+3449254912,3449273599,CA
+3449273600,3449273855,US
+3449273856,3449278975,CA
+3449278976,3449279487,US
+3449279488,3449290495,CA
+3449290496,3449598207,US
3449598208,3449598463,GB
3449598464,3449638911,US
3449638912,3449639359,GB
@@ -145982,8 +146521,7 @@
3454563624,3454563631,NC
3454563632,3454599423,US
3454599424,3454601215,CA
-3454601216,3454602239,US
-3454602752,3454603007,US
+3454601216,3454603007,US
3454603008,3454603519,CA
3454603520,3454604031,US
3454604032,3454604799,CA
@@ -146069,6 +146607,7 @@
3454810368,3454814975,CA
3454814976,3454815231,US
3454815232,3454815743,CA
+3454815744,3454816255,US
3454816256,3454816511,CA
3454816512,3454816767,US
3454816768,3454828287,CA
@@ -146080,8 +146619,8 @@
3454867968,3454881535,CA
3454881536,3454881791,US
3454881792,3454883839,CA
-3454883840,3454914559,US
-3454914560,3454926591,CA
+3454883840,3454915071,US
+3454915072,3454926591,CA
3454926592,3455096831,US
3455096832,3455097855,EC
3455097856,3455109119,US
@@ -156081,7 +156620,7 @@
3524157440,3524161535,AU
3524161536,3524247551,CN
3524247552,3524263935,AU
-3524263936,3524296703,PH
+3524263936,3524280319,PH
3524296704,3524313087,CN
3524313088,3524329471,KR
3524329472,3524362239,TW
@@ -156118,6 +156657,7 @@
3526901760,3526909951,AU
3526909952,3526918143,IN
3526918144,3526922239,SG
+3526922240,3526924287,IN
3526924288,3526926335,AU
3526926336,3526934527,JP
3526934528,3526942719,CN
diff --git a/src/config/torrc.bridge.in b/src/config/torrc.bridge.in
deleted file mode 100644
index b7b7e050ba..0000000000
--- a/src/config/torrc.bridge.in
+++ /dev/null
@@ -1,175 +0,0 @@
-## Configuration file for a typical Tor user
-## Last updated 16 July 2009 for Tor 0.2.2.1-alpha.
-## (May or may not work for much older or much newer versions of Tor.)
-##
-## Lines that begin with "## " try to explain what's going on. Lines
-## that begin with just "#" are disabled commands: you can enable them
-## by removing the "#" symbol.
-##
-## See 'man tor', or https://www.torproject.org/docs/tor-manual.html,
-## for more options you can use in this file.
-##
-## Tor will look for this file in various places based on your platform:
-## https://www.torproject.org/docs/faq#torrc
-
-
-## Replace this with "SocksPort 0" if you plan to run Tor only as a
-## relay, and not make any local application connections yourself.
-SocksPort 9050 # what port to open for local application connections
-SocksListenAddress 127.0.0.1 # accept connections only from localhost
-#SocksListenAddress 192.168.0.1:9100 # listen on this IP:port also
-
-## Entry policies to allow/deny SOCKS requests based on IP address.
-## First entry that matches wins. If no SocksPolicy is set, we accept
-## all (and only) requests from SocksListenAddress.
-#SocksPolicy accept 192.168.0.0/16
-#SocksPolicy reject *
-
-## Logs go to stdout at level "notice" unless redirected by something
-## else, like one of the below lines. You can have as many Log lines as
-## you want.
-##
-## We advise using "notice" in most cases, since anything more verbose
-## may provide sensitive information to an attacker who obtains the logs.
-##
-## Send all messages of level 'notice' or higher to @LOCALSTATEDIR@/log/tor/notices.log
-#Log notice file @LOCALSTATEDIR@/log/tor/notices.log
-## Send every possible message to @LOCALSTATEDIR@/log/tor/debug.log
-#Log debug file @LOCALSTATEDIR@/log/tor/debug.log
-## Use the system log instead of Tor's logfiles
-#Log notice syslog
-## To send all messages to stderr:
-#Log debug stderr
-
-## Uncomment this to start the process in the background... or use
-## --runasdaemon 1 on the command line. This is ignored on Windows;
-## see the FAQ entry if you want Tor to run as an NT service.
-#RunAsDaemon 1
-
-## The directory for keeping all the keys/etc. By default, we store
-## things in $HOME/.tor on Unix, and in Application Data\tor on Windows.
-#DataDirectory @LOCALSTATEDIR@/lib/tor
-
-## The port on which Tor will listen for local connections from Tor
-## controller applications, as documented in control-spec.txt.
-#ControlPort 9051
-## If you enable the controlport, be sure to enable one of these
-## authentication methods, to prevent attackers from accessing it.
-#HashedControlPassword 16:872860B76453A77D60CA2BB8C1A7042072093276A3D701AD684053EC4C
-#CookieAuthentication 1
-
-############### This section is just for location-hidden services ###
-
-## Once you have configured a hidden service, you can look at the
-## contents of the file ".../hidden_service/hostname" for the address
-## to tell people.
-##
-## HiddenServicePort x y:z says to redirect requests on port x to the
-## address y:z.
-
-#HiddenServiceDir @LOCALSTATEDIR@/lib/tor/hidden_service/
-#HiddenServicePort 80 127.0.0.1:80
-
-#HiddenServiceDir @LOCALSTATEDIR@/lib/tor/other_hidden_service/
-#HiddenServicePort 80 127.0.0.1:80
-#HiddenServicePort 22 127.0.0.1:22
-
-################ This section is just for relays #####################
-#
-## See https://www.torproject.org/docs/tor-doc-relay for details.
-
-## Required: what port to advertise for incoming Tor connections.
-ORPort 9001
-## If you want to listen on a port other than the one advertised
-## in ORPort (e.g. to advertise 443 but bind to 9090), uncomment the
-## line below too. You'll need to do ipchains or other port forwarding
-## yourself to make this work.
-#ORListenAddress 0.0.0.0:9090
-
-## A handle for your relay, so people don't have to refer to it by key.
-Nickname Unnamed
-
-## The IP address or full DNS name for your relay. Leave commented out
-## and Tor will guess.
-#Address noname.example.com
-
-## Define these to limit how much relayed traffic you will allow. Your
-## own traffic is still unthrottled. Note that RelayBandwidthRate must
-## be at least 20 KB.
-## Note that units for these config options are bytes per second, not bits
-## per second, and that prefixes are binary prefixes, i.e. 2^10, 2^20, etc.
-#RelayBandwidthRate 100 KB # Throttle traffic to 100KB/s (800Kbps)
-#RelayBandwidthBurst 200 KB # But allow bursts up to 200KB/s (1600Kbps)
-RelayBandwidthBurst 10485760
-RelayBandwidthRate 5242880
-
-## Use these to restrict the maximum traffic per day, week, or month.
-## Note that this threshold applies to sent _and_ to received bytes,
-## not to their sum: Setting "4 GB" may allow up to 8 GB
-## total before hibernating.
-##
-## Set a maximum of 4 gigabytes each way per period.
-#AccountingMax 4 GB
-## Each period starts daily at midnight (AccountingMax is per day)
-#AccountingStart day 00:00
-## Each period starts on the 3rd of the month at 15:00 (AccountingMax
-## is per month)
-#AccountingStart month 3 15:00
-
-## Contact info to be published in the directory, so we can contact you
-## if your relay is misconfigured or something else goes wrong. Google
-## indexes this, so spammers might also collect it.
-#ContactInfo Random Person <nobody AT example dot com>
-## You might also include your PGP or GPG fingerprint if you have one:
-#ContactInfo 1234D/FFFFFFFF Random Person <nobody AT example dot com>
-
-## Uncomment this to mirror directory information for others. Please do
-## if you have enough bandwidth.
-DirPort 9030 # what port to advertise for directory connections
-## If you want to listen on a port other than the one advertised
-## in DirPort (e.g. to advertise 80 but bind to 9091), uncomment the line
-## below too. You'll need to do ipchains or other port forwarding yourself
-## to make this work.
-#DirListenAddress 0.0.0.0:9091
-## Uncomment to return an arbitrary blob of html on your DirPort. Now you
-## can explain what Tor is if anybody wonders why your IP address is
-## contacting them. See contrib/tor-exit-notice.html in Tor's source
-## distribution for a sample.
-#DirPortFrontPage @CONFDIR@/tor-exit-notice.html
-
-## Uncomment this if you run more than one Tor relay, and add the identity
-## key fingerprint of each Tor relay you control, even if they're on
-## different networks. You declare it here so Tor clients can avoid
-## using more than one of your relays in a single circuit. See
-## https://wiki.torproject.org/noreply/TheOnionRouter/TorFAQ#MultipleServers
-## However, you should never include a bridge's fingerprint here, as it would
-## break its concealability and potentionally reveal its IP/TCP address.
-#MyFamily $keyid,$keyid,...
-
-## A comma-separated list of exit policies. They're considered first
-## to last, and the first match wins. If you want to _replace_
-## the default exit policy, end this with either a reject *:* or an
-## accept *:*. Otherwise, you're _augmenting_ (prepending to) the
-## default exit policy. Leave commented to just use the default, which is
-## described in the man page or at
-## https://www.torproject.org/documentation.html
-##
-## Look at https://www.torproject.org/faq-abuse.html#TypicalAbuses
-## for issues you might encounter if you use the default exit policy.
-##
-## If certain IPs and ports are blocked externally, e.g. by your firewall,
-## you should update your exit policy to reflect this -- otherwise Tor
-## users will be told that those destinations are down.
-##
-#ExitPolicy accept *:6660-6667,reject *:* # allow irc ports but no more
-#ExitPolicy accept *:119 # accept nntp as well as default exit policy
-#ExitPolicy reject *:* # no exits allowed
-#
-## Bridge relays (or "bridges") are Tor relays that aren't listed in the
-## main directory. Since there is no complete public list of them, even if an
-## ISP is filtering connections to all the known Tor relays, they probably
-## won't be able to block all the bridges. Also, websites won't treat you
-## differently because they won't know you're running Tor. If you can
-## be a real relay, please do; but if not, be a bridge!
-BridgeRelay 1
-ExitPolicy reject *:*
diff --git a/src/or/Makefile.nmake b/src/or/Makefile.nmake
index 919edbbf22..3181e79c20 100644
--- a/src/or/Makefile.nmake
+++ b/src/or/Makefile.nmake
@@ -1,28 +1,28 @@
-all: tor.exe
-
-CFLAGS = /I ..\win32 /I ..\..\..\build-alpha\include /I ..\common
-
-LIBS = ..\..\..\build-alpha\lib\libevent.a \
- ..\..\..\build-alpha\lib\libcrypto.a \
- ..\..\..\build-alpha\lib\libssl.a \
- ..\..\..\build-alpha\lib\libz.a \
- ws2_32.lib advapi32.lib shell32.lib
-
-LIBTOR_OBJECTS = buffers.obj circuitbuild.obj circuitlist.obj circuituse.obj \
- command.obj config.obj connection.obj connection_edge.obj \
- connection_or.obj control.obj cpuworker.obj directory.obj \
- dirserv.obj dirvote.obj dns.obj dnsserv.obj geoip.obj \
- hibernate.obj main.obj microdesc.obj networkstatus.obj \
- nodelist.obj onion.obj policies.obj reasons.obj relay.obj \
- rendclient.obj rendcommon.obj rendmid.obj rendservice.obj \
- rephist.obj router.obj routerlist.obj routerparse.obj status.obj \
- config_codedigest.obj ntmain.obj
-
-libtor.lib: $(LIBTOR_OBJECTS)
- lib $(LIBTOR_OBJECTS) /out:libtor.lib
-
-tor.exe: libtor.lib tor_main.obj
- $(CC) $(CFLAGS) $(LIBS) libtor.lib ..\common\*.lib tor_main.obj
-
-clean:
- del $(LIBTOR_OBJECTS) *.lib tor.exe
+all: tor.exe
+
+CFLAGS = /I ..\win32 /I ..\..\..\build-alpha\include /I ..\common
+
+LIBS = ..\..\..\build-alpha\lib\libevent.a \
+ ..\..\..\build-alpha\lib\libcrypto.a \
+ ..\..\..\build-alpha\lib\libssl.a \
+ ..\..\..\build-alpha\lib\libz.a \
+ ws2_32.lib advapi32.lib shell32.lib
+
+LIBTOR_OBJECTS = buffers.obj circuitbuild.obj circuitlist.obj circuituse.obj \
+ command.obj config.obj connection.obj connection_edge.obj \
+ connection_or.obj control.obj cpuworker.obj directory.obj \
+ dirserv.obj dirvote.obj dns.obj dnsserv.obj geoip.obj \
+ hibernate.obj main.obj microdesc.obj networkstatus.obj \
+ nodelist.obj onion.obj policies.obj reasons.obj relay.obj \
+ rendclient.obj rendcommon.obj rendmid.obj rendservice.obj \
+ rephist.obj router.obj routerlist.obj routerparse.obj status.obj \
+ config_codedigest.obj ntmain.obj
+
+libtor.lib: $(LIBTOR_OBJECTS)
+ lib $(LIBTOR_OBJECTS) /out:libtor.lib
+
+tor.exe: libtor.lib tor_main.obj
+ $(CC) $(CFLAGS) $(LIBS) libtor.lib ..\common\*.lib tor_main.obj
+
+clean:
+ del $(LIBTOR_OBJECTS) *.lib tor.exe
diff --git a/src/or/buffers.c b/src/or/buffers.c
index d60e54e87a..aa3e01fd9d 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -1011,7 +1011,7 @@ fetch_from_buf(char *string, size_t string_len, buf_t *buf)
/** True iff the cell command <b>command</b> is one that implies a
* variable-length cell in Tor link protocol <b>linkproto</b>. */
-static inline int
+static INLINE int
cell_command_is_var_length(uint8_t command, int linkproto)
{
/* If linkproto is v2 (2), CELL_VERSIONS is the only variable-length cells
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 5481838ccb..82ff327135 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -2847,6 +2847,10 @@ choose_good_exit_server_general(int need_uptime, int need_capacity)
if (node)
break;
smartlist_clear(supporting);
+ /* If we reach this point, we can't actually support any unhandled
+ * predicted ports, so clear all the remaining ones. */
+ if (smartlist_len(needed_ports))
+ rep_hist_remove_predicted_ports(needed_ports);
}
SMARTLIST_FOREACH(needed_ports, uint16_t *, cp, tor_free(cp));
smartlist_free(needed_ports);
@@ -3733,7 +3737,9 @@ entry_guard_free(entry_guard_t *e)
/** Remove any entry guard which was selected by an unknown version of Tor,
* or which was selected by a version of Tor that's known to select
- * entry guards badly. */
+ * entry guards badly, or which was selected more 2 months ago. */
+/* XXXX The "obsolete guards" and "chosen long ago guards" things should
+ * probably be different functions. */
static int
remove_obsolete_entry_guards(time_t now)
{
@@ -3862,6 +3868,8 @@ entry_guards_compute_status(const or_options_t *options, time_t now)
if (remove_dead_entry_guards(now))
changed = 1;
+ if (remove_obsolete_entry_guards(now))
+ changed = 1;
if (changed) {
SMARTLIST_FOREACH_BEGIN(entry_guards, entry_guard_t *, entry) {
@@ -4964,6 +4972,21 @@ find_bridge_by_digest(const char *digest)
return NULL;
}
+const char *
+find_transport_name_by_bridge_addrport(const tor_addr_t *addr, uint16_t port)
+{
+ if (!bridge_list)
+ return NULL;
+
+ SMARTLIST_FOREACH_BEGIN(bridge_list, const bridge_info_t *, bridge) {
+ if (tor_addr_eq(&bridge->addr, addr) &&
+ (bridge->port == port))
+ return bridge->transport_name;
+ } SMARTLIST_FOREACH_END(bridge);
+
+ return NULL;
+}
+
/** If <b>addr</b> and <b>port</b> match the address and port of a
* bridge of ours that uses pluggable transports, place its transport
* in <b>transport</b>.
diff --git a/src/or/circuitbuild.h b/src/or/circuitbuild.h
index a7fd208305..2ef5be8f25 100644
--- a/src/or/circuitbuild.h
+++ b/src/or/circuitbuild.h
@@ -157,6 +157,9 @@ void transport_free(transport_t *transport);
transport_t *transport_new(const tor_addr_t *addr, uint16_t port,
const char *name, int socks_ver);
+const char *find_transport_name_by_bridge_addrport(const tor_addr_t *addr,
+ uint16_t port);
+
int find_transport_by_bridge_addrport(const tor_addr_t *addr, uint16_t port,
const transport_t **transport);
transport_t *transport_get_by_name(const char *name);
diff --git a/src/or/command.c b/src/or/command.c
index 9b14092fed..4e56edd5db 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -601,7 +601,6 @@ command_process_destroy_cell(cell_t *cell, or_connection_t *conn)
int reason;
circ = circuit_get_by_circid_orconn(cell->circ_id, conn);
- reason = (uint8_t)cell->payload[0];
if (!circ) {
log_info(LD_OR,"unknown circuit %d on connection from %s:%d. Dropping.",
cell->circ_id, conn->_base.address, conn->_base.port);
@@ -609,6 +608,8 @@ command_process_destroy_cell(cell_t *cell, or_connection_t *conn)
}
log_debug(LD_OR,"Received for circID %d.",cell->circ_id);
+ reason = (uint8_t)cell->payload[0];
+
if (!CIRCUIT_IS_ORIGIN(circ) &&
cell->circ_id == TO_OR_CIRCUIT(circ)->p_circ_id) {
/* the destroy came from behind */
diff --git a/src/or/config.c b/src/or/config.c
index bfed4e5db4..27aa8a2f23 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -748,7 +748,7 @@ set_options(or_options_t *new_val, char **msg)
}
/* Issues a CONF_CHANGED event to notify controller of the change. If Tor is
* just starting up then the old_options will be undefined. */
- if (old_options) {
+ if (old_options && old_options != global_options) {
elements = smartlist_new();
for (i=0; options_format.vars[i].name; ++i) {
const config_var_t *var = &options_format.vars[i];
@@ -774,7 +774,9 @@ set_options(or_options_t *new_val, char **msg)
control_event_conf_changed(elements);
smartlist_free(elements);
}
- config_free(&options_format, old_options);
+
+ if (old_options != global_options)
+ config_free(&options_format, old_options);
return 0;
}
@@ -783,6 +785,7 @@ extern const char tor_git_revision[]; /* from tor_main.c */
/** The version of this Tor process, as parsed. */
static char *the_tor_version = NULL;
+static char *the_short_tor_version = NULL;
/** Return the current Tor version. */
const char *
@@ -790,14 +793,31 @@ get_version(void)
{
if (the_tor_version == NULL) {
if (strlen(tor_git_revision)) {
- tor_asprintf(&the_tor_version, "%s (git-%s)", VERSION, tor_git_revision);
+ tor_asprintf(&the_tor_version, "%s (git-%s)", get_short_version(),
+ tor_git_revision);
} else {
- the_tor_version = tor_strdup(VERSION);
+ the_tor_version = tor_strdup(get_short_version());
}
}
return the_tor_version;
}
+/** Return the current Tor version, without any git tag. */
+const char *
+get_short_version(void)
+{
+
+ if (the_short_tor_version == NULL) {
+#ifdef TOR_BUILD_TAG
+ tor_asprintf(&the_short_tor_version, "%s (%s)", VERSION, TOR_BUILD_TAG);
+#else
+ the_short_tor_version = tor_strdup(VERSION);
+#endif
+ }
+ return the_short_tor_version;
+}
+
+
/** Release additional memory allocated in options
*/
static void
@@ -5099,7 +5119,7 @@ parse_client_transport_line(const char *line, int validate_only)
*tmp++ = smartlist_get(items, 2);
smartlist_del_keeporder(items, 2);
}
- *tmp = NULL; /*terminated with NUL pointer, just like execve() likes it*/
+ *tmp = NULL; /*terminated with NULL, just like execve() likes it*/
/* kickstart the thing */
pt_kickstart_client_proxy(transport_list, proxy_argv);
@@ -5222,7 +5242,7 @@ parse_server_transport_line(const char *line, int validate_only)
*tmp++ = smartlist_get(items, 2);
smartlist_del_keeporder(items, 2);
}
- *tmp = NULL; /*terminated with NUL pointer, just like execve() likes it*/
+ *tmp = NULL; /*terminated with NULL, just like execve() likes it*/
/* kickstart the thing */
pt_kickstart_server_proxy(transport_list, proxy_argv);
@@ -6040,6 +6060,65 @@ get_configured_ports(void)
return configured_ports;
}
+/** Return an <address>:<port> string representation of the address
+ * where the first <b>listener_type</b> listener waits for
+ * connections. Return NULL if we couldn't find a listener. The
+ * string is allocated on the heap and it's the responsibility of the
+ * caller to free it after use.
+ *
+ * This function is meant to be used by the pluggable transport proxy
+ * spawning code, please make sure that it fits your purposes before
+ * using it. */
+char *
+get_first_listener_addrport_string(int listener_type)
+{
+ static const char *ipv4_localhost = "127.0.0.1";
+ static const char *ipv6_localhost = "[::1]";
+ const char *address;
+ uint16_t port;
+ char *string = NULL;
+
+ if (!configured_ports)
+ return NULL;
+
+ SMARTLIST_FOREACH_BEGIN(configured_ports, const port_cfg_t *, cfg) {
+ if (cfg->no_listen)
+ continue;
+
+ if (cfg->type == listener_type &&
+ tor_addr_family(&cfg->addr) != AF_UNSPEC) {
+
+ /* We found the first listener of the type we are interested in! */
+
+ /* If a listener is listening on INADDR_ANY, assume that it's
+ also listening on 127.0.0.1, and point the transport proxy
+ there: */
+ if (tor_addr_is_null(&cfg->addr))
+ address = tor_addr_is_v4(&cfg->addr) ? ipv4_localhost : ipv6_localhost;
+ else
+ address = fmt_and_decorate_addr(&cfg->addr);
+
+ /* If a listener is configured with port 'auto', we are forced
+ to iterate all listener connections and find out in which
+ port it ended up listening: */
+ if (cfg->port == CFG_AUTO_PORT) {
+ port = router_get_active_listener_port_by_type(listener_type);
+ if (!port)
+ return NULL;
+ } else {
+ port = cfg->port;
+ }
+
+ tor_asprintf(&string, "%s:%u", address, port);
+
+ return string;
+ }
+
+ } SMARTLIST_FOREACH_END(cfg);
+
+ return NULL;
+}
+
/** Return the first advertised port of type <b>listener_type</b> in
<b>address_family</b>. */
int
diff --git a/src/or/config.h b/src/or/config.h
index 0f7c618861..a68a3e3113 100644
--- a/src/or/config.h
+++ b/src/or/config.h
@@ -22,6 +22,7 @@ const char *safe_str(const char *address);
const char *escaped_safe_str_client(const char *address);
const char *escaped_safe_str(const char *address);
const char *get_version(void);
+const char *get_short_version(void);
int config_get_lines(const char *string, config_line_t **result, int extended);
void config_free_lines(config_line_t *front);
@@ -72,6 +73,8 @@ int get_first_advertised_port_by_type_af(int listener_type,
#define get_primary_dir_port() \
(get_first_advertised_port_by_type_af(CONN_TYPE_DIR_LISTENER, AF_INET))
+char *get_first_listener_addrport_string(int listener_type);
+
int options_need_geoip_info(const or_options_t *options,
const char **reason_out);
diff --git a/src/or/connection.c b/src/or/connection.c
index d379533494..0c970cc3b4 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -778,7 +778,8 @@ create_unix_sockaddr(const char *listenaddress, char **readable_address,
"Unix domain sockets not supported, yet we tried to create one.");
*len_out = 0;
tor_assert(0);
-};
+ return NULL;
+}
#endif /* HAVE_SYS_UN_H */
/** Warn that an accept or a connect has failed because we're running up
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 03558e557c..ca4bf3ffe4 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -2000,20 +2000,35 @@ connection_ap_handshake_rewrite_and_attach(entry_connection_t *conn,
if (options->ClientRejectInternalAddresses &&
!conn->use_begindir && !conn->chosen_exit_name && !circ) {
tor_addr_t addr;
- if (tor_addr_parse(&addr, socks->address) >= 0 &&
- tor_addr_is_internal(&addr, 0)) {
+ if (tor_addr_hostname_is_local(socks->address) ||
+ (tor_addr_parse(&addr, socks->address) >= 0 &&
+ tor_addr_is_internal(&addr, 0))) {
/* If this is an explicit private address with no chosen exit node,
* then we really don't want to try to connect to it. That's
* probably an error. */
if (conn->is_transparent_ap) {
- log_warn(LD_NET,
- "Rejecting request for anonymous connection to private "
- "address %s on a TransPort or NATDPort. Possible loop "
- "in your NAT rules?", safe_str_client(socks->address));
+#define WARN_INTERVAL_LOOP 300
+ static ratelim_t loop_warn_limit = RATELIM_INIT(WARN_INTERVAL_LOOP);
+ char *m;
+ if ((m = rate_limit_log(&loop_warn_limit, approx_time()))) {
+ log_warn(LD_NET,
+ "Rejecting request for anonymous connection to private "
+ "address %s on a TransPort or NATDPort. Possible loop "
+ "in your NAT rules?%s", safe_str_client(socks->address),
+ m);
+ tor_free(m);
+ }
} else {
- log_warn(LD_NET,
- "Rejecting SOCKS request for anonymous connection to "
- "private address %s", safe_str_client(socks->address));
+#define WARN_INTERVAL_PRIV 300
+ static ratelim_t priv_warn_limit = RATELIM_INIT(WARN_INTERVAL_PRIV);
+ char *m;
+ if ((m = rate_limit_log(&priv_warn_limit, approx_time()))) {
+ log_warn(LD_NET,
+ "Rejecting SOCKS request for anonymous connection to "
+ "private address %s.%s",
+ safe_str_client(socks->address),m);
+ tor_free(m);
+ }
}
connection_mark_unattached_ap(conn, END_STREAM_REASON_PRIVATE_ADDR);
return -1;
@@ -2304,6 +2319,11 @@ connection_ap_handshake_process_socks(entry_connection_t *conn)
connection_write_to_buf((const char*)socks->reply, socks->replylen,
base_conn);
socks->replylen = 0;
+ if (sockshere == -1) {
+ /* An invalid request just got a reply, no additional
+ * one is necessary. */
+ socks->has_finished = 1;
+ }
}
if (sockshere == 0) {
@@ -2745,7 +2765,7 @@ tell_controller_about_resolved_result(entry_connection_t *conn,
answer_type == RESOLVED_TYPE_HOSTNAME)) {
return; /* we already told the controller. */
} else if (answer_type == RESOLVED_TYPE_IPV4 && answer_len >= 4) {
- char *cp = tor_dup_ip(get_uint32(answer));
+ char *cp = tor_dup_ip(ntohl(get_uint32(answer)));
control_event_address_mapped(conn->socks_request->address,
cp, expires, NULL);
tor_free(cp);
diff --git a/src/or/connection_edge.h b/src/or/connection_edge.h
index 47c9c45b1a..f6db4b4ef9 100644
--- a/src/or/connection_edge.h
+++ b/src/or/connection_edge.h
@@ -79,7 +79,8 @@ int addressmap_have_mapping(const char *address, int update_timeout);
void addressmap_register(const char *address, char *new_address,
time_t expires, addressmap_entry_source_t source,
- int address_wildcard, int new_address_wildcard);
+ const int address_wildcard,
+ const int new_address_wildcard);
int parse_virtual_addr_network(const char *val, int validate_only,
char **msg);
int client_dns_incr_failures(const char *address);
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 0d3f9d87f2..81df70eb37 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -1051,8 +1051,27 @@ connection_or_connect(const tor_addr_t *_addr, uint16_t port,
conn->_base.proxy_state = PROXY_INFANT;
}
} else {
- log_warn(LD_GENERAL, "Tried to connect through proxy, but proxy address "
- "could not be found.");
+ /* get_proxy_addrport() might fail if we have a Bridge line that
+ references a transport, but no ClientTransportPlugin lines
+ defining its transport proxy. If this is the case, let's try to
+ output a useful log message to the user. */
+ const char *transport_name =
+ find_transport_name_by_bridge_addrport(&TO_CONN(conn)->addr,
+ TO_CONN(conn)->port);
+
+ if (transport_name) {
+ log_warn(LD_GENERAL, "We were supposed to connect to bridge '%s:%u' "
+ "using pluggable transport '%s', but it seems that we can't "
+ "find a pluggable transport proxy supporting '%s'. Please make "
+ "sure that your configuration file is valid.",
+ fmt_addr(&TO_CONN(conn)->addr), TO_CONN(conn)->port,
+ transport_name, transport_name);
+ } else {
+ log_warn(LD_GENERAL, "Tried to connect to '%s:%u' through a proxy, but "
+ "the proxy address could not be found.",
+ fmt_addr(&TO_CONN(conn)->addr), TO_CONN(conn)->port);
+ }
+
connection_free(TO_CONN(conn));
return NULL;
}
diff --git a/src/or/control.c b/src/or/control.c
index 397bb53ab4..ec018ffc23 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -2530,6 +2530,10 @@ handle_control_setcircuitpurpose(control_connection_t *conn,
{
const char *purp = find_element_starting_with(args,1,"PURPOSE=");
+ if (!purp) {
+ connection_write_str_to_buf("552 No purpose given\r\n", conn);
+ goto done;
+ }
new_purpose = circuit_purpose_from_string(purp);
if (new_purpose == CIRCUIT_PURPOSE_UNKNOWN) {
connection_printf_to_buf(conn, "552 Unknown purpose \"%s\"\r\n", purp);
@@ -2986,13 +2990,14 @@ handle_control_authchallenge(control_connection_t *conn, uint32_t len,
cp += strlen("SAFECOOKIE");
} else {
connection_write_str_to_buf("513 AUTHCHALLENGE only supports SAFECOOKIE "
- "authentication", conn);
+ "authentication\r\n", conn);
connection_mark_for_close(TO_CONN(conn));
return -1;
}
if (!authentication_cookie_is_set) {
- connection_write_str_to_buf("515 Cookie authentication is disabled", conn);
+ connection_write_str_to_buf("515 Cookie authentication is disabled\r\n",
+ conn);
connection_mark_for_close(TO_CONN(conn));
return -1;
}
@@ -3003,7 +3008,7 @@ handle_control_authchallenge(control_connection_t *conn, uint32_t len,
decode_escaped_string(cp, len - (cp - body),
&client_nonce, &client_nonce_len);
if (newcp == NULL) {
- connection_write_str_to_buf("513 Invalid quoted client nonce",
+ connection_write_str_to_buf("513 Invalid quoted client nonce\r\n",
conn);
connection_mark_for_close(TO_CONN(conn));
return -1;
@@ -3017,7 +3022,7 @@ handle_control_authchallenge(control_connection_t *conn, uint32_t len,
if (base16_decode(client_nonce, client_nonce_len,
cp, client_nonce_encoded_len) < 0) {
- connection_write_str_to_buf("513 Invalid base16 client nonce",
+ connection_write_str_to_buf("513 Invalid base16 client nonce\r\n",
conn);
connection_mark_for_close(TO_CONN(conn));
tor_free(client_nonce);
@@ -3030,7 +3035,7 @@ handle_control_authchallenge(control_connection_t *conn, uint32_t len,
cp += strspn(cp, " \t\n\r");
if (*cp != '\0' ||
cp != body + len) {
- connection_write_str_to_buf("513 Junk at end of AUTHCHALLENGE command",
+ connection_write_str_to_buf("513 Junk at end of AUTHCHALLENGE command\r\n",
conn);
connection_mark_for_close(TO_CONN(conn));
tor_free(client_nonce);
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 1c2579865f..1220c32a50 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1252,6 +1252,15 @@ directory_caches_v2_dir_info(const or_options_t *options)
return options->DirPort != NULL;
}
+/** Return true iff we want to fetch and keep certificates for authorities
+ * that we don't acknowledge as aurthorities ourself.
+ */
+int
+directory_caches_unknown_auth_certs(const or_options_t *options)
+{
+ return options->DirPort || options->BridgeRelay;
+}
+
/** Return 1 if we want to keep descriptors, networkstatuses, etc around
* and we're willing to serve them to others. Else return 0.
*/
diff --git a/src/or/dirserv.h b/src/or/dirserv.h
index fc48e489e8..3ff08157e0 100644
--- a/src/or/dirserv.h
+++ b/src/or/dirserv.h
@@ -76,6 +76,7 @@ int directory_fetches_dir_info_early(const or_options_t *options);
int directory_fetches_dir_info_later(const or_options_t *options);
int directory_caches_v2_dir_info(const or_options_t *options);
#define directory_caches_v1_dir_info(o) directory_caches_v2_dir_info(o)
+int directory_caches_unknown_auth_certs(const or_options_t *options);
int directory_caches_dir_info(const or_options_t *options);
int directory_permits_begindir_requests(const or_options_t *options);
int directory_permits_controller_requests(const or_options_t *options);
diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index cddb658244..20dc8c2649 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -668,10 +668,10 @@ dirvote_compute_params(smartlist_t *votes, int method, int total_authorities)
const char *next_param;
int ok=0;
eq = strchr(param, '=');
- tor_assert(i<n_votes);
+ tor_assert(i<n_votes); /* Make sure we prevented vote-stuffing. */
vals[i++] = (int32_t)
tor_parse_long(eq+1, 10, INT32_MIN, INT32_MAX, &ok, NULL);
- tor_assert(ok);
+ tor_assert(ok); /* Already checked these when parsing. */
if (param_sl_idx+1 == smartlist_len(param_list))
next_param = NULL;
@@ -1005,7 +1005,7 @@ networkstatus_compute_bw_weights_v10(smartlist_t *chunks, int64_t G,
/* 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);
+ tor_assert(0 < weight_scale && weight_scale <= INT32_MAX);
/*
* Provide Wgm=Wgg, Wmm=1, Wem=Wee, Weg=Wed. May later determine
@@ -1233,7 +1233,7 @@ networkstatus_compute_bw_weights_v9(smartlist_t *chunks, int64_t G, int64_t M,
/* 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);
+ tor_assert(0 < weight_scale && weight_scale <= INT32_MAX);
if (Wgg < 0 || Wgg > weight_scale) {
log_warn(LD_DIR, "Bw %s: Wgg="I64_FORMAT"! G="I64_FORMAT
@@ -2019,7 +2019,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
int ok=0;
char *eq = strchr(bw_weight_param, '=');
if (eq) {
- weight_scale = tor_parse_long(eq+1, 10, INT32_MIN, INT32_MAX, &ok,
+ weight_scale = tor_parse_long(eq+1, 10, 1, INT32_MAX, &ok,
NULL);
if (!ok) {
log_warn(LD_DIR, "Bad element '%s' in bw weight param",
diff --git a/src/or/dns.c b/src/or/dns.c
index 2b7d3e3506..b349f02f68 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -1389,7 +1389,7 @@ evdns_callback(int result, char type, int count, int ttl, void *addresses,
static int
launch_resolve(edge_connection_t *exitconn)
{
- char *addr = tor_strdup(exitconn->_base.address);
+ char *addr;
struct evdns_request *req = NULL;
tor_addr_t a;
int r;
@@ -1408,6 +1408,8 @@ launch_resolve(edge_connection_t *exitconn)
}
}
+ addr = tor_strdup(exitconn->_base.address);
+
r = tor_addr_parse_PTR_name(
&a, exitconn->_base.address, AF_UNSPEC, 0);
diff --git a/src/or/main.c b/src/or/main.c
index 9022f2eb87..8308b3a238 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -1773,8 +1773,16 @@ do_hup(void)
}
options = get_options(); /* they have changed now */
} else {
+ char *msg = NULL;
log_notice(LD_GENERAL, "Not reloading config file: the controller told "
"us not to.");
+ /* Make stuff get rescanned, reloaded, etc. */
+ if (set_options((or_options_t*)options, &msg) < 0) {
+ if (!msg)
+ msg = tor_strdup("Unknown error");
+ log_warn(LD_GENERAL, "Unable to re-set previous options: %s", msg);
+ tor_free(msg);
+ }
}
if (authdir_mode_handles_descs(options, -1)) {
/* reload the approved-routers file */
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 910b99c5c0..3646ee6844 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -1463,8 +1463,10 @@ networkstatus_get_latest_consensus_by_flavor(consensus_flavor_t f)
return current_ns_consensus;
else if (f == FLAV_MICRODESC)
return current_md_consensus;
- else
+ else {
tor_assert(0);
+ return NULL;
+ }
}
/** Return the most recent consensus that we have downloaded, or NULL if it is
diff --git a/src/or/or.h b/src/or/or.h
index b8fee649ea..76681c9eea 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -23,11 +23,8 @@
#endif
#ifdef _WIN32
-#ifndef WIN32_WINNT
-#define WIN32_WINNT 0x400
-#endif
#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x400
+#define _WIN32_WINNT 0x0501
#endif
#define WIN32_LEAN_AND_MEAN
#endif
diff --git a/src/or/rendmid.c b/src/or/rendmid.c
index 2742c351b3..894bbb3c54 100644
--- a/src/or/rendmid.c
+++ b/src/or/rendmid.c
@@ -276,13 +276,6 @@ rend_mid_rendezvous(or_circuit_t *circ, const uint8_t *request,
or_circuit_t *rend_circ;
char hexid[9];
int reason = END_CIRC_REASON_INTERNAL;
- base16_encode(hexid,9,(char*)request,request_len<4?request_len:4);
-
- if (request_len>=4) {
- log_info(LD_REND,
- "Got request for rendezvous from circuit %d to cookie %s.",
- circ->p_circ_id, hexid);
- }
if (circ->_base.purpose != CIRCUIT_PURPOSE_OR || circ->_base.n_conn) {
log_info(LD_REND,
@@ -300,6 +293,12 @@ rend_mid_rendezvous(or_circuit_t *circ, const uint8_t *request,
goto err;
}
+ base16_encode(hexid, sizeof(hexid), (const char*)request, 4);
+
+ log_info(LD_REND,
+ "Got request for rendezvous from circuit %d to cookie %s.",
+ circ->p_circ_id, hexid);
+
rend_circ = circuit_get_rendezvous((char*)request);
if (!rend_circ) {
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 0cd60eeb83..0727c6851a 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -1868,6 +1868,26 @@ rep_hist_get_predicted_ports(time_t now)
return out;
}
+/**
+ * Take a list of uint16_t *, and remove every port in the list from the
+ * current list of predicted ports.
+ */
+void
+rep_hist_remove_predicted_ports(const smartlist_t *rmv_ports)
+{
+ /* Let's do this on O(N), not O(N^2). */
+ bitarray_t *remove_ports = bitarray_init_zero(UINT16_MAX);
+ SMARTLIST_FOREACH(rmv_ports, const uint16_t *, p,
+ bitarray_set(remove_ports, *p));
+ SMARTLIST_FOREACH_BEGIN(predicted_ports_list, predicted_port_t *, pp) {
+ if (bitarray_is_set(remove_ports, pp->port)) {
+ tor_free(pp);
+ SMARTLIST_DEL_CURRENT(predicted_ports_list, pp);
+ }
+ } SMARTLIST_FOREACH_END(pp);
+ bitarray_free(remove_ports);
+}
+
/** The user asked us to do a resolve. Rather than keeping track of
* timings and such of resolves, we fake it for now by treating
* it the same way as a connection to port 80. This way we will continue
@@ -2650,24 +2670,30 @@ rep_hist_format_desc_stats(time_t now)
const char *key;
void *val;
unsigned size;
- int *vals;
+ int *vals, max = 0, q3 = 0, md = 0, q1 = 0, min = 0;
int n = 0;
if (!start_of_served_descs_stats_interval)
return NULL;
- size = digestmap_size(served_descs);
- if (size == 0)
- return NULL;
- vals = tor_malloc(size * sizeof(int));
-
- for (iter = digestmap_iter_init(served_descs); !digestmap_iter_done(iter);
- iter = digestmap_iter_next(served_descs, iter) ) {
- uintptr_t count;
- digestmap_iter_get(iter, &key, &val);
- count = (uintptr_t)val;
- vals[n++] = (int)count;
- (void)key;
+ size = digestmap_size(served_descs);
+ if (size > 0) {
+ vals = tor_malloc(size * sizeof(int));
+ for (iter = digestmap_iter_init(served_descs);
+ !digestmap_iter_done(iter);
+ iter = digestmap_iter_next(served_descs, iter)) {
+ uintptr_t count;
+ digestmap_iter_get(iter, &key, &val);
+ count = (uintptr_t)val;
+ vals[n++] = (int)count;
+ (void)key;
+ }
+ max = find_nth_int(vals, size, size-1);
+ q3 = find_nth_int(vals, size, (3*size-1)/4);
+ md = find_nth_int(vals, size, (size-1)/2);
+ q1 = find_nth_int(vals, size, (size-1)/4);
+ min = find_nth_int(vals, size, 0);
+ tor_free(vals);
}
format_iso_time(t, now);
@@ -2678,14 +2704,8 @@ rep_hist_format_desc_stats(time_t now)
t,
(unsigned) (now - start_of_served_descs_stats_interval),
total_descriptor_downloads,
- size,
- find_nth_int(vals, size, size-1),
- find_nth_int(vals, size, (3*size-1)/4),
- find_nth_int(vals, size, (size-1)/2),
- find_nth_int(vals, size, (size-1)/4),
- find_nth_int(vals, size, 0));
-
- tor_free(vals);
+ size, max, q3, md, q1, min);
+
return result;
}
@@ -2705,6 +2725,7 @@ rep_hist_desc_stats_write(time_t now)
return start_of_served_descs_stats_interval + WRITE_STATS_INTERVAL;
str = rep_hist_format_desc_stats(now);
+ tor_assert(str != NULL);
statsdir = get_datadir_fname("stats");
if (check_private_dir(statsdir, CPD_CREATE, get_options()->User) < 0) {
diff --git a/src/or/rephist.h b/src/or/rephist.h
index 0a3e46ae1a..860713c350 100644
--- a/src/or/rephist.h
+++ b/src/or/rephist.h
@@ -34,7 +34,7 @@ int rep_hist_load_state(or_state_t *state, char **err);
void rep_history_clean(time_t before);
void rep_hist_note_router_reachable(const char *id, const tor_addr_t *at_addr,
- uint16_t at_port, time_t when);
+ const uint16_t at_port, time_t when);
void rep_hist_note_router_unreachable(const char *id, time_t when);
int rep_hist_record_mtbf_data(time_t now, int missing_means_down);
int rep_hist_load_mtbf_data(time_t now);
@@ -49,6 +49,7 @@ const char *rep_hist_get_router_stability_doc(time_t now);
void rep_hist_note_used_port(time_t now, uint16_t port);
smartlist_t *rep_hist_get_predicted_ports(time_t now);
+void rep_hist_remove_predicted_ports(const smartlist_t *rmv_ports);
void rep_hist_note_used_resolve(time_t now);
void rep_hist_note_used_internal(time_t now, int need_uptime,
int need_capacity);
diff --git a/src/or/router.c b/src/or/router.c
index 4cdfd02e56..34e231ae7c 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -1228,6 +1228,22 @@ consider_publishable_server(int force)
}
}
+/** Return the port of the first active listener of type
+ * <b>listener_type</b>. */
+/** XXX not a very good interface. it's not reliable when there are
+ multiple listeners. */
+uint16_t
+router_get_active_listener_port_by_type(int listener_type)
+{
+ /* Iterate all connections, find one of the right kind and return
+ the port. Not very sophisticated or fast, but effective. */
+ const connection_t *c = connection_get_by_type(listener_type);
+ if (c)
+ return c->port;
+
+ return 0;
+}
+
/** Return the port that we should advertise as our ORPort; this is either
* the one configured in the ORPort option, or the one we actually bound to
* if ORPort is "auto".
@@ -1238,12 +1254,11 @@ router_get_advertised_or_port(const or_options_t *options)
int port = get_primary_or_port();
(void)options;
- if (port == CFG_AUTO_PORT) {
- connection_t *c = connection_get_by_type(CONN_TYPE_OR_LISTENER);
- if (c)
- return c->port;
- return 0;
- }
+ /* If the port is in 'auto' mode, we have to use
+ router_get_listener_port_by_type(). */
+ if (port == CFG_AUTO_PORT)
+ return router_get_active_listener_port_by_type(CONN_TYPE_OR_LISTENER);
+
return port;
}
@@ -1260,12 +1275,10 @@ router_get_advertised_dir_port(const or_options_t *options, uint16_t dirport)
if (!dirport_configured)
return dirport;
- if (dirport_configured == CFG_AUTO_PORT) {
- connection_t *c = connection_get_by_type(CONN_TYPE_DIR_LISTENER);
- if (c)
- return c->port;
- return 0;
- }
+
+ if (dirport_configured == CFG_AUTO_PORT)
+ return router_get_active_listener_port_by_type(CONN_TYPE_DIR_LISTENER);
+
return dirport_configured;
}
@@ -1530,10 +1543,18 @@ router_rebuild_descriptor(int force)
if (p->type == CONN_TYPE_OR_LISTENER &&
! p->no_advertise &&
! p->ipv4_only &&
- tor_addr_family(&p->addr) == AF_INET6 &&
- ! tor_addr_is_internal(&p->addr, 1)) {
- ipv6_orport = p;
- break;
+ tor_addr_family(&p->addr) == AF_INET6) {
+ if (! tor_addr_is_internal(&p->addr, 0)) {
+ ipv6_orport = p;
+ break;
+ } else {
+ char addrbuf[TOR_ADDR_BUF_LEN];
+ log_warn(LD_CONFIG,
+ "Unable to use configured IPv6 address \"%s\" in a "
+ "descriptor. Skipping it. "
+ "Try specifying a globally reachable address explicitly. ",
+ tor_addr_to_str(addrbuf, &p->addr, sizeof(addrbuf), 1));
+ }
}
} SMARTLIST_FOREACH_END(p);
if (ipv6_orport) {
@@ -1647,6 +1668,7 @@ router_rebuild_descriptor(int force)
ei->cache_info.signed_descriptor_len =
strlen(ei->cache_info.signed_descriptor_body);
router_get_extrainfo_hash(ei->cache_info.signed_descriptor_body,
+ ei->cache_info.signed_descriptor_len,
ei->cache_info.signed_descriptor_digest);
}
@@ -1672,12 +1694,15 @@ router_rebuild_descriptor(int force)
ri->purpose =
options->BridgeRelay ? ROUTER_PURPOSE_BRIDGE : ROUTER_PURPOSE_GENERAL;
- ri->cache_info.send_unencrypted = 1;
- /* Let bridges serve their own descriptors unencrypted, so they can
- * pass reachability testing. (If they want to be harder to notice,
- * they can always leave the DirPort off). */
- if (ei && !options->BridgeRelay)
- ei->cache_info.send_unencrypted = 1;
+ if (options->BridgeRelay) {
+ /* Bridges shouldn't be able to send their descriptors unencrypted,
+ anyway, since they don't have a DirPort, and always connect to the
+ bridge authority anonymously. But just in case they somehow think of
+ sending them on an unencrypted connection, don't allow them to try. */
+ ri->cache_info.send_unencrypted = ei->cache_info.send_unencrypted = 0;
+ } else {
+ ri->cache_info.send_unencrypted = ei->cache_info.send_unencrypted = 1;
+ }
router_get_router_hash(ri->cache_info.signed_descriptor_body,
strlen(ri->cache_info.signed_descriptor_body),
@@ -1927,7 +1952,7 @@ router_guess_address_from_dir_headers(uint32_t *guess)
void
get_platform_str(char *platform, size_t len)
{
- tor_snprintf(platform, len, "Tor %s on %s", get_version(), get_uname());
+ tor_snprintf(platform, len, "Tor %s on %s", get_short_version(), get_uname());
}
/* XXX need to audit this thing and count fenceposts. maybe
@@ -2351,7 +2376,7 @@ extrainfo_dump_to_string(char **s_out, extrainfo_t *extrainfo,
}
memset(sig, 0, sizeof(sig));
- if (router_get_extrainfo_hash(s, digest) < 0 ||
+ if (router_get_extrainfo_hash(s, strlen(s), digest) < 0 ||
router_append_dirobj_signature(sig, sizeof(sig), digest, DIGEST_LEN,
ident_key) < 0) {
log_warn(LD_BUG, "Could not append signature to extra-info "
diff --git a/src/or/router.h b/src/or/router.h
index fb914349f3..294736e70c 100644
--- a/src/or/router.h
+++ b/src/or/router.h
@@ -53,6 +53,7 @@ int authdir_mode_publishes_statuses(const or_options_t *options);
int authdir_mode_tests_reachability(const or_options_t *options);
int authdir_mode_bridge(const or_options_t *options);
+uint16_t router_get_active_listener_port_by_type(int listener_type);
uint16_t router_get_advertised_or_port(const or_options_t *options);
uint16_t router_get_advertised_dir_port(const or_options_t *options,
uint16_t dirport);
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index a64b93f3a9..0abc2e9bcf 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -229,7 +229,7 @@ trusted_dirs_load_certs_from_string(const char *contents, int from_store,
"signing key %s", from_store ? "cached" : "downloaded",
ds->nickname, hex_str(cert->signing_key_digest,DIGEST_LEN));
} else {
- int adding = directory_caches_dir_info(get_options());
+ int adding = directory_caches_unknown_auth_certs(get_options());
log_info(LD_DIR, "%s %s certificate for unrecognized directory "
"authority with signing key %s",
adding ? "Adding" : "Not adding",
@@ -480,7 +480,7 @@ authority_certs_fetch_missing(networkstatus_t *status, time_t now)
smartlist_t *missing_digests;
char *resource = NULL;
cert_list_t *cl;
- const int cache = directory_caches_dir_info(get_options());
+ const int cache = directory_caches_unknown_auth_certs(get_options());
if (should_delay_dir_fetches(get_options()))
return;
@@ -2838,6 +2838,13 @@ routerlist_insert(routerlist_t *rl, routerinfo_t *ri)
ri->cache_info.signed_descriptor_digest,
&(ri->cache_info));
if (sd_old) {
+ int idx = sd_old->routerlist_index;
+ sd_old->routerlist_index = -1;
+ smartlist_del(rl->old_routers, idx);
+ if (idx < smartlist_len(rl->old_routers)) {
+ signed_descriptor_t *d = smartlist_get(rl->old_routers, idx);
+ d->routerlist_index = idx;
+ }
rl->desc_store.bytes_dropped += sd_old->signed_descriptor_len;
sdmap_remove(rl->desc_by_eid_map, sd_old->extra_info_digest);
signed_descriptor_free(sd_old);
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 7cc8b965e6..781c57897d 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -682,12 +682,12 @@ router_get_networkstatus_v3_hash(const char *s, char *digest,
' ', alg);
}
-/** Set <b>digest</b> to the SHA-1 digest of the hash of the extrainfo
- * string in <b>s</b>. Return 0 on success, -1 on failure. */
+/** Set <b>digest</b> to the SHA-1 digest of the hash of the <b>s_len</b>-byte
+ * extrainfo string at <b>s</b>. Return 0 on success, -1 on failure. */
int
-router_get_extrainfo_hash(const char *s, char *digest)
+router_get_extrainfo_hash(const char *s, size_t s_len, char *digest)
{
- return router_get_hash_impl(s, strlen(s), digest, "extra-info",
+ return router_get_hash_impl(s, s_len, digest, "extra-info",
"\nrouter-signature",'\n', DIGEST_SHA1);
}
@@ -1643,7 +1643,7 @@ extrainfo_parse_entry_from_string(const char *s, const char *end,
while (end > s+2 && *(end-1) == '\n' && *(end-2) == '\n')
--end;
- if (router_get_extrainfo_hash(s, digest) < 0) {
+ if (router_get_extrainfo_hash(s, end-s, digest) < 0) {
log_warn(LD_DIR, "Couldn't compute router hash.");
goto err;
}
@@ -2821,6 +2821,7 @@ networkstatus_parse_vote_from_string(const char *s, const char **eos_out,
int i, inorder, n_signatures = 0;
memarea_t *area = NULL, *rs_area = NULL;
consensus_flavor_t flav = FLAV_NS;
+ char *last_kwd=NULL;
tor_assert(s);
@@ -2977,15 +2978,18 @@ networkstatus_parse_vote_from_string(const char *s, const char **eos_out,
tok = find_opt_by_keyword(tokens, K_PARAMS);
if (tok) {
+ int any_dups = 0;
inorder = 1;
ns->net_params = smartlist_new();
for (i = 0; i < tok->n_args; ++i) {
int ok=0;
char *eq = strchr(tok->args[i], '=');
+ size_t eq_pos;
if (!eq) {
log_warn(LD_DIR, "Bad element '%s' in params", escaped(tok->args[i]));
goto err;
}
+ eq_pos = eq-tok->args[i];
tor_parse_long(eq+1, 10, INT32_MIN, INT32_MAX, &ok, NULL);
if (!ok) {
log_warn(LD_DIR, "Bad element '%s' in params", escaped(tok->args[i]));
@@ -2995,12 +2999,24 @@ networkstatus_parse_vote_from_string(const char *s, const char **eos_out,
log_warn(LD_DIR, "%s >= %s", tok->args[i-1], tok->args[i]);
inorder = 0;
}
+ if (last_kwd && eq_pos == strlen(last_kwd) &&
+ fast_memeq(last_kwd, tok->args[i], eq_pos)) {
+ log_warn(LD_DIR, "Duplicate value for %s parameter",
+ escaped(tok->args[i]));
+ any_dups = 1;
+ }
+ tor_free(last_kwd);
+ last_kwd = tor_strndup(tok->args[i], eq_pos);
smartlist_add(ns->net_params, tor_strdup(tok->args[i]));
}
if (!inorder) {
log_warn(LD_DIR, "params not in order");
goto err;
}
+ if (any_dups) {
+ log_warn(LD_DIR, "Duplicate in parameters");
+ goto err;
+ }
}
ns->voters = smartlist_new();
@@ -3339,6 +3355,7 @@ networkstatus_parse_vote_from_string(const char *s, const char **eos_out,
}
if (rs_area)
memarea_drop_all(rs_area);
+ tor_free(last_kwd);
return ns;
}
diff --git a/src/or/routerparse.h b/src/or/routerparse.h
index b274d2196c..6486a09c73 100644
--- a/src/or/routerparse.h
+++ b/src/or/routerparse.h
@@ -19,7 +19,7 @@ int router_get_networkstatus_v2_hash(const char *s, char *digest);
int router_get_networkstatus_v3_hash(const char *s, char *digest,
digest_algorithm_t algorithm);
int router_get_networkstatus_v3_hashes(const char *s, digests_t *digests);
-int router_get_extrainfo_hash(const char *s, char *digest);
+int router_get_extrainfo_hash(const char *s, size_t s_len, char *digest);
#define DIROBJ_MAX_SIG_LEN 256
int router_append_dirobj_signature(char *buf, size_t buf_len,
const char *digest,
diff --git a/src/or/transports.c b/src/or/transports.c
index 564603e1fe..a20decfc03 100644
--- a/src/or/transports.c
+++ b/src/or/transports.c
@@ -119,10 +119,6 @@ static INLINE void free_execve_args(char **arg);
#define PROTO_CMETHODS_DONE "CMETHODS DONE"
#define PROTO_SMETHODS_DONE "SMETHODS DONE"
-/* The smallest valid managed proxy protocol line that can
- appear. It's the size of "VERSION 1" */
-#define SMALLEST_MANAGED_LINE_SIZE 9
-
/** Number of environment variables for managed proxy clients/servers. */
#define ENVIRON_SIZE_CLIENT 3
#define ENVIRON_SIZE_SERVER 7 /* XXX known to be too high, but that's ok */
@@ -340,11 +336,12 @@ pt_configure_remaining_proxies(void)
/* This proxy is marked by a SIGHUP. Check whether we need to
restart it. */
if (proxy_needs_restart(mp)) {
- log_info(LD_GENERAL, "Preparing managed proxy for restart.");
+ log_info(LD_GENERAL, "Preparing managed proxy '%s' for restart.",
+ mp->argv[0]);
proxy_prepare_for_restart(mp);
} else { /* it doesn't need to be restarted. */
- log_info(LD_GENERAL, "Nothing changed for managed proxy after HUP: "
- "not restarting.");
+ log_info(LD_GENERAL, "Nothing changed for managed proxy '%s' after "
+ "HUP: not restarting.", mp->argv[0]);
}
continue;
@@ -387,7 +384,8 @@ configure_proxy(managed_proxy_t *mp)
pos = tor_read_all_handle(tor_process_get_stdout_pipe(mp->process_handle),
stdout_buf, sizeof(stdout_buf) - 1, NULL);
if (pos < 0) {
- log_notice(LD_GENERAL, "Failed to read data from managed proxy");
+ log_notice(LD_GENERAL, "Failed to read data from managed proxy '%s'.",
+ mp->argv[0]);
mp->conf_state = PT_PROTO_BROKEN;
goto done;
}
@@ -449,11 +447,13 @@ configure_proxy(managed_proxy_t *mp)
} else if (r == IO_STREAM_EAGAIN) { /* check back later */
return;
} else if (r == IO_STREAM_CLOSED || r == IO_STREAM_TERM) { /* snap! */
- log_notice(LD_GENERAL, "Managed proxy stream closed. "
- "Most probably application stopped running");
+ log_warn(LD_GENERAL, "Our communication channel with the managed proxy "
+ "'%s' closed. Most probably application stopped running.",
+ mp->argv[0]);
mp->conf_state = PT_PROTO_BROKEN;
} else { /* unknown stream status */
- log_notice(LD_GENERAL, "Unknown stream status while configuring proxy.");
+ log_warn(LD_BUG, "Unknown stream status '%d' while configuring managed "
+ "proxy '%s'.", (int)r, mp->argv[0]);
}
/* if the proxy finished configuring, exit the loop. */
@@ -586,8 +586,8 @@ handle_finished_proxy(managed_proxy_t *mp)
case PT_PROTO_ACCEPTING_METHODS:
case PT_PROTO_COMPLETED:
default:
- log_warn(LD_CONFIG, "Unexpected managed proxy state in "
- "handle_finished_proxy().");
+ log_warn(LD_CONFIG, "Unexpected state '%d' of managed proxy '%s'.",
+ (int)mp->conf_state, mp->argv[0]);
tor_assert(0);
}
@@ -612,11 +612,13 @@ handle_methods_done(const managed_proxy_t *mp)
tor_assert(mp->transports);
if (smartlist_len(mp->transports) == 0)
- log_notice(LD_GENERAL, "Proxy was spawned successfully, "
- "but it didn't laucn any pluggable transport listeners!");
+ log_notice(LD_GENERAL, "Managed proxy '%s' was spawned successfully, "
+ "but it didn't launch any pluggable transport listeners!",
+ mp->argv[0]);
- log_info(LD_CONFIG, "%s managed proxy configuration completed!",
- mp->is_server ? "Server" : "Client");
+ log_info(LD_CONFIG, "%s managed proxy '%s' configuration completed!",
+ mp->is_server ? "Server" : "Client",
+ mp->argv[0]);
}
/** Handle a configuration protocol <b>line</b> received from a
@@ -624,13 +626,8 @@ handle_methods_done(const managed_proxy_t *mp)
void
handle_proxy_line(const char *line, managed_proxy_t *mp)
{
- log_debug(LD_GENERAL, "Got a line from managed proxy: %s", line);
-
- if (strlen(line) < SMALLEST_MANAGED_LINE_SIZE) {
- log_warn(LD_GENERAL, "Managed proxy configuration line is too small. "
- "Discarding");
- goto err;
- }
+ log_info(LD_GENERAL, "Got a line from managed proxy '%s': (%s)",
+ mp->argv[0], line);
if (!strcmpstart(line, PROTO_ENV_ERROR)) {
if (mp->conf_state != PT_PROTO_LAUNCHED)
@@ -705,12 +702,13 @@ handle_proxy_line(const char *line, managed_proxy_t *mp)
return;
}
- log_warn(LD_CONFIG, "Unknown line received by managed proxy. (%s)", line);
+ log_notice(LD_GENERAL, "Unknown line received by managed proxy (%s).", line);
+ return;
err:
mp->conf_state = PT_PROTO_BROKEN;
log_warn(LD_CONFIG, "Managed proxy at '%s' failed the configuration protocol"
- " and will be destroyed.", mp->argv ? mp->argv[0] : "");
+ " and will be destroyed.", mp->argv[0]);
}
/** Parses an ENV-ERROR <b>line</b> and warns the user accordingly. */
@@ -957,8 +955,6 @@ get_bindaddr_for_server_proxy(const managed_proxy_t *mp)
static process_environment_t *
create_managed_proxy_environment(const managed_proxy_t *mp)
{
- const or_options_t *options = get_options();
-
/* Environment variables to be added to or set in mp's environment. */
smartlist_t *envs = smartlist_new();
/* XXXX The next time someone touches this code, shorten the name of
@@ -993,8 +989,12 @@ create_managed_proxy_environment(const managed_proxy_t *mp)
}
if (mp->is_server) {
- smartlist_add_asprintf(envs, "TOR_PT_ORPORT=127.0.0.1:%s",
- options->ORPort->value);
+ {
+ char *orport_tmp =
+ get_first_listener_addrport_string(CONN_TYPE_OR_LISTENER);
+ smartlist_add_asprintf(envs, "TOR_PT_ORPORT=%s", orport_tmp);
+ tor_free(orport_tmp);
+ }
{
char *bindaddr_tmp = get_bindaddr_for_server_proxy(mp);
@@ -1027,8 +1027,11 @@ create_managed_proxy_environment(const managed_proxy_t *mp)
}
/** Create and return a new managed proxy for <b>transport</b> using
- * <b>proxy_argv</b>. If <b>is_server</b> is true, it's a server
- * managed proxy. */
+ * <b>proxy_argv</b>. Also, add it to the global managed proxy list. If
+ * <b>is_server</b> is true, it's a server managed proxy. Takes ownership of
+ * <b>proxy_argv</b>.
+ *
+ * Requires that proxy_argv have at least one element. */
static managed_proxy_t *
managed_proxy_create(const smartlist_t *transport_list,
char **proxy_argv, int is_server)
@@ -1056,7 +1059,13 @@ managed_proxy_create(const smartlist_t *transport_list,
/** Register proxy with <b>proxy_argv</b>, supporting transports in
* <b>transport_list</b>, to the managed proxy subsystem.
- * If <b>is_server</b> is true, then the proxy is a server proxy. */
+ * If <b>is_server</b> is true, then the proxy is a server proxy.
+ *
+ * Takes ownership of proxy_argv.
+ *
+ * Requires that proxy_argv be a NULL-terminated array of command-line
+ * elements, containing at least one element.
+ **/
void
pt_kickstart_proxy(const smartlist_t *transport_list,
char **proxy_argv, int is_server)
@@ -1064,6 +1073,10 @@ pt_kickstart_proxy(const smartlist_t *transport_list,
managed_proxy_t *mp=NULL;
transport_t *old_transport = NULL;
+ if (!proxy_argv || !proxy_argv[0]) {
+ return;
+ }
+
mp = get_managed_proxy_by_argv_and_type(proxy_argv, is_server);
if (!mp) { /* we haven't seen this proxy before */
diff --git a/src/test/Makefile.nmake b/src/test/Makefile.nmake
new file mode 100644
index 0000000000..aec477cf99
--- /dev/null
+++ b/src/test/Makefile.nmake
@@ -0,0 +1,20 @@
+all: test.exe
+
+CFLAGS = /I ..\win32 /I ..\..\..\build-alpha\include /I ..\common /I ..\or
+
+LIBS = ..\..\..\build-alpha\lib\libevent.lib \
+ ..\..\..\build-alpha\lib\libcrypto.lib \
+ ..\..\..\build-alpha\lib\libssl.lib \
+ ..\..\..\build-alpha\lib\libz.lib \
+ ..\or\libtor.lib \
+ ws2_32.lib advapi32.lib shell32.lib
+
+TEST_OBJECTS = test.obj test_addr.obj test_containers.obj \
+ test_crypto.obj test_data.obj test_dir.obj test_microdesc.obj \
+ test_pt.obj test_util.obj test_config.obj tinytest.obj
+
+test.exe: $(TEST_OBJECTS)
+ $(CC) $(CFLAGS) $(LIBS) ..\common\*.lib $(TEST_OBJECTS)
+
+clean:
+ del $(TEST_OBJECTS) *.lib test.exe
diff --git a/src/test/test.c b/src/test/test.c
index 7f196aacf4..c2dba924e4 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -71,6 +71,9 @@ int have_failed = 0;
/** Temporary directory (set up by setup_directory) under which we store all
* our files during testing. */
static char temp_dir[256];
+#ifdef _WIN32
+#define pid_t unsigned
+#endif
static pid_t temp_dir_setup_in_pid = 0;
/** Select and create the temporary directory we'll use to run our unit tests.
diff --git a/src/test/test_pt.c b/src/test/test_pt.c
index 9d6aa09f0d..fde64ab28e 100644
--- a/src/test/test_pt.c
+++ b/src/test/test_pt.c
@@ -94,15 +94,11 @@ test_pt_protocol(void)
managed_proxy_t *mp = tor_malloc_zero(sizeof(managed_proxy_t));
mp->conf_state = PT_PROTO_LAUNCHED;
mp->transports = smartlist_new();
+ mp->argv = tor_malloc_zero(sizeof(char*)*2);
+ mp->argv[0] = tor_strdup("<testcase>");
/* various wrong protocol runs: */
- strcpy(line, "TEST TEST");
- handle_proxy_line(line, mp);
- test_assert(mp->conf_state == PT_PROTO_BROKEN);
-
- reset_mp(mp);
-
strcpy(line,"VERSION 1");
handle_proxy_line(line, mp);
test_assert(mp->conf_state == PT_PROTO_ACCEPTING_METHODS);
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 7a455e06a9..99c5544508 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -174,6 +174,76 @@ test_util_time(void)
}
static void
+test_util_parse_http_time(void *arg)
+{
+ struct tm a_time;
+ char b[ISO_TIME_LEN+1];
+ (void)arg;
+
+#define T(s) do { \
+ format_iso_time(b, tor_timegm(&a_time)); \
+ tt_str_op(b, ==, (s)); \
+ b[0]='\0'; \
+ } while (0)
+
+ /* Test parse_http_time */
+
+ test_eq(-1, parse_http_time("", &a_time));
+ test_eq(-1, parse_http_time("Sunday, 32 Aug 2004 00:48:22 GMT", &a_time));
+ test_eq(-1, parse_http_time("Sunday, 3 Aug 1869 00:48:22 GMT", &a_time));
+ test_eq(-1, parse_http_time("Sunday, 32-Aug-94 00:48:22 GMT", &a_time));
+ test_eq(-1, parse_http_time("Sunday, 3-Ago-04 00:48:22", &a_time));
+ test_eq(-1, parse_http_time("Sunday, August the third", &a_time));
+ test_eq(-1, parse_http_time("Wednesday,,04 Aug 1994 00:48:22 GMT", &a_time));
+
+ test_eq(0, parse_http_time("Wednesday, 04 Aug 1994 00:48:22 GMT", &a_time));
+ test_eq((time_t)775961302UL, tor_timegm(&a_time));
+ T("1994-08-04 00:48:22");
+ test_eq(0, parse_http_time("Wednesday, 4 Aug 1994 0:48:22 GMT", &a_time));
+ test_eq((time_t)775961302UL, tor_timegm(&a_time));
+ T("1994-08-04 00:48:22");
+ test_eq(0, parse_http_time("Miercoles, 4 Aug 1994 0:48:22 GMT", &a_time));
+ test_eq((time_t)775961302UL, tor_timegm(&a_time));
+ T("1994-08-04 00:48:22");
+ test_eq(0, parse_http_time("Wednesday, 04-Aug-94 00:48:22 GMT", &a_time));
+ test_eq((time_t)775961302UL, tor_timegm(&a_time));
+ T("1994-08-04 00:48:22");
+ test_eq(0, parse_http_time("Wednesday, 4-Aug-94 0:48:22 GMT", &a_time));
+ test_eq((time_t)775961302UL, tor_timegm(&a_time));
+ T("1994-08-04 00:48:22");
+ test_eq(0, parse_http_time("Miercoles, 4-Aug-94 0:48:22 GMT", &a_time));
+ test_eq((time_t)775961302UL, tor_timegm(&a_time));
+ T("1994-08-04 00:48:22");
+ test_eq(0, parse_http_time("Wed Aug 04 00:48:22 1994", &a_time));
+ test_eq((time_t)775961302UL, tor_timegm(&a_time));
+ T("1994-08-04 00:48:22");
+ test_eq(0, parse_http_time("Wed Aug 4 0:48:22 1994", &a_time));
+ test_eq((time_t)775961302UL, tor_timegm(&a_time));
+ T("1994-08-04 00:48:22");
+ test_eq(0, parse_http_time("Mie Aug 4 0:48:22 1994", &a_time));
+ test_eq((time_t)775961302UL, tor_timegm(&a_time));
+ T("1994-08-04 00:48:22");
+ test_eq(0, parse_http_time("Sun, 1 Jan 2012 00:00:00 GMT", &a_time));
+ test_eq((time_t)1325376000UL, tor_timegm(&a_time));
+ T("2012-01-01 00:00:00");
+ test_eq(0, parse_http_time("Mon, 31 Dec 2012 00:00:00 GMT", &a_time));
+ test_eq((time_t)1356912000UL, tor_timegm(&a_time));
+ T("2012-12-31 00:00:00");
+ test_eq(-1, parse_http_time("2004-08-zz 99-99x99 GMT", &a_time));
+ test_eq(-1, parse_http_time("2011-03-32 00:00:00 GMT", &a_time));
+ test_eq(-1, parse_http_time("2011-03-30 24:00:00 GMT", &a_time));
+ test_eq(-1, parse_http_time("2011-03-30 23:60:00 GMT", &a_time));
+ test_eq(-1, parse_http_time("2011-03-30 23:59:62 GMT", &a_time));
+ test_eq(-1, parse_http_time("1969-03-30 23:59:59 GMT", &a_time));
+ test_eq(-1, parse_http_time("2011-00-30 23:59:59 GMT", &a_time));
+ test_eq(-1, parse_http_time("2011-03-30 23:59", &a_time));
+
+#undef T
+ done:
+ ;
+}
+
+static void
test_util_config_line(void)
{
char buf[1024];
@@ -755,6 +825,21 @@ test_util_strmisc(void)
test_eq(-10.0, d);
}
+ {
+ /* Test tor_parse_* where we overflow/underflow the underlying type. */
+ /* This string should overflow 64-bit ints. */
+#define TOOBIG "100000000000000000000000000"
+ test_eq(0L, tor_parse_long(TOOBIG, 10, LONG_MIN, LONG_MAX, &i, NULL));
+ test_eq(i, 0);
+ test_eq(0L, tor_parse_long("-"TOOBIG, 10, LONG_MIN, LONG_MAX, &i, NULL));
+ test_eq(i, 0);
+ test_eq(0UL, tor_parse_ulong(TOOBIG, 10, 0, ULONG_MAX, &i, NULL));
+ test_eq(i, 0);
+ test_eq(U64_LITERAL(0), tor_parse_uint64(TOOBIG, 10,
+ 0, UINT64_MAX, &i, NULL));
+ test_eq(i, 0);
+ }
+
/* Test snprintf */
/* Returning -1 when there's not enough room in the output buffer */
test_eq(-1, tor_snprintf(buf, 0, "Foo"));
@@ -1737,32 +1822,56 @@ test_util_strtok(void)
{
char buf[128];
char buf2[128];
+ int i;
char *cp1, *cp2;
- strlcpy(buf, "Graved on the dark in gestures of descent", sizeof(buf));
- strlcpy(buf2, "they.seemed;their!own;most.perfect;monument", sizeof(buf2));
- /* -- "Year's End", Richard Wilbur */
- test_streq("Graved", tor_strtok_r_impl(buf, " ", &cp1));
- test_streq("they", tor_strtok_r_impl(buf2, ".!..;!", &cp2));
+ for (i = 0; i < 3; i++) {
+ const char *pad1, *pad2;
+ switch (i) {
+ case 0:
+ pad1 = pad2 = "";
+ break;
+ case 1:
+ pad1 = " ";
+ pad2 = "!";
+ break;
+ case 2:
+ pad1 = " ";
+ pad2 = ";!";
+ break;
+ }
+ tor_snprintf(buf, sizeof(buf), "%s", pad1);
+ tor_snprintf(buf2, sizeof(buf2), "%s", pad2);
+ test_assert(NULL == tor_strtok_r_impl(buf, " ", &cp1));
+ test_assert(NULL == tor_strtok_r_impl(buf2, ".!..;!", &cp2));
+
+ tor_snprintf(buf, sizeof(buf),
+ "%sGraved on the dark in gestures of descent%s", pad1, pad1);
+ tor_snprintf(buf2, sizeof(buf2),
+ "%sthey.seemed;;their!.own;most.perfect;monument%s",pad2,pad2);
+ /* -- "Year's End", Richard Wilbur */
+
+ test_streq("Graved", tor_strtok_r_impl(buf, " ", &cp1));
+ test_streq("they", tor_strtok_r_impl(buf2, ".!..;!", &cp2));
#define S1() tor_strtok_r_impl(NULL, " ", &cp1)
#define S2() tor_strtok_r_impl(NULL, ".!..;!", &cp2)
- test_streq("on", S1());
- test_streq("the", S1());
- test_streq("dark", S1());
- test_streq("seemed", S2());
- test_streq("their", S2());
- test_streq("own", S2());
- test_streq("in", S1());
- test_streq("gestures", S1());
- test_streq("of", S1());
- test_streq("most", S2());
- test_streq("perfect", S2());
- test_streq("descent", S1());
- test_streq("monument", S2());
- test_eq_ptr(NULL, S1());
- test_eq_ptr(NULL, S2());
+ test_streq("on", S1());
+ test_streq("the", S1());
+ test_streq("dark", S1());
+ test_streq("seemed", S2());
+ test_streq("their", S2());
+ test_streq("own", S2());
+ test_streq("in", S1());
+ test_streq("gestures", S1());
+ test_streq("of", S1());
+ test_streq("most", S2());
+ test_streq("perfect", S2());
+ test_streq("descent", S1());
+ test_streq("monument", S2());
+ test_eq_ptr(NULL, S1());
+ test_eq_ptr(NULL, S2());
+ }
-#if 0
buf[0] = 0;
test_eq_ptr(NULL, tor_strtok_r_impl(buf, " ", &cp1));
test_eq_ptr(NULL, tor_strtok_r_impl(buf, "!", &cp1));
@@ -1775,12 +1884,10 @@ test_util_strtok(void)
test_eq_ptr(NULL, tor_strtok_r_impl(buf, " ", &cp1));
strlcpy(buf, " ", sizeof(buf));
test_eq_ptr(NULL, tor_strtok_r_impl(buf, " ", &cp1));
-#endif
strlcpy(buf, "something ", sizeof(buf));
test_streq("something", tor_strtok_r_impl(buf, " ", &cp1));
- test_streq(" ", tor_strtok_r_impl(NULL, ";", &cp1));
- test_eq_ptr(NULL, tor_strtok_r_impl(NULL, " ", &cp1));
+ test_eq_ptr(NULL, tor_strtok_r_impl(NULL, ";", &cp1));
done:
;
}
@@ -2226,6 +2333,9 @@ test_util_spawn_background_ok(void *ptr)
static void
test_util_spawn_background_fail(void *ptr)
{
+#ifndef BUILDDIR
+#define BUILDDIR "."
+#endif
const char *argv[] = {BUILDDIR "/src/test/no-such-file", "--test", NULL};
const char *expected_err = "";
char expected_out[1024];
@@ -2881,6 +2991,7 @@ test_util_set_env_var_in_sl(void *ptr)
struct testcase_t util_tests[] = {
UTIL_LEGACY(time),
+ UTIL_TEST(parse_http_time, 0),
UTIL_LEGACY(config_line),
UTIL_LEGACY(config_line_quotes),
UTIL_LEGACY(config_line_comment_character),
diff --git a/src/tools/Makefile.nmake b/src/tools/Makefile.nmake
new file mode 100644
index 0000000000..a30a28b2e1
--- /dev/null
+++ b/src/tools/Makefile.nmake
@@ -0,0 +1,19 @@
+all: tor-resolve.exe tor-gencert.exe
+
+CFLAGS = /I ..\win32 /I ..\..\..\build-alpha\include /I ..\common /I ..\or
+
+LIBS = ..\..\..\build-alpha\lib\libevent.lib \
+ ..\..\..\build-alpha\lib\libcrypto.lib \
+ ..\..\..\build-alpha\lib\libssl.lib \
+ ..\..\..\build-alpha\lib\libz.lib \
+ ws2_32.lib advapi32.lib shell32.lib
+
+
+tor-gencert.exe: tor-gencert.obj
+ $(CC) $(CFLAGS) $(LIBS) ..\common\*.lib tor-gencert.obj
+
+tor-resolve.exe: tor-resolve.obj
+ $(CC) $(CFLAGS) $(LIBS) ..\common\*.lib tor-resolve.obj
+
+clean:
+ del *.obj *.lib *.exe
diff --git a/src/tools/tor-gencert.c b/src/tools/tor-gencert.c
index b5c96e556a..2d92e1ee8b 100644
--- a/src/tools/tor-gencert.c
+++ b/src/tools/tor-gencert.c
@@ -9,7 +9,9 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <openssl/evp.h>
#include <openssl/pem.h>
diff --git a/src/win32/orconfig.h b/src/win32/orconfig.h
index b3e579ed27..a08d0c6b58 100644
--- a/src/win32/orconfig.h
+++ b/src/win32/orconfig.h
@@ -3,7 +3,6 @@
*/
/* Windows-only defines. */
-#define _WIN32
#define CONFDIR ""
/* Define to 1 if you have the <arpa/inet.h> header file. */
@@ -233,7 +232,7 @@
#define USING_TWOS_COMPLEMENT
/* Version number of package */
-#define VERSION "0.2.3.14-alpha-dev"
+#define VERSION "0.2.3.15-alpha-dev"