mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
Make a new AssumeReachable config option that will publish anyway.
Also, let authdirservers start without setting their Address field. Something is still not working though. Will fix in morning. svn:r4839
This commit is contained in:
parent
d5e426ab51
commit
893acb3acc
@ -100,6 +100,7 @@ static config_var_t _option_vars[] = {
|
|||||||
VAR("AccountingStart", STRING, AccountingStart, NULL),
|
VAR("AccountingStart", STRING, AccountingStart, NULL),
|
||||||
VAR("Address", STRING, Address, NULL),
|
VAR("Address", STRING, Address, NULL),
|
||||||
VAR("AllowUnverifiedNodes",CSV, AllowUnverifiedNodes, "middle,rendezvous"),
|
VAR("AllowUnverifiedNodes",CSV, AllowUnverifiedNodes, "middle,rendezvous"),
|
||||||
|
VAR("AssumeReachable", BOOL, AssumeReachable, "0"),
|
||||||
VAR("AuthoritativeDirectory",BOOL, AuthoritativeDir, "0"),
|
VAR("AuthoritativeDirectory",BOOL, AuthoritativeDir, "0"),
|
||||||
VAR("BandwidthBurst", MEMUNIT, BandwidthBurst, "5 MB"),
|
VAR("BandwidthBurst", MEMUNIT, BandwidthBurst, "5 MB"),
|
||||||
VAR("BandwidthRate", MEMUNIT, BandwidthRate, "2 MB"),
|
VAR("BandwidthRate", MEMUNIT, BandwidthRate, "2 MB"),
|
||||||
@ -1141,7 +1142,7 @@ print_usage(void)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Based on <b>options-\>Address</b>, guess our public IP address and put it
|
* Based on <b>options-\>Address</b>, guess our public IP address and put it
|
||||||
* in *<b>addr_out</b>. If <b>hostname_out</b> is provided, set
|
* (in host order) into *<b>addr_out</b>. If <b>hostname_out</b> is provided, set
|
||||||
* *<b>hostname_out</b> to a new string holding the hostname we used to get
|
* *<b>hostname_out</b> to a new string holding the hostname we used to get
|
||||||
* the address. Return 0 if all is well, or -1 if we can't find a suitable
|
* the address. Return 0 if all is well, or -1 if we can't find a suitable
|
||||||
* public IP address.
|
* public IP address.
|
||||||
|
@ -669,10 +669,9 @@ connection_handle_listener_read(connection_t *conn, int new_type)
|
|||||||
newconn->s = news;
|
newconn->s = news;
|
||||||
|
|
||||||
/* remember the remote address */
|
/* remember the remote address */
|
||||||
newconn->address = tor_malloc(INET_NTOA_BUF_LEN);
|
|
||||||
tor_inet_ntoa(&remote.sin_addr, newconn->address, INET_NTOA_BUF_LEN);
|
|
||||||
newconn->addr = ntohl(remote.sin_addr.s_addr);
|
newconn->addr = ntohl(remote.sin_addr.s_addr);
|
||||||
newconn->port = ntohs(remote.sin_port);
|
newconn->port = ntohs(remote.sin_port);
|
||||||
|
newconn->address = tor_dup_addr(newconn->addr);
|
||||||
|
|
||||||
if (connection_add(newconn) < 0) { /* no space, forget it */
|
if (connection_add(newconn) < 0) { /* no space, forget it */
|
||||||
connection_free(newconn);
|
connection_free(newconn);
|
||||||
|
@ -240,7 +240,6 @@ connection_or_init_conn_from_address(connection_t *conn,
|
|||||||
uint32_t addr, uint16_t port,
|
uint32_t addr, uint16_t port,
|
||||||
const char *id_digest)
|
const char *id_digest)
|
||||||
{
|
{
|
||||||
struct in_addr in;
|
|
||||||
const char *n;
|
const char *n;
|
||||||
or_options_t *options = get_options();
|
or_options_t *options = get_options();
|
||||||
routerinfo_t *r = router_get_by_digest(id_digest);
|
routerinfo_t *r = router_get_by_digest(id_digest);
|
||||||
@ -265,10 +264,7 @@ connection_or_init_conn_from_address(connection_t *conn,
|
|||||||
conn->identity_digest, DIGEST_LEN);
|
conn->identity_digest, DIGEST_LEN);
|
||||||
}
|
}
|
||||||
tor_free(conn->address);
|
tor_free(conn->address);
|
||||||
in.s_addr = htonl(addr);
|
conn->address = tor_dup_addr(addr);
|
||||||
|
|
||||||
conn->address = tor_malloc(INET_NTOA_BUF_LEN);
|
|
||||||
tor_inet_ntoa(&in,conn->address,INET_NTOA_BUF_LEN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** "update an OR connection nickname on the fly"
|
/** "update an OR connection nickname on the fly"
|
||||||
|
@ -1092,6 +1092,7 @@ typedef struct {
|
|||||||
int SocksPort; /**< Port to listen on for SOCKS connections. */
|
int SocksPort; /**< Port to listen on for SOCKS connections. */
|
||||||
int ControlPort; /**< Port to listen on for control connections. */
|
int ControlPort; /**< Port to listen on for control connections. */
|
||||||
int DirPort; /**< Port to listen on for directory connections. */
|
int DirPort; /**< Port to listen on for directory connections. */
|
||||||
|
int AssumeReachable; /**< Whether to publish our descriptor regardless. */
|
||||||
int AuthoritativeDir; /**< Boolean: is this an authoritative directory? */
|
int AuthoritativeDir; /**< Boolean: is this an authoritative directory? */
|
||||||
int ClientOnly; /**< Boolean: should we never evolve into a server role? */
|
int ClientOnly; /**< Boolean: should we never evolve into a server role? */
|
||||||
int NoPublish; /**< Boolean: should we never publish a descriptor? */
|
int NoPublish; /**< Boolean: should we never publish a descriptor? */
|
||||||
|
@ -401,14 +401,20 @@ static int can_reach_dir_port = 0;
|
|||||||
int
|
int
|
||||||
check_whether_orport_reachable(void)
|
check_whether_orport_reachable(void)
|
||||||
{
|
{
|
||||||
return clique_mode(get_options()) || can_reach_or_port;
|
or_options_t *options = get_options();
|
||||||
|
return clique_mode(options) ||
|
||||||
|
options->AssumeReachable ||
|
||||||
|
can_reach_or_port;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return 1 if we don't have a dirport configured, or if it's reachable. */
|
/** Return 1 if we don't have a dirport configured, or if it's reachable. */
|
||||||
int
|
int
|
||||||
check_whether_dirport_reachable(void)
|
check_whether_dirport_reachable(void)
|
||||||
{
|
{
|
||||||
return !get_options()->DirPort || can_reach_dir_port;
|
or_options_t *options = get_options();
|
||||||
|
return !options->DirPort ||
|
||||||
|
options->AssumeReachable ||
|
||||||
|
can_reach_dir_port;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**DOCDOC*/
|
/**DOCDOC*/
|
||||||
@ -720,10 +726,8 @@ router_rebuild_descriptor(int force)
|
|||||||
routerinfo_t *ri;
|
routerinfo_t *ri;
|
||||||
uint32_t addr;
|
uint32_t addr;
|
||||||
char platform[256];
|
char platform[256];
|
||||||
struct in_addr in;
|
|
||||||
int hibernating = we_are_hibernating();
|
int hibernating = we_are_hibernating();
|
||||||
or_options_t *options = get_options();
|
or_options_t *options = get_options();
|
||||||
char addrbuf[INET_NTOA_BUF_LEN];
|
|
||||||
|
|
||||||
if (desc_clean_since && !force)
|
if (desc_clean_since && !force)
|
||||||
return 0;
|
return 0;
|
||||||
@ -734,9 +738,7 @@ router_rebuild_descriptor(int force)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ri = tor_malloc_zero(sizeof(routerinfo_t));
|
ri = tor_malloc_zero(sizeof(routerinfo_t));
|
||||||
in.s_addr = htonl(addr);
|
ri->address = tor_dup_addr(addr);
|
||||||
tor_inet_ntoa(&in, addrbuf, sizeof(addrbuf));
|
|
||||||
ri->address = tor_strdup(addrbuf);
|
|
||||||
ri->nickname = tor_strdup(options->Nickname);
|
ri->nickname = tor_strdup(options->Nickname);
|
||||||
ri->addr = addr;
|
ri->addr = addr;
|
||||||
ri->or_port = options->ORPort;
|
ri->or_port = options->ORPort;
|
||||||
|
@ -1461,15 +1461,25 @@ add_trusted_dir_server(const char *address, uint16_t port, const char *digest)
|
|||||||
if (!trusted_dir_servers)
|
if (!trusted_dir_servers)
|
||||||
trusted_dir_servers = smartlist_create();
|
trusted_dir_servers = smartlist_create();
|
||||||
|
|
||||||
if (tor_lookup_hostname(address, &a)) {
|
if (!address) { /* need to guess */
|
||||||
|
if (resolve_my_address(get_options(), &a, NULL) < 0) {
|
||||||
|
log_fn(LOG_WARN, "Couldn't find a suitable address. Returning.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (tor_lookup_hostname(address, &a)) {
|
||||||
log_fn(LOG_WARN, "Unable to lookup address for directory server at %s",
|
log_fn(LOG_WARN, "Unable to lookup address for directory server at %s",
|
||||||
address);
|
address);
|
||||||
return;
|
return;
|
||||||
|
a = ntohl(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
ent = tor_malloc(sizeof(trusted_dir_server_t));
|
ent = tor_malloc(sizeof(trusted_dir_server_t));
|
||||||
ent->address = tor_strdup(address);
|
if (address) {
|
||||||
ent->addr = ntohl(a);
|
ent->address = tor_strdup(address);
|
||||||
|
} else {
|
||||||
|
ent->address = tor_dup_addr(a);
|
||||||
|
}
|
||||||
|
ent->addr = a;
|
||||||
ent->dir_port = port;
|
ent->dir_port = port;
|
||||||
ent->is_running = 1;
|
ent->is_running = 1;
|
||||||
memcpy(ent->digest, digest, DIGEST_LEN);
|
memcpy(ent->digest, digest, DIGEST_LEN);
|
||||||
|
Loading…
Reference in New Issue
Block a user