[tor-commits] [tor/maint-0.2.2] Merge branch 'log_domains' into maint-0.2.2

nickm at torproject.org nickm at torproject.org
Tue Feb 22 18:02:11 UTC 2011


commit 9d5873cdaedf5bbae50bec08bb0719a1a5be403d
Merge: 613073e ce149c1
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Feb 22 13:01:02 2011 -0500

    Merge branch 'log_domains' into maint-0.2.2

 changes/log_domains |   12 +++++++
 doc/tor.1.txt       |   28 +++++++++++++++
 src/common/log.c    |   92 ++++++++++++++++++++++++++++++++++++++++++--------
 src/common/torlog.h |    1 +
 src/or/config.c     |    7 +++-
 src/or/or.h         |    3 ++
 6 files changed, 127 insertions(+), 16 deletions(-)

diff --combined doc/tor.1.txt
index e5dae8c,a4ab0d9..033f0a2
--- a/doc/tor.1.txt
+++ b/doc/tor.1.txt
@@@ -323,6 -323,34 +323,34 @@@ Other options can be specified either o
      Messages are sent to all the logs that match their severity
      level.
  
+ **Log** **[**__domain__,...**]**__minSeverity__[-__maxSeverity__] ... **file** __FILENAME__ +
+ 
+ **Log** **[**__domain__,...**]**__minSeverity__[-__maxSeverity__] ... **stderr**|**stdout**|**syslog** ::
+     As above, but select messages by range of log severity __and__ by a
+     set of "logging domains".  Each logging domain corresponds to an area of
+     functionality inside Tor.  You can specify any number of severity ranges
+     for a single log statement, each of them prefixed by a comma-separated
+     list of logging domains.  You can prefix a domain with ~ to indicate
+     negation, and use * to indicate "all domains".  If you specify a severity
+     range without a list of domains, it matches all domains. +
+  +
+     This is an advanced feature which is most useful for debugging one or two
+     of Tor's subsystems at a time. +
+  +
+     The currently recognized domains are: general, crypto, net, config, fs,
+     protocol, mm, http, app, control, circ, rend, bug, dir, dirserv, or, edge,
+     acct, hist, and handshake.  Domain names are case-insensitive. +
+  +
+     For example, "`Log [handshake]debug [~net,~mm]info notice stdout`" sends
+     to stdout: all handshake messages of any severity, all info-and-higher
+     messages from domains other than networking and memory management, and all
+     messages of severity notice or higher.
+ 
+ **LogMessageDomains** **0**|**1**::
+     If 1, Tor includes message domains with each log message.  Every log
+     message currently has at least one domain; most currently have exactly
+     one.  This doesn't affect controller log messages. (Default: 0)
+ 
  **OutboundBindAddress** __IP__::
      Make all outbound connections originate from the IP address specified. This
      is only useful when you have multiple network interfaces, and you want all
@@@ -471,7 -499,7 +499,7 @@@ The following options are useful only f
      list.
  
  **EntryNodes** __node__,__node__,__...__::
 -    A list of identity fingerprints, nicknames, country codes and address
 +    A list of identity fingerprints, nicknames and address
      patterns of nodes to use for the first hop in normal circuits. These are
      treated only as preferences unless StrictNodes (see below) is also set.
  
@@@ -654,9 -682,8 +682,9 @@@
      can leak your location to attackers. (Default: 1)
  
  **VirtualAddrNetwork** __Address__/__bits__::
 -    When a controller asks for a virtual (unused) address with the MAPADDRESS
 -    command, Tor picks an unassigned address from this range. (Default:
 +    When Tor needs to assign a virtual (unused) address because of a MAPADDRESS
 +    command from the controller or the AutomapHostsOnResolve feature, Tor
 +    picks an unassigned address from this range. (Default:
      127.192.0.0/10) +
   +
      When providing proxy server service to a network of computers using a tool
@@@ -732,12 -759,6 +760,12 @@@
      192.168.0.1). This option prevents certain browser-based attacks; don't
      turn it off unless you know what you're doing. (Default: 1).
  
 +**ClientRejectInternalAddresses** **0**|**1**::
 +    If true, Tor does not try to fulfill requests to connect to an internal
 +    address (like 127.0.0.1 or 192.168.0.1) __unless a exit node is
 +    specifically requested__ (for example, via a .exit hostname, or a
 +    controller request).  (Default: 1).
 +
  **DownloadExtraInfo** **0**|**1**::
      If true, Tor downloads and caches "extra-info" documents. These documents
      contain information about servers other than the information in their
