diff options
author | Alexander Færøy <ahf@torproject.org> | 2019-07-02 19:03:39 +0200 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2020-10-06 09:30:10 -0400 |
commit | db0aaf428ebb00b37b451db1d5eecb2fd5689b79 (patch) | |
tree | 716ba4d527d1ea5cff38e040361dcb6fdeb44040 /src | |
parent | 25bffccd718220bd5b378d1517d09669d6685db1 (diff) | |
download | tor-db0aaf428ebb00b37b451db1d5eecb2fd5689b79.tar.gz tor-db0aaf428ebb00b37b451db1d5eecb2fd5689b79.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/app/config/config.c | 10 | ||||
-rw-r--r-- | src/app/config/or_options_st.h | 6 |
2 files changed, 15 insertions, 1 deletions
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 */ |