[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r8959: Tweaks to test-connection patch: use ".noconnect" instead of (in tor/trunk: . doc src/or)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] r8959: Tweaks to test-connection patch: use ".noconnect" instead of (in tor/trunk: . doc src/or)
- From: nickm@xxxxxxxx
- Date: Thu, 16 Nov 2006 22:35:06 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Thu, 16 Nov 2006 22:35:16 -0500
- Reply-to: or-talk@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Author: nickm
Date: 2006-11-16 22:34:58 -0500 (Thu, 16 Nov 2006)
New Revision: 8959
Modified:
tor/trunk/
tor/trunk/ChangeLog
tor/trunk/doc/TODO
tor/trunk/src/or/connection_edge.c
tor/trunk/src/or/control.c
tor/trunk/src/or/or.h
Log:
r9561@Kushana: nickm | 2006-11-16 22:32:54 -0500
Tweaks to test-connection patch: use ".noconnect" instead of ".test" (since there are lots of ways to test things). Use a regular sequence of STREAM events (NEW followed by CLOSED) instead of a new event type. Make the function that checks the address be static and use const and strcasecmpend properly.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r9561] on c95137ef-5f19-0410-b913-86e773d04f59
Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog 2006-11-17 03:34:44 UTC (rev 8958)
+++ tor/trunk/ChangeLog 2006-11-17 03:34:58 UTC (rev 8959)
@@ -7,6 +7,12 @@
o Minor features
- Add breakdown of public key operations to dumped statistics.
+ o Minor features, controller
+ - Make all connections to addresses of the form .noconnect immediately
+ get closed. This is more useful than you'd think, since it lets
+ application/controller combos successfully tell when they're talking to
+ the same Tor by watching for STREAM events.
+
o Major bugfixes
- Handle TransPort connections even when the server sends data before
the client sends data. Previously, the connection would just hang
Modified: tor/trunk/doc/TODO
===================================================================
--- tor/trunk/doc/TODO 2006-11-17 03:34:44 UTC (rev 8958)
+++ tor/trunk/doc/TODO 2006-11-17 03:34:58 UTC (rev 8959)
@@ -57,6 +57,8 @@
- Use for something, so we can be sure it works.
- Test and debug
+N - Document .noconnect addresses... but where?
+
o Send back RELAY_END cells on malformed RELAY_BEGIN.
o Change the circuit end reason display a little for reasons from
Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c 2006-11-17 03:34:44 UTC (rev 8958)
+++ tor/trunk/src/or/connection_edge.c 2006-11-17 03:34:58 UTC (rev 8959)
@@ -30,6 +30,7 @@
static int connection_ap_handshake_process_socks(edge_connection_t *conn);
static int connection_ap_process_natd(edge_connection_t *conn);
static int connection_exit_connect_dir(edge_connection_t *exit_conn);
+static int hostname_is_noconnect_address(const char *address);
/** An AP stream has failed/finished. If it hasn't already sent back
* a socks reply, send one now (based on endreason). Also set
@@ -1395,8 +1396,8 @@
* If the handshake is complete, send it to
* connection_ap_handshake_rewrite_and_attach().
*
- * Return -1 if an unexpected error with conn (and it should be marked
- * for close), else return 0.
+ * Return -1 if an unexpected error with conn ocurrs (and mark it for close),
+ * else return 0.
*/
static int
connection_ap_handshake_process_socks(edge_connection_t *conn)
@@ -1440,10 +1441,11 @@
return -1;
} /* else socks handshake is done, continue processing */
- if (hostname_is_a_test_address(socks->address))
+ if (hostname_is_noconnect_address(socks->address))
{
- control_event_teststream(conn);
- connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL);
+ control_event_stream_status(conn, STREAM_EVENT_NEW, 0);
+ control_event_stream_status(conn, STREAM_EVENT_CLOSED, 0);
+ connection_mark_unattached_ap(conn, END_STREAM_REASON_DONE);
return -1;
}
@@ -2457,16 +2459,11 @@
return BAD_HOSTNAME;
}
-/** Check if the address is of the form "y.test"
+/** Check if the address is of the form "y.noconnect"
*/
-int
-hostname_is_a_test_address(char *address)
+static int
+hostname_is_noconnect_address(const char *address)
{
- char *s;
- s = strrchr(address,'.');
- if (!s)
- return 0;
- if (!strcmp(s+1,"test"))
- return 1;
- return 0;
+ return ! strcasecmpend(address, ".noconnect");
}
+
Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c 2006-11-17 03:34:44 UTC (rev 8958)
+++ tor/trunk/src/or/control.c 2006-11-17 03:34:58 UTC (rev 8959)
@@ -86,8 +86,7 @@
#define EVENT_STATUS_CLIENT 0x0010
#define EVENT_STATUS_SERVER 0x0011
#define EVENT_STATUS_GENERAL 0x0012
-#define EVENT_TESTSTREAM 0x0013
-#define _EVENT_MAX 0x0013
+#define _EVENT_MAX 0x0012
/* If _EVENT_MAX ever hits 0x0020, we need to make the mask wider. */
/** Array mapping from message type codes to human-readable message
@@ -1064,8 +1063,6 @@
event_code = EVENT_STATUS_CLIENT;
else if (!strcasecmp(ev, "STATUS_SERVER"))
event_code = EVENT_STATUS_SERVER;
- else if (!strcasecmp(ev, "TESTSTREAM"))
- event_code = EVENT_TESTSTREAM;
else {
connection_printf_to_buf(conn, "552 Unrecognized event \"%s\"\r\n",
ev);
@@ -3547,17 +3544,6 @@
return r;
}
-/** Called when a request is made for a hostname ending in .test
- */
-int
-control_event_teststream(edge_connection_t *conn)
-{
- send_control1_event(EVENT_TESTSTREAM, ALL_NAMES|ALL_FORMATS,
- "650 TESTSTREAM %s\r\n",
- conn->socks_request->address);
- return 0;
-}
-
/** Choose a random authentication cookie and write it to disk.
* Anybody who can read the cookie from disk will be considered
* authorized to use the control connection. */
Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h 2006-11-17 03:34:44 UTC (rev 8958)
+++ tor/trunk/src/or/or.h 2006-11-17 03:34:58 UTC (rev 8959)
@@ -473,6 +473,8 @@
* everywhere. */
#define END_STREAM_REASON_FIXME_XXXX 0
+/* Reasons why we (or a remote OR) might close a stream. See tor-spec.txt for
+ * documentation of these. */
#define END_STREAM_REASON_MISC 1
#define END_STREAM_REASON_RESOLVEFAILED 2
#define END_STREAM_REASON_CONNECTREFUSED 3
@@ -514,6 +516,8 @@
#define END_CIRC_REASON_NOPATH -2
#define END_CIRC_AT_ORIGIN -1
+/* Reasons why we (or a remote OR) might close a circuit. See tor-spec.txt for
+ * documentation of these. */
#define _END_CIRC_REASON_MIN 0
#define END_CIRC_REASON_NONE 0
#define END_CIRC_REASON_TORPROTOCOL 1
@@ -2034,7 +2038,6 @@
NORMAL_HOSTNAME, ONION_HOSTNAME, EXIT_HOSTNAME, BAD_HOSTNAME
} hostname_type_t;
hostname_type_t parse_extended_hostname(char *address);
-int hostname_is_a_test_address(char *address);
/********************************* connection_or.c ***************************/
@@ -2142,7 +2145,6 @@
CHECK_PRINTF(2,3);
int control_event_server_status(int severity, const char *format, ...)
CHECK_PRINTF(2,3);
-int control_event_teststream(edge_connection_t *conn);
int init_cookie_authentication(int enabled);
int decode_hashed_password(char *buf, const char *hashed);