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
16f337e7
Commit
16f337e7
authored
8 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Plain Diff
Merge branch 'bug21027_v2_squashed' into maint-0.3.0
parents
eef8bd4d
1582adab
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
changes/bug21027
+8
-0
8 additions, 0 deletions
changes/bug21027
src/or/bridges.c
+27
-0
27 additions, 0 deletions
src/or/bridges.c
src/or/bridges.h
+4
-0
4 additions, 0 deletions
src/or/bridges.h
src/or/entrynodes.c
+16
-21
16 additions, 21 deletions
src/or/entrynodes.c
with
55 additions
and
21 deletions
changes/bug21027
0 → 100644
+
8
−
0
View file @
16f337e7
o Major bugfixes (bridges):
- When the same bridge is configured multiple times at different
address:port combinations (but with the same identity), treat
those bridge instances as separate guards. This allows clients to
configure the same bridge with multiple pluggable transports, once
again. Fixes bug 21027; bugfix on 0.3.0.1-alpha.
This diff is collapsed.
Click to expand it.
src/or/bridges.c
+
27
−
0
View file @
16f337e7
...
...
@@ -199,6 +199,33 @@ get_configured_bridge_by_addr_port_digest(const tor_addr_t *addr,
return
NULL
;
}
/**
* As get_configured_bridge_by_addr_port, but require that the
* address match <b>addr</b>:<b>port</b>, and that the ID digest match
* <b>digest</b>. (The other function will ignore the address if the
* digest matches.)
*/
bridge_info_t
*
get_configured_bridge_by_exact_addr_port_digest
(
const
tor_addr_t
*
addr
,
uint16_t
port
,
const
char
*
digest
)
{
if
(
!
bridge_list
)
return
NULL
;
SMARTLIST_FOREACH_BEGIN
(
bridge_list
,
bridge_info_t
*
,
bridge
)
{
if
(
!
tor_addr_compare
(
&
bridge
->
addr
,
addr
,
CMP_EXACT
)
&&
bridge
->
port
==
port
)
{
if
(
digest
&&
tor_memeq
(
bridge
->
identity
,
digest
,
DIGEST_LEN
))
return
bridge
;
else
if
(
!
digest
)
return
bridge
;
}
}
SMARTLIST_FOREACH_END
(
bridge
);
return
NULL
;
}
/** If we have a bridge configured whose digest matches <b>digest</b>, or a
* bridge with no known digest whose address matches <b>addr</b>:<b>port</b>,
* return 1. Else return 0. If <b>digest</b> is NULL, check for
...
...
This diff is collapsed.
Click to expand it.
src/or/bridges.h
+
4
−
0
View file @
16f337e7
...
...
@@ -27,6 +27,10 @@ bridge_info_t *get_configured_bridge_by_addr_port_digest(
const
tor_addr_t
*
addr
,
uint16_t
port
,
const
char
*
digest
);
bridge_info_t
*
get_configured_bridge_by_exact_addr_port_digest
(
const
tor_addr_t
*
addr
,
uint16_t
port
,
const
char
*
digest
);
int
addr_is_a_configured_bridge
(
const
tor_addr_t
*
addr
,
uint16_t
port
,
const
char
*
digest
);
...
...
This diff is collapsed.
Click to expand it.
src/or/entrynodes.c
+
16
−
21
View file @
16f337e7
...
...
@@ -768,11 +768,6 @@ get_sampled_guard_for_bridge(guard_selection_t *gs,
const
uint8_t
*
id
=
bridge_get_rsa_id_digest
(
bridge
);
const
tor_addr_port_t
*
addrport
=
bridge_get_addr_port
(
bridge
);
entry_guard_t
*
guard
;
if
(
id
)
{
guard
=
get_sampled_guard_with_id
(
gs
,
id
);
if
(
guard
)
return
guard
;
}
if
(
BUG
(
!
addrport
))
return
NULL
;
// LCOV_EXCL_LINE
guard
=
get_sampled_guard_by_bridge_addr
(
gs
,
addrport
);
...
...
@@ -787,16 +782,17 @@ get_sampled_guard_for_bridge(guard_selection_t *gs,
static
bridge_info_t
*
get_bridge_info_for_guard
(
const
entry_guard_t
*
guard
)
{
const
uint8_t
*
identity
=
NULL
;
if
(
!
tor_digest_is_zero
(
guard
->
identity
))
{
bridge_info_t
*
bridge
=
find_bridge_by_digest
(
guard
->
identity
);
if
(
bridge
)
return
bridge
;
identity
=
(
const
uint8_t
*
)
guard
->
identity
;
}
if
(
BUG
(
guard
->
bridge_addr
==
NULL
))
return
NULL
;
return
get_configured_bridge_by_addr_port_digest
(
&
guard
->
bridge_addr
->
addr
,
guard
->
bridge_addr
->
port
,
NULL
);
return
get_configured_bridge_by_exact_addr_port_digest
(
&
guard
->
bridge_addr
->
addr
,
guard
->
bridge_addr
->
port
,
(
const
char
*
)
identity
);
}
/**
...
...
@@ -820,6 +816,10 @@ entry_guard_add_to_sample(guard_selection_t *gs,
log_info
(
LD_GUARD
,
"Adding %s as to the entry guard sample set."
,
node_describe
(
node
));
/* make sure that the guard is not already sampled. */
if
(
BUG
(
have_sampled_guard_with_id
(
gs
,
(
const
uint8_t
*
)
node
->
identity
)))
return
NULL
;
// LCOV_EXCL_LINE
return
entry_guard_add_to_sample_impl
(
gs
,
(
const
uint8_t
*
)
node
->
identity
,
node_get_nickname
(
node
),
...
...
@@ -843,9 +843,6 @@ entry_guard_add_to_sample_impl(guard_selection_t *gs,
// XXXX #20827 take ed25519 identity here too.
/* make sure that the guard is not already sampled. */
if
(
rsa_id_digest
&&
BUG
(
have_sampled_guard_with_id
(
gs
,
rsa_id_digest
)))
return
NULL
;
// LCOV_EXCL_LINE
/* Make sure we can actually identify the guard. */
if
(
BUG
(
!
rsa_id_digest
&&
!
bridge_addrport
))
return
NULL
;
// LCOV_EXCL_LINE
...
...
@@ -890,6 +887,10 @@ entry_guard_add_bridge_to_sample(guard_selection_t *gs,
tor_assert
(
addrport
);
/* make sure that the guard is not already sampled. */
if
(
BUG
(
get_sampled_guard_for_bridge
(
gs
,
bridge
)))
return
NULL
;
// LCOV_EXCL_LINE
return
entry_guard_add_to_sample_impl
(
gs
,
id_digest
,
NULL
,
addrport
);
}
...
...
@@ -2901,13 +2902,7 @@ entry_guard_t *
entry_guard_get_by_id_digest_for_guard_selection
(
guard_selection_t
*
gs
,
const
char
*
digest
)
{
tor_assert
(
gs
!=
NULL
);
SMARTLIST_FOREACH
(
gs
->
sampled_entry_guards
,
entry_guard_t
*
,
entry
,
if
(
tor_memeq
(
digest
,
entry
->
identity
,
DIGEST_LEN
))
return
entry
;
);
return
NULL
;
return
get_sampled_guard_with_id
(
gs
,
(
const
uint8_t
*
)
digest
);
}
/** Return the node_t associated with a single entry_guard_t. May
...
...
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