Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tor
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
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
debian
tor
Commits
ac68704f
Commit
ac68704f
authored
15 years ago
by
Mike Perry
Browse files
Options
Downloads
Patches
Plain Diff
Allow "EXTENDCIRCUIT 0" to omit a path.
parent
8512e337
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/spec/control-spec.txt
+12
-7
12 additions, 7 deletions
doc/spec/control-spec.txt
src/or/control.c
+42
-11
42 additions, 11 deletions
src/or/control.c
with
54 additions
and
18 deletions
doc/spec/control-spec.txt
+
12
−
7
View file @
ac68704f
...
...
@@ -606,15 +606,20 @@
3.10. EXTENDCIRCUIT
Sent from the client to the server. The format is:
"EXTENDCIRCUIT" SP CircuitID
SP
ServerSpec *("," ServerSpec)
[
SP "purpose=" Purpose] CRLF
"EXTENDCIRCUIT" SP CircuitID
[SP
ServerSpec *("," ServerSpec)
SP "purpose=" Purpose] CRLF
This request takes one of two forms: either the CircuitID is zero, in
which case it is a request for the server to build a new circuit according
to the specified path, or the CircuitID is nonzero, in which case it is a
request for the server to extend an existing circuit with that ID according
to the specified path.
which case it is a request for the server to build a new circuit,
or the CircuitID is nonzero, in which case it is a request for the
server to extend an existing circuit with that ID according to the
specified path.
If the CircuitID is 0, the controller has the option of providing
a path for Tor to use to build the circuit. If it does not provide
a path, Tor will select one automatically from high capacity nodes
according to path-spec.txt.
If CircuitID is 0 and "purpose=" is specified, then the circuit's
purpose is set. Two choices are recognized: "general" and
...
...
This diff is collapsed.
Click to expand it.
src/or/control.c
+
42
−
11
View file @
ac68704f
...
...
@@ -2055,27 +2055,58 @@ handle_control_extendcircuit(control_connection_t *conn, uint32_t len,
router_nicknames
=
smartlist_create
();
args
=
getargs_helper
(
"EXTENDCIRCUIT"
,
conn
,
body
,
2
,
-
1
);
args
=
getargs_helper
(
"EXTENDCIRCUIT"
,
conn
,
body
,
1
,
-
1
);
if
(
!
args
)
goto
done
;
zero_circ
=
!
strcmp
(
"0"
,
(
char
*
)
smartlist_get
(
args
,
0
));
if
(
zero_circ
)
{
char
*
purp
=
NULL
;
if
(
smartlist_len
(
args
)
==
2
)
{
// "EXTENDCIRCUIT 0 PURPOSE=foo"
purp
=
smartlist_get
(
args
,
1
);
}
else
if
(
smartlist_len
(
args
)
==
3
)
{
// "EXTENDCIRCUIT 0 router1,router2 PURPOSE=foo"
purp
=
smartlist_get
(
args
,
2
);
}
if
(
purp
&&
strcmpstart
(
purp
,
"purpose="
)
!=
0
)
purp
=
NULL
;
if
(
purp
)
{
intended_purpose
=
circuit_purpose_from_string
(
purp
);
if
(
intended_purpose
==
CIRCUIT_PURPOSE_UNKNOWN
)
{
connection_printf_to_buf
(
conn
,
"552 Unknown purpose
\"
%s
\"\r\n
"
,
purp
);
SMARTLIST_FOREACH
(
args
,
char
*
,
cp
,
tor_free
(
cp
));
smartlist_free
(
args
);
}
}
if
((
smartlist_len
(
args
)
==
1
)
||
(
purp
&&
(
smartlist_len
(
args
)
==
2
)))
{
// "EXTENDCIRCUIT 0" || EXTENDCIRCUIT 0 PURPOSE=foo"
circ
=
circuit_launch_by_router
(
intended_purpose
,
NULL
,
CIRCLAUNCH_NEED_CAPACITY
);
if
(
!
circ
)
{
connection_write_str_to_buf
(
"551 Couldn't start circuit
\r\n
"
,
conn
);
}
else
{
connection_printf_to_buf
(
conn
,
"250 EXTENDED %lu
\r\n
"
,
(
unsigned
long
)
circ
->
global_identifier
);
}
goto
done
;
}
// "EXTENDCIRCUIT 0 router1,router2" ||
// "EXTENDCIRCUIT 0 router1,router2 PURPOSE=foo"
}
if
(
!
zero_circ
&&
!
(
circ
=
get_circ
(
smartlist_get
(
args
,
0
))))
{
connection_printf_to_buf
(
conn
,
"552 Unknown circuit
\"
%s
\"\r\n
"
,
(
char
*
)
smartlist_get
(
args
,
0
));
goto
done
;
}
smartlist_split_string
(
router_nicknames
,
smartlist_get
(
args
,
1
),
","
,
0
,
0
);
if
(
zero_circ
&&
smartlist_len
(
args
)
>
2
)
{
char
*
purp
=
smartlist_get
(
args
,
2
);
intended_purpose
=
circuit_purpose_from_string
(
purp
);
if
(
intended_purpose
==
CIRCUIT_PURPOSE_UNKNOWN
)
{
connection_printf_to_buf
(
conn
,
"552 Unknown purpose
\"
%s
\"\r\n
"
,
purp
);
SMARTLIST_FOREACH
(
args
,
char
*
,
cp
,
tor_free
(
cp
));
smartlist_free
(
args
);
goto
done
;
}
}
SMARTLIST_FOREACH
(
args
,
char
*
,
cp
,
tor_free
(
cp
));
smartlist_free
(
args
);
if
(
!
zero_circ
&&
!
circ
)
{
...
...
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