Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Core
Tor
Commits
90e143e6
Commit
90e143e6
authored
21 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Patches
Plain Diff
Remove a possible source of error in circID picking.
svn:r824
parent
e5d6e7db
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/or/circuit.c
+7
-11
7 additions, 11 deletions
src/or/circuit.c
with
7 additions
and
11 deletions
src/or/circuit.c
+
7
−
11
View file @
90e143e6
...
...
@@ -7,7 +7,7 @@
extern
or_options_t
options
;
/* command-line and config-file options */
static
void
circuit_free_cpath_node
(
crypt_path_t
*
victim
);
static
circ_id_t
get_unique_circ_id_by_
addr_port
(
uint32_t
addr
,
uint16_t
port
,
int
circ_id_type
);
static
circ_id_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
;
...
...
@@ -121,17 +121,12 @@ 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_
addr_port
(
uint32_t
addr
,
uint16_t
port
,
int
circ_id_type
)
{
static
circ_id_t
get_unique_circ_id_by_
conn
(
connection_t
*
conn
,
int
circ_id_type
)
{
circ_id_t
test_circ_id
;
connection_t
*
conn
;
uint16_t
high_bit
;
assert
(
conn
&&
conn
->
type
==
CONN_TYPE_OR
);
high_bit
=
(
circ_id_type
==
CIRC_ID_TYPE_HIGHER
)
?
1
<<
15
:
0
;
conn
=
connection_exact_get_by_addr_port
(
addr
,
port
);
/* XXX race condition: if conn is marked_for_close it won't be noticed */
if
(
!
conn
)
return
(
1
|
high_bit
);
/* No connection exists; conflict is impossible. */
do
{
/* Sequentially iterate over test_circ_id=1...1<<15-1 until we find an
* circID such that (high_bit|test_circ_id) is not already used. */
...
...
@@ -771,9 +766,10 @@ int circuit_send_next_onion_skin(circuit_t *circ) {
assert
(
circ
&&
circ
->
cpath
);
if
(
circ
->
cpath
->
state
==
CPATH_STATE_CLOSED
)
{
assert
(
circ
->
n_conn
&&
circ
->
n_conn
->
type
==
CONN_TYPE_OR
);
log_fn
(
LOG_DEBUG
,
"First skin; sending create cell."
);
circ
->
n_circ_id
=
get_unique_circ_id_by_
addr_port
(
circ
->
n_addr
,
circ
->
n_port
,
CIRC_ID_TYPE_BOTH
);
circ
->
n_circ_id
=
get_unique_circ_id_by_
conn
(
circ
->
n_conn
,
CIRC_ID_TYPE_BOTH
);
memset
(
&
cell
,
0
,
sizeof
(
cell_t
));
cell
.
command
=
CELL_CREATE
;
...
...
@@ -875,7 +871,7 @@ int circuit_extend(cell_t *cell, circuit_t *circ) {
circ_id_type
=
decide_circ_id_type
(
options
.
Nickname
,
n_conn
->
nickname
);
log_fn
(
LOG_DEBUG
,
"circ_id_type = %u."
,
circ_id_type
);
circ
->
n_circ_id
=
get_unique_circ_id_by_
addr_port
(
circ
->
n_addr
,
circ
->
n_port
,
circ_id_type
);
circ
->
n_circ_id
=
get_unique_circ_id_by_
conn
(
circ
->
n_conn
,
circ_id_type
);
if
(
!
circ
->
n_circ_id
)
{
log_fn
(
LOG_WARN
,
"failed to get unique circID."
);
return
-
1
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment