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
51ca6dea
Commit
51ca6dea
authored
5 years ago
by
teor
Browse files
Options
Downloads
Patches
Plain Diff
relay: Simplify relay/transport_config
Minor simplification and refactoring. Part of 32113.
parent
2dfd1801
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/feature/relay/transport_config.c
+23
-21
23 additions, 21 deletions
src/feature/relay/transport_config.c
with
23 additions
and
21 deletions
src/feature/relay/transport_config.c
+
23
−
21
View file @
51ca6dea
...
...
@@ -40,7 +40,8 @@
* The returned string is allocated on the heap and it's the
* responsibility of the caller to free it. */
static
char
*
get_bindaddr_from_transport_listen_line
(
const
char
*
line
,
const
char
*
transport
)
get_bindaddr_from_transport_listen_line
(
const
char
*
line
,
const
char
*
transport
)
{
smartlist_t
*
items
=
NULL
;
const
char
*
parsed_transport
=
NULL
;
...
...
@@ -113,10 +114,11 @@ get_transport_bindaddr_from_config(const char *transport)
* The returned smartlist and its strings are allocated on the heap
* and it's the responsibility of the caller to free it. */
STATIC
smartlist_t
*
get_options_from_transport_options_line
(
const
char
*
line
,
const
char
*
transport
)
get_options_from_transport_options_line
(
const
char
*
line
,
const
char
*
transport
)
{
smartlist_t
*
items
=
smartlist_new
();
smartlist_t
*
options
=
smartlist_new
();
smartlist_t
*
pt_
options
=
smartlist_new
();
const
char
*
parsed_transport
=
NULL
;
smartlist_split_string
(
items
,
line
,
NULL
,
...
...
@@ -143,22 +145,22 @@ get_options_from_transport_options_line(const char *line,const char *transport)
}
/* add it to the options smartlist */
smartlist_add_strdup
(
options
,
option
);
smartlist_add_strdup
(
pt_
options
,
option
);
log_debug
(
LD_CONFIG
,
"Added %s to the list of options"
,
escaped
(
option
));
}
SMARTLIST_FOREACH_END
(
option
);
goto
done
;
err:
SMARTLIST_FOREACH
(
options
,
char
*
,
s
,
tor_free
(
s
));
smartlist_free
(
options
);
options
=
NULL
;
SMARTLIST_FOREACH
(
pt_
options
,
char
*
,
s
,
tor_free
(
s
));
smartlist_free
(
pt_
options
);
pt_
options
=
NULL
;
done:
SMARTLIST_FOREACH
(
items
,
char
*
,
s
,
tor_free
(
s
));
smartlist_free
(
items
);
return
options
;
return
pt_
options
;
}
/** Given the name of a pluggable transport in <b>transport</b>, check
...
...
@@ -203,11 +205,6 @@ options_validate_server_transport(const or_options_t *old_options,
config_line_t
*
cl
;
for
(
cl
=
options
->
ServerTransportPlugin
;
cl
;
cl
=
cl
->
next
)
{
if
(
parse_transport_line
(
options
,
cl
->
value
,
1
,
1
)
<
0
)
REJECT
(
"Invalid server transport line. See logs for details."
);
}
if
(
options
->
ServerTransportPlugin
&&
!
server_mode
(
options
))
{
log_notice
(
LD_GENERAL
,
"Tor is not configured as a relay but you specified"
" a ServerTransportPlugin line (%s). The ServerTransportPlugin "
...
...
@@ -215,6 +212,17 @@ options_validate_server_transport(const or_options_t *old_options,
escaped
(
options
->
ServerTransportPlugin
->
value
));
}
if
(
options
->
ServerTransportListenAddr
&&
!
options
->
ServerTransportPlugin
)
{
log_notice
(
LD_GENERAL
,
"You need at least a single managed-proxy to "
"specify a transport listen address. The "
"ServerTransportListenAddr line will be ignored."
);
}
for
(
cl
=
options
->
ServerTransportPlugin
;
cl
;
cl
=
cl
->
next
)
{
if
(
parse_transport_line
(
options
,
cl
->
value
,
1
,
1
)
<
0
)
REJECT
(
"Invalid server transport line. See logs for details."
);
}
for
(
cl
=
options
->
ServerTransportListenAddr
;
cl
;
cl
=
cl
->
next
)
{
/** If get_bindaddr_from_transport_listen_line() fails with
'transport' being NULL, it means that something went wrong
...
...
@@ -225,12 +233,6 @@ options_validate_server_transport(const or_options_t *old_options,
tor_free
(
bindaddr
);
}
if
(
options
->
ServerTransportListenAddr
&&
!
options
->
ServerTransportPlugin
)
{
log_notice
(
LD_GENERAL
,
"You need at least a single managed-proxy to "
"specify a transport listen address. The "
"ServerTransportListenAddr line will be ignored."
);
}
for
(
cl
=
options
->
ServerTransportOptions
;
cl
;
cl
=
cl
->
next
)
{
/** If get_options_from_transport_options_line() fails with
'transport' being NULL, it means that something went wrong
...
...
@@ -268,7 +270,7 @@ options_act_server_transport(const or_options_t *old_options)
/* If we are a bridge with a pluggable transport proxy but no
Extended ORPort, inform the user that they are missing out. */
if
(
server_mode
(
options
)
&&
options
->
ServerTransportPlugin
&&
if
(
options
->
ServerTransportPlugin
&&
!
options
->
ExtORPort_lines
)
{
log_notice
(
LD_CONFIG
,
"We use pluggable transports but the Extended "
"ORPort is disabled. Tor and your pluggable transports proxy "
...
...
@@ -287,7 +289,7 @@ options_act_server_transport(const or_options_t *old_options)
}
if
(
!
options
->
DisableNetwork
)
{
if
(
options
->
ServerTransportPlugin
&&
server_mode
(
options
)
)
{
if
(
options
->
ServerTransportPlugin
)
{
for
(
cl
=
options
->
ServerTransportPlugin
;
cl
;
cl
=
cl
->
next
)
{
if
(
parse_transport_line
(
options
,
cl
->
value
,
0
,
1
)
<
0
)
{
// LCOV_EXCL_START
...
...
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