mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Be consistent about preferring foo* to struct foo*
svn:r4637
This commit is contained in:
parent
d42aae7cfb
commit
18c11eb3bc
@ -733,14 +733,14 @@ get_uname(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(USE_PTHREADS)
|
#if defined(USE_PTHREADS)
|
||||||
struct tor_pthread_data_t {
|
typedef struct tor_pthread_data_t {
|
||||||
int (*func)(void *);
|
int (*func)(void *);
|
||||||
void *data;
|
void *data;
|
||||||
};
|
} tor_pthread_data_t;
|
||||||
static void *
|
static void *
|
||||||
tor_pthread_helper_fn(void *_data)
|
tor_pthread_helper_fn(void *_data)
|
||||||
{
|
{
|
||||||
struct tor_pthread_data_t *data = _data;
|
tor_pthread_data_t *data = _data;
|
||||||
int (*func)(void*);
|
int (*func)(void*);
|
||||||
void *arg;
|
void *arg;
|
||||||
func = data->func;
|
func = data->func;
|
||||||
@ -771,8 +771,8 @@ spawn_func(int (*func)(void *), void *data)
|
|||||||
return 0;
|
return 0;
|
||||||
#elif defined(USE_PTHREADS)
|
#elif defined(USE_PTHREADS)
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
struct tor_pthread_data_t *d;
|
tor_pthread_data_t *d;
|
||||||
d = tor_malloc(sizeof(struct tor_pthread_data_t));
|
d = tor_malloc(sizeof(tor_pthread_data_t));
|
||||||
d->data = data;
|
d->data = data;
|
||||||
d->func = func;
|
d->func = func;
|
||||||
if (pthread_create(&thread,NULL,tor_pthread_helper_fn,d))
|
if (pthread_create(&thread,NULL,tor_pthread_helper_fn,d))
|
||||||
|
@ -388,18 +388,18 @@ char *smartlist_join_strings2(smartlist_t *sl, const char *join,
|
|||||||
|
|
||||||
/* Splay-tree implementation of string-to-void* map
|
/* Splay-tree implementation of string-to-void* map
|
||||||
*/
|
*/
|
||||||
struct strmap_entry_t {
|
typedef struct strmap_entry_t {
|
||||||
SPLAY_ENTRY(strmap_entry_t) node;
|
SPLAY_ENTRY(strmap_entry_t) node;
|
||||||
char *key;
|
char *key;
|
||||||
void *val;
|
void *val;
|
||||||
};
|
} strmap_entry_t;
|
||||||
|
|
||||||
struct strmap_t {
|
struct strmap_t {
|
||||||
SPLAY_HEAD(strmap_tree, strmap_entry_t) head;
|
SPLAY_HEAD(strmap_tree, strmap_entry_t) head;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int compare_strmap_entries(struct strmap_entry_t *a,
|
static int compare_strmap_entries(strmap_entry_t *a,
|
||||||
struct strmap_entry_t *b)
|
strmap_entry_t *b)
|
||||||
{
|
{
|
||||||
return strcmp(a->key, b->key);
|
return strcmp(a->key, b->key);
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,6 @@ char *smartlist_join_strings2(smartlist_t *sl, const char *join,
|
|||||||
|
|
||||||
/* Map from const char * to void*. Implemented with a splay tree. */
|
/* Map from const char * to void*. Implemented with a splay tree. */
|
||||||
typedef struct strmap_t strmap_t;
|
typedef struct strmap_t strmap_t;
|
||||||
typedef struct strmap_entry_t strmap_entry_t;
|
|
||||||
typedef struct strmap_entry_t strmap_iter_t;
|
typedef struct strmap_entry_t strmap_iter_t;
|
||||||
strmap_t* strmap_new(void);
|
strmap_t* strmap_new(void);
|
||||||
void* strmap_set(strmap_t *map, const char *key, void *val);
|
void* strmap_set(strmap_t *map, const char *key, void *val);
|
||||||
|
@ -86,7 +86,7 @@ get_unique_circ_id_by_conn(connection_t *conn)
|
|||||||
char *
|
char *
|
||||||
circuit_list_path(circuit_t *circ, int verbose)
|
circuit_list_path(circuit_t *circ, int verbose)
|
||||||
{
|
{
|
||||||
struct crypt_path_t *hop;
|
crypt_path_t *hop;
|
||||||
smartlist_t *elements;
|
smartlist_t *elements;
|
||||||
const char *states[] = {"closed", "waiting for keys", "open"};
|
const char *states[] = {"closed", "waiting for keys", "open"};
|
||||||
char buf[128];
|
char buf[128];
|
||||||
@ -156,7 +156,7 @@ circuit_log_path(int severity, circuit_t *circ)
|
|||||||
void
|
void
|
||||||
circuit_rep_hist_note_result(circuit_t *circ)
|
circuit_rep_hist_note_result(circuit_t *circ)
|
||||||
{
|
{
|
||||||
struct crypt_path_t *hop;
|
crypt_path_t *hop;
|
||||||
char *prev_digest = NULL;
|
char *prev_digest = NULL;
|
||||||
routerinfo_t *router;
|
routerinfo_t *router;
|
||||||
hop = circ->cpath;
|
hop = circ->cpath;
|
||||||
|
@ -26,19 +26,19 @@ static void circuit_free_cpath_node(crypt_path_t *victim);
|
|||||||
|
|
||||||
/** A map from OR connection and circuit ID to circuit. (Lookup performance is
|
/** A map from OR connection and circuit ID to circuit. (Lookup performance is
|
||||||
* very important here, since we need to do it every time a cell arrives.) */
|
* very important here, since we need to do it every time a cell arrives.) */
|
||||||
struct orconn_circid_circuit_map_t {
|
typedef struct orconn_circid_circuit_map_t {
|
||||||
RB_ENTRY(orconn_circid_circuit_map_t) node;
|
RB_ENTRY(orconn_circid_circuit_map_t) node;
|
||||||
connection_t *or_conn;
|
connection_t *or_conn;
|
||||||
uint16_t circ_id;
|
uint16_t circ_id;
|
||||||
circuit_t *circuit;
|
circuit_t *circuit;
|
||||||
};
|
} orconn_circid_circuit_map_t;
|
||||||
|
|
||||||
/** Helper for RB tree: compare the OR connection and circuit ID for a and b,
|
/** Helper for RB tree: compare the OR connection and circuit ID for a and b,
|
||||||
* and return less than, equal to, or greater than zero appropriately.
|
* and return less than, equal to, or greater than zero appropriately.
|
||||||
*/
|
*/
|
||||||
static INLINE int
|
static INLINE int
|
||||||
compare_orconn_circid_entries(struct orconn_circid_circuit_map_t *a,
|
compare_orconn_circid_entries(orconn_circid_circuit_map_t *a,
|
||||||
struct orconn_circid_circuit_map_t *b)
|
orconn_circid_circuit_map_t *b)
|
||||||
{
|
{
|
||||||
if (a->or_conn < b->or_conn)
|
if (a->or_conn < b->or_conn)
|
||||||
return -1;
|
return -1;
|
||||||
@ -58,7 +58,7 @@ RB_GENERATE(orconn_circid_tree, orconn_circid_circuit_map_t, node, compare_orcon
|
|||||||
*/
|
*/
|
||||||
/* (We tried using splay trees, but round-robin turned out to make them
|
/* (We tried using splay trees, but round-robin turned out to make them
|
||||||
* suck.) */
|
* suck.) */
|
||||||
struct orconn_circid_circuit_map_t *_last_circid_orconn_ent = NULL;
|
orconn_circid_circuit_map_t *_last_circid_orconn_ent = NULL;
|
||||||
|
|
||||||
/** Set the p_conn or n_conn field of a circuit <b>circ</b>, along
|
/** Set the p_conn or n_conn field of a circuit <b>circ</b>, along
|
||||||
* with the corresponding circuit ID, and add the circuit as appropriate
|
* with the corresponding circuit ID, and add the circuit as appropriate
|
||||||
@ -70,8 +70,8 @@ circuit_set_circid_orconn(circuit_t *circ, uint16_t id,
|
|||||||
{
|
{
|
||||||
uint16_t old_id;
|
uint16_t old_id;
|
||||||
connection_t *old_conn;
|
connection_t *old_conn;
|
||||||
struct orconn_circid_circuit_map_t search;
|
orconn_circid_circuit_map_t search;
|
||||||
struct orconn_circid_circuit_map_t *found;
|
orconn_circid_circuit_map_t *found;
|
||||||
|
|
||||||
tor_assert(!conn || conn->type == CONN_TYPE_OR);
|
tor_assert(!conn || conn->type == CONN_TYPE_OR);
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ circuit_set_circid_orconn(circuit_t *circ, uint16_t id,
|
|||||||
if (found) {
|
if (found) {
|
||||||
found->circuit = circ;
|
found->circuit = circ;
|
||||||
} else {
|
} else {
|
||||||
found = tor_malloc_zero(sizeof(struct orconn_circid_circuit_map_t));
|
found = tor_malloc_zero(sizeof(orconn_circid_circuit_map_t));
|
||||||
found->circ_id = id;
|
found->circ_id = id;
|
||||||
found->or_conn = conn;
|
found->or_conn = conn;
|
||||||
found->circuit = circ;
|
found->circuit = circ;
|
||||||
@ -341,8 +341,8 @@ circuit_get_by_global_id(uint32_t id)
|
|||||||
circuit_t *
|
circuit_t *
|
||||||
circuit_get_by_circid_orconn(uint16_t circ_id, connection_t *conn)
|
circuit_get_by_circid_orconn(uint16_t circ_id, connection_t *conn)
|
||||||
{
|
{
|
||||||
struct orconn_circid_circuit_map_t search;
|
orconn_circid_circuit_map_t search;
|
||||||
struct orconn_circid_circuit_map_t *found;
|
orconn_circid_circuit_map_t *found;
|
||||||
|
|
||||||
tor_assert(conn->type == CONN_TYPE_OR);
|
tor_assert(conn->type == CONN_TYPE_OR);
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ typedef struct {
|
|||||||
/** Largest allowed config line */
|
/** Largest allowed config line */
|
||||||
#define CONFIG_LINE_T_MAXLEN 4096
|
#define CONFIG_LINE_T_MAXLEN 4096
|
||||||
|
|
||||||
static void config_line_append(struct config_line_t **lst,
|
static void config_line_append(config_line_t **lst,
|
||||||
const char *key, const char *val);
|
const char *key, const char *val);
|
||||||
static void option_reset(config_format_t *fmt, or_options_t *options,
|
static void option_reset(config_format_t *fmt, or_options_t *options,
|
||||||
config_var_t *var);
|
config_var_t *var);
|
||||||
@ -221,19 +221,19 @@ static void config_register_addressmaps(or_options_t *options);
|
|||||||
|
|
||||||
static int parse_dir_server_line(const char *line, int validate_only);
|
static int parse_dir_server_line(const char *line, int validate_only);
|
||||||
static int parse_redirect_line(smartlist_t *result,
|
static int parse_redirect_line(smartlist_t *result,
|
||||||
struct config_line_t *line);
|
config_line_t *line);
|
||||||
static int parse_log_severity_range(const char *range, int *min_out,
|
static int parse_log_severity_range(const char *range, int *min_out,
|
||||||
int *max_out);
|
int *max_out);
|
||||||
static int convert_log_option(or_options_t *options,
|
static int convert_log_option(or_options_t *options,
|
||||||
struct config_line_t *level_opt,
|
config_line_t *level_opt,
|
||||||
struct config_line_t *file_opt, int isDaemon);
|
config_line_t *file_opt, int isDaemon);
|
||||||
static int add_single_log_option(or_options_t *options, int minSeverity,
|
static int add_single_log_option(or_options_t *options, int minSeverity,
|
||||||
int maxSeverity,
|
int maxSeverity,
|
||||||
const char *type, const char *fname);
|
const char *type, const char *fname);
|
||||||
static int normalize_log_options(or_options_t *options);
|
static int normalize_log_options(or_options_t *options);
|
||||||
static int validate_data_directory(or_options_t *options);
|
static int validate_data_directory(or_options_t *options);
|
||||||
static int write_configuration_file(const char *fname, or_options_t *options);
|
static int write_configuration_file(const char *fname, or_options_t *options);
|
||||||
static struct config_line_t *get_assigned_option(config_format_t *fmt,
|
static config_line_t *get_assigned_option(config_format_t *fmt,
|
||||||
or_options_t *options, const char *key);
|
or_options_t *options, const char *key);
|
||||||
static void config_init(config_format_t *fmt, or_options_t *options);
|
static void config_init(config_format_t *fmt, or_options_t *options);
|
||||||
|
|
||||||
@ -325,7 +325,7 @@ safe_str(const char *address)
|
|||||||
int
|
int
|
||||||
options_act(void)
|
options_act(void)
|
||||||
{
|
{
|
||||||
struct config_line_t *cl;
|
config_line_t *cl;
|
||||||
or_options_t *options = get_options();
|
or_options_t *options = get_options();
|
||||||
static int libevent_initialized = 0;
|
static int libevent_initialized = 0;
|
||||||
|
|
||||||
@ -474,11 +474,11 @@ expand_abbrev(config_format_t *fmt, const char *option, int command_line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Helper: Read a list of configuration options from the command line. */
|
/** Helper: Read a list of configuration options from the command line. */
|
||||||
static struct config_line_t *
|
static config_line_t *
|
||||||
config_get_commandlines(int argc, char **argv)
|
config_get_commandlines(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct config_line_t *front = NULL;
|
config_line_t *front = NULL;
|
||||||
struct config_line_t **new = &front;
|
config_line_t **new = &front;
|
||||||
char *s;
|
char *s;
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
||||||
@ -495,7 +495,7 @@ config_get_commandlines(int argc, char **argv)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
*new = tor_malloc_zero(sizeof(struct config_line_t));
|
*new = tor_malloc_zero(sizeof(config_line_t));
|
||||||
s = argv[i];
|
s = argv[i];
|
||||||
|
|
||||||
while (*s == '-')
|
while (*s == '-')
|
||||||
@ -516,13 +516,13 @@ config_get_commandlines(int argc, char **argv)
|
|||||||
/** Helper: allocate a new configuration option mapping 'key' to 'val',
|
/** Helper: allocate a new configuration option mapping 'key' to 'val',
|
||||||
* append it to *<b>lst</b>. */
|
* append it to *<b>lst</b>. */
|
||||||
static void
|
static void
|
||||||
config_line_append(struct config_line_t **lst,
|
config_line_append(config_line_t **lst,
|
||||||
const char *key,
|
const char *key,
|
||||||
const char *val)
|
const char *val)
|
||||||
{
|
{
|
||||||
struct config_line_t *newline;
|
config_line_t *newline;
|
||||||
|
|
||||||
newline = tor_malloc(sizeof(struct config_line_t));
|
newline = tor_malloc(sizeof(config_line_t));
|
||||||
newline->key = tor_strdup(key);
|
newline->key = tor_strdup(key);
|
||||||
newline->value = tor_strdup(val);
|
newline->value = tor_strdup(val);
|
||||||
newline->next = NULL;
|
newline->next = NULL;
|
||||||
@ -537,9 +537,9 @@ config_line_append(struct config_line_t **lst,
|
|||||||
* failed. Return 0 on success, -1 on failure. Warn and ignore any
|
* failed. Return 0 on success, -1 on failure. Warn and ignore any
|
||||||
* misformatted lines. */
|
* misformatted lines. */
|
||||||
int
|
int
|
||||||
config_get_lines(char *string, struct config_line_t **result)
|
config_get_lines(char *string, config_line_t **result)
|
||||||
{
|
{
|
||||||
struct config_line_t *list = NULL, **next;
|
config_line_t *list = NULL, **next;
|
||||||
char *k, *v;
|
char *k, *v;
|
||||||
|
|
||||||
next = &list;
|
next = &list;
|
||||||
@ -553,7 +553,7 @@ config_get_lines(char *string, struct config_line_t **result)
|
|||||||
/* This list can get long, so we keep a pointer to the end of it
|
/* This list can get long, so we keep a pointer to the end of it
|
||||||
* rather than using config_line_append over and over and getting n^2
|
* rather than using config_line_append over and over and getting n^2
|
||||||
* performance. This is the only really long list. */
|
* performance. This is the only really long list. */
|
||||||
*next = tor_malloc(sizeof(struct config_line_t));
|
*next = tor_malloc(sizeof(config_line_t));
|
||||||
(*next)->key = tor_strdup(k);
|
(*next)->key = tor_strdup(k);
|
||||||
(*next)->value = tor_strdup(v);
|
(*next)->value = tor_strdup(v);
|
||||||
(*next)->next = NULL;
|
(*next)->next = NULL;
|
||||||
@ -569,9 +569,9 @@ config_get_lines(char *string, struct config_line_t **result)
|
|||||||
* Free all the configuration lines on the linked list <b>front</b>.
|
* Free all the configuration lines on the linked list <b>front</b>.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
config_free_lines(struct config_line_t *front)
|
config_free_lines(config_line_t *front)
|
||||||
{
|
{
|
||||||
struct config_line_t *tmp;
|
config_line_t *tmp;
|
||||||
|
|
||||||
while (front) {
|
while (front) {
|
||||||
tmp = front;
|
tmp = front;
|
||||||
@ -621,7 +621,7 @@ config_find_option(config_format_t *fmt, const char *key)
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
config_assign_line(config_format_t *fmt,
|
config_assign_line(config_format_t *fmt,
|
||||||
or_options_t *options, struct config_line_t *c, int reset)
|
or_options_t *options, config_line_t *c, int reset)
|
||||||
{
|
{
|
||||||
int i, ok;
|
int i, ok;
|
||||||
config_var_t *var;
|
config_var_t *var;
|
||||||
@ -708,7 +708,7 @@ config_assign_line(config_format_t *fmt,
|
|||||||
|
|
||||||
case CONFIG_TYPE_LINELIST:
|
case CONFIG_TYPE_LINELIST:
|
||||||
case CONFIG_TYPE_LINELIST_S:
|
case CONFIG_TYPE_LINELIST_S:
|
||||||
config_line_append((struct config_line_t**)lvalue, c->key, c->value);
|
config_line_append((config_line_t**)lvalue, c->key, c->value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONFIG_TYPE_OBSOLETE:
|
case CONFIG_TYPE_OBSOLETE:
|
||||||
@ -755,22 +755,21 @@ config_option_get_canonical_name(const char *key)
|
|||||||
return var->name;
|
return var->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Return a canonicalized list of the options assigned for key.
|
/** Return a canonicalized list of the options assigned for key.
|
||||||
*/
|
*/
|
||||||
struct config_line_t *
|
config_line_t *
|
||||||
config_get_assigned_option(or_options_t *options, const char *key)
|
config_get_assigned_option(or_options_t *options, const char *key)
|
||||||
{
|
{
|
||||||
return get_assigned_option(&config_format, options, key);
|
return get_assigned_option(&config_format, options, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct config_line_t *
|
static config_line_t *
|
||||||
get_assigned_option(config_format_t *fmt, or_options_t *options, const char *key)
|
get_assigned_option(config_format_t *fmt, or_options_t *options, const char *key)
|
||||||
{
|
{
|
||||||
config_var_t *var;
|
config_var_t *var;
|
||||||
const void *value;
|
const void *value;
|
||||||
char buf[32];
|
char buf[32];
|
||||||
struct config_line_t *result;
|
config_line_t *result;
|
||||||
tor_assert(options && key);
|
tor_assert(options && key);
|
||||||
|
|
||||||
CHECK(fmt, options);
|
CHECK(fmt, options);
|
||||||
@ -788,10 +787,10 @@ get_assigned_option(config_format_t *fmt, or_options_t *options, const char *key
|
|||||||
if (var->type == CONFIG_TYPE_LINELIST ||
|
if (var->type == CONFIG_TYPE_LINELIST ||
|
||||||
var->type == CONFIG_TYPE_LINELIST_V) {
|
var->type == CONFIG_TYPE_LINELIST_V) {
|
||||||
/* Linelist requires special handling: we just copy and return it. */
|
/* Linelist requires special handling: we just copy and return it. */
|
||||||
const struct config_line_t *next_in = *(const struct config_line_t**)value;
|
const config_line_t *next_in = *(const config_line_t**)value;
|
||||||
struct config_line_t **next_out = &result;
|
config_line_t **next_out = &result;
|
||||||
while (next_in) {
|
while (next_in) {
|
||||||
*next_out = tor_malloc(sizeof(struct config_line_t));
|
*next_out = tor_malloc(sizeof(config_line_t));
|
||||||
(*next_out)->key = tor_strdup(next_in->key);
|
(*next_out)->key = tor_strdup(next_in->key);
|
||||||
(*next_out)->value = tor_strdup(next_in->value);
|
(*next_out)->value = tor_strdup(next_in->value);
|
||||||
next_in = next_in->next;
|
next_in = next_in->next;
|
||||||
@ -801,7 +800,7 @@ get_assigned_option(config_format_t *fmt, or_options_t *options, const char *key
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = tor_malloc_zero(sizeof(struct config_line_t));
|
result = tor_malloc_zero(sizeof(config_line_t));
|
||||||
result->key = tor_strdup(var->name);
|
result->key = tor_strdup(var->name);
|
||||||
switch (var->type)
|
switch (var->type)
|
||||||
{
|
{
|
||||||
@ -866,9 +865,9 @@ get_assigned_option(config_format_t *fmt, or_options_t *options, const char *key
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
config_assign(config_format_t *fmt,
|
config_assign(config_format_t *fmt,
|
||||||
or_options_t *options, struct config_line_t *list, int reset)
|
or_options_t *options, config_line_t *list, int reset)
|
||||||
{
|
{
|
||||||
struct config_line_t *p;
|
config_line_t *p;
|
||||||
|
|
||||||
CHECK(fmt, options);
|
CHECK(fmt, options);
|
||||||
|
|
||||||
@ -905,7 +904,7 @@ config_assign(config_format_t *fmt,
|
|||||||
* keys, -2 on bad values, -3 on bad transition.
|
* keys, -2 on bad values, -3 on bad transition.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
config_trial_assign(struct config_line_t *list, int reset)
|
config_trial_assign(config_line_t *list, int reset)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
or_options_t *trial_options = options_dup(&config_format, get_options());
|
or_options_t *trial_options = options_dup(&config_format, get_options());
|
||||||
@ -934,7 +933,7 @@ config_trial_assign(struct config_line_t *list, int reset)
|
|||||||
static void
|
static void
|
||||||
option_reset(config_format_t *fmt, or_options_t *options, config_var_t *var)
|
option_reset(config_format_t *fmt, or_options_t *options, config_var_t *var)
|
||||||
{
|
{
|
||||||
struct config_line_t *c;
|
config_line_t *c;
|
||||||
void *lvalue;
|
void *lvalue;
|
||||||
|
|
||||||
CHECK(fmt, options);
|
CHECK(fmt, options);
|
||||||
@ -964,8 +963,8 @@ option_reset(config_format_t *fmt, or_options_t *options, config_var_t *var)
|
|||||||
break;
|
break;
|
||||||
case CONFIG_TYPE_LINELIST:
|
case CONFIG_TYPE_LINELIST:
|
||||||
case CONFIG_TYPE_LINELIST_S:
|
case CONFIG_TYPE_LINELIST_S:
|
||||||
config_free_lines(*(struct config_line_t **)lvalue);
|
config_free_lines(*(config_line_t **)lvalue);
|
||||||
*(struct config_line_t **)lvalue = NULL;
|
*(config_line_t **)lvalue = NULL;
|
||||||
break;
|
break;
|
||||||
case CONFIG_TYPE_LINELIST_V:
|
case CONFIG_TYPE_LINELIST_V:
|
||||||
/* handled by linelist_s. */
|
/* handled by linelist_s. */
|
||||||
@ -974,7 +973,7 @@ option_reset(config_format_t *fmt, or_options_t *options, config_var_t *var)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (var->initvalue) {
|
if (var->initvalue) {
|
||||||
c = tor_malloc_zero(sizeof(struct config_line_t));
|
c = tor_malloc_zero(sizeof(config_line_t));
|
||||||
c->key = tor_strdup(var->name);
|
c->key = tor_strdup(var->name);
|
||||||
c->value = tor_strdup(var->initvalue);
|
c->value = tor_strdup(var->initvalue);
|
||||||
config_assign_line(fmt, options,c,0);
|
config_assign_line(fmt, options,c,0);
|
||||||
@ -1154,8 +1153,8 @@ options_free(config_format_t *fmt,or_options_t *options)
|
|||||||
break;
|
break;
|
||||||
case CONFIG_TYPE_LINELIST:
|
case CONFIG_TYPE_LINELIST:
|
||||||
case CONFIG_TYPE_LINELIST_V:
|
case CONFIG_TYPE_LINELIST_V:
|
||||||
config_free_lines(*(struct config_line_t**)lvalue);
|
config_free_lines(*(config_line_t**)lvalue);
|
||||||
*(struct config_line_t**)lvalue = NULL;
|
*(config_line_t**)lvalue = NULL;
|
||||||
break;
|
break;
|
||||||
case CONFIG_TYPE_CSV:
|
case CONFIG_TYPE_CSV:
|
||||||
if (*(smartlist_t**)lvalue) {
|
if (*(smartlist_t**)lvalue) {
|
||||||
@ -1179,7 +1178,7 @@ static int
|
|||||||
option_is_same(config_format_t *fmt,
|
option_is_same(config_format_t *fmt,
|
||||||
or_options_t *o1, or_options_t *o2, const char *name)
|
or_options_t *o1, or_options_t *o2, const char *name)
|
||||||
{
|
{
|
||||||
struct config_line_t *c1, *c2;
|
config_line_t *c1, *c2;
|
||||||
int r = 1;
|
int r = 1;
|
||||||
CHECK(fmt, o1);
|
CHECK(fmt, o1);
|
||||||
CHECK(fmt, o2);
|
CHECK(fmt, o2);
|
||||||
@ -1209,7 +1208,7 @@ options_dup(config_format_t *fmt, or_options_t *old)
|
|||||||
{
|
{
|
||||||
or_options_t *newopts;
|
or_options_t *newopts;
|
||||||
int i;
|
int i;
|
||||||
struct config_line_t *line;
|
config_line_t *line;
|
||||||
|
|
||||||
newopts = config_alloc(fmt);
|
newopts = config_alloc(fmt);
|
||||||
for (i=0; fmt->vars[i].name; ++i) {
|
for (i=0; fmt->vars[i].name; ++i) {
|
||||||
@ -1258,7 +1257,7 @@ config_dump(config_format_t *fmt, or_options_t *options, int minimal)
|
|||||||
{
|
{
|
||||||
smartlist_t *elements;
|
smartlist_t *elements;
|
||||||
or_options_t *defaults;
|
or_options_t *defaults;
|
||||||
struct config_line_t *line;
|
config_line_t *line;
|
||||||
char *result;
|
char *result;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -1334,7 +1333,7 @@ static int
|
|||||||
options_validate(or_options_t *options)
|
options_validate(or_options_t *options)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
struct config_line_t *cl;
|
config_line_t *cl;
|
||||||
addr_policy_t *addr_policy=NULL;
|
addr_policy_t *addr_policy=NULL;
|
||||||
|
|
||||||
if (options->ORPort < 0 || options->ORPort > 65535) {
|
if (options->ORPort < 0 || options->ORPort > 65535) {
|
||||||
@ -1857,7 +1856,7 @@ int
|
|||||||
init_from_config(int argc, char **argv)
|
init_from_config(int argc, char **argv)
|
||||||
{
|
{
|
||||||
or_options_t *oldoptions, *newoptions;
|
or_options_t *oldoptions, *newoptions;
|
||||||
struct config_line_t *cl;
|
config_line_t *cl;
|
||||||
char *cf=NULL, *fname=NULL;
|
char *cf=NULL, *fname=NULL;
|
||||||
int i, retval;
|
int i, retval;
|
||||||
int using_default_torrc;
|
int using_default_torrc;
|
||||||
@ -1995,7 +1994,7 @@ static void
|
|||||||
config_register_addressmaps(or_options_t *options)
|
config_register_addressmaps(or_options_t *options)
|
||||||
{
|
{
|
||||||
smartlist_t *elts;
|
smartlist_t *elts;
|
||||||
struct config_line_t *opt;
|
config_line_t *opt;
|
||||||
char *from, *to;
|
char *from, *to;
|
||||||
|
|
||||||
addressmap_clear_configured();
|
addressmap_clear_configured();
|
||||||
@ -2081,8 +2080,8 @@ parse_log_severity_range(const char *range, int *min_out, int *max_out)
|
|||||||
* (LogFile/Syslog)] to a new-style option, and add the new option to
|
* (LogFile/Syslog)] to a new-style option, and add the new option to
|
||||||
* options->Logs. */
|
* options->Logs. */
|
||||||
static int
|
static int
|
||||||
convert_log_option(or_options_t *options, struct config_line_t *level_opt,
|
convert_log_option(or_options_t *options, config_line_t *level_opt,
|
||||||
struct config_line_t *file_opt, int isDaemon)
|
config_line_t *file_opt, int isDaemon)
|
||||||
{
|
{
|
||||||
int levelMin = -1, levelMax = -1;
|
int levelMin = -1, levelMax = -1;
|
||||||
|
|
||||||
@ -2120,7 +2119,7 @@ convert_log_option(or_options_t *options, struct config_line_t *level_opt,
|
|||||||
int
|
int
|
||||||
config_init_logs(or_options_t *options, int validate_only)
|
config_init_logs(or_options_t *options, int validate_only)
|
||||||
{
|
{
|
||||||
struct config_line_t *opt;
|
config_line_t *opt;
|
||||||
int ok;
|
int ok;
|
||||||
smartlist_t *elts;
|
smartlist_t *elts;
|
||||||
|
|
||||||
@ -2222,7 +2221,7 @@ normalize_log_options(or_options_t *options)
|
|||||||
{
|
{
|
||||||
/* The order of options is: Level? (File Level?)+
|
/* The order of options is: Level? (File Level?)+
|
||||||
*/
|
*/
|
||||||
struct config_line_t *opt = options->OldLogOptions;
|
config_line_t *opt = options->OldLogOptions;
|
||||||
|
|
||||||
/* Special case for if first option is LogLevel. */
|
/* Special case for if first option is LogLevel. */
|
||||||
if (opt && !strcasecmp(opt->key, "LogLevel")) {
|
if (opt && !strcasecmp(opt->key, "LogLevel")) {
|
||||||
@ -2280,7 +2279,7 @@ normalize_log_options(or_options_t *options)
|
|||||||
void
|
void
|
||||||
config_append_default_exit_policy(addr_policy_t **policy)
|
config_append_default_exit_policy(addr_policy_t **policy)
|
||||||
{
|
{
|
||||||
struct config_line_t tmp;
|
config_line_t tmp;
|
||||||
addr_policy_t *ap;
|
addr_policy_t *ap;
|
||||||
|
|
||||||
tmp.key = NULL;
|
tmp.key = NULL;
|
||||||
@ -2306,7 +2305,7 @@ config_append_default_exit_policy(addr_policy_t **policy)
|
|||||||
* are malformed, else return 0.
|
* are malformed, else return 0.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
config_parse_addr_policy(struct config_line_t *cfg,
|
config_parse_addr_policy(config_line_t *cfg,
|
||||||
addr_policy_t **dest)
|
addr_policy_t **dest)
|
||||||
{
|
{
|
||||||
addr_policy_t **nextp;
|
addr_policy_t **nextp;
|
||||||
@ -2361,7 +2360,7 @@ addr_policy_free(addr_policy_t *p)
|
|||||||
* <b>result</b> and return 0. Else if they are valid, return 0.
|
* <b>result</b> and return 0. Else if they are valid, return 0.
|
||||||
* Else return -1. */
|
* Else return -1. */
|
||||||
static int
|
static int
|
||||||
parse_redirect_line(smartlist_t *result, struct config_line_t *line)
|
parse_redirect_line(smartlist_t *result, config_line_t *line)
|
||||||
{
|
{
|
||||||
smartlist_t *elements = NULL;
|
smartlist_t *elements = NULL;
|
||||||
exit_redirect_t *r;
|
exit_redirect_t *r;
|
||||||
|
@ -784,16 +784,16 @@ connection_connect(connection_t *conn, char *address,
|
|||||||
* or if the existing connections do not match those configured.
|
* or if the existing connections do not match those configured.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
retry_listeners(int type, struct config_line_t *cfg,
|
retry_listeners(int type, config_line_t *cfg,
|
||||||
int port_option, const char *default_addr, int force)
|
int port_option, const char *default_addr, int force)
|
||||||
{
|
{
|
||||||
struct smartlist_t *launch = smartlist_create();
|
smartlist_t *launch = smartlist_create();
|
||||||
int free_launch_elts = 1;
|
int free_launch_elts = 1;
|
||||||
struct config_line_t *c;
|
config_line_t *c;
|
||||||
int n_conn, i;
|
int n_conn, i;
|
||||||
connection_t *conn;
|
connection_t *conn;
|
||||||
connection_t **carray;
|
connection_t **carray;
|
||||||
struct config_line_t *line;
|
config_line_t *line;
|
||||||
|
|
||||||
if (cfg && port_option) {
|
if (cfg && port_option) {
|
||||||
for (c = cfg; c; c = c->next) {
|
for (c = cfg; c; c = c->next) {
|
||||||
@ -801,7 +801,7 @@ retry_listeners(int type, struct config_line_t *cfg,
|
|||||||
}
|
}
|
||||||
free_launch_elts = 0;
|
free_launch_elts = 0;
|
||||||
} else if (port_option) {
|
} else if (port_option) {
|
||||||
line = tor_malloc_zero(sizeof(struct config_line_t));
|
line = tor_malloc_zero(sizeof(config_line_t));
|
||||||
line->key = tor_strdup("");
|
line->key = tor_strdup("");
|
||||||
line->value = tor_strdup(default_addr);
|
line->value = tor_strdup(default_addr);
|
||||||
smartlist_add(launch, line);
|
smartlist_add(launch, line);
|
||||||
@ -823,7 +823,7 @@ retry_listeners(int type, struct config_line_t *cfg,
|
|||||||
}
|
}
|
||||||
/* Okay, so this is a listener. Is it configured? */
|
/* Okay, so this is a listener. Is it configured? */
|
||||||
line = NULL;
|
line = NULL;
|
||||||
SMARTLIST_FOREACH(launch, struct config_line_t *, wanted,
|
SMARTLIST_FOREACH(launch, config_line_t *, wanted,
|
||||||
{
|
{
|
||||||
char *addr;
|
char *addr;
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
@ -852,7 +852,7 @@ retry_listeners(int type, struct config_line_t *cfg,
|
|||||||
|
|
||||||
/* Now open all the listeners that are configured but not opened. */
|
/* Now open all the listeners that are configured but not opened. */
|
||||||
i = 0;
|
i = 0;
|
||||||
SMARTLIST_FOREACH(launch, struct config_line_t *, cfg,
|
SMARTLIST_FOREACH(launch, config_line_t *, cfg,
|
||||||
{
|
{
|
||||||
if (connection_create_listener(cfg->value, (uint16_t) port_option,
|
if (connection_create_listener(cfg->value, (uint16_t) port_option,
|
||||||
type)<0)
|
type)<0)
|
||||||
@ -860,7 +860,7 @@ retry_listeners(int type, struct config_line_t *cfg,
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (free_launch_elts) {
|
if (free_launch_elts) {
|
||||||
SMARTLIST_FOREACH(launch, struct config_line_t *, cfg,
|
SMARTLIST_FOREACH(launch, config_line_t *, cfg,
|
||||||
config_free_lines(cfg));
|
config_free_lines(cfg));
|
||||||
}
|
}
|
||||||
smartlist_free(launch);
|
smartlist_free(launch);
|
||||||
|
@ -602,7 +602,7 @@ static int
|
|||||||
handle_control_setconf(connection_t *conn, uint32_t len, char *body)
|
handle_control_setconf(connection_t *conn, uint32_t len, char *body)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
struct config_line_t *lines=NULL;
|
config_line_t *lines=NULL;
|
||||||
char *start = body;
|
char *start = body;
|
||||||
int v0 = STATE_IS_V0(conn->state);
|
int v0 = STATE_IS_V0(conn->state);
|
||||||
|
|
||||||
@ -717,7 +717,7 @@ handle_control_getconf(connection_t *conn, uint32_t body_len, const char *body)
|
|||||||
smartlist_add(unrecognized, q);
|
smartlist_add(unrecognized, q);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
struct config_line_t *answer = config_get_assigned_option(options,q);
|
config_line_t *answer = config_get_assigned_option(options,q);
|
||||||
if (!v0 && !answer) {
|
if (!v0 && !answer) {
|
||||||
const char *name = config_option_get_canonical_name(q);
|
const char *name = config_option_get_canonical_name(q);
|
||||||
size_t alen = strlen(name)+8;
|
size_t alen = strlen(name)+8;
|
||||||
@ -727,7 +727,7 @@ handle_control_getconf(connection_t *conn, uint32_t body_len, const char *body)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (answer) {
|
while (answer) {
|
||||||
struct config_line_t *next;
|
config_line_t *next;
|
||||||
size_t alen = strlen(answer->key)+strlen(answer->value)+8;
|
size_t alen = strlen(answer->key)+strlen(answer->value)+8;
|
||||||
char *astr = tor_malloc(alen);
|
char *astr = tor_malloc(alen);
|
||||||
if (v0)
|
if (v0)
|
||||||
|
@ -96,7 +96,7 @@ dirserv_parse_fingerprint_file(const char *fname)
|
|||||||
char *nickname, *fingerprint;
|
char *nickname, *fingerprint;
|
||||||
smartlist_t *fingerprint_list_new;
|
smartlist_t *fingerprint_list_new;
|
||||||
int result;
|
int result;
|
||||||
struct config_line_t *front=NULL, *list;
|
config_line_t *front=NULL, *list;
|
||||||
|
|
||||||
cf = read_file_to_str(fname, 0);
|
cf = read_file_to_str(fname, 0);
|
||||||
if (!cf) {
|
if (!cf) {
|
||||||
@ -608,7 +608,7 @@ dirserv_dump_directory_to_string(char **dir_out,
|
|||||||
|
|
||||||
{
|
{
|
||||||
smartlist_t *versions;
|
smartlist_t *versions;
|
||||||
struct config_line_t *ln;
|
config_line_t *ln;
|
||||||
versions = smartlist_create();
|
versions = smartlist_create();
|
||||||
for (ln = get_options()->RecommendedVersions; ln; ln = ln->next) {
|
for (ln = get_options()->RecommendedVersions; ln; ln = ln->next) {
|
||||||
smartlist_split_string(versions, ln->value, ",",
|
smartlist_split_string(versions, ln->value, ",",
|
||||||
|
88
src/or/dns.c
88
src/or/dns.c
@ -45,17 +45,17 @@ static int num_dnsworkers_busy=0;
|
|||||||
static time_t last_rotation_time=0;
|
static time_t last_rotation_time=0;
|
||||||
|
|
||||||
/** Linked list of connections waiting for a DNS answer. */
|
/** Linked list of connections waiting for a DNS answer. */
|
||||||
struct pending_connection_t {
|
typedef struct pending_connection_t {
|
||||||
struct connection_t *conn;
|
connection_t *conn;
|
||||||
struct pending_connection_t *next;
|
struct pending_connection_t *next;
|
||||||
};
|
} pending_connection_t;
|
||||||
|
|
||||||
/** A DNS request: possibly completed, possibly pending; cached_resolve
|
/** A DNS request: possibly completed, possibly pending; cached_resolve
|
||||||
* structs are stored at the OR side in a splay tree, and as a linked
|
* structs are stored at the OR side in a splay tree, and as a linked
|
||||||
* list from oldest to newest.
|
* list from oldest to newest.
|
||||||
*/
|
*/
|
||||||
struct cached_resolve {
|
typedef struct cached_resolve_t {
|
||||||
SPLAY_ENTRY(cached_resolve) node;
|
SPLAY_ENTRY(cached_resolve_t) node;
|
||||||
char address[MAX_ADDRESSLEN]; /**< The hostname to be resolved. */
|
char address[MAX_ADDRESSLEN]; /**< The hostname to be resolved. */
|
||||||
uint32_t addr; /**< IPv4 addr for <b>address</b>. */
|
uint32_t addr; /**< IPv4 addr for <b>address</b>. */
|
||||||
char state; /**< 0 is pending; 1 means answer is valid; 2 means resolve failed. */
|
char state; /**< 0 is pending; 1 means answer is valid; 2 means resolve failed. */
|
||||||
@ -63,13 +63,13 @@ struct cached_resolve {
|
|||||||
#define CACHE_STATE_VALID 1
|
#define CACHE_STATE_VALID 1
|
||||||
#define CACHE_STATE_FAILED 2
|
#define CACHE_STATE_FAILED 2
|
||||||
uint32_t expire; /**< Remove items from cache after this time. */
|
uint32_t expire; /**< Remove items from cache after this time. */
|
||||||
struct pending_connection_t *pending_connections;
|
pending_connection_t *pending_connections;
|
||||||
struct cached_resolve *next;
|
struct cached_resolve_t *next;
|
||||||
};
|
} cached_resolve_t;
|
||||||
|
|
||||||
static void purge_expired_resolves(uint32_t now);
|
static void purge_expired_resolves(uint32_t now);
|
||||||
static int assign_to_dnsworker(connection_t *exitconn);
|
static int assign_to_dnsworker(connection_t *exitconn);
|
||||||
static void dns_purge_resolve(struct cached_resolve *resolve);
|
static void dns_purge_resolve(cached_resolve_t *resolve);
|
||||||
static void dns_found_answer(char *address, uint32_t addr, char outcome);
|
static void dns_found_answer(char *address, uint32_t addr, char outcome);
|
||||||
static int dnsworker_main(void *data);
|
static int dnsworker_main(void *data);
|
||||||
static int spawn_dnsworker(void);
|
static int spawn_dnsworker(void);
|
||||||
@ -77,18 +77,18 @@ static void spawn_enough_dnsworkers(void);
|
|||||||
static void send_resolved_cell(connection_t *conn, uint8_t answer_type);
|
static void send_resolved_cell(connection_t *conn, uint8_t answer_type);
|
||||||
|
|
||||||
/** Splay tree of cached_resolve objects. */
|
/** Splay tree of cached_resolve objects. */
|
||||||
static SPLAY_HEAD(cache_tree, cached_resolve) cache_root;
|
static SPLAY_HEAD(cache_tree, cached_resolve_t) cache_root;
|
||||||
|
|
||||||
/** Function to compare hashed resolves on their addresses; used to
|
/** Function to compare hashed resolves on their addresses; used to
|
||||||
* implement splay trees. */
|
* implement splay trees. */
|
||||||
static int compare_cached_resolves(struct cached_resolve *a,
|
static int compare_cached_resolves(cached_resolve_t *a,
|
||||||
struct cached_resolve *b) {
|
cached_resolve_t *b) {
|
||||||
/* make this smarter one day? */
|
/* make this smarter one day? */
|
||||||
return strncmp(a->address, b->address, MAX_ADDRESSLEN);
|
return strncmp(a->address, b->address, MAX_ADDRESSLEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
SPLAY_PROTOTYPE(cache_tree, cached_resolve, node, compare_cached_resolves);
|
SPLAY_PROTOTYPE(cache_tree, cached_resolve_t, node, compare_cached_resolves);
|
||||||
SPLAY_GENERATE(cache_tree, cached_resolve, node, compare_cached_resolves);
|
SPLAY_GENERATE(cache_tree, cached_resolve_t, node, compare_cached_resolves);
|
||||||
|
|
||||||
/** Initialize the DNS cache. */
|
/** Initialize the DNS cache. */
|
||||||
static void
|
static void
|
||||||
@ -108,10 +108,10 @@ dns_init(void)
|
|||||||
|
|
||||||
/** Helper: free storage held by an entry in the DNS cache. */
|
/** Helper: free storage held by an entry in the DNS cache. */
|
||||||
static void
|
static void
|
||||||
_free_cached_resolve(struct cached_resolve *r)
|
_free_cached_resolve(cached_resolve_t *r)
|
||||||
{
|
{
|
||||||
while (r->pending_connections) {
|
while (r->pending_connections) {
|
||||||
struct pending_connection_t *victim = r->pending_connections;
|
pending_connection_t *victim = r->pending_connections;
|
||||||
r->pending_connections = victim->next;
|
r->pending_connections = victim->next;
|
||||||
tor_free(victim);
|
tor_free(victim);
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ _free_cached_resolve(struct cached_resolve *r)
|
|||||||
void
|
void
|
||||||
dns_free_all(void)
|
dns_free_all(void)
|
||||||
{
|
{
|
||||||
struct cached_resolve *ptr, *next;
|
cached_resolve_t *ptr, *next;
|
||||||
for (ptr = SPLAY_MIN(cache_tree, &cache_root); ptr != NULL; ptr = next) {
|
for (ptr = SPLAY_MIN(cache_tree, &cache_root); ptr != NULL; ptr = next) {
|
||||||
next = SPLAY_NEXT(cache_tree, &cache_root, ptr);
|
next = SPLAY_NEXT(cache_tree, &cache_root, ptr);
|
||||||
SPLAY_REMOVE(cache_tree, &cache_root, ptr);
|
SPLAY_REMOVE(cache_tree, &cache_root, ptr);
|
||||||
@ -131,16 +131,16 @@ dns_free_all(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Linked list of resolved addresses, oldest to newest. */
|
/** Linked list of resolved addresses, oldest to newest. */
|
||||||
static struct cached_resolve *oldest_cached_resolve = NULL;
|
static cached_resolve_t *oldest_cached_resolve = NULL;
|
||||||
static struct cached_resolve *newest_cached_resolve = NULL;
|
static cached_resolve_t *newest_cached_resolve = NULL;
|
||||||
|
|
||||||
/** Remove every cached_resolve whose <b>expire</b> time is before <b>now</b>
|
/** Remove every cached_resolve whose <b>expire</b> time is before <b>now</b>
|
||||||
* from the cache. */
|
* from the cache. */
|
||||||
static void
|
static void
|
||||||
purge_expired_resolves(uint32_t now)
|
purge_expired_resolves(uint32_t now)
|
||||||
{
|
{
|
||||||
struct cached_resolve *resolve;
|
cached_resolve_t *resolve;
|
||||||
struct pending_connection_t *pend;
|
pending_connection_t *pend;
|
||||||
connection_t *pendconn;
|
connection_t *pendconn;
|
||||||
|
|
||||||
/* this is fast because the linked list
|
/* this is fast because the linked list
|
||||||
@ -212,7 +212,7 @@ send_resolved_cell(connection_t *conn, uint8_t answer_type)
|
|||||||
/** Link <b>r</b> into the tree of address-to-result mappings, and add it to
|
/** Link <b>r</b> into the tree of address-to-result mappings, and add it to
|
||||||
* the linked list of resolves-by-age. */
|
* the linked list of resolves-by-age. */
|
||||||
static void
|
static void
|
||||||
insert_resolve(struct cached_resolve *r)
|
insert_resolve(cached_resolve_t *r)
|
||||||
{
|
{
|
||||||
/* add us to the linked list of resolves */
|
/* add us to the linked list of resolves */
|
||||||
if (!oldest_cached_resolve) {
|
if (!oldest_cached_resolve) {
|
||||||
@ -238,9 +238,9 @@ insert_resolve(struct cached_resolve *r)
|
|||||||
int
|
int
|
||||||
dns_resolve(connection_t *exitconn)
|
dns_resolve(connection_t *exitconn)
|
||||||
{
|
{
|
||||||
struct cached_resolve *resolve;
|
cached_resolve_t *resolve;
|
||||||
struct cached_resolve search;
|
cached_resolve_t search;
|
||||||
struct pending_connection_t *pending_connection;
|
pending_connection_t *pending_connection;
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
circuit_t *circ;
|
circuit_t *circ;
|
||||||
uint32_t now = time(NULL);
|
uint32_t now = time(NULL);
|
||||||
@ -271,7 +271,7 @@ dns_resolve(connection_t *exitconn)
|
|||||||
case CACHE_STATE_PENDING:
|
case CACHE_STATE_PENDING:
|
||||||
/* add us to the pending list */
|
/* add us to the pending list */
|
||||||
pending_connection = tor_malloc_zero(
|
pending_connection = tor_malloc_zero(
|
||||||
sizeof(struct pending_connection_t));
|
sizeof(pending_connection_t));
|
||||||
pending_connection->conn = exitconn;
|
pending_connection->conn = exitconn;
|
||||||
pending_connection->next = resolve->pending_connections;
|
pending_connection->next = resolve->pending_connections;
|
||||||
resolve->pending_connections = pending_connection;
|
resolve->pending_connections = pending_connection;
|
||||||
@ -301,13 +301,13 @@ dns_resolve(connection_t *exitconn)
|
|||||||
tor_assert(0);
|
tor_assert(0);
|
||||||
}
|
}
|
||||||
/* not there, need to add it */
|
/* not there, need to add it */
|
||||||
resolve = tor_malloc_zero(sizeof(struct cached_resolve));
|
resolve = tor_malloc_zero(sizeof(cached_resolve_t));
|
||||||
resolve->state = CACHE_STATE_PENDING;
|
resolve->state = CACHE_STATE_PENDING;
|
||||||
resolve->expire = now + MAX_DNS_ENTRY_AGE;
|
resolve->expire = now + MAX_DNS_ENTRY_AGE;
|
||||||
strlcpy(resolve->address, exitconn->address, sizeof(resolve->address));
|
strlcpy(resolve->address, exitconn->address, sizeof(resolve->address));
|
||||||
|
|
||||||
/* add us to the pending list */
|
/* add us to the pending list */
|
||||||
pending_connection = tor_malloc_zero(sizeof(struct pending_connection_t));
|
pending_connection = tor_malloc_zero(sizeof(pending_connection_t));
|
||||||
pending_connection->conn = exitconn;
|
pending_connection->conn = exitconn;
|
||||||
resolve->pending_connections = pending_connection;
|
resolve->pending_connections = pending_connection;
|
||||||
exitconn->state = EXIT_CONN_STATE_RESOLVING;
|
exitconn->state = EXIT_CONN_STATE_RESOLVING;
|
||||||
@ -360,9 +360,9 @@ assign_to_dnsworker(connection_t *exitconn)
|
|||||||
void
|
void
|
||||||
connection_dns_remove(connection_t *conn)
|
connection_dns_remove(connection_t *conn)
|
||||||
{
|
{
|
||||||
struct pending_connection_t *pend, *victim;
|
pending_connection_t *pend, *victim;
|
||||||
struct cached_resolve search;
|
cached_resolve_t search;
|
||||||
struct cached_resolve *resolve;
|
cached_resolve_t *resolve;
|
||||||
|
|
||||||
tor_assert(conn->type == CONN_TYPE_EXIT);
|
tor_assert(conn->type == CONN_TYPE_EXIT);
|
||||||
tor_assert(conn->state == EXIT_CONN_STATE_RESOLVING);
|
tor_assert(conn->state == EXIT_CONN_STATE_RESOLVING);
|
||||||
@ -406,8 +406,8 @@ connection_dns_remove(connection_t *conn)
|
|||||||
void
|
void
|
||||||
assert_connection_edge_not_dns_pending(connection_t *conn)
|
assert_connection_edge_not_dns_pending(connection_t *conn)
|
||||||
{
|
{
|
||||||
struct pending_connection_t *pend;
|
pending_connection_t *pend;
|
||||||
struct cached_resolve *resolve;
|
cached_resolve_t *resolve;
|
||||||
|
|
||||||
SPLAY_FOREACH(resolve, cache_tree, &cache_root) {
|
SPLAY_FOREACH(resolve, cache_tree, &cache_root) {
|
||||||
for (pend = resolve->pending_connections;
|
for (pend = resolve->pending_connections;
|
||||||
@ -423,8 +423,8 @@ assert_connection_edge_not_dns_pending(connection_t *conn)
|
|||||||
void
|
void
|
||||||
assert_all_pending_dns_resolves_ok(void)
|
assert_all_pending_dns_resolves_ok(void)
|
||||||
{
|
{
|
||||||
struct pending_connection_t *pend;
|
pending_connection_t *pend;
|
||||||
struct cached_resolve *resolve;
|
cached_resolve_t *resolve;
|
||||||
|
|
||||||
SPLAY_FOREACH(resolve, cache_tree, &cache_root) {
|
SPLAY_FOREACH(resolve, cache_tree, &cache_root) {
|
||||||
for (pend = resolve->pending_connections;
|
for (pend = resolve->pending_connections;
|
||||||
@ -444,9 +444,9 @@ assert_all_pending_dns_resolves_ok(void)
|
|||||||
void
|
void
|
||||||
dns_cancel_pending_resolve(char *address)
|
dns_cancel_pending_resolve(char *address)
|
||||||
{
|
{
|
||||||
struct pending_connection_t *pend;
|
pending_connection_t *pend;
|
||||||
struct cached_resolve search;
|
cached_resolve_t search;
|
||||||
struct cached_resolve *resolve;
|
cached_resolve_t *resolve;
|
||||||
connection_t *pendconn;
|
connection_t *pendconn;
|
||||||
circuit_t *circ;
|
circuit_t *circ;
|
||||||
|
|
||||||
@ -493,9 +493,9 @@ dns_cancel_pending_resolve(char *address)
|
|||||||
/** Remove <b>resolve</b> from the cache.
|
/** Remove <b>resolve</b> from the cache.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
dns_purge_resolve(struct cached_resolve *resolve)
|
dns_purge_resolve(cached_resolve_t *resolve)
|
||||||
{
|
{
|
||||||
struct cached_resolve *tmp;
|
cached_resolve_t *tmp;
|
||||||
|
|
||||||
/* remove resolve from the linked list */
|
/* remove resolve from the linked list */
|
||||||
if (resolve == oldest_cached_resolve) {
|
if (resolve == oldest_cached_resolve) {
|
||||||
@ -528,9 +528,9 @@ dns_purge_resolve(struct cached_resolve *resolve)
|
|||||||
static void
|
static void
|
||||||
dns_found_answer(char *address, uint32_t addr, char outcome)
|
dns_found_answer(char *address, uint32_t addr, char outcome)
|
||||||
{
|
{
|
||||||
struct pending_connection_t *pend;
|
pending_connection_t *pend;
|
||||||
struct cached_resolve search;
|
cached_resolve_t search;
|
||||||
struct cached_resolve *resolve;
|
cached_resolve_t *resolve;
|
||||||
connection_t *pendconn;
|
connection_t *pendconn;
|
||||||
circuit_t *circ;
|
circuit_t *circ;
|
||||||
|
|
||||||
@ -540,7 +540,7 @@ dns_found_answer(char *address, uint32_t addr, char outcome)
|
|||||||
if (!resolve) {
|
if (!resolve) {
|
||||||
log_fn(LOG_INFO,"Resolved unasked address '%s'; caching anyway.",
|
log_fn(LOG_INFO,"Resolved unasked address '%s'; caching anyway.",
|
||||||
safe_str(address));
|
safe_str(address));
|
||||||
resolve = tor_malloc_zero(sizeof(struct cached_resolve));
|
resolve = tor_malloc_zero(sizeof(cached_resolve_t));
|
||||||
resolve->state = (outcome == DNS_RESOLVE_SUCCEEDED) ?
|
resolve->state = (outcome == DNS_RESOLVE_SUCCEEDED) ?
|
||||||
CACHE_STATE_VALID : CACHE_STATE_FAILED;
|
CACHE_STATE_VALID : CACHE_STATE_FAILED;
|
||||||
resolve->addr = addr;
|
resolve->addr = addr;
|
||||||
|
@ -100,8 +100,6 @@ static void accounting_set_wakeup_time(void);
|
|||||||
* Functions for bandwidth accounting.
|
* Functions for bandwidth accounting.
|
||||||
* ************/
|
* ************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Configure accounting start/end time settings based on
|
/** Configure accounting start/end time settings based on
|
||||||
* options->AccountingStart. Return 0 on success, -1 on failure. If
|
* options->AccountingStart. Return 0 on success, -1 on failure. If
|
||||||
* <b>validate_only</b> is true, do not change the current settings. */
|
* <b>validate_only</b> is true, do not change the current settings. */
|
||||||
@ -886,3 +884,4 @@ accounting_getinfo_helper(const char *question, char **answer)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,18 +13,18 @@ const char onion_c_id[] = "$Id$";
|
|||||||
|
|
||||||
#include "or.h"
|
#include "or.h"
|
||||||
|
|
||||||
struct onion_queue_t {
|
typedef struct onion_queue_t {
|
||||||
circuit_t *circ;
|
circuit_t *circ;
|
||||||
time_t when_added;
|
time_t when_added;
|
||||||
struct onion_queue_t *next;
|
struct onion_queue_t *next;
|
||||||
};
|
} onion_queue_t;
|
||||||
|
|
||||||
/** 5 seconds on the onion queue til we just send back a destroy */
|
/** 5 seconds on the onion queue til we just send back a destroy */
|
||||||
#define ONIONQUEUE_WAIT_CUTOFF 5
|
#define ONIONQUEUE_WAIT_CUTOFF 5
|
||||||
|
|
||||||
/** Global (within this file) variables used by the next few functions */
|
/** Global (within this file) variables used by the next few functions */
|
||||||
static struct onion_queue_t *ol_list=NULL;
|
static onion_queue_t *ol_list=NULL;
|
||||||
static struct onion_queue_t *ol_tail=NULL;
|
static onion_queue_t *ol_tail=NULL;
|
||||||
/** Length of ol_list */
|
/** Length of ol_list */
|
||||||
static int ol_length=0;
|
static int ol_length=0;
|
||||||
|
|
||||||
@ -34,10 +34,10 @@ static int ol_length=0;
|
|||||||
int
|
int
|
||||||
onion_pending_add(circuit_t *circ)
|
onion_pending_add(circuit_t *circ)
|
||||||
{
|
{
|
||||||
struct onion_queue_t *tmp;
|
onion_queue_t *tmp;
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
|
|
||||||
tmp = tor_malloc_zero(sizeof(struct onion_queue_t));
|
tmp = tor_malloc_zero(sizeof(onion_queue_t));
|
||||||
tmp->circ = circ;
|
tmp->circ = circ;
|
||||||
tmp->when_added = now;
|
tmp->when_added = now;
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ onion_next_task(void)
|
|||||||
void
|
void
|
||||||
onion_pending_remove(circuit_t *circ)
|
onion_pending_remove(circuit_t *circ)
|
||||||
{
|
{
|
||||||
struct onion_queue_t *tmpo, *victim;
|
onion_queue_t *tmpo, *victim;
|
||||||
|
|
||||||
if (!ol_list)
|
if (!ol_list)
|
||||||
return; /* nothing here. */
|
return; /* nothing here. */
|
||||||
@ -408,7 +408,7 @@ void
|
|||||||
clear_pending_onions(void)
|
clear_pending_onions(void)
|
||||||
{
|
{
|
||||||
while (ol_list) {
|
while (ol_list) {
|
||||||
struct onion_queue_t *victim = ol_list;
|
onion_queue_t *victim = ol_list;
|
||||||
ol_list = victim->next;
|
ol_list = victim->next;
|
||||||
tor_free(victim);
|
tor_free(victim);
|
||||||
}
|
}
|
||||||
|
59
src/or/or.h
59
src/or/or.h
@ -782,7 +782,7 @@ typedef struct extend_info_t {
|
|||||||
|
|
||||||
/** Holds accounting information for a single step in the layered encryption
|
/** Holds accounting information for a single step in the layered encryption
|
||||||
* performed by a circuit. Used only at the client edge of a circuit. */
|
* performed by a circuit. Used only at the client edge of a circuit. */
|
||||||
struct crypt_path_t {
|
typedef struct crypt_path_t {
|
||||||
uint32_t magic;
|
uint32_t magic;
|
||||||
|
|
||||||
/* crypto environments */
|
/* crypto environments */
|
||||||
@ -827,7 +827,7 @@ struct crypt_path_t {
|
|||||||
* at this step? */
|
* at this step? */
|
||||||
int deliver_window; /**< How many bytes are we willing to deliver originating
|
int deliver_window; /**< How many bytes are we willing to deliver originating
|
||||||
* at this step? */
|
* at this step? */
|
||||||
};
|
} crypt_path_t;
|
||||||
|
|
||||||
#define CPATH_KEY_MATERIAL_LEN (20*2+16*2)
|
#define CPATH_KEY_MATERIAL_LEN (20*2+16*2)
|
||||||
|
|
||||||
@ -838,8 +838,6 @@ struct crypt_path_t {
|
|||||||
#define ONIONSKIN_REPLY_LEN (DH_KEY_LEN+DIGEST_LEN)
|
#define ONIONSKIN_REPLY_LEN (DH_KEY_LEN+DIGEST_LEN)
|
||||||
#define REND_COOKIE_LEN DIGEST_LEN
|
#define REND_COOKIE_LEN DIGEST_LEN
|
||||||
|
|
||||||
typedef struct crypt_path_t crypt_path_t;
|
|
||||||
|
|
||||||
/** Information used to build a circuit. */
|
/** Information used to build a circuit. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** Intended length of the final circuit. */
|
/** Intended length of the final circuit. */
|
||||||
@ -853,7 +851,7 @@ typedef struct {
|
|||||||
/** Whether the last hop was picked with exiting in mind. */
|
/** Whether the last hop was picked with exiting in mind. */
|
||||||
int is_internal;
|
int is_internal;
|
||||||
/** The crypt_path_t to append after rendezvous: used for rendezvous. */
|
/** The crypt_path_t to append after rendezvous: used for rendezvous. */
|
||||||
struct crypt_path_t *pending_final_cpath;
|
crypt_path_t *pending_final_cpath;
|
||||||
/** How many times has building a circuit for this task failed? */
|
/** How many times has building a circuit for this task failed? */
|
||||||
int failure_count;
|
int failure_count;
|
||||||
/** At what time should we give up on this task? */
|
/** At what time should we give up on this task? */
|
||||||
@ -1015,6 +1013,12 @@ typedef struct exit_redirect_t {
|
|||||||
uint16_t port_dest;
|
uint16_t port_dest;
|
||||||
} exit_redirect_t;
|
} exit_redirect_t;
|
||||||
|
|
||||||
|
typedef struct config_line_t {
|
||||||
|
char *key;
|
||||||
|
char *value;
|
||||||
|
struct config_line_t *next;
|
||||||
|
} config_line_t;
|
||||||
|
|
||||||
/** Configuration options for a Tor process */
|
/** Configuration options for a Tor process */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t _magic;
|
uint32_t _magic;
|
||||||
@ -1026,10 +1030,10 @@ typedef struct {
|
|||||||
} command;
|
} command;
|
||||||
const char *command_arg; /**< Argument for command-line option. */
|
const char *command_arg; /**< Argument for command-line option. */
|
||||||
|
|
||||||
struct config_line_t *OldLogOptions; /**< List of configuration lines
|
config_line_t *OldLogOptions; /**< List of configuration lines
|
||||||
* for logfiles, old style. */
|
* for logfiles, old style. */
|
||||||
|
|
||||||
struct config_line_t *Logs; /**< New-style list of configuration lines
|
config_line_t *Logs; /**< New-style list of configuration lines
|
||||||
* for logs */
|
* for logs */
|
||||||
|
|
||||||
char *DebugLogFile; /**< Where to send verbose log messages. */
|
char *DebugLogFile; /**< Where to send verbose log messages. */
|
||||||
@ -1056,20 +1060,20 @@ typedef struct {
|
|||||||
|
|
||||||
smartlist_t *AllowUnverifiedNodes; /**< List of "entry", "middle", "exit" */
|
smartlist_t *AllowUnverifiedNodes; /**< List of "entry", "middle", "exit" */
|
||||||
int _AllowUnverified; /**< Bitmask; derived from AllowUnverifiedNodes; */
|
int _AllowUnverified; /**< Bitmask; derived from AllowUnverifiedNodes; */
|
||||||
struct config_line_t *ExitPolicy; /**< Lists of exit policy components. */
|
config_line_t *ExitPolicy; /**< Lists of exit policy components. */
|
||||||
struct config_line_t *SocksPolicy; /**< Lists of socks policy components */
|
config_line_t *SocksPolicy; /**< Lists of socks policy components */
|
||||||
struct config_line_t *DirPolicy; /**< Lists of dir policy components */
|
config_line_t *DirPolicy; /**< Lists of dir policy components */
|
||||||
/** Addresses to bind for listening for SOCKS connections. */
|
/** Addresses to bind for listening for SOCKS connections. */
|
||||||
struct config_line_t *SocksBindAddress;
|
config_line_t *SocksBindAddress;
|
||||||
/** Addresses to bind for listening for OR connections. */
|
/** Addresses to bind for listening for OR connections. */
|
||||||
struct config_line_t *ORBindAddress;
|
config_line_t *ORBindAddress;
|
||||||
/** Addresses to bind for listening for directory connections. */
|
/** Addresses to bind for listening for directory connections. */
|
||||||
struct config_line_t *DirBindAddress;
|
config_line_t *DirBindAddress;
|
||||||
/** Local address to bind outbound sockets */
|
/** Local address to bind outbound sockets */
|
||||||
char *OutboundBindAddress;
|
char *OutboundBindAddress;
|
||||||
/** Directory server only: which versions of
|
/** Directory server only: which versions of
|
||||||
* Tor should we tell users to run? */
|
* Tor should we tell users to run? */
|
||||||
struct config_line_t *RecommendedVersions;
|
config_line_t *RecommendedVersions;
|
||||||
/** Whether dirservers refuse router descriptors with private IPs. */
|
/** Whether dirservers refuse router descriptors with private IPs. */
|
||||||
int DirAllowPrivateAddresses;
|
int DirAllowPrivateAddresses;
|
||||||
char *User; /**< Name of user to run Tor as. */
|
char *User; /**< Name of user to run Tor as. */
|
||||||
@ -1095,7 +1099,7 @@ typedef struct {
|
|||||||
/** Should we try to reuse the same exit node for a given host */
|
/** Should we try to reuse the same exit node for a given host */
|
||||||
smartlist_t *TrackHostExits;
|
smartlist_t *TrackHostExits;
|
||||||
int TrackHostExitsExpire; /**< Number of seconds until we expire an addressmap */
|
int TrackHostExitsExpire; /**< Number of seconds until we expire an addressmap */
|
||||||
struct config_line_t *AddressMap; /**< List of address map directives. */
|
config_line_t *AddressMap; /**< List of address map directives. */
|
||||||
int DirFetchPeriod; /**< How often do we fetch new directories? */
|
int DirFetchPeriod; /**< How often do we fetch new directories? */
|
||||||
int DirPostPeriod; /**< How often do we post our server descriptor to the
|
int DirPostPeriod; /**< How often do we post our server descriptor to the
|
||||||
* authoritative directory servers? */
|
* authoritative directory servers? */
|
||||||
@ -1120,7 +1124,7 @@ typedef struct {
|
|||||||
int NumCpus; /**< How many CPUs should we try to use? */
|
int NumCpus; /**< How many CPUs should we try to use? */
|
||||||
int RunTesting; /**< If true, create testing circuits to measure how well the
|
int RunTesting; /**< If true, create testing circuits to measure how well the
|
||||||
* other ORs are running. */
|
* other ORs are running. */
|
||||||
struct config_line_t *RendConfigLines; /**< List of configuration lines
|
config_line_t *RendConfigLines; /**< List of configuration lines
|
||||||
* for rendezvous services. */
|
* for rendezvous services. */
|
||||||
char *ContactInfo; /**< Contact info to be published in the directory */
|
char *ContactInfo; /**< Contact info to be published in the directory */
|
||||||
|
|
||||||
@ -1134,12 +1138,12 @@ typedef struct {
|
|||||||
uint16_t HttpsProxyPort; /**< Parsed port for https proxy, if any */
|
uint16_t HttpsProxyPort; /**< Parsed port for https proxy, if any */
|
||||||
char *HttpsProxyAuthenticator; /**< username:password string, if any */
|
char *HttpsProxyAuthenticator; /**< username:password string, if any */
|
||||||
|
|
||||||
struct config_line_t *DirServers; /**< List of configuration lines
|
config_line_t *DirServers; /**< List of configuration lines
|
||||||
* for directory servers. */
|
* for directory servers. */
|
||||||
char *MyFamily; /**< Declared family for this OR. */
|
char *MyFamily; /**< Declared family for this OR. */
|
||||||
struct config_line_t *NodeFamilies; /**< List of config lines for
|
config_line_t *NodeFamilies; /**< List of config lines for
|
||||||
* node families */
|
* node families */
|
||||||
struct config_line_t *RedirectExit; /**< List of config lines for simple
|
config_line_t *RedirectExit; /**< List of config lines for simple
|
||||||
* addr/port redirection */
|
* addr/port redirection */
|
||||||
smartlist_t *RedirectExitList; /**< List of exit_redirect_t */
|
smartlist_t *RedirectExitList; /**< List of exit_redirect_t */
|
||||||
int _MonthlyAccountingStart; /**< Deprecated: day of month when accounting
|
int _MonthlyAccountingStart; /**< Deprecated: day of month when accounting
|
||||||
@ -1321,32 +1325,26 @@ extern unsigned long stats_n_destroy_cells_processed;
|
|||||||
|
|
||||||
/********************************* config.c ***************************/
|
/********************************* config.c ***************************/
|
||||||
|
|
||||||
struct config_line_t {
|
|
||||||
char *key;
|
|
||||||
char *value;
|
|
||||||
struct config_line_t *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
or_options_t *get_options(void);
|
or_options_t *get_options(void);
|
||||||
void set_options(or_options_t *new_val);
|
void set_options(or_options_t *new_val);
|
||||||
int options_act(void);
|
int options_act(void);
|
||||||
void config_free_all(void);
|
void config_free_all(void);
|
||||||
const char *safe_str(const char *address);
|
const char *safe_str(const char *address);
|
||||||
|
|
||||||
int config_get_lines(char *string, struct config_line_t **result);
|
int config_get_lines(char *string, config_line_t **result);
|
||||||
void config_free_lines(struct config_line_t *front);
|
void config_free_lines(config_line_t *front);
|
||||||
int config_trial_assign(struct config_line_t *list, int reset);
|
int config_trial_assign(config_line_t *list, int reset);
|
||||||
int resolve_my_address(or_options_t *options, uint32_t *addr);
|
int resolve_my_address(or_options_t *options, uint32_t *addr);
|
||||||
void options_init(or_options_t *options);
|
void options_init(or_options_t *options);
|
||||||
int init_from_config(int argc, char **argv);
|
int init_from_config(int argc, char **argv);
|
||||||
int config_init_logs(or_options_t *options, int validate_only);
|
int config_init_logs(or_options_t *options, int validate_only);
|
||||||
int config_parse_addr_policy(struct config_line_t *cfg,
|
int config_parse_addr_policy(config_line_t *cfg,
|
||||||
addr_policy_t **dest);
|
addr_policy_t **dest);
|
||||||
void config_append_default_exit_policy(addr_policy_t **policy);
|
void config_append_default_exit_policy(addr_policy_t **policy);
|
||||||
void addr_policy_free(addr_policy_t *p);
|
void addr_policy_free(addr_policy_t *p);
|
||||||
int config_option_is_recognized(const char *key);
|
int config_option_is_recognized(const char *key);
|
||||||
const char *config_option_get_canonical_name(const char *key);
|
const char *config_option_get_canonical_name(const char *key);
|
||||||
struct config_line_t *config_get_assigned_option(or_options_t *options,
|
config_line_t *config_get_assigned_option(or_options_t *options,
|
||||||
const char *key);
|
const char *key);
|
||||||
char *config_dump_options(or_options_t *options, int minimal);
|
char *config_dump_options(or_options_t *options, int minimal);
|
||||||
int save_current_config(void);
|
int save_current_config(void);
|
||||||
@ -1629,7 +1627,6 @@ int we_are_hibernating(void);
|
|||||||
void consider_hibernation(time_t now);
|
void consider_hibernation(time_t now);
|
||||||
int accounting_getinfo_helper(const char *question, char **answer);
|
int accounting_getinfo_helper(const char *question, char **answer);
|
||||||
|
|
||||||
|
|
||||||
/********************************* main.c ***************************/
|
/********************************* main.c ***************************/
|
||||||
|
|
||||||
int connection_add(connection_t *conn);
|
int connection_add(connection_t *conn);
|
||||||
|
@ -193,7 +193,7 @@ parse_port_config(const char *string)
|
|||||||
int
|
int
|
||||||
rend_config_services(or_options_t *options, int validate_only)
|
rend_config_services(or_options_t *options, int validate_only)
|
||||||
{
|
{
|
||||||
struct config_line_t *line;
|
config_line_t *line;
|
||||||
rend_service_t *service = NULL;
|
rend_service_t *service = NULL;
|
||||||
rend_service_port_config_t *portcfg;
|
rend_service_port_config_t *portcfg;
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ void
|
|||||||
routerlist_add_family(smartlist_t *sl, routerinfo_t *router)
|
routerlist_add_family(smartlist_t *sl, routerinfo_t *router)
|
||||||
{
|
{
|
||||||
routerinfo_t *r;
|
routerinfo_t *r;
|
||||||
struct config_line_t *cl;
|
config_line_t *cl;
|
||||||
|
|
||||||
if (!router->declared_family)
|
if (!router->declared_family)
|
||||||
return;
|
return;
|
||||||
|
@ -1030,7 +1030,7 @@ static void
|
|||||||
test_control_formats(void)
|
test_control_formats(void)
|
||||||
{
|
{
|
||||||
char *out;
|
char *out;
|
||||||
const char *inp =
|
const char *inp =
|
||||||
"..This is a test\r\nof the emergency \nbroadcast\r\n..system.\r\nZ.\r\n";
|
"..This is a test\r\nof the emergency \nbroadcast\r\n..system.\r\nZ.\r\n";
|
||||||
size_t sz;
|
size_t sz;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user