[or-cvs] [tor/master] Change proxy-address type to tor_addr_t to allow ipv6 proxies.

Nick Mathewson nickm at seul.org
Wed Aug 26 15:34:35 UTC 2009


Author: Nick Mathewson <nickm at torproject.org>
Date: Fri, 19 Jun 2009 12:48:00 -0400
Subject: Change proxy-address type to tor_addr_t to allow ipv6 proxies.
Commit: 659fc13da5f8cf7c3d7d3be238df709e8de06945

---
 src/or/config.c        |   12 ++++++------
 src/or/connection_or.c |    6 +++---
 src/or/directory.c     |    2 +-
 src/or/or.h            |    8 ++++----
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/or/config.c b/src/or/config.c
index e1830fa..f769600 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -3386,7 +3386,7 @@ options_validate(or_options_t *old_options, or_options_t *options,
     REJECT("Failed to parse accounting options. See logs for details.");
 
   if (options->HttpProxy) { /* parse it now */
-    if (parse_addr_port(LOG_WARN, options->HttpProxy, NULL,
+    if (tor_addr_port_parse(options->HttpProxy,
                         &options->HttpProxyAddr, &options->HttpProxyPort) < 0)
       REJECT("HttpProxy failed to parse or resolve. Please fix.");
     if (options->HttpProxyPort == 0) { /* give it a default */
@@ -3400,7 +3400,7 @@ options_validate(or_options_t *old_options, or_options_t *options,
   }
 
   if (options->HttpsProxy) { /* parse it now */
-    if (parse_addr_port(LOG_WARN, options->HttpsProxy, NULL,
+    if (tor_addr_port_parse(options->HttpsProxy,
                         &options->HttpsProxyAddr, &options->HttpsProxyPort) <0)
       REJECT("HttpsProxy failed to parse or resolve. Please fix.");
     if (options->HttpsProxyPort == 0) { /* give it a default */
@@ -3414,7 +3414,7 @@ options_validate(or_options_t *old_options, or_options_t *options,
   }
 
   if (options->Socks4Proxy) { /* parse it now */
-    if (parse_addr_port(LOG_WARN, options->Socks4Proxy, NULL,
+    if (tor_addr_port_parse(options->Socks4Proxy,
                         &options->Socks4ProxyAddr,
                         &options->Socks4ProxyPort) <0)
       REJECT("Socks4Proxy failed to parse or resolve. Please fix.");
@@ -3424,9 +3424,9 @@ options_validate(or_options_t *old_options, or_options_t *options,
   }
 
   if (options->Socks5Proxy) { /* parse it now */
-    if (parse_addr_port(LOG_WARN, options->Socks5Proxy, NULL,
-                        &options->Socks5ProxyAddr,
-                        &options->Socks5ProxyPort) <0)
+    if (tor_addr_port_parse(options->Socks5Proxy,
+                            &options->Socks5ProxyAddr,
+                            &options->Socks5ProxyPort) <0)
       REJECT("Socks5Proxy failed to parse or resolve. Please fix.");
     if (options->Socks5ProxyPort == 0) { /* give it a default */
       options->Socks5ProxyPort = 1080;
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index bbfa611..8c8b549 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -721,15 +721,15 @@ connection_or_connect(const tor_addr_t *_addr, uint16_t port,
   /* use a proxy server if available */
   if (options->HttpsProxy) {
     using_proxy = 1;
-    tor_addr_from_ipv4h(&addr, options->HttpsProxyAddr);
+    tor_addr_copy(&addr, &options->HttpsProxyAddr);
     port = options->HttpsProxyPort;
   } else if (options->Socks4Proxy) {
     using_proxy = 1;
-    tor_addr_from_ipv4h(&addr, options->Socks4ProxyAddr);
+    tor_addr_copy(&addr, &options->Socks4ProxyAddr);
     port = options->Socks4ProxyPort;
   } else if (options->Socks5Proxy) {
     using_proxy = 1;
-    tor_addr_from_ipv4h(&addr, options->Socks5ProxyAddr);
+    tor_addr_copy(&addr, &options->Socks5ProxyAddr);
     port = options->Socks5ProxyPort;
   }
 
diff --git a/src/or/directory.c b/src/or/directory.c
index d6457e0..b015b9e 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -781,7 +781,7 @@ directory_initiate_command_rend(const char *address, const tor_addr_t *_addr,
     /* then we want to connect to dirport directly */
 
     if (options->HttpProxy) {
-      tor_addr_from_ipv4h(&addr, options->HttpProxyAddr);
+      tor_addr_copy(&addr, &options->HttpProxyAddr);
       dir_port = options->HttpProxyPort;
     }
 
diff --git a/src/or/or.h b/src/or/or.h
index f901121..bb6cee1 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -2349,21 +2349,21 @@ typedef struct {
   char *ContactInfo; /**< Contact info to be published in the directory. */
 
   char *HttpProxy; /**< hostname[:port] to use as http proxy, if any. */
-  uint32_t HttpProxyAddr; /**< Parsed IPv4 addr for http proxy, if any. */
+  tor_addr_t HttpProxyAddr; /**< Parsed IPv4 addr for http proxy, if any. */
   uint16_t HttpProxyPort; /**< Parsed port for http proxy, if any. */
   char *HttpProxyAuthenticator; /**< username:password string, if any. */
 
   char *HttpsProxy; /**< hostname[:port] to use as https proxy, if any. */
-  uint32_t HttpsProxyAddr; /**< Parsed IPv4 addr for https proxy, if any. */
+  tor_addr_t HttpsProxyAddr; /**< Parsed addr for https proxy, if any. */
   uint16_t HttpsProxyPort; /**< Parsed port for https proxy, if any. */
   char *HttpsProxyAuthenticator; /**< username:password string, if any. */
 
   char *Socks4Proxy;
-  uint32_t Socks4ProxyAddr;
+  tor_addr_t Socks4ProxyAddr;
   uint16_t Socks4ProxyPort;
 
   char *Socks5Proxy;
-  uint32_t Socks5ProxyAddr;
+  tor_addr_t Socks5ProxyAddr;
   uint16_t Socks5ProxyPort;
   char *Socks5ProxyUsername;
   char *Socks5ProxyPassword;
-- 
1.5.6.5




More information about the tor-commits mailing list