mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 05:03:43 +01:00
r13777@catbus: nickm | 2007-07-16 12:58:08 -0400
Patch from tup: new address-mappings/ GETINFO that includes expiry times. svn:r10844
This commit is contained in:
parent
483c1e9017
commit
26a25edaec
15
ChangeLog
15
ChangeLog
@ -21,6 +21,14 @@ Changes in version 0.2.0.3-alpha - 2007-??-??
|
||||
from Robert Hogan.)
|
||||
- Add GETINFO status/enough-dir-info to let controllers tell whether
|
||||
Tor has downloaded sufficient directory information. (Patch from Tup.)
|
||||
- You can now use the ControlSocket option to tell Tor to listen for
|
||||
controller connections on Unix domain sockets on systems that support
|
||||
them. (Patch from Peter Palfrader.)
|
||||
- STREAM NEW events are generated for DNSPort requests and for tunneled
|
||||
directory connections. (Patch from Robert Hogan.)
|
||||
- New GETINFO address-mappings/* command to get address mappings with
|
||||
expiry information. addr-mappings/* is now deprecated.
|
||||
(Patch from Tup.)
|
||||
|
||||
o Performance improvements (win32):
|
||||
- Use Critical Sections rather than Mutexes for synchronizing threads
|
||||
@ -30,13 +38,6 @@ Changes in version 0.2.0.3-alpha - 2007-??-??
|
||||
o Deprecated features:
|
||||
- RedirectExits is now deprecated.
|
||||
|
||||
o Minor features (controller):
|
||||
- You can now use the ControlSocket option to tell Tor to listen for
|
||||
controller connections on Unix domain sockets on systems that support
|
||||
them. (Patch from Peter Palfrader.)
|
||||
- STREAM NEW events are generated for DNSPort requests and for tunneled
|
||||
directory connections. (Patch from Robert Hogan.)
|
||||
|
||||
o Major bugfixes (directory):
|
||||
- Fix a crash bug in directory authorities when we re-number the
|
||||
routerlist while inserting a new router. [Bugfix on 0.1.2.x]
|
||||
|
@ -377,16 +377,22 @@ $Id$
|
||||
space-separated list of LongName, each preceded by a "!" if it is
|
||||
believed to be not running.)
|
||||
|
||||
"addr-mappings/all"
|
||||
"addr-mappings/config"
|
||||
"addr-mappings/cache"
|
||||
"addr-mappings/control" -- a \r\n-separated list of address
|
||||
mappings, each in the form of "from-address to-address".
|
||||
"address-mappings/all"
|
||||
"address-mappings/config"
|
||||
"address-mappings/cache"
|
||||
"address-mappings/control" -- a \r\n-separated list of address
|
||||
mappings, each in the form of "from-address to-address expiry".
|
||||
The 'config' key returns those address mappings set in the
|
||||
configuration; the 'cache' key returns the mappings in the
|
||||
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.
|
||||
First introduced in 0.2.0.3-alpha.
|
||||
|
||||
"addr-mappings/*" -- as for address-mappings/*, but without the
|
||||
expiry portion of the value. Use of this value is deprecated
|
||||
since 0.2.0.3-alpha; use address-mappings instead.
|
||||
|
||||
"address" -- the best guess at our external IP address. If we
|
||||
have no guess, return a 551 error. (Added in 0.1.2.2-alpha)
|
||||
|
@ -617,14 +617,14 @@ addressmap_ent_remove(const char *address, addressmap_entry_t *ent)
|
||||
void
|
||||
addressmap_clear_configured(void)
|
||||
{
|
||||
addressmap_get_mappings(NULL, 0, 0);
|
||||
addressmap_get_mappings(NULL, 0, 0, 0);
|
||||
}
|
||||
|
||||
/** Remove all entries from the addressmap that are set to expire, ever. */
|
||||
void
|
||||
addressmap_clear_transient(void)
|
||||
{
|
||||
addressmap_get_mappings(NULL, 2, TIME_MAX);
|
||||
addressmap_get_mappings(NULL, 2, TIME_MAX, 0);
|
||||
}
|
||||
|
||||
/** Clean out entries from the addressmap cache that were
|
||||
@ -633,7 +633,7 @@ addressmap_clear_transient(void)
|
||||
void
|
||||
addressmap_clean(time_t now)
|
||||
{
|
||||
addressmap_get_mappings(NULL, 2, now);
|
||||
addressmap_get_mappings(NULL, 2, now, 0);
|
||||
}
|
||||
|
||||
/** Free all the elements in the addressmap, and free the addressmap
|
||||
@ -1136,12 +1136,13 @@ address_is_invalid_destination(const char *address, int client)
|
||||
|
||||
/** Iterate over all address mappings which have expiry times between
|
||||
* min_expires and max_expires, inclusive. If sl is provided, add an
|
||||
* "old-addr new-addr" string to sl for each mapping. If sl is NULL,
|
||||
* remove the mappings.
|
||||
* "old-addr new-addr expiry" string to sl for each mapping, omitting
|
||||
* the expiry time if want_expiry is false. If sl is NULL, remove the
|
||||
* mappings.
|
||||
*/
|
||||
void
|
||||
addressmap_get_mappings(smartlist_t *sl, time_t min_expires,
|
||||
time_t max_expires)
|
||||
time_t max_expires, int want_expiry)
|
||||
{
|
||||
strmap_iter_t *iter;
|
||||
const char *key;
|
||||
@ -1160,9 +1161,20 @@ addressmap_get_mappings(smartlist_t *sl, time_t min_expires,
|
||||
addressmap_ent_remove(key, val);
|
||||
continue;
|
||||
} else if (val->new_address) {
|
||||
size_t len = strlen(key)+strlen(val->new_address)+2;
|
||||
size_t len = strlen(key)+strlen(val->new_address)+ISO_TIME_LEN+5;
|
||||
char *line = tor_malloc(len);
|
||||
tor_snprintf(line, len, "%s %s", key, val->new_address);
|
||||
if (want_expiry) {
|
||||
if (val->expires < 3 || val->expires == TIME_MAX)
|
||||
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);
|
||||
tor_snprintf(line, len, "%s %s \"%s\"", key, val->new_address,
|
||||
time);
|
||||
}
|
||||
} else {
|
||||
tor_snprintf(line, len, "%s %s", key, val->new_address);
|
||||
}
|
||||
smartlist_add(sl, line);
|
||||
}
|
||||
}
|
||||
|
@ -1457,22 +1457,28 @@ getinfo_helper_events(control_connection_t *control_conn,
|
||||
*answer = smartlist_join_strings(status, "\r\n", 0, NULL);
|
||||
SMARTLIST_FOREACH(status, char *, cp, tor_free(cp));
|
||||
smartlist_free(status);
|
||||
} else if (!strcmpstart(question, "addr-mappings/")) {
|
||||
} else if (!strcmpstart(question, "addr-mappings/") ||
|
||||
!strcmpstart(question, "address-mappings/")) {
|
||||
/* XXXX020 Warn about deprecated addr-mappings variant? Or wait for
|
||||
* 0.2.1.x? */
|
||||
time_t min_e, max_e;
|
||||
smartlist_t *mappings;
|
||||
if (!strcmp(question, "addr-mappings/all")) {
|
||||
int want_expiry = !strcmpstart(question, "address-mappings/");
|
||||
question += strlen(want_expiry ? "address-mappings/"
|
||||
: "addr-mappings/");
|
||||
if (!strcmp(question, "all")) {
|
||||
min_e = 0; max_e = TIME_MAX;
|
||||
} else if (!strcmp(question, "addr-mappings/cache")) {
|
||||
} else if (!strcmp(question, "cache")) {
|
||||
min_e = 2; max_e = TIME_MAX;
|
||||
} else if (!strcmp(question, "addr-mappings/config")) {
|
||||
} else if (!strcmp(question, "config")) {
|
||||
min_e = 0; max_e = 0;
|
||||
} else if (!strcmp(question, "addr-mappings/control")) {
|
||||
} else if (!strcmp(question, "control")) {
|
||||
min_e = 1; max_e = 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
mappings = smartlist_create();
|
||||
addressmap_get_mappings(mappings, min_e, max_e);
|
||||
addressmap_get_mappings(mappings, min_e, max_e, want_expiry);
|
||||
*answer = smartlist_join_strings(mappings, "\r\n", 0, NULL);
|
||||
SMARTLIST_FOREACH(mappings, char *, cp, tor_free(cp));
|
||||
smartlist_free(mappings);
|
||||
@ -1587,11 +1593,20 @@ static const getinfo_item_t getinfo_items[] = {
|
||||
ITEM("circuit-status", events, "List of current circuits originating here."),
|
||||
ITEM("stream-status", events,"List of current streams."),
|
||||
ITEM("orconn-status", events, "A list of current OR connections."),
|
||||
PREFIX("address-mappings/", events, NULL),
|
||||
DOC("address-mappings/all", "Current address mappings."),
|
||||
DOC("address-mappings/cache", "Current cached DNS replies."),
|
||||
DOC("address-mappings/config",
|
||||
"Current address mappings from configuration."),
|
||||
DOC("address-mappings/control", "Current address mappings from controller."),
|
||||
PREFIX("addr-mappings/", events, NULL),
|
||||
DOC("addr-mappings/all", "Current address mappings."),
|
||||
DOC("addr-mappings/cache", "Current cached DNS replies."),
|
||||
DOC("addr-mappings/config", "Current address mappings from configuration."),
|
||||
DOC("addr-mappings/control", "Current address mappings from controller."),
|
||||
DOC("addr-mappings/all", "Current address mappings without expiry times."),
|
||||
DOC("addr-mappings/cache",
|
||||
"Current cached DNS replies without expiry times."),
|
||||
DOC("addr-mappings/config",
|
||||
"Current address mappings from configuration without expiry times."),
|
||||
DOC("addr-mappings/control",
|
||||
"Current address mappings from controller without expiry times."),
|
||||
PREFIX("status/", events, NULL),
|
||||
DOC("status/circuit-established",
|
||||
"Whether we think client functionality is working."),
|
||||
|
@ -2511,7 +2511,7 @@ void client_dns_set_addressmap(const char *address, uint32_t val,
|
||||
int address_is_in_virtual_range(const char *addr);
|
||||
const char *addressmap_register_virtual_address(int type, char *new_address);
|
||||
void addressmap_get_mappings(smartlist_t *sl, time_t min_expires,
|
||||
time_t max_expires);
|
||||
time_t max_expires, int want_expiry);
|
||||
int connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn,
|
||||
origin_circuit_t *circ,
|
||||
crypt_path_t *cpath);
|
||||
|
Loading…
Reference in New Issue
Block a user