mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
rename circ_id_t to uint16_t for code clarity
change message when using non-recommended tor version svn:r954
This commit is contained in:
+5
-5
@@ -10,7 +10,7 @@ static int relay_crypt(circuit_t *circ, char *in, char cell_direction,
|
||||
crypt_path_t **layer_hint, char *recognized);
|
||||
static connection_t *relay_lookup_conn(circuit_t *circ, cell_t *cell, int cell_direction);
|
||||
static void circuit_free_cpath_node(crypt_path_t *victim);
|
||||
static circ_id_t get_unique_circ_id_by_conn(connection_t *conn, int circ_id_type);
|
||||
static uint16_t get_unique_circ_id_by_conn(connection_t *conn, int circ_id_type);
|
||||
|
||||
unsigned long stats_n_relay_cells_relayed = 0;
|
||||
unsigned long stats_n_relay_cells_delivered = 0;
|
||||
@@ -56,7 +56,7 @@ void circuit_remove(circuit_t *circ) {
|
||||
}
|
||||
}
|
||||
|
||||
circuit_t *circuit_new(circ_id_t p_circ_id, connection_t *p_conn) {
|
||||
circuit_t *circuit_new(uint16_t p_circ_id, connection_t *p_conn) {
|
||||
circuit_t *circ;
|
||||
|
||||
circ = tor_malloc_zero(sizeof(circuit_t));
|
||||
@@ -129,8 +129,8 @@ static void circuit_free_cpath_node(crypt_path_t *victim) {
|
||||
}
|
||||
|
||||
/* return 0 if can't get a unique circ_id. */
|
||||
static circ_id_t get_unique_circ_id_by_conn(connection_t *conn, int circ_id_type) {
|
||||
circ_id_t test_circ_id;
|
||||
static uint16_t get_unique_circ_id_by_conn(connection_t *conn, int circ_id_type) {
|
||||
uint16_t test_circ_id;
|
||||
int attempts=0;
|
||||
uint16_t high_bit;
|
||||
|
||||
@@ -156,7 +156,7 @@ static circ_id_t get_unique_circ_id_by_conn(connection_t *conn, int circ_id_type
|
||||
return test_circ_id;
|
||||
}
|
||||
|
||||
circuit_t *circuit_get_by_circ_id_conn(circ_id_t circ_id, connection_t *conn) {
|
||||
circuit_t *circuit_get_by_circ_id_conn(uint16_t circ_id, connection_t *conn) {
|
||||
circuit_t *circ;
|
||||
connection_t *tmpconn;
|
||||
|
||||
|
||||
+1
-1
@@ -647,7 +647,7 @@ int connection_state_is_open(connection_t *conn) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int connection_send_destroy(circ_id_t circ_id, connection_t *conn) {
|
||||
int connection_send_destroy(uint16_t circ_id, connection_t *conn) {
|
||||
cell_t cell;
|
||||
|
||||
assert(conn);
|
||||
|
||||
+8
-8
@@ -30,18 +30,18 @@ int connection_cpu_finished_flushing(connection_t *conn) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void tag_pack(char *tag, uint32_t addr, uint16_t port, circ_id_t circ_id) {
|
||||
*(uint32_t *)tag = addr;
|
||||
static void tag_pack(char *tag, uint32_t addr, uint16_t port, uint16_t circ_id) {
|
||||
*(uint32_t *)tag = addr;
|
||||
*(uint16_t *)(tag+4) = port;
|
||||
*(circ_id_t *)(tag+6) = circ_id;
|
||||
*(uint16_t *)(tag+6) = circ_id;
|
||||
}
|
||||
|
||||
static void tag_unpack(char *tag, uint32_t *addr, uint16_t *port, circ_id_t *circ_id) {
|
||||
static void tag_unpack(char *tag, uint32_t *addr, uint16_t *port, uint16_t *circ_id) {
|
||||
struct in_addr in;
|
||||
|
||||
*addr = *(uint32_t *)tag;
|
||||
*port = *(uint16_t *)(tag+4);
|
||||
*circ_id = *(circ_id_t *)(tag+6);
|
||||
*addr = *(uint32_t *)tag;
|
||||
*port = *(uint16_t *)(tag+4);
|
||||
*circ_id = *(uint16_t *)(tag+6);
|
||||
|
||||
in.s_addr = htonl(*addr);
|
||||
log_fn(LOG_DEBUG,"onion was from %s:%d, circ_id %d.", inet_ntoa(in), *port, *circ_id);
|
||||
@@ -51,7 +51,7 @@ int connection_cpu_process_inbuf(connection_t *conn) {
|
||||
unsigned char buf[LEN_ONION_RESPONSE];
|
||||
uint32_t addr;
|
||||
uint16_t port;
|
||||
circ_id_t circ_id;
|
||||
uint16_t circ_id;
|
||||
connection_t *p_conn;
|
||||
circuit_t *circ;
|
||||
|
||||
|
||||
+8
-10
@@ -230,8 +230,6 @@
|
||||
|
||||
#define SOCKS4_NETWORK_LEN 8
|
||||
|
||||
typedef uint16_t circ_id_t;
|
||||
|
||||
/*
|
||||
* Relay payload:
|
||||
* Relay command [1 byte]
|
||||
@@ -276,7 +274,7 @@ typedef uint16_t circ_id_t;
|
||||
|
||||
/* cell definition */
|
||||
typedef struct {
|
||||
circ_id_t circ_id;
|
||||
uint16_t circ_id;
|
||||
unsigned char command;
|
||||
unsigned char payload[CELL_PAYLOAD_SIZE];
|
||||
} cell_t;
|
||||
@@ -331,8 +329,8 @@ struct connection_t {
|
||||
|
||||
/* Used only by OR connections: */
|
||||
tor_tls *tls;
|
||||
circ_id_t next_circ_id; /* Which circ_id do we try to use next on this connection?
|
||||
* This is always in the range 0..1<<15-1.*/
|
||||
uint16_t next_circ_id; /* Which circ_id do we try to use next on this connection?
|
||||
* This is always in the range 0..1<<15-1.*/
|
||||
|
||||
/* bandwidth and receiver_bucket only used by ORs in OPEN state: */
|
||||
uint32_t bandwidth; /* connection bandwidth. */
|
||||
@@ -450,8 +448,8 @@ struct circuit_t {
|
||||
int package_window;
|
||||
int deliver_window;
|
||||
|
||||
circ_id_t p_circ_id; /* circuit identifiers */
|
||||
circ_id_t n_circ_id;
|
||||
uint16_t p_circ_id; /* circuit identifiers */
|
||||
uint16_t n_circ_id;
|
||||
|
||||
crypto_cipher_env_t *p_crypto; /* used only for intermediate hops */
|
||||
crypto_cipher_env_t *n_crypto;
|
||||
@@ -554,11 +552,11 @@ int fetch_from_buf_socks(buf_t *buf, socks_request_t *req);
|
||||
|
||||
void circuit_add(circuit_t *circ);
|
||||
void circuit_remove(circuit_t *circ);
|
||||
circuit_t *circuit_new(circ_id_t p_circ_id, connection_t *p_conn);
|
||||
circuit_t *circuit_new(uint16_t p_circ_id, connection_t *p_conn);
|
||||
void circuit_free(circuit_t *circ);
|
||||
void circuit_free_cpath(crypt_path_t *cpath);
|
||||
|
||||
circuit_t *circuit_get_by_circ_id_conn(circ_id_t circ_id, connection_t *conn);
|
||||
circuit_t *circuit_get_by_circ_id_conn(uint16_t circ_id, connection_t *conn);
|
||||
circuit_t *circuit_get_by_conn(connection_t *conn);
|
||||
circuit_t *circuit_get_newest(connection_t *conn, int must_be_open);
|
||||
|
||||
@@ -650,7 +648,7 @@ int connection_receiver_bucket_should_increase(connection_t *conn);
|
||||
int connection_is_listener(connection_t *conn);
|
||||
int connection_state_is_open(connection_t *conn);
|
||||
|
||||
int connection_send_destroy(circ_id_t circ_id, connection_t *conn);
|
||||
int connection_send_destroy(uint16_t circ_id, connection_t *conn);
|
||||
|
||||
int connection_process_inbuf(connection_t *conn);
|
||||
int connection_finished_flushing(connection_t *conn);
|
||||
|
||||
+4
-3
@@ -333,9 +333,10 @@ int router_set_routerlist_from_directory(const char *s, crypto_pk_env_t *pkey)
|
||||
}
|
||||
if (compare_recommended_versions(VERSION, routerlist->software_versions) < 0) {
|
||||
log(options.IgnoreVersion ? LOG_WARN : LOG_ERR,
|
||||
"You are running Tor version %s, which is not recommended.\n"
|
||||
"Please upgrade to one of %s.",
|
||||
VERSION, routerlist->software_versions);
|
||||
"You are running Tor version %s, which will not work with this network.\n"
|
||||
"Please use %s%s.",
|
||||
VERSION, strchr(routerlist->software_versions,',') ? "one of " : "",
|
||||
routerlist->software_versions);
|
||||
if(options.IgnoreVersion) {
|
||||
log(LOG_WARN, "IgnoreVersion is set. If it breaks, we told you so.");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user