[or-cvs] start the process of reducing clutter in server logs

arma at seul.org arma at seul.org
Mon Oct 17 00:35:56 UTC 2005


Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or

Modified Files:
	command.c config.c connection_or.c main.c or.h relay.c 
Log Message:
start the process of reducing clutter in server logs


Index: command.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/command.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- command.c	11 Jun 2005 18:52:11 -0000	1.92
+++ command.c	17 Oct 2005 00:35:53 -0000	1.93
@@ -144,7 +144,8 @@
 #endif
       break;
     default:
-      log_fn(LOG_WARN,"Cell of unknown type (%d) received. Dropping.", cell->command);
+      log_fn(LOG_PROTOCOL_WARN,
+             "Cell of unknown type (%d) received. Dropping.", cell->command);
       break;
   }
 }
@@ -184,7 +185,9 @@
   circ = circuit_get_by_circid_orconn(cell->circ_id, conn);
 
   if (circ) {
-    log_fn(LOG_WARN,"received CREATE cell (circID %d) for known circ. Dropping.", cell->circ_id);
+    log_fn(LOG_PROTOCOL_WARN,
+           "received CREATE cell (circID %d) for known circ. Dropping.",
+           cell->circ_id);
     return;
   }
 
@@ -238,7 +241,7 @@
   }
 
   if (circ->n_circ_id != cell->circ_id) {
-    log_fn(LOG_WARN,"got created cell from OPward? Closing.");
+    log_fn(LOG_PROTOCOL_WARN,"got created cell from OPward? Closing.");
     circuit_mark_for_close(circ);
     return;
   }
