[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] when an exit node gets a malformed begin cell, don"t compla...



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

Modified Files:
	util.c util.h 
Log Message:
when an exit node gets a malformed begin cell, don't complain to
the node operator, since he can't do anything about it.


Index: util.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/common/util.c,v
retrieving revision 1.263
retrieving revision 1.264
diff -u -p -d -r1.263 -r1.264
--- util.c	18 Jun 2006 07:37:21 -0000	1.263
+++ util.c	6 Jul 2006 02:44:03 -0000	1.264
@@ -1486,8 +1486,8 @@ is_local_IP(uint32_t ip)
  * Return 0 on success, -1 on failure.
  */
 int
-parse_addr_port(const char *addrport, char **address, uint32_t *addr,
-                uint16_t *port_out)
+parse_addr_port(int severity, const char *addrport, char **address,
+                uint32_t *addr, uint16_t *port_out)
 {
   const char *colon;
   char *_address = NULL;
@@ -1501,14 +1501,14 @@ parse_addr_port(const char *addrport, ch
     _address = tor_strndup(addrport, colon-addrport);
     _port = (int) tor_parse_long(colon+1,10,1,65535,NULL,NULL);
     if (!_port) {
-      log_warn(LD_GENERAL, "Port %s out of range", escaped(colon+1));
+      log_fn(severity, LD_GENERAL, "Port %s out of range", escaped(colon+1));
       ok = 0;
     }
     if (!port_out) {
       char *esc_addrport = esc_for_log(addrport);
-      log_warn(LD_GENERAL,
-               "Port %s given on %s when not required",
-               escaped(colon+1), esc_addrport);
+      log_fn(severity, LD_GENERAL,
+             "Port %s given on %s when not required",
+             escaped(colon+1), esc_addrport);
       tor_free(esc_addrport);
       ok = 0;
     }
@@ -1520,7 +1520,7 @@ parse_addr_port(const char *addrport, ch
   if (addr) {
     /* There's an addr pointer, so we need to resolve the hostname. */
     if (tor_lookup_hostname(_address,addr)) {
-      log_warn(LD_NET, "Couldn't look up %s", escaped(_address));
+      log_fn(severity, LD_NET, "Couldn't look up %s", escaped(_address));
       ok = 0;
       *addr = 0;
     }

Index: util.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/common/util.h,v
retrieving revision 1.161
retrieving revision 1.162
diff -u -p -d -r1.161 -r1.162
--- util.h	4 Jul 2006 03:25:07 -0000	1.161
+++ util.h	6 Jul 2006 02:44:03 -0000	1.162
@@ -168,8 +168,8 @@ int path_is_relative(const char *filenam
 /* Net helpers */
 int is_internal_IP(uint32_t ip, int for_listening);
 int is_local_IP(uint32_t ip);
-int parse_addr_port(const char *addrport, char **address, uint32_t *addr,
-                    uint16_t *port);
+int parse_addr_port(int severity, const char *addrport, char **address,
+                    uint32_t *addr, uint16_t *port_out);
 int parse_port_range(const char *port, uint16_t *port_min_out,
                      uint16_t *port_max_out);
 int parse_addr_and_port_range(const char *s, uint32_t *addr_out,