Commit 893acb3a authored by Roger Dingledine's avatar Roger Dingledine
Browse files

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
parent d5e426ab
Loading
Loading
Loading
Loading
+2 −1
Changes for src/or/config.c: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ static config_var_t _option_vars[] = {
  VAR("AccountingStart",     STRING,   AccountingStart,      NULL),
  VAR("Address",             STRING,   Address,              NULL),
  VAR("AllowUnverifiedNodes",CSV,      AllowUnverifiedNodes, "middle,rendezvous"),
  VAR("AssumeReachable",     BOOL,     AssumeReachable,      "0"),
  VAR("AuthoritativeDirectory",BOOL,   AuthoritativeDir,     "0"),
  VAR("BandwidthBurst",      MEMUNIT,  BandwidthBurst,       "5 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
 * 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
 * the address. Return 0 if all is well, or -1 if we can't find a suitable
 * public IP address.
+1 −2
Changes for src/or/connection.c: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -669,10 +669,9 @@ connection_handle_listener_read(connection_t *conn, int new_type)
  newconn->s = news;

  /* 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->port = ntohs(remote.sin_port);
  newconn->address = tor_dup_addr(newconn->addr);

  if (connection_add(newconn) < 0) { /* no space, forget it */
    connection_free(newconn);
+1 −5
Changes for src/or/connection_or.c: 1 added line, 5 removed lines.
Original line number Diff line number Diff line
@@ -240,7 +240,6 @@ connection_or_init_conn_from_address(connection_t *conn,
                                     uint32_t addr, uint16_t port,
                                     const char *id_digest)
{
  struct in_addr in;
  const char *n;
  or_options_t *options = get_options();
  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);
  }
  tor_free(conn->address);
  in.s_addr = htonl(addr);

  conn->address = tor_malloc(INET_NTOA_BUF_LEN);
  tor_inet_ntoa(&in,conn->address,INET_NTOA_BUF_LEN);
  conn->address = tor_dup_addr(addr);
}

/** "update an OR connection nickname on the fly"
+1 −0
Changes for src/or/or.h: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -1092,6 +1092,7 @@ typedef struct {
  int SocksPort; /**< Port to listen on for SOCKS connections. */
  int ControlPort; /**< Port to listen on for control 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 ClientOnly; /**< Boolean: should we never evolve into a server role? */
  int NoPublish; /**< Boolean: should we never publish a descriptor? */
+9 −7
Changes for src/or/router.c: 9 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -401,14 +401,20 @@ static int can_reach_dir_port = 0;
int
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. */
int
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*/
@@ -720,10 +726,8 @@ router_rebuild_descriptor(int force)
  routerinfo_t *ri;
  uint32_t addr;
  char platform[256];
  struct in_addr in;
  int hibernating = we_are_hibernating();
  or_options_t *options = get_options();
  char addrbuf[INET_NTOA_BUF_LEN];

  if (desc_clean_since && !force)
    return 0;
@@ -734,9 +738,7 @@ router_rebuild_descriptor(int force)
  }

  ri = tor_malloc_zero(sizeof(routerinfo_t));
  in.s_addr = htonl(addr);
  tor_inet_ntoa(&in, addrbuf, sizeof(addrbuf));
  ri->address = tor_strdup(addrbuf);
  ri->address = tor_dup_addr(addr);
  ri->nickname = tor_strdup(options->Nickname);
  ri->addr = addr;
  ri->or_port = options->ORPort;
Loading