]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
r15619@catbus: nickm | 2007-10-10 00:23:45 -0400
authorNick Mathewson <nickm@torproject.org>
Wed, 10 Oct 2007 04:24:02 +0000 (04:24 +0000)
committerNick Mathewson <nickm@torproject.org>
Wed, 10 Oct 2007 04:24:02 +0000 (04:24 +0000)
 Fix bug 483: downgrade a harmless "Hey your accept() implementation sucks" warning to an info.

svn:r11828

ChangeLog
src/or/connection.c

index c5132eeaff0530c6c5d736ba0a6ef222ca26799f..22fada7389bab2e93c54ec5a97ccb55cc06ea45c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -51,6 +51,10 @@ Changes in version 0.2.0.8-alpha - 2007-??-??
       advantage of 64-bit platforms and to remove some possibly-costly
       voodoo.
 
+  o Minor bugfixes (portability):
+    - On some platforms, accept() can return a broken address.  Detect
+      this more quietly, and deal accordingly.  (Fixes bug 483.)
+
   o Code simplifications and refactoring:
     - Make a bunch of functions static.  Remove some dead code.
     - Pull out about a third of the really big routerlist.c; put it in a
index b6af0910f99df000e9e46a6ab7f1cc0154cdbc73..b3d298435edd3c8c69be06692acfeb1ee8b5d37f 100644 (file)
@@ -899,7 +899,7 @@ connection_handle_listener_read(connection_t *conn, int new_type)
   struct sockaddr_in remote;
   char addrbuf[256];
   /* length of the remote address. Must be whatever accept() needs. */
-  socklen_t remotelen = 256;
+  socklen_t remotelen = sizeof(addrbuf);
   char tmpbuf[INET_NTOA_BUF_LEN];
   or_options_t *options = get_options();
 
@@ -932,9 +932,11 @@ connection_handle_listener_read(connection_t *conn, int new_type)
     set_constrained_socket_buffers(news, (int)options->ConstrainedSockSize);
 
   if (((struct sockaddr*)addrbuf)->sa_family != conn->socket_family) {
-    log_warn(LD_BUG, "A listener connection returned a socket with a "
+    /* This is annoying, but can apparently happen on some Darwins. */
+    log_info(LD_BUG, "A listener connection returned a socket with a "
              "mismatched family. %s for addr_family %d gave us a socket "
-             "with address family %d.", conn_type_to_string(conn->type),
+             "with address family %d.  Dropping.",
+             conn_type_to_string(conn->type),
              (int)conn->socket_family,
              (int)((struct sockaddr*)addrbuf)->sa_family);
     tor_close_socket(news);