mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
start calling it *ListenAddress rather than *BindAddress,
since none of our users know what it means to bind an address or port. svn:r5260
This commit is contained in:
parent
22c72bd9c5
commit
fd165329b8
@ -67,6 +67,9 @@ static config_abbrev_t _option_abbrevs[] = {
|
||||
{ "BandwidthBurstBytes", "BandwidthBurst", 0, 0},
|
||||
{ "DirFetchPostPeriod", "StatusFetchPeriod", 0, 0},
|
||||
{ "MaxConn", "ConnLimit", 0, 1},
|
||||
{ "ORBindAddress", "ORListenAddress", 0, 1},
|
||||
{ "DirBindAddress", "DirListenAddress", 0, 1},
|
||||
{ "SocksBindAddress", "SocksListenAddress", 0, 1},
|
||||
{ NULL, NULL, 0, 0},
|
||||
};
|
||||
#undef PLURAL
|
||||
@ -115,8 +118,9 @@ static config_var_t _option_vars[] = {
|
||||
VAR("DataDirectory", STRING, DataDirectory, NULL),
|
||||
VAR("DebugLogFile", STRING, DebugLogFile, NULL),
|
||||
VAR("DirAllowPrivateAddresses",BOOL, DirAllowPrivateAddresses, NULL),
|
||||
VAR("DirBindAddress", LINELIST, DirBindAddress, NULL),
|
||||
VAR("DirFetchPeriod", INTERVAL, DirFetchPeriod, "0 seconds"), /** DOCDOC **/
|
||||
VAR("DirListenAddress", LINELIST, DirListenAddress, NULL),
|
||||
/* if DirFetchPeriod is 0, see get_dir_fetch_period() in main.c */
|
||||
VAR("DirFetchPeriod", INTERVAL, DirFetchPeriod, "0 seconds"),
|
||||
VAR("DirPolicy", LINELIST, DirPolicy, NULL),
|
||||
VAR("DirPort", UINT, DirPort, "0"),
|
||||
OBSOLETE("DirPostPeriod"),
|
||||
@ -159,7 +163,7 @@ static config_var_t _option_vars[] = {
|
||||
VAR("NodeFamily", LINELIST, NodeFamilies, NULL),
|
||||
VAR("NumCpus", UINT, NumCpus, "1"),
|
||||
VAR("NumHelperNodes", UINT, NumHelperNodes, "3"),
|
||||
VAR("ORBindAddress", LINELIST, ORBindAddress, NULL),
|
||||
VAR("ORListenAddress", LINELIST, ORListenAddress, NULL),
|
||||
VAR("ORPort", UINT, ORPort, "0"),
|
||||
VAR("OutboundBindAddress", STRING, OutboundBindAddress, NULL),
|
||||
VAR("PathlenCoinWeight", DOUBLE, PathlenCoinWeight, "0.3"),
|
||||
@ -179,10 +183,11 @@ static config_var_t _option_vars[] = {
|
||||
VAR("RunTesting", BOOL, RunTesting, "0"),
|
||||
VAR("SafeLogging", BOOL, SafeLogging, "1"),
|
||||
VAR("ShutdownWaitLength", INTERVAL, ShutdownWaitLength, "30 seconds"),
|
||||
VAR("SocksBindAddress", LINELIST, SocksBindAddress, NULL),
|
||||
VAR("SocksListenAddress", LINELIST, SocksListenAddress, NULL),
|
||||
VAR("SocksPolicy", LINELIST, SocksPolicy, NULL),
|
||||
VAR("SocksPort", UINT, SocksPort, "9050"),
|
||||
VAR("StatusFetchPeriod", INTERVAL, StatusFetchPeriod, "0 seconds"), /** DOCDOC */
|
||||
/* if StatusFetchPeriod is 0, see get_status_fetch_period() in main.c */
|
||||
VAR("StatusFetchPeriod", INTERVAL, StatusFetchPeriod, "0 seconds"),
|
||||
VAR("StrictEntryNodes", BOOL, StrictEntryNodes, "0"),
|
||||
VAR("StrictExitNodes", BOOL, StrictExitNodes, "0"),
|
||||
VAR("SysLog", LINELIST_S, OldLogOptions, NULL),
|
||||
@ -1732,16 +1737,16 @@ options_validate(or_options_t *options)
|
||||
result = -1;
|
||||
}
|
||||
|
||||
if (options->ORPort == 0 && options->ORBindAddress != NULL) {
|
||||
log(LOG_WARN, "ORPort must be defined if ORBindAddress is defined.");
|
||||
if (options->ORPort == 0 && options->ORListenAddress != NULL) {
|
||||
log(LOG_WARN, "ORPort must be defined if ORListenAddress is defined.");
|
||||
result = -1;
|
||||
}
|
||||
if (options->DirPort == 0 && options->DirBindAddress != NULL) {
|
||||
log(LOG_WARN, "DirPort must be defined if DirBindAddress is defined.");
|
||||
if (options->DirPort == 0 && options->DirListenAddress != NULL) {
|
||||
log(LOG_WARN, "DirPort must be defined if DirListenAddress is defined.");
|
||||
result = -1;
|
||||
}
|
||||
if (options->SocksPort == 0 && options->SocksBindAddress != NULL) {
|
||||
log(LOG_WARN, "SocksPort must be defined if SocksBindAddress is defined.");
|
||||
if (options->SocksPort == 0 && options->SocksListenAddress != NULL) {
|
||||
log(LOG_WARN, "SocksPort must be defined if SocksListenAddress is defined.");
|
||||
result = -1;
|
||||
}
|
||||
|
||||
|
@ -13,8 +13,8 @@ const char connection_c_id[] = "$Id$";
|
||||
|
||||
#include "or.h"
|
||||
|
||||
static connection_t *connection_create_listener(const char *bindaddress,
|
||||
uint16_t bindport, int type);
|
||||
static connection_t *connection_create_listener(const char *listenaddress,
|
||||
uint16_t listenport, int type);
|
||||
static int connection_init_accepted_conn(connection_t *conn);
|
||||
static int connection_handle_listener_read(connection_t *conn, int new_type);
|
||||
static int connection_receiver_bucket_should_increase(connection_t *conn);
|
||||
@ -474,17 +474,17 @@ connection_expire_held_open(void)
|
||||
}
|
||||
|
||||
/** Bind a new non-blocking socket listening to
|
||||
* <b>bindaddress</b>:<b>bindport</b>, and add this new connection
|
||||
* <b>listenaddress</b>:<b>listenport</b>, and add this new connection
|
||||
* (of type <b>type</b>) to the connection array.
|
||||
*
|
||||
* If <b>bindaddress</b> includes a port, we bind on that port; otherwise, we
|
||||
* use bindport.
|
||||
* If <b>listenaddress</b> includes a port, we bind on that port;
|
||||
* otherwise, we use listenport.
|
||||
*/
|
||||
static connection_t *
|
||||
connection_create_listener(const char *bindaddress, uint16_t bindport,
|
||||
connection_create_listener(const char *listenaddress, uint16_t listenport,
|
||||
int type)
|
||||
{
|
||||
struct sockaddr_in bindaddr; /* where to bind */
|
||||
struct sockaddr_in listenaddr; /* where to bind */
|
||||
char *address = NULL;
|
||||
connection_t *conn;
|
||||
uint16_t usePort;
|
||||
@ -494,17 +494,17 @@ connection_create_listener(const char *bindaddress, uint16_t bindport,
|
||||
int one=1;
|
||||
#endif
|
||||
|
||||
memset(&bindaddr,0,sizeof(struct sockaddr_in));
|
||||
if (parse_addr_port(bindaddress, &address, &addr, &usePort)<0) {
|
||||
log_fn(LOG_WARN, "Error parsing/resolving BindAddress %s",bindaddress);
|
||||
memset(&listenaddr,0,sizeof(struct sockaddr_in));
|
||||
if (parse_addr_port(listenaddress, &address, &addr, &usePort)<0) {
|
||||
log_fn(LOG_WARN, "Error parsing/resolving ListenAddress %s",listenaddress);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (usePort==0)
|
||||
usePort = bindport;
|
||||
bindaddr.sin_addr.s_addr = htonl(addr);
|
||||
bindaddr.sin_family = AF_INET;
|
||||
bindaddr.sin_port = htons((uint16_t) usePort);
|
||||
usePort = listenport;
|
||||
listenaddr.sin_addr.s_addr = htonl(addr);
|
||||
listenaddr.sin_family = AF_INET;
|
||||
listenaddr.sin_port = htons((uint16_t) usePort);
|
||||
|
||||
log_fn(LOG_NOTICE, "Opening %s on %s:%d",
|
||||
conn_type_to_string(type), address, usePort);
|
||||
@ -527,7 +527,7 @@ connection_create_listener(const char *bindaddress, uint16_t bindport,
|
||||
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (void*) &one, sizeof(one));
|
||||
#endif
|
||||
|
||||
if (bind(s,(struct sockaddr *)&bindaddr,sizeof(bindaddr)) < 0) {
|
||||
if (bind(s,(struct sockaddr *)&listenaddr,sizeof(listenaddr)) < 0) {
|
||||
log_fn(LOG_WARN, "Could not bind to %s:%u: %s", address, usePort,
|
||||
tor_socket_strerror(tor_socket_errno(s)));
|
||||
goto err;
|
||||
@ -803,7 +803,7 @@ connection_connect(connection_t *conn, char *address,
|
||||
/**
|
||||
* Launch any configured listener connections of type <b>type</b>. (A
|
||||
* listener is configured if <b>port_option</b> is non-zero. If any
|
||||
* BindAddress configuration options are given in <b>cfg</b>, create a
|
||||
* ListenAddress configuration options are given in <b>cfg</b>, create a
|
||||
* connection binding to each one. Otherwise, create a single
|
||||
* connection binding to the address <b>default_addr</b>.)
|
||||
*
|
||||
@ -935,15 +935,15 @@ retry_all_listeners(int force, smartlist_t *replaced_conns,
|
||||
or_options_t *options = get_options();
|
||||
|
||||
if (server_mode(options) &&
|
||||
retry_listeners(CONN_TYPE_OR_LISTENER, options->ORBindAddress,
|
||||
retry_listeners(CONN_TYPE_OR_LISTENER, options->ORListenAddress,
|
||||
options->ORPort, "0.0.0.0", force,
|
||||
replaced_conns, new_conns)<0)
|
||||
return -1;
|
||||
if (retry_listeners(CONN_TYPE_DIR_LISTENER, options->DirBindAddress,
|
||||
if (retry_listeners(CONN_TYPE_DIR_LISTENER, options->DirListenAddress,
|
||||
options->DirPort, "0.0.0.0", force,
|
||||
replaced_conns, new_conns)<0)
|
||||
return -1;
|
||||
if (retry_listeners(CONN_TYPE_AP_LISTENER, options->SocksBindAddress,
|
||||
if (retry_listeners(CONN_TYPE_AP_LISTENER, options->SocksListenAddress,
|
||||
options->SocksPort, "127.0.0.1", force,
|
||||
replaced_conns, new_conns)<0)
|
||||
return -1;
|
||||
|
@ -1174,11 +1174,11 @@ typedef struct {
|
||||
config_line_t *SocksPolicy; /**< Lists of socks policy components */
|
||||
config_line_t *DirPolicy; /**< Lists of dir policy components */
|
||||
/** Addresses to bind for listening for SOCKS connections. */
|
||||
config_line_t *SocksBindAddress;
|
||||
config_line_t *SocksListenAddress;
|
||||
/** Addresses to bind for listening for OR connections. */
|
||||
config_line_t *ORBindAddress;
|
||||
config_line_t *ORListenAddress;
|
||||
/** Addresses to bind for listening for directory connections. */
|
||||
config_line_t *DirBindAddress;
|
||||
config_line_t *DirListenAddress;
|
||||
/** Local address to bind outbound sockets */
|
||||
char *OutboundBindAddress;
|
||||
/** Directory server only: which versions of
|
||||
|
@ -524,7 +524,7 @@ int
|
||||
server_mode(or_options_t *options)
|
||||
{
|
||||
if (options->ClientOnly) return 0;
|
||||
return (options->ORPort != 0 || options->ORBindAddress);
|
||||
return (options->ORPort != 0 || options->ORListenAddress);
|
||||
}
|
||||
|
||||
/** Remember if we've advertised ourselves to the dirservers. */
|
||||
@ -551,7 +551,7 @@ set_server_advertised(int s)
|
||||
int
|
||||
proxy_mode(or_options_t *options)
|
||||
{
|
||||
return (options->SocksPort != 0 || options->SocksBindAddress);
|
||||
return (options->SocksPort != 0 || options->SocksListenAddress);
|
||||
}
|
||||
|
||||
/** Decide if we're a publishable server. We are a publishable server if:
|
||||
|
Loading…
Reference in New Issue
Block a user