[or-cvs] only complain about private IPs if we had to guess

Roger Dingledine arma at seul.org
Mon Mar 15 04:04:18 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	config.c 
Log Message:
only complain about private IPs if we had to guess


Index: config.c
===================================================================
RCS file: /home/or/cvsroot/src/or/config.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- config.c	15 Mar 2004 04:00:14 -0000	1.96
+++ config.c	15 Mar 2004 04:04:16 -0000	1.97
@@ -349,8 +349,10 @@
   struct in_addr in;
   struct hostent *rent;
   char localhostname[256];
+  int guessed=0;
 
   if(!options->Address) { /* then we need to guess our address */
+    guessed = 1;
 
     if(gethostname(localhostname,sizeof(localhostname)) < 0) {
       log_fn(LOG_WARN,"Error obtaining local hostname");
@@ -376,7 +378,7 @@
   }
   assert(rent->h_length == 4);
   memcpy(&in.s_addr, rent->h_addr,rent->h_length);
-  if(is_internal_IP(htonl(in.s_addr))) {
+  if(guessed==1 && is_internal_IP(htonl(in.s_addr))) {
     log_fn(LOG_WARN,"Address '%s' resolves to private IP '%s'. "
            "Please set the Address config option to be your public IP.",
            options->Address, inet_ntoa(in));



More information about the tor-commits mailing list