@@ -281,20 +284,20 @@
   }
 
   if (circ->state == CIRCUIT_STATE_ONIONSKIN_PENDING) {
-    log_fn(LOG_WARN,"circuit in create_wait. Closing.");
+    log_fn(LOG_PROTOCOL_WARN,"circuit in create_wait. Closing.");
     circuit_mark_for_close(circ);
     return;
   }
 
   if (cell->circ_id == circ->p_circ_id) { /* it's an outgoing cell */
     if (circuit_receive_relay_cell(cell, circ, CELL_DIRECTION_OUT) < 0) {
-      log_fn(LOG_WARN,"circuit_receive_relay_cell (forward) failed. Closing.");
+      log_fn(LOG_PROTOCOL_WARN,"circuit_receive_relay_cell (forward) failed. Closing.");
       circuit_mark_for_close(circ);
       return;
     }
   } else { /* it's an ingoing cell */
     if (circuit_receive_relay_cell(cell, circ, CELL_DIRECTION_IN) < 0) {
-      log_fn(LOG_WARN,"circuit_receive_relay_cell (backward) failed. Closing.");
+      log_fn(LOG_PROTOCOL_WARN,"circuit_receive_relay_cell (backward) failed. Closing.");
       circuit_mark_for_close(circ);
       return;
     }

Index: config.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.436
retrieving revision 1.437
diff -u -d -r1.436 -r1.437
--- config.c	12 Oct 2005 19:08:48 -0000	1.436
+++ config.c	17 Oct 2005 00:35:53 -0000	1.437
@@ -163,6 +163,7 @@
   VAR("OutboundBindAddress", STRING,   OutboundBindAddress,  NULL),
   VAR("PathlenCoinWeight",   DOUBLE,   PathlenCoinWeight,    "0.3"),
   VAR("PidFile",             STRING,   PidFile,              NULL),
+  VAR("ProtocolWarnings",    BOOL,     ProtocolWarnings,     "0"),
   VAR("ReachableAddresses",  LINELIST, ReachableAddresses,   NULL),
   VAR("RecommendedVersions", LINELIST, RecommendedVersions,  NULL),
   VAR("RecommendedClientVersions", LINELIST, RecommendedClientVersions,  NULL),

Index: connection_or.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection_or.c,v
retrieving revision 1.190
retrieving revision 1.191
diff -u -d -r1.190 -r1.191
--- connection_or.c	14 Oct 2005 02:26:12 -0000	1.190
+++ connection_or.c	17 Oct 2005 00:35:53 -0000	1.191
@@ -481,7 +481,7 @@
   log_fn(LOG_DEBUG, "Other side (%s:%d) claims to be router '%s'",
          conn->address, conn->port, nickname);
 
-  if (tor_tls_verify(conn->tls, &identity_rcvd) < 0) {
+  if (tor_tls_verify(severity, conn->tls, &identity_rcvd) < 0) {
     log_fn(LOG_WARN,"Other side, which claims to be router '%s' (%s:%d), has a cert but it's invalid. Closing.",
            nickname, conn->address, conn->port);
     return -1;

Index: main.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.578
retrieving revision 1.579
diff -u -d -r1.578 -r1.579
--- main.c	16 Oct 2005 19:47:01 -0000	1.578
+++ main.c	17 Oct 2005 00:35:53 -0000	1.579
@@ -463,7 +463,13 @@
       return 0;
     }
     if (connection_wants_to_flush(conn)) {
-      log_fn(LOG_NOTICE,"Something wrong with your network connection? Conn (addr %s, fd %d, type %s, state %d) tried to write %d bytes but timed out. (Marked at %s:%d)",
+      int severity;
+      if (conn->type == CONN_TYPE_EXIT ||
+          (conn->type == CONN_TYPE_DIR && conn->purpose == DIR_PURPOSE_SERVER))
+        severity = LOG_INFO;
+      else
+        severity = LOG_NOTICE;
+      log_fn(severity, "Something wrong with your network connection? Conn (addr %s, fd %d, type %s, state %d) tried to write %d bytes but timed out. (Marked at %s:%d)",
              safe_str(conn->address), conn->s, conn_type_to_string(conn->type),
              conn->state,
              (int)buf_datalen(conn->outbuf), conn->marked_for_close_file,

Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.716
retrieving revision 1.717
diff -u -d -r1.716 -r1.717
--- or.h	16 Oct 2005 18:43:41 -0000	1.716
+++ or.h	17 Oct 2005 00:35:53 -0000	1.717
@@ -1290,6 +1290,9 @@
                            * long do we wait before exiting? */
   int SafeLogging; /**< Boolean: are we allowed to log sensitive strings
                     * such as addresses (0), or do we scrub them first (1)? */
+#define LOG_PROTOCOL_WARN (get_options()->ProtocolWarnings ? LOG_WARN : LOG_INFO)
+  int ProtocolWarnings; /**< Boolean: when other parties screw up the Tor
+                         * protocol, is it a warn or an info in our logs? */
   int HardwareAccel; /**< Boolean: Should we enable OpenSSL hardware
                       * acceleration where available? */
   int UseHelperNodes; /**< Boolean: Do we try to enter from a smallish number

Index: relay.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/relay.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- relay.c	9 Sep 2005 06:11:37 -0000	1.81
+++ relay.c	17 Oct 2005 00:35:53 -0000	1.82
@@ -193,7 +193,7 @@
       }
       return 0;
     }
-    log_fn(LOG_WARN,"Didn't recognize cell, but circ stops here! Closing circ.");
+    log_fn(LOG_PROTOCOL_WARN,"Didn't recognize cell, but circ stops here! Closing circ.");
     return -1;
   }
 
@@ -429,7 +429,7 @@
   }
 
   if (!circ) {
-    log_fn(LOG_WARN,"no circ. Closing conn.");
+    log_fn(LOG_INFO,"no circ. Closing conn.");
     tor_assert(fromconn);
     if (fromconn->type == CONN_TYPE_AP) {
       connection_mark_unattached_ap(fromconn, END_STREAM_REASON_INTERNAL);



More information about the tor-commits mailing list