@@@ -882,9 -903,9 +910,9 @@@ is non-zero)
      specified in ORPort. (Default: 0.0.0.0) This directive can be specified
      multiple times to bind to multiple addresses/ports.
  
 -**PublishServerDescriptor** **0**|**1**|**v1**|**v2**|**v3**|**bridge**|**hidserv**,**...**::
 +**PublishServerDescriptor** **0**|**1**|**v1**|**v2**|**v3**|**bridge**,**...**::
      This option specifies which descriptors Tor will publish when acting as
 -    a relay or hidden service. You can
 +    a relay. You can
      choose multiple arguments, separated by commas.
   +
      If this option is set to 0, Tor will not publish its
@@@ -892,7 -913,7 +920,7 @@@
      out your server, or if you're using a Tor controller that handles directory
      publishing for you.) Otherwise, Tor will publish its descriptors of all
      type(s) specified. The default is "1",
 -    which means "if running as a server or a hidden service, publish the
 +    which means "if running as a server, publish the
      appropriate descriptors to the authorities".
  
  **ShutdownWaitLength** __NUM__::
@@@ -907,9 -928,7 +935,9 @@@
      period, or receive more than that number in the period. For example, with
      AccountingMax set to 1 GB, a server could send 900 MB and receive 800 MB
      and continue running. It will only hibernate once one of the two reaches 1
 -    GB. When the number of bytes is exhausted, Tor will hibernate until some
 +    GB. When the number of bytes gets low, Tor will stop accepting new
 +    connections and circuits.  When the number of bytes
 +    is exhausted, Tor will hibernate until some
      time in the next accounting period. To prevent all servers from waking at
      the same time, Tor will also wait until a random point in each period
      before waking up. If you have bandwidth cost issues, enabling hibernation
@@@ -1069,8 -1088,7 +1097,8 @@@ if DirPort is non-zero)
  
  **HSAuthoritativeDir** **0**|**1**::
      When this option is set in addition to **AuthoritativeDirectory**, Tor also
 -    accepts and serves hidden service descriptors. (Default: 0)
 +    accepts and serves v0 hidden service descriptors,
 +    which are produced and used by Tor 0.2.1.x and older. (Default: 0)
  
  **HidServDirectoryV2** **0**|**1**::
      When this option is set, Tor accepts and serves v2 hidden service
@@@ -1277,7 -1295,6 +1305,7 @@@ The following options are used for runn
         AuthDirMaxServersPerAddr 0
         AuthDirMaxServersPerAuthAddr 0
         ClientDNSRejectInternalAddresses 0
 +       ClientRejectInternalAddresses 0
         ExitPolicyRejectPrivate 0
         V3AuthVotingInterval 5 minutes
         V3AuthVoteDelay 20 seconds
diff --combined src/or/config.c
index ec86dbc,5600ac5..178ed1e
--- a/src/or/config.c
+++ b/src/or/config.c
@@@ -195,7 -195,6 +195,7 @@@ static config_var_t _option_vars[] = 
    V(CircuitStreamTimeout,        INTERVAL, "0"),
    V(CircuitPriorityHalflife,     DOUBLE,  "-100.0"), /*negative:'Use default'*/
    V(ClientDNSRejectInternalAddresses, BOOL,"1"),
 +  V(ClientRejectInternalAddresses, BOOL,   "1"),
    V(ClientOnly,                  BOOL,     "0"),
    V(ConsensusParams,             STRING,   NULL),
    V(ConnLimit,                   UINT,     "1000"),
@@@ -288,6 -287,7 +288,7 @@@
    OBSOLETE("IgnoreVersion"),
    V(KeepalivePeriod,             INTERVAL, "5 minutes"),
    VAR("Log",                     LINELIST, Logs,             NULL),
+   V(LogMessageDomains,           BOOL,     "0"),
    OBSOLETE("LinkPadding"),
    OBSOLETE("LogLevel"),
    OBSOLETE("LogFile"),
@@@ -406,7 -406,6 +407,7 @@@ static config_var_t testing_tor_network
    V(AuthDirMaxServersPerAddr,    UINT,     "0"),
    V(AuthDirMaxServersPerAuthAddr,UINT,     "0"),
    V(ClientDNSRejectInternalAddresses, BOOL,"0"),
 +  V(ClientRejectInternalAddresses, BOOL,   "0"),
    V(ExitPolicyRejectPrivate,     BOOL,     "0"),
    V(V3AuthVotingInterval,        INTERVAL, "5 minutes"),
    V(V3AuthVoteDelay,             INTERVAL, "20 seconds"),
