summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-10-03 18:59:52 +0000
committerNick Mathewson <nickm@torproject.org>2006-10-03 18:59:52 +0000
commit1ae7282d9b0faed2b9ea18be31eada2ee6a154be (patch)
tree756d948f6435a13321f23cba66cf12101d21ec1c
parentca0ebd0ba8b194f9ca29098219350e5cdd0731e6 (diff)
downloadtor-1ae7282d9b0faed2b9ea18be31eada2ee6a154be.tar.gz
tor-1ae7282d9b0faed2b9ea18be31eada2ee6a154be.zip
r8857@totoro: nickm | 2006-10-03 13:54:21 -0400
Implement ORCONN with verbose names. svn:r8588
-rw-r--r--doc/TODO6
-rw-r--r--src/or/control.c36
2 files changed, 32 insertions, 10 deletions
diff --git a/doc/TODO b/doc/TODO
index 9863b94b15..84793fc716 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -55,7 +55,8 @@ N . Improve behavior when telling nicknames and digests to controllers.
server with digest D named N". Nothing else matches.)
o Add ability to selectively send 'long' nicknames on v1 connections.
o Add a feature to actually turn on the switch.
- - Implement response for ORCONN.
+ o Implement response for ORCONN.
+ - As used in responses to getinfo requests?
. Verify that everything actually does the right thing.
- Specify everything.
@@ -131,6 +132,9 @@ N - DNS improvements
o Option to deal with broken DNS of the "ggoogle.com? Ah, you meant
ads.me.com!" variety.
o Autodetect whether DNS is broken in this way.
+ - Additional fix: allow clients to have some addresses that mean,
+ notfound. Yes, this blacklists IPs for having ever been used by
+ DNS hijackers.
o Don't ask reject *:* nodes for DNS unless client wants you to.
. Asynchronous DNS
o Document and rename SearchDomains, ResolvConf options
diff --git a/src/or/control.c b/src/or/control.c
index 49417dcb13..9a914717ee 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -2323,7 +2323,7 @@ handle_control_usefeature(control_connection_t *conn,
SMARTLIST_FOREACH(args, const char *, arg, {
if (!strcasecmp(arg, "VERBOSE_NAMES"))
verbose_names = 1;
- if (!strcasecmp(arg, "EXTENDED_EVENTS"))
+ else if (!strcasecmp(arg, "EXTENDED_EVENTS"))
extended_events = 1;
else {
connection_printf_to_buf(conn, "552 Unrecognized feature \"%s\"\r\n",
@@ -2882,11 +2882,6 @@ control_event_or_conn_status(or_connection_t *conn,or_conn_status_event_t tp)
if (EVENT_IS_INTERESTING1(EVENT_OR_CONN_STATUS)) {
const char *status;
char name[128];
- if (conn->nickname)
- strlcpy(name, conn->nickname, sizeof(name));
- else
- tor_snprintf(name, sizeof(name), "%s:%d",
- conn->_base.address, conn->_base.port);
switch (tp)
{
case OR_CONN_EVENT_LAUNCHED: status = "LAUNCHED"; break;
@@ -2898,9 +2893,32 @@ control_event_or_conn_status(or_connection_t *conn,or_conn_status_event_t tp)
log_warn(LD_BUG, "Unrecognized status code %d", (int)tp);
return 0;
}
- send_control1_event(EVENT_OR_CONN_STATUS, ALL_NAMES/*XXXX NM*/,
- "650 ORCONN %s %s\r\n",
- name, status);
+ if (EVENT_IS_INTERESTING1S(EVENT_OR_CONN_STATUS)) {
+ if (conn->nickname)
+ strlcpy(name, conn->nickname, sizeof(name));
+ else
+ tor_snprintf(name, sizeof(name), "%s:%d",
+ conn->_base.address, conn->_base.port);
+ send_control1_event(EVENT_OR_CONN_STATUS, SHORT_NAMES,
+ "650 ORCONN %s %s\r\n",
+ name, status);
+ }
+ if (EVENT_IS_INTERESTING1L(EVENT_OR_CONN_STATUS)) {
+ routerinfo_t *ri = router_get_by_digest(conn->identity_digest);
+ if (ri) {
+ router_get_verbose_nickname(name, ri);
+ } else if (! tor_digest_is_zero(conn->identity_digest)) {
+ name[0] = '$';
+ base16_encode(name+1, sizeof(name)-1, conn->identity_digest,
+ DIGEST_LEN);
+ } else {
+ tor_snprintf(name, sizeof(name), "%s:%d",
+ conn->_base.address, conn->_base.port);
+ }
+ send_control1_event(EVENT_OR_CONN_STATUS, LONG_NAMES,
+ "650 ORCONN %s %s\r\n",
+ name, status);
+ }
}
return 0;
}