]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Merge branch 'resolvemyaddr_squashed'
authorNick Mathewson <nickm@torproject.org>
Mon, 29 Dec 2014 15:00:34 +0000 (10:00 -0500)
committerNick Mathewson <nickm@torproject.org>
Mon, 29 Dec 2014 15:00:34 +0000 (10:00 -0500)
1  2 
src/common/address.c
src/common/address.h
src/common/compat.c
src/common/compat.h
src/common/testsupport.h
src/or/config.c
src/test/test_config.c

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc src/or/config.c
index e7891a5bd3de712d67becc8ca3509dc3c074eb28,e0a24606853e347c56c8e8f9e02f7d1de249cf30..ae4b0892d61c6e50f32b302301c5df7ed3c1e3b6
@@@ -2078,15 -2051,34 +2079,41 @@@ get_last_resolved_addr(void
    return last_resolved_addr;
  }
  
 +/** Reset last_resolved_addr from outside this file. */
 +void
 +reset_last_resolved_addr(void)
 +{
 +  last_resolved_addr = 0;
 +}
 +
  /**
-  * Use <b>options-\>Address</b> to guess our public IP address.
+  * Attempt getting our non-local (as judged by tor_addr_is_internal()
+  * function) IP address using following techniques, listed in
+  * order from best (most desirable, try first) to worst (least
+  * desirable, try if everything else fails).
+  *
+  * First, attempt using <b>options-\>Address</b> to get our
+  * non-local IP address.
+  *
+  * If <b>options-\>Address</b> represents a non-local IP address,
+  * consider it ours.
+  *
+  * If <b>options-\>Address</b> is a DNS name that resolves to
+  * a non-local IP address, consider this IP address ours.
+  *
+  * If <b>options-\>Address</b> is NULL, fall back to getting local
+  * hostname and using it in above-described ways to try and
+  * get our IP address.
+  *
+  * In case local hostname cannot be resolved to a non-local IP
+  * address, try getting an IP address of network interface
+  * in hopes it will be non-local one.
+  *
+  * Fail if one or more of the following is true:
+  *   - DNS name in <b>options-\>Address</b> cannot be resolved.
+  *   - <b>options-\>Address</b> is a local host address.
+  *   - Attempt to getting local hostname fails.
+  *   - Attempt to getting network interface address fails.
   *
   * Return 0 if all is well, or -1 if we can't find a suitable
   * public IP address.
Simple merge