[or-cvs] r10930: ADDRMAP events should never have specified local time. Exten (in tor/trunk: . doc/spec src/or)
nickm at seul.org
nickm at seul.org
Wed Jul 25 22:56:55 UTC 2007
Author: nickm
Date: 2007-07-25 18:56:54 -0400 (Wed, 25 Jul 2007)
New Revision: 10930
Modified:
tor/trunk/
tor/trunk/ChangeLog
tor/trunk/doc/spec/control-spec.txt
tor/trunk/src/or/connection_edge.c
tor/trunk/src/or/control.c
Log:
r13905 at catbus: nickm | 2007-07-25 18:48:44 -0400
ADDRMAP events should never have specified local time. Extend them to have the proper gmt time, and make GETINFO address-mappings always do the right thing (since it is new in this version).
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r13905] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog 2007-07-25 22:56:50 UTC (rev 10929)
+++ tor/trunk/ChangeLog 2007-07-25 22:56:54 UTC (rev 10930)
@@ -77,7 +77,12 @@
can time them out correctly. (Bug found by mwenge) [Bugfix on
0.2.0.2-alpha]
+ o Minor bugfixes (controller)
+ - Provide DNS expiry times in GMT, not in local time. For backward
+ compatibility, ADDRMAP events only provide GMT expiry in an extended
+ field. "GETINFO address-mappings" always does the right thing.
+
Changes in version 0.1.2.15 - 2007-07-17
o Major bugfixes (compilation):
- Fix compile on FreeBSD/NetBSD/OpenBSD. Oops.
Modified: tor/trunk/doc/spec/control-spec.txt
===================================================================
--- tor/trunk/doc/spec/control-spec.txt 2007-07-25 22:56:50 UTC (rev 10929)
+++ tor/trunk/doc/spec/control-spec.txt 2007-07-25 22:56:54 UTC (rev 10930)
@@ -387,7 +387,8 @@
client-side DNS cache; the 'control' key returns the mappings set
via the control interface; the 'all' target returns the mappings
set through any mechanism.
- Expiry is formatted as with ADDRMAP events; see section 4.1.7.
+ Expiry is formatted as with ADDRMAP events, except that "expiry" is
+ always a time in GMT or the string "NEVER"; see section 4.1.7.
First introduced in 0.2.0.3-alpha.
"addr-mappings/*" -- as for address-mappings/*, but without the
@@ -925,7 +926,7 @@
If extended events are enabled (see 3.19), optional reason and
circuit counting information is provided for CLOSED and FAILED
- events.
+ events.
Reason = "MISC" / "DONE" / "CONNECTREFUSED" /
"IDENTITY" / "CONNECTRESET" / "TIMEOUT" / "NOROUTE" /
@@ -963,11 +964,18 @@
4.1.7. New Address mapping
Syntax:
- "650" SP "ADDRMAP" SP Address SP Address SP Expiry
+ "650" SP "ADDRMAP" SP Address SP Address SP Expiry SP Error SP GMTExpiry
Expiry = DQUOTE ISOTime DQUOTE / "NEVER"
- Expiry is expressed as the local time (rather than GMT).
+ Error = / "error=" ErrorCode
+ GMTExpiry = "EXPIRES=" DQUOTE IsoTime DQUOTE
+ Error and GMTExpiry are only provided if extended events are enabled.
+
+ Expiry is expressed as the local time (rather than GMT). This is a bug,
+ left in for backward compatibility; new code should look at GMTExpiry
+ instead.
+
These events are generated when a new address mapping is entered in the
cache, or when the answer for a RESOLVE command is found.
Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c 2007-07-25 22:56:50 UTC (rev 10929)
+++ tor/trunk/src/or/connection_edge.c 2007-07-25 22:56:54 UTC (rev 10930)
@@ -1161,7 +1161,7 @@
tor_snprintf(line, len, "%s %s NEVER", key, val->new_address);
else {
char time[ISO_TIME_LEN+1];
- format_local_iso_time(time, val->expires);
+ format_iso_time(time, val->expires);
tor_snprintf(line, len, "%s %s \"%s\"", key, val->new_address,
time);
}
Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c 2007-07-25 22:56:50 UTC (rev 10929)
+++ tor/trunk/src/or/control.c 2007-07-25 22:56:54 UTC (rev 10930)
@@ -3099,10 +3099,15 @@
error);
else {
char buf[ISO_TIME_LEN+1];
+ char buf2[ISO_TIME_LEN+1];
format_local_iso_time(buf,expires);
+ format_iso_time(buf2,expires);
send_control_event_extended(EVENT_ADDRMAP, ALL_NAMES,
- "650 ADDRMAP %s %s \"%s\"@%s\r\n",
- from, to, buf, error);
+ "650 ADDRMAP %s %s \"%s\""
+ "@%s%sEXPIRES=\"%s\"\r\n",
+ from, to, buf,
+ error, error?" ":"",
+ buf2);
}
return 0;
More information about the tor-commits
mailing list