[or-cvs] r11828: Fix bug 483: downgrade a harmless "Hey your accept() impleme (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Wed Oct 10 04:24:03 UTC 2007


Author: nickm
Date: 2007-10-10 00:24:02 -0400 (Wed, 10 Oct 2007)
New Revision: 11828

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/connection.c
Log:
 r15619 at catbus:  nickm | 2007-10-10 00:23:45 -0400
 Fix bug 483: downgrade a harmless "Hey your accept() implementation sucks" warning to an info.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r15619] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-10-10 02:30:34 UTC (rev 11827)
+++ tor/trunk/ChangeLog	2007-10-10 04:24:02 UTC (rev 11828)
@@ -51,6 +51,10 @@
       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

Modified: tor/trunk/src/or/connection.c
===================================================================
--- tor/trunk/src/or/connection.c	2007-10-10 02:30:34 UTC (rev 11827)
+++ tor/trunk/src/or/connection.c	2007-10-10 04:24:02 UTC (rev 11828)
@@ -899,7 +899,7 @@
   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 @@
     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);



More information about the tor-commits mailing list