@@@ -2841,9 -2840,7 +2842,9 @@@ compute_publishserverdescriptor(or_opti
      else if (!strcasecmp(string, "bridge"))
        *auth |= BRIDGE_AUTHORITY;
      else if (!strcasecmp(string, "hidserv"))
 -      *auth |= HIDSERV_AUTHORITY;
 +      log_warn(LD_CONFIG,
 +               "PublishServerDescriptor hidserv is invalid. See "
 +               "PublishHidServDescriptors.");
      else if (!strcasecmp(string, "") || !strcmp(string, "0"))
        /* no authority */;
      else
@@@ -3347,11 -3344,6 +3348,11 @@@ options_validate(or_options_t *old_opti
                             "PerConnBWBurst", msg) < 0)
      return -1;
  
 +  if (options->RelayBandwidthRate && !options->RelayBandwidthBurst)
 +    options->RelayBandwidthBurst = options->RelayBandwidthRate;
 +  if (options->RelayBandwidthBurst && !options->RelayBandwidthRate)
 +    options->RelayBandwidthRate = options->RelayBandwidthBurst;
 +
    if (server_mode(options)) {
      if (options->BandwidthRate < ROUTER_REQUIRED_MIN_BANDWIDTH) {
        tor_asprintf(msg,
@@@ -3380,6 -3372,9 +3381,6 @@@
      }
    }
  
 -  if (options->RelayBandwidthRate && !options->RelayBandwidthBurst)
 -    options->RelayBandwidthBurst = options->RelayBandwidthRate;
 -
    if (options->RelayBandwidthRate > options->RelayBandwidthBurst)
      REJECT("RelayBandwidthBurst must be at least equal "
             "to RelayBandwidthRate.");
@@@ -3817,7 -3812,8 +3818,8 @@@ options_transition_affects_workers(or_o
        old_options->SafeLogging != new_options->SafeLogging ||
        old_options->ClientOnly != new_options->ClientOnly ||
        public_server_mode(old_options) != public_server_mode(new_options) ||
-       !config_lines_eq(old_options->Logs, new_options->Logs))
+       !config_lines_eq(old_options->Logs, new_options->Logs) ||
+       old_options->LogMessageDomains != new_options->LogMessageDomains)
      return 1;
  
    /* Check whether log options match. */
@@@ -4393,6 -4389,9 +4395,9 @@@ options_init_logs(or_options_t *options
    }
    smartlist_free(elts);
  
+   if (ok && !validate_only)
+     logs_set_domain_logging(options->LogMessageDomains);
+ 
    return ok?0:-1;
  }
  
diff --combined src/or/or.h
index 752de21,7bccf83..2a55668
--- a/src/or/or.h
+++ b/src/or/or.h
@@@ -583,9 -583,6 +583,9 @@@ typedef enum 
  /** This is a connection on the NATD port, and the destination IP:Port was
   * either ill-formed or out-of-range. */
  #define END_STREAM_REASON_INVALID_NATD_DEST 261
 +/** The target address is in a private network (like 127.0.0.1 or 10.0.0.1);
 + * you don't want to do that over a randomly chosen exit */
 +#define END_STREAM_REASON_PRIVATE_ADDR 262
  
  /** Bitwise-and this value with endreason to mask out all flags. */
  #define END_STREAM_REASON_MASK 511
@@@ -1173,10 -1170,6 +1173,10 @@@ typedef struct edge_connection_t 
     * zero, abandon the associated mapaddress. */
    unsigned int chosen_exit_retries:3;
  
 +  /** True iff this is an AP connection that came from a transparent or
 +   * NATd connection */
 +  unsigned int is_transparent_ap:1;
 +
    /** If this is a DNSPort connection, this field holds the pending DNS
     * request that we're going to try to answer.  */
    struct evdns_server_request *dns_server_request;
@@@ -2345,6 -2338,9 +2345,9 @@@ typedef struct 
    config_line_t *Logs; /**< New-style list of configuration lines
                          * for logs */
  
+   int LogMessageDomains; /**< Boolean: Should we log the domain(s) in which
+                           * each log message occurs? */
+ 
    char *DebugLogFile; /**< Where to send verbose log messages. */
    char *DataDirectory; /**< OR only: where to store long-term data. */
    char *Nickname; /**< OR only: nickname of this onion router. */
@@@ -2756,10 -2752,6 +2759,10 @@@
     * Helps avoid some cross-site attacks. */
    int ClientDNSRejectInternalAddresses;
  
 +  /** If true, do not accept any requests to connect to internal addresses
 +   * over randomly chosen exits. */
 +  int ClientRejectInternalAddresses;
 +
    /** The length of time that we think a consensus should be fresh. */
    int V3AuthVotingInterval;
    /** The length of time we think it will take to distribute votes. */



More information about the tor-commits mailing list