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
This commit is contained in:
Alexander Færøy 2019-07-02 19:03:39 +02:00 committed by David Goulet
parent 25bffccd71
commit db0aaf428e
3 changed files with 26 additions and 1 deletions

View File

@ -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.

View File

@ -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;

View File

@ -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
*/