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

[tor-commits] [tor/master] Add `OutboundBindAddressPT` to torrc.



commit db0aaf428ebb00b37b451db1d5eecb2fd5689b79
Author: Alexander Færøy <ahf@xxxxxxxxxxxxxx>
Date:   Tue Jul 2 19:03:39 2019 +0200

    Add `OutboundBindAddressPT` to torrc.
    
    This patch adds a new option to torrc: `OutboundBindAddressPT`. This
    option works in the same way as `OutboundBindAddressOR` and
    `OutboundBindAddressExit` in that it allows the user to specify which
    outbound IP address the user wants the PT to make its connections from.
    
    There is one difference though in that OutboundBindAddressPT will only
    be a suggestion for the PT to use since Tor cannot enforce whether or
    not the PT actually uses this option for anything.
    
    See: https://bugs.torproject.org/5304
---
 doc/man/tor.1.txt              | 11 +++++++++++
 src/app/config/config.c        | 10 +++++++++-
 src/app/config/or_options_st.h |  6 ++++++
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/doc/man/tor.1.txt b/doc/man/tor.1.txt
index 4b37548b07..cd53d5ea26 100644
--- a/doc/man/tor.1.txt
+++ b/doc/man/tor.1.txt
@@ -797,6 +797,17 @@ forward slash (/) in the configuration file and on the command line.
     field, Tor will use it for separate rate limiting for each connection
     from a non-relay. (Default: 0)
 
+[[OutboundBindAddressPT]] **OutboundBindAddressPT** __IP__::
+    Request that pluggable transports makes all outbound connections
+    originate from the IP address specified. Because outgoing connections
+    are handled by the pluggable transport itself, it is not possible for
+    Tor to enforce whether the pluggable transport honors this option. This
+    option overrides **OutboundBindAddress** for the same IP version. This
+    option may be used twice, once with an IPv4 address and once with an
+    IPv6 address. IPv6 addresses should be wrapped in square brackets. This
+    setting will be ignored for connections to the loopback addresses
+    (127.0.0.0/8 and ::1).
+
 [[PidFile]] **PidFile** __FILE__::
     On startup, write our PID to FILE. On clean shutdown, remove
     FILE. Can not be changed while tor is running.
diff --git a/src/app/config/config.c b/src/app/config/config.c
index 5c8a3792ee..9fee83aebb 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -580,6 +580,7 @@ static const config_var_t option_vars_[] = {
   V(OutboundBindAddress,         LINELIST,   NULL),
   V(OutboundBindAddressOR,       LINELIST,   NULL),
   V(OutboundBindAddressExit,     LINELIST,   NULL),
+  V(OutboundBindAddressPT,       LINELIST,   NULL),
 
   OBSOLETE("PathBiasDisableRate"),
   V(PathBiasCircThreshold,       INT,      "-1"),
@@ -7180,7 +7181,8 @@ parse_outbound_address_lines(const config_line_t *lines, outbound_addr_t type,
                      "configured: %s",
                      family==AF_INET?" IPv4":(family==AF_INET6?" IPv6":""),
                      type==OUTBOUND_ADDR_OR?" OR":
-                     (type==OUTBOUND_ADDR_EXIT?" exit":""), lines->value);
+                     (type==OUTBOUND_ADDR_EXIT?" exit":
+                     (type==OUTBOUND_ADDR_PT?" PT":"")), lines->value);
       return -1;
     }
     lines = lines->next;
@@ -7220,6 +7222,12 @@ parse_outbound_addresses(or_options_t *options, int validate_only, char **msg)
     goto err;
   }
 
+  if (parse_outbound_address_lines(options->OutboundBindAddressPT,
+                                   OUTBOUND_ADDR_PT, options, validate_only,
+                                   msg) < 0) {
+    goto err;
+  }
+
   return 0;
  err:
   return -1;
diff --git a/src/app/config/or_options_st.h b/src/app/config/or_options_st.h
index 9520a1b736..ce3006cc37 100644
--- a/src/app/config/or_options_st.h
+++ b/src/app/config/or_options_st.h
@@ -34,6 +34,10 @@ typedef enum {
    * `OutboundBindAddressOR` configuration entry in torrc. */
   OUTBOUND_ADDR_OR,
 
+  /** Outbound IP address for PT connections. Controlled by the
+   * `OutboundBindAddressPT` configuration entry in torrc. */
+  OUTBOUND_ADDR_PT,
+
   /** Outbound IP address for both Exit and OR connections. Controlled by the
    * OutboundBindAddress configuration entry in torrc. This value is used as
    * fallback if the more specific OUTBOUND_ADDR_EXIT and OUTBOUND_ADDR_OR is
@@ -146,6 +150,8 @@ struct or_options_t {
   struct config_line_t *OutboundBindAddressOR;
   /** Local address to bind outbound exit sockets */
   struct config_line_t *OutboundBindAddressExit;
+  /** Local address to bind outbound PT sockets */
+  struct config_line_t *OutboundBindAddressPT;
   /** Addresses derived from the various OutboundBindAddress lines.
    * [][0] is IPv4, [][1] is IPv6
    */



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits