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
Package Registry
Container Registry
Model registry
Operate
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
Pier Angelo Vendrame
Tor
Commits
3c8035b4
Commit
3c8035b4
authored
1 year ago
by
Alexander Hansen Færøy
Committed by
David Goulet
8 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Add changes file for
tpo/core/tor#11101
.
parent
b4f8518f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
changes/ticket11101
+4
-0
4 additions, 0 deletions
changes/ticket11101
src/feature/client/transports.c
+21
-9
21 additions, 9 deletions
src/feature/client/transports.c
src/test/test_pt.c
+86
-0
86 additions, 0 deletions
src/test/test_pt.c
with
111 additions
and
9 deletions
changes/ticket11101
0 → 100644
+
4
−
0
View file @
3c8035b4
o Minor feature (bridges, pluggable transport):
- Add STATUS TYPE=version handler for Pluggable Transport. This allows us to
gather version statistics on Pluggable Transport usage from bridge servers
on our metrics portal. Closes ticket 11101.
This diff is collapsed.
Click to expand it.
src/feature/client/transports.c
+
21
−
9
View file @
3c8035b4
...
...
@@ -89,6 +89,7 @@
* old transports from the circuitbuild.c subsystem.
**/
#include
"lib/string/printf.h"
#define PT_PRIVATE
#include
"core/or/or.h"
#include
"feature/client/bridges.h"
...
...
@@ -1307,6 +1308,11 @@ STATIC void
handle_status_message
(
const
config_line_t
*
values
,
managed_proxy_t
*
mp
)
{
if
(
config_count_key
(
values
,
"TYPE"
)
>
1
)
{
log_warn
(
LD_PT
,
"Managed proxy
\"
%s
\"
has multiple TYPE key which "
"is not allowed."
,
mp
->
argv
[
0
]);
return
;
}
const
config_line_t
*
message_type
=
config_line_find
(
values
,
"TYPE"
);
/* Check if we have a TYPE field? */
...
...
@@ -1790,16 +1796,22 @@ pt_get_extra_info_descriptor_string(void)
tor_free
(
transport_args
);
}
SMARTLIST_FOREACH_END
(
t
);
if
(
mp
->
version
!=
NULL
)
{
smartlist_add_asprintf
(
string_chunks
,
"transport-version %s"
,
mp
->
version
);
}
/* Set transport-info line. */
{
char
*
transport_info_args
=
NULL
;
if
(
mp
->
implementation
!=
NULL
)
{
smartlist_add_asprintf
(
string_chunks
,
"transport-implementation %s"
,
mp
->
implementation
);
if
(
mp
->
version
)
{
tor_asprintf
(
&
transport_info_args
,
" version=%s"
,
mp
->
version
);
}
if
(
mp
->
implementation
)
{
tor_asprintf
(
&
transport_info_args
,
" implementation=%s"
,
mp
->
implementation
);
}
if
(
transport_info_args
)
{
smartlist_add_asprintf
(
string_chunks
,
"transport-info%s"
,
transport_info_args
?
transport_info_args
:
""
);
tor_free
(
transport_info_args
);
}
}
}
SMARTLIST_FOREACH_END
(
mp
);
...
...
This diff is collapsed.
Click to expand it.
src/test/test_pt.c
+
86
−
0
View file @
3c8035b4
...
...
@@ -162,6 +162,7 @@ test_pt_status_parsing(void *arg)
tt_ptr_op
(
mp
->
version
,
OP_EQ
,
NULL
);
tt_ptr_op
(
mp
->
implementation
,
OP_EQ
,
NULL
);
/* Normal case. */
strlcpy
(
line
,
"STATUS "
"IMPLEMENTATION=xyz "
"TYPE=version "
...
...
@@ -171,7 +172,92 @@ test_pt_status_parsing(void *arg)
tt_str_op
(
mp
->
version
,
OP_EQ
,
"1.33.7-hax beta"
);
tt_str_op
(
mp
->
implementation
,
OP_EQ
,
"xyz"
);
reset_mp
(
mp
);
/* Normal case but different case for TYPE value. */
strlcpy
(
line
,
"STATUS "
"IMPLEMENTATION=xyz "
"TYPE=vErSiON "
"VERSION=
\"
1.33.7-hax beta
\"
"
,
sizeof
(
line
));
handle_proxy_line
(
line
,
mp
);
tt_str_op
(
mp
->
version
,
OP_EQ
,
"1.33.7-hax beta"
);
tt_str_op
(
mp
->
implementation
,
OP_EQ
,
"xyz"
);
reset_mp
(
mp
);
/* IMPLEMENTATION and VERSION set but no TYPE. */
strlcpy
(
line
,
"STATUS "
"IMPLEMENTATION=xyz "
"VERSION=
\"
1.33.7-hax beta
\"
"
,
sizeof
(
line
));
handle_proxy_line
(
line
,
mp
);
tt_assert
(
mp
->
version
==
NULL
);
tt_assert
(
mp
->
implementation
==
NULL
);
reset_mp
(
mp
);
/* Multiple TYPE= is not allowed. */
strlcpy
(
line
,
"STATUS "
"IMPLEMENTATION=xyz "
"TYPE=version "
"VERSION=
\"
1.33.7-hax beta
\"
"
"TYPE=nothing"
,
sizeof
(
line
));
handle_proxy_line
(
line
,
mp
);
tt_assert
(
mp
->
version
==
NULL
);
tt_assert
(
mp
->
implementation
==
NULL
);
reset_mp
(
mp
);
/* Multiple TYPE= is not allowed. */
strlcpy
(
line
,
"STATUS "
"IMPLEMENTATION=xyz "
"TYPE=version "
"VERSION=
\"
1.33.7-hax beta
\"
"
"TYPE=version"
,
sizeof
(
line
));
handle_proxy_line
(
line
,
mp
);
tt_assert
(
mp
->
version
==
NULL
);
tt_assert
(
mp
->
implementation
==
NULL
);
reset_mp
(
mp
);
/* Missing VERSION. */
strlcpy
(
line
,
"STATUS "
"TYPE=version "
"IMPLEMENTATION=xyz "
,
sizeof
(
line
));
handle_proxy_line
(
line
,
mp
);
tt_assert
(
mp
->
version
==
NULL
);
tt_assert
(
mp
->
implementation
==
NULL
);
reset_mp
(
mp
);
/* Many IMPLEMENTATION and VERSION. First found are used. */
strlcpy
(
line
,
"STATUS "
"TYPE=version "
"IMPLEMENTATION=xyz "
"VERSION=
\"
1.33.7-hax beta
\"
"
"IMPLEMENTATION=abc "
"VERSION=
\"
2.33.7-hax beta
\"
"
,
sizeof
(
line
));
handle_proxy_line
(
line
,
mp
);
tt_str_op
(
mp
->
version
,
OP_EQ
,
"1.33.7-hax beta"
);
tt_str_op
(
mp
->
implementation
,
OP_EQ
,
"xyz"
);
reset_mp
(
mp
);
/* Control characters. Invalid input. */
strlcpy
(
line
,
"STATUS "
"TYPE=version "
"IMPLEMENTATION=xyz
\0
abc "
"VERSION=
\"
1.33.7-hax beta
\"\0
.3 "
,
sizeof
(
line
));
handle_proxy_line
(
line
,
mp
);
tt_assert
(
mp
->
version
==
NULL
);
tt_assert
(
mp
->
implementation
==
NULL
);
reset_mp
(
mp
);
done:
...
...
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