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

[or-cvs] Change interface of parse_addr_port() to return address in ...



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv24505/src/or

Modified Files:
	config.c connection.c rendservice.c 
Log Message:
Change interface of parse_addr_port() to return address in host order, since most users seem to want that.

Index: config.c
===================================================================
RCS file: /home/or/cvsroot/src/or/config.c,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -d -r1.174 -r1.175
--- config.c	16 Oct 2004 20:38:56 -0000	1.174
+++ config.c	16 Oct 2004 21:53:29 -0000	1.175
@@ -847,7 +847,6 @@
       log(LOG_WARN,"HttpProxy failed to parse or resolve. Please fix.");
       result = -1;
     }
-    options->HttpProxyAddr = ntohl(options->HttpProxyAddr); /* switch to host-order */
     if (options->HttpProxyPort == 0) { /* give it a default */
       options->HttpProxyPort = 80;
     }

Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.263
retrieving revision 1.264
diff -u -d -r1.263 -r1.264
--- connection.c	14 Oct 2004 15:41:41 -0000	1.263
+++ connection.c	16 Oct 2004 21:53:29 -0000	1.264
@@ -317,17 +317,19 @@
   struct sockaddr_in bindaddr; /* where to bind */
   connection_t *conn;
   uint16_t usePort;
+  uint32_t addr;
   int s; /* the socket we're going to make */
   int one=1;
 
   memset(&bindaddr,0,sizeof(struct sockaddr_in));
-  if (parse_addr_port(bindaddress, NULL, &(bindaddr.sin_addr.s_addr),
-                      &usePort)<0) {
+  if (parse_addr_port(bindaddress, NULL, &addr, &usePort)<0) {
     log_fn(LOG_WARN, "Error parsing/resolving BindAddress %s",bindaddress);
     return -1;
   }
+  
   if (usePort==0)
     usePort = bindport;
+  binaddrr.sin_addr.s_addr = htonl(addr);
   bindaddr.sin_family = AF_INET;
   bindaddr.sin_port = htons((uint16_t) usePort);
 

Index: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendservice.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- rendservice.c	14 Oct 2004 08:45:07 -0000	1.90
+++ rendservice.c	16 Oct 2004 21:53:30 -0000	1.91
@@ -165,13 +165,13 @@
       log_fn(LOG_WARN, "Port out of range");
       return NULL;
     }
-    addr = htonl(0x7F000001u); /* Default to 127.0.0.1 */
+    addr = 0x7F000001u; /* Default to 127.0.0.1 */
   }
 
   result = tor_malloc(sizeof(rend_service_port_config_t));
   result->virtual_port = virtport;
   result->real_port = realport;
-  result->real_address = ntohl(addr);
+  result->real_address = addr;
   return result;
 }