[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[or-cvs] all listeners listen on 0.0.0.0 except AP which listens on ...



Update of /home/or/cvsroot/src/or
In directory moria.seul.org:/home/arma/work/onion/cvs/src/or

Modified Files:
	connection.c 
Log Message:
all listeners listen on 0.0.0.0 except AP which listens on 127.0.0.1


Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- connection.c	1 Oct 2002 23:37:31 -0000	1.28
+++ connection.c	2 Oct 2002 01:03:00 -0000	1.29
@@ -279,11 +279,12 @@
     return -1;
 
   local.sin_port = htons(or_listenport);
-
   if(role & ROLE_OR_CONNECT_ALL) {
     router_retry_connections(&local);
   }
 
+  local.sin_addr.s_addr = htonl(INADDR_ANY); /* anyone can connect */
+
   if(role & ROLE_OR_LISTEN) {
     if(!connection_get_by_type(CONN_TYPE_OR_LISTENER)) {
       connection_or_create_listener(&local);
@@ -297,13 +298,6 @@
     }
   }
 
-  if(role & ROLE_AP_LISTEN) {
-    local.sin_port = htons(ap_listenport);
-    if(!connection_get_by_type(CONN_TYPE_AP_LISTENER)) {
-      connection_ap_create_listener(&local);
-    }
-  }
-
   if(role & ROLE_DIR_LISTEN) {
     local.sin_port = htons(dir_listenport);
     if(!connection_get_by_type(CONN_TYPE_DIR_LISTENER)) {
@@ -311,6 +305,14 @@
     }
   }
  
+  if(role & ROLE_AP_LISTEN) {
+    local.sin_port = htons(ap_listenport);
+    inet_aton("127.0.0.1", &(local.sin_addr)); /* the AP listens only on localhost! */
+    if(!connection_get_by_type(CONN_TYPE_AP_LISTENER)) {
+      connection_ap_create_listener(&local);
+    }
+  }
+
   return 0;
 }