Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Benjamin J. Thompson
Tor
Commits
e609f003
Unverified
Commit
e609f003
authored
5 years ago
by
teor
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'tor-github/pr/1211' into test31343_040
parents
0a661cde
7e32db47
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
changes/bug31343
+9
-0
9 additions, 0 deletions
changes/bug31343
src/core/or/channeltls.c
+16
-4
16 additions, 4 deletions
src/core/or/channeltls.c
src/feature/nodelist/routerlist.c
+4
-2
4 additions, 2 deletions
src/feature/nodelist/routerlist.c
with
29 additions
and
6 deletions
changes/bug31343
0 → 100644
+
9
−
0
View file @
e609f003
o Minor bugfixes (compilation):
- Avoid using labs() on time_t, which can cause compilation warnings
on 64-bit Windows builds. Fixes bug 31343; bugfix on 0.2.4.4-alpha.
o Minor bugfixes (clock skew detection):
- Don't believe clock skew results from NETINFO cells that appear to
arrive before the VERSIONS cells they are responding to were sent.
Previously, we would accept them up to 3 minutes "in the past".
Fixes bug 31343; bugfix on 0.2.4.4-alpha.
This diff is collapsed.
Click to expand it.
src/core/or/channeltls.c
+
16
−
4
View file @
e609f003
...
...
@@ -1664,7 +1664,19 @@ tor_addr_from_netinfo_addr(tor_addr_t *tor_addr,
}
/**
* Process a 'netinfo' cell.
* Helper: compute the absolute value of a time_t.
*
* (we need this because labs() doesn't always work for time_t, since
* long can be shorter than time_t.)
*/
static
inline
time_t
time_abs
(
time_t
val
)
{
return
(
val
<
0
)
?
-
val
:
val
;
}
/**
* Process a 'netinfo' cell
*
* This function is called to handle an incoming NETINFO cell; read and act
* on its contents, and set the connection state to "open".
...
...
@@ -1679,7 +1691,7 @@ channel_tls_process_netinfo_cell(cell_t *cell, channel_tls_t *chan)
time_t
now
=
time
(
NULL
);
const
routerinfo_t
*
me
=
router_get_my_routerinfo
();
long
apparent_skew
=
0
;
time_t
apparent_skew
=
0
;
tor_addr_t
my_apparent_addr
=
TOR_ADDR_NULL
;
int
started_here
=
0
;
const
char
*
identity_digest
=
NULL
;
...
...
@@ -1765,7 +1777,7 @@ channel_tls_process_netinfo_cell(cell_t *cell, channel_tls_t *chan)
my_addr_type
=
netinfo_addr_get_addr_type
(
my_addr
);
my_addr_len
=
netinfo_addr_get_len
(
my_addr
);
if
(
labs
(
now
-
chan
->
conn
->
handshake_state
->
sent_versions_at
)
<
180
)
{
if
((
now
-
chan
->
conn
->
handshake_state
->
sent_versions_at
)
<
180
)
{
apparent_skew
=
now
-
timestamp
;
}
/* We used to check:
...
...
@@ -1842,7 +1854,7 @@ channel_tls_process_netinfo_cell(cell_t *cell, channel_tls_t *chan)
/* Act on apparent skew. */
/** Warn when we get a netinfo skew with at least this value. */
#define NETINFO_NOTICE_SKEW 3600
if
(
l
abs
(
apparent_skew
)
>
NETINFO_NOTICE_SKEW
&&
if
(
time_
abs
(
apparent_skew
)
>
NETINFO_NOTICE_SKEW
&&
(
started_here
||
connection_or_digest_is_known_relay
(
chan
->
conn
->
identity_digest
)))
{
int
trusted
=
router_digest_is_trusted_dir
(
chan
->
conn
->
identity_digest
);
...
...
This diff is collapsed.
Click to expand it.
src/feature/nodelist/routerlist.c
+
4
−
2
View file @
e609f003
...
...
@@ -2856,7 +2856,7 @@ int
router_differences_are_cosmetic
(
const
routerinfo_t
*
r1
,
const
routerinfo_t
*
r2
)
{
time_t
r1pub
,
r2pub
;
long
time_difference
;
time_t
time_difference
;
tor_assert
(
r1
&&
r2
);
/* r1 should be the one that was published first. */
...
...
@@ -2920,7 +2920,9 @@ router_differences_are_cosmetic(const routerinfo_t *r1, const routerinfo_t *r2)
* give or take some slop? */
r1pub
=
r1
->
cache_info
.
published_on
;
r2pub
=
r2
->
cache_info
.
published_on
;
time_difference
=
labs
(
r2
->
uptime
-
(
r1
->
uptime
+
(
r2pub
-
r1pub
)));
time_difference
=
r2
->
uptime
-
(
r1
->
uptime
+
(
r2pub
-
r1pub
));
if
(
time_difference
<
0
)
time_difference
=
-
time_difference
;
if
(
time_difference
>
ROUTER_ALLOW_UPTIME_DRIFT
&&
time_difference
>
r1
->
uptime
*
.
05
&&
time_difference
>
r2
->
uptime
*
.
05
)
...
...
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