[or-cvs] r17771: {tor} some fixes i found in my sandbox (in tor/trunk: . src/common src/or)
arma at seul.org
arma at seul.org
Thu Dec 25 15:37:47 UTC 2008
Author: arma
Date: 2008-12-25 10:37:47 -0500 (Thu, 25 Dec 2008)
New Revision: 17771
Modified:
tor/trunk/ChangeLog
tor/trunk/src/common/address.c
tor/trunk/src/common/address.h
tor/trunk/src/or/control.c
tor/trunk/src/or/geoip.c
tor/trunk/src/or/routerlist.c
tor/trunk/src/or/test.c
Log:
some fixes i found in my sandbox
Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog 2008-12-25 15:02:23 UTC (rev 17770)
+++ tor/trunk/ChangeLog 2008-12-25 15:37:47 UTC (rev 17771)
@@ -1,7 +1,7 @@
Changes in version 0.2.1.9-alpha - 2008-12-2?
- o Major features:
+ o Security fixes:
- Never use a connection with a mismatched address to extend a
- circuit, unless that connections is canonical. A canonical
+ circuit, unless that connection is canonical. A canonical
connection is one whose address is authenticated by the router's
identity key, either in a NETINFO cell or in a router descriptor.
@@ -59,8 +59,6 @@
o Minor features (controller):
- New CONSENSUS_ARRIVED event to note when a new consensus has
been fetched and validated.
- - Finally remove deprecated "EXTENDED_FORMAT" feature. It has
- been called EXTENDED_EVENTS since 0.1.2.4-alpha.
- When we realize that another process has modified our cached
descriptors, print out a more useful error message rather than
triggering an assertion. Fixes bug 885. Patch from Karsten.
@@ -95,7 +93,10 @@
Bugfix on 0.2.0.18-alpha.
o Deprecated and removed features:
- - RedirectExits has been removed. It was deprecated since 0.2.0.3-alpha.
+ - RedirectExits has been removed. It was deprecated since
+ 0.2.0.3-alpha.
+ - Finally remove deprecated "EXTENDED_FORMAT" controller feature. It
+ has been called EXTENDED_EVENTS since 0.1.2.4-alpha.
- Cell pools are now always enabled; --disable-cell-pools is ignored.
o Code simplifications and refactoring:
Modified: tor/trunk/src/common/address.c
===================================================================
--- tor/trunk/src/common/address.c 2008-12-25 15:02:23 UTC (rev 17770)
+++ tor/trunk/src/common/address.c 2008-12-25 15:37:47 UTC (rev 17771)
@@ -1013,7 +1013,7 @@
/** Parse an address or address-port combination from <b>s</b>, and put the
result in <b>addr_out</b> and (optionally) <b>port_out</b>. Return 0 on
- success, negative on failure.*/
+ success, negative on failure. */
int
tor_addr_port_parse(const char *s, tor_addr_t *addr_out, uint16_t *port_out)
{
Modified: tor/trunk/src/common/address.h
===================================================================
--- tor/trunk/src/common/address.h 2008-12-25 15:02:23 UTC (rev 17770)
+++ tor/trunk/src/common/address.h 2008-12-25 15:37:47 UTC (rev 17771)
@@ -33,28 +33,12 @@
} addr;
} tor_addr_t;
-/** Return an IPv4 address in network order for <b>a</b>, or 0 if
- * <b>a</b> is not an IPv4 address. */
+static INLINE const struct in6_addr *tor_addr_to_in6(const tor_addr_t *a);
static INLINE uint32_t tor_addr_to_ipv4n(const tor_addr_t *a);
-/** Return an IPv4 address in host order for <b>a</b>, or 0 if
- * <b>a</b> is not an IPv4 address. */
static INLINE uint32_t tor_addr_to_ipv4h(const tor_addr_t *a);
-/* Given an IPv6 address, return its mapped IPv4 address in host order, or
- * 0 if <b>a</b> is not an IPv6 address.
- *
- * (Does not check whether the address is really a mapped address */
static INLINE uint32_t tor_addr_to_mapped_ipv4h(const tor_addr_t *a);
-/** Return the address family of <b>a</b>. Possible values are:
- * AF_INET6, AF_INET, AF_UNSPEC. */
static INLINE sa_family_t tor_addr_family(const tor_addr_t *a);
-/** Return an in_addr* equivalent to <b>a</b>, or NULL if <b>a</b> is not
- * an IPv4 address. */
static INLINE const struct in_addr *tor_addr_to_in(const tor_addr_t *a);
-/** Return an in6_addr* equivalent to <b>a</b>, or NULL if <b>a</b> is not
- * an IPv6 address. */
-static INLINE const struct in6_addr *tor_addr_to_in6(const tor_addr_t *a);
-/** Return true iff <b>a</b> is an IPv4 address equal to the host-ordered
- * address in <b>u</b>. */
static INLINE int tor_addr_eq_ipv4h(const tor_addr_t *a, uint32_t u);
socklen_t tor_addr_to_sockaddr(const tor_addr_t *a, uint16_t port,
@@ -63,6 +47,8 @@
uint16_t *port_out);
void tor_addr_make_unspec(tor_addr_t *a);
+/** Return an in6_addr* equivalent to <b>a</b>, or NULL if <b>a</b> is not
+ * an IPv6 address. */
static INLINE const struct in6_addr *
tor_addr_to_in6(const tor_addr_t *a)
{
@@ -73,31 +59,45 @@
#define tor_addr_to_in6_addr16(x) S6_ADDR16(*tor_addr_to_in6(x))
#define tor_addr_to_in6_addr32(x) S6_ADDR32(*tor_addr_to_in6(x))
+/** Return an IPv4 address in network order for <b>a</b>, or 0 if
+ * <b>a</b> is not an IPv4 address. */
static INLINE uint32_t
tor_addr_to_ipv4n(const tor_addr_t *a)
{
return a->family == AF_INET ? a->addr.in_addr.s_addr : 0;
}
+/** Return an IPv4 address in host order for <b>a</b>, or 0 if
+ * <b>a</b> is not an IPv4 address. */
static INLINE uint32_t
tor_addr_to_ipv4h(const tor_addr_t *a)
{
return ntohl(tor_addr_to_ipv4n(a));
}
+/* Given an IPv6 address, return its mapped IPv4 address in host order, or
+ * 0 if <b>a</b> is not an IPv6 address.
+ *
+ * (Does not check whether the address is really a mapped address */
static INLINE uint32_t
tor_addr_to_mapped_ipv4h(const tor_addr_t *a)
{
return a->family == AF_INET6 ? ntohl(tor_addr_to_in6_addr32(a)[3]) : 0;
}
+/** Return the address family of <b>a</b>. Possible values are:
+ * AF_INET6, AF_INET, AF_UNSPEC. */
static INLINE sa_family_t
tor_addr_family(const tor_addr_t *a)
{
return a->family;
}
+/** Return an in_addr* equivalent to <b>a</b>, or NULL if <b>a</b> is not
+ * an IPv4 address. */
static INLINE const struct in_addr *
tor_addr_to_in(const tor_addr_t *a)
{
return a->family == AF_INET ? &a->addr.in_addr : NULL;
}
+/** Return true iff <b>a</b> is an IPv4 address equal to the host-ordered
+ * address in <b>u</b>. */
static INLINE int
tor_addr_eq_ipv4h(const tor_addr_t *a, uint32_t u)
{
Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c 2008-12-25 15:02:23 UTC (rev 17770)
+++ tor/trunk/src/or/control.c 2008-12-25 15:37:47 UTC (rev 17771)
@@ -496,7 +496,7 @@
* but it will always end with a CRLF sequence.
*
* Currently the length of the message is limited to 1024 (including the
- * ending CR LF NUL ("\\r\\n\\0") . */
+ * ending CR LF NUL ("\\r\\n\\0"). */
static void
connection_printf_to_buf(control_connection_t *conn, const char *format, ...)
{
Modified: tor/trunk/src/or/geoip.c
===================================================================
--- tor/trunk/src/or/geoip.c 2008-12-25 15:02:23 UTC (rev 17770)
+++ tor/trunk/src/or/geoip.c 2008-12-25 15:37:47 UTC (rev 17771)
@@ -28,7 +28,7 @@
/** How long are the periods for which we should remember request history? */
#define REQUEST_HIST_PERIOD (8*60*60)
-/** A per-country record for GeoIP request history */
+/** A per-country record for GeoIP request history. */
typedef struct geoip_country_t {
char countrycode[3];
uint32_t n_v2_ns_requests[REQUEST_HIST_LEN];
Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c 2008-12-25 15:02:23 UTC (rev 17770)
+++ tor/trunk/src/or/routerlist.c 2008-12-25 15:37:47 UTC (rev 17771)
@@ -2908,7 +2908,8 @@
* <b>router</b> after subsequent calls with other routerinfo's -- they
* might cause the original routerinfo to get freed.
*
- * Returns the status for the operation.
+ * Returns the status for the operation. Might set *<b>msg</b> if it wants
+ * the poster of the router to know something.
*
* If <b>from_cache</b>, this descriptor came from our disk cache. If
* <b>from_fetch</b>, we received it in response to a request we made.
Modified: tor/trunk/src/or/test.c
===================================================================
--- tor/trunk/src/or/test.c 2008-12-25 15:02:23 UTC (rev 17770)
+++ tor/trunk/src/or/test.c 2008-12-25 15:37:47 UTC (rev 17771)
@@ -1388,7 +1388,7 @@
STMT_END
/** Helper: assert that <b>a</b> parses by tor_inet_pton() into a address that
- * passes tor_addr_is_internal() with <b>for_listening</b> */
+ * passes tor_addr_is_internal() with <b>for_listening</b>. */
#define test_internal_ip(a,for_listening) STMT_BEGIN \
test_eq(tor_inet_pton(AF_INET6, a, &t1.addr.in6_addr), 1); \
t1.family = AF_INET6; \
More information about the tor-commits
mailing list