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
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
sergi
Tor
Commits
bc799a1e
Commit
bc799a1e
authored
4 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'tor-gitlab/mr/320'
parents
100221ba
c9646525
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
changes/changes40308
+5
-0
5 additions, 0 deletions
changes/changes40308
src/core/or/dos.c
+35
-39
35 additions, 39 deletions
src/core/or/dos.c
src/test/test_status.c
+3
-1
3 additions, 1 deletion
src/test/test_status.c
with
43 additions
and
40 deletions
changes/changes40308
0 → 100644
+
5
−
0
View file @
bc799a1e
o Minor feature (DoS log heartbeat):
- Change the DoS subsystem heartbeat line format so be more clear on what
has been detected/rejected and which option is disabled if any. Closes
ticket 40308.
This diff is collapsed.
Click to expand it.
src/core/or/dos.c
+
35
−
39
View file @
bc799a1e
...
...
@@ -776,58 +776,54 @@ dos_should_refuse_single_hop_client(void)
void
dos_log_heartbeat
(
void
)
{
char
*
conn_msg
=
NULL
;
char
*
cc_msg
=
NULL
;
char
*
single_hop_client_msg
=
NULL
;
char
*
circ_stats_msg
=
NULL
;
char
*
hs_dos_intro2_msg
=
NULL
;
smartlist_t
*
elems
=
smartlist_new
();
/* Stats number coming from relay.c append_cell_to_circuit_queue(). */
tor_asprintf
(
&
circ_stats_
ms
g
,
"
%"
PRIu64
" circuits killed with too many cells
.
"
,
stats_n_circ_max_cell_reached
);
smartlist_add_asprintf
(
ele
ms
,
"
%"
PRIu64
" circuits killed with too many cells"
,
stats_n_circ_max_cell_reached
);
if
(
dos_cc_enabled
)
{
tor_asprintf
(
&
cc_msg
,
" %"
PRIu64
" circuits rejected,"
" %"
PRIu32
" marked addresses."
,
cc_num_rejected_cells
,
cc_num_marked_addrs
);
smartlist_add_asprintf
(
elems
,
"%"
PRIu64
" circuits rejected, "
"%"
PRIu32
" marked addresses"
,
cc_num_rejected_cells
,
cc_num_marked_addrs
);
}
else
{
smartlist_add_asprintf
(
elems
,
"[DoSCircuitCreationEnabled disabled]"
);
}
if
(
dos_conn_enabled
)
{
tor_asprintf
(
&
conn_msg
,
" %"
PRIu64
" connections closed."
,
conn_num_addr_rejected
);
tor_asprintf
(
&
conn_msg
,
" %"
PRIu64
" connect() connections closed."
,
conn_num_addr_connect_rejected
);
smartlist_add_asprintf
(
elems
,
"%"
PRIu64
" same address concurrent "
"connections rejected"
,
conn_num_addr_rejected
);
smartlist_add_asprintf
(
elems
,
"%"
PRIu64
" connections rejected"
,
conn_num_addr_connect_rejected
);
}
else
{
smartlist_add_asprintf
(
elems
,
"[DoSConnectionEnabled disabled]"
);
}
if
(
dos_should_refuse_single_hop_client
())
{
tor_asprintf
(
&
single_hop_client_msg
,
" %"
PRIu64
" single hop clients refused."
,
num_single_hop_client_refused
);
smartlist_add_asprintf
(
elems
,
"%"
PRIu64
" single hop clients refused"
,
num_single_hop_client_refused
);
}
else
{
smartlist_add_asprintf
(
elems
,
"[DoSRefuseSingleHopClientRendezvous disabled]"
);
}
/* HS DoS stats. */
tor_asprintf
(
&
hs_dos_intro2_msg
,
" %"
PRIu64
" INTRODUCE2 rejected."
,
hs_dos_get_intro2_rejected_count
());
log_notice
(
LD_HEARTBEAT
,
"DoS mitigation since startup:%s%s%s%s%s"
,
circ_stats_msg
,
(
cc_msg
!=
NULL
)
?
cc_msg
:
" [cc not enabled]"
,
(
conn_msg
!=
NULL
)
?
conn_msg
:
" [conn not enabled]"
,
(
single_hop_client_msg
!=
NULL
)
?
single_hop_client_msg
:
""
,
(
hs_dos_intro2_msg
!=
NULL
)
?
hs_dos_intro2_msg
:
""
);
tor_free
(
conn_msg
);
tor_free
(
cc_msg
);
tor_free
(
single_hop_client_msg
);
tor_free
(
circ_stats_msg
);
tor_free
(
hs_dos_intro2_msg
);
return
;
smartlist_add_asprintf
(
elems
,
"%"
PRIu64
" INTRODUCE2 rejected"
,
hs_dos_get_intro2_rejected_count
());
char
*
msg
=
smartlist_join_strings
(
elems
,
", "
,
0
,
NULL
);
log_notice
(
LD_HEARTBEAT
,
"DoS mitigation since startup: %s."
,
msg
);
tor_free
(
msg
);
SMARTLIST_FOREACH
(
elems
,
char
*
,
e
,
tor_free
(
e
));
smartlist_free
(
elems
);
}
/* Called when a new client connection has been established on the given
...
...
This diff is collapsed.
Click to expand it.
src/test/test_status.c
+
3
−
1
View file @
bc799a1e
...
...
@@ -360,7 +360,9 @@ test_status_hb_not_in_consensus(void *arg)
"initiated 0 and received 0 v4 connections; "
"initiated 0 and received 0 v5 connections.
\n
"
);
expect_log_msg
(
"DoS mitigation since startup: 0 circuits killed with "
"too many cells. [cc not enabled] [conn not enabled] "
"too many cells, [DoSCircuitCreationEnabled disabled], "
"[DoSConnectionEnabled disabled], "
"[DoSRefuseSingleHopClientRendezvous disabled], "
"0 INTRODUCE2 rejected.
\n
"
);
tt_int_op
(
mock_saved_log_n_entries
(),
OP_EQ
,
6
);
...
...
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