Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Core
Tor
Commits
f720a5a4
Commit
f720a5a4
authored
Jul 05, 2018
by
Nick Mathewson
👁
Browse files
Fix everything that previously referred to src/or
parent
5f51c2de
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Doxyfile.in
View file @
f720a5a4
This diff is collapsed.
Click to expand it.
configure.ac
View file @
f720a5a4
...
...
@@ -5,7 +5,7 @@ dnl See LICENSE for licensing information
AC_PREREQ([2.63])
AC_INIT([tor],[0.3.5.0-alpha-dev])
AC_CONFIG_SRCDIR([src/or
/
main.c])
AC_CONFIG_SRCDIR([src/
app/main/t
or
_
main.c])
AC_CONFIG_MACRO_DIR([m4])
# "foreign" means we don't follow GNU package layout standards
...
...
doc/HACKING/Module.md
View file @
f720a5a4
...
...
@@ -12,9 +12,9 @@ Currently, there is only one module:
-
Directory Authority subsystem (dirauth)
It is located in its own directory in
`src/
or
/dirauth/`
. To disable it,
one
need to pass
`--disable-module-dirauth`
at configure time. All modules
are
currently enabled by default.
It is located in its own directory in
`src/
feature
/dirauth/`
. To disable it,
one
need to pass
`--disable-module-dirauth`
at configure time. All modules
are
currently enabled by default.
## Build System ##
...
...
@@ -32,10 +32,10 @@ The changes to the build system are pretty straightforward.
the C code to conditionally compile things for your module. And the
`BUILD_MODULE_<name>`
is also defined for automake files (e.g: include.am).
3.
In the
`src/or/include.am`
file, locate the
`MODULE_DIRAUTH_SOURCES`
value.
You need to create your own
`_SOURCES`
variable for your module
and then
conditionally add the it to
`LIBTOR_A_SOURCES`
if you should
build the
module.
3.
In the
`src/
c
or
e
/include.am`
file, locate the
`MODULE_DIRAUTH_SOURCES`
value.
You need to create your own
`_SOURCES`
variable for your module
and then
conditionally add the it to
`LIBTOR_A_SOURCES`
if you should
build the
module.
It is then
**very**
important to add your SOURCES variable to
`src_or_libtor_testing_a_SOURCES`
so the tests can build it.
...
...
@@ -51,7 +51,7 @@ always build everything in order to tests everything.
## Coding ##
As mentioned above, a module must be isolated in its own directory (name of
the module) in
`src/
or
/`
.
the module) in
`src/
feature
/`
.
There are couples of "rules" you want to follow:
...
...
@@ -87,10 +87,10 @@ There are couples of "rules" you want to follow:
making the code much more difficult to follow/understand.
*
It is possible that you end up with code that needs to be used by the rest
of the code base but is still part of your module. As a good example, if
you
look at
`src/
or
/shared_random_client.c`
: it contains code needed
by the hidden
service subsystem but mainly related to the shared random
subsystem very
specific to the dirauth module.
of the code base but is still part of your module. As a good example, if
you
look at
`src/
feature
/shared_random_client.c`
: it contains code needed
by the hidden
service subsystem but mainly related to the shared random
subsystem very
specific to the dirauth module.
This is fine but try to keep it as lean as possible and never use the same
filename as the one in the module. For example, this is a bad idea and
...
...
@@ -102,7 +102,7 @@ There are couples of "rules" you want to follow:
*
When you include headers from the module,
**always**
use the full module
path in your statement. Example:
`#include "dirauth/dirvote.h"`
`#include "
feature/
dirauth/dirvote.h"`
The main reason is that we do
**not**
add the module include path by default
so it needs to be specified. But also, it helps our human brain understand
...
...
doc/HACKING/Tracing.md
View file @
f720a5a4
...
...
@@ -69,7 +69,7 @@ configure option:
## Instrument Tor ##
This is pretty easy. Let's say you want to add a trace event in
`src/
or
/rendcache.c`
, you only have to add this include statement:
`src/
feature/rend
/rendcache.c`
, you only have to add this include statement:
#include "trace/events.h"
...
...
scripts/maint/fallback.whitelist
View file @
f720a5a4
...
...
@@ -12,7 +12,8 @@
# To replace this list with the hard-coded fallback list (for testing), use
# a command similar to:
# cat src/or/fallback_dirs.inc | grep \" | grep -v weight | tr -d '\n' | \
# cat src/app/config/fallback_dirs.inc | grep \" | grep -v weight | \
# tr -d '\n' | \
# sed 's/"" / /g' | sed 's/""/"/g' | tr \" '\n' | grep -v '^$' \
# > scripts/maint/fallback.whitelist
#
...
...
scripts/maint/updateFallbackDirs.py
View file @
f720a5a4
...
...
@@ -3,11 +3,11 @@
# Usage:
#
# Regenerate the list:
# scripts/maint/updateFallbackDirs.py > src/
or
/fallback_dirs.inc 2> fallback_dirs.log
# scripts/maint/updateFallbackDirs.py > src/
app/config
/fallback_dirs.inc 2> fallback_dirs.log
#
# Check the existing list:
# scripts/maint/updateFallbackDirs.py check_existing > fallback_dirs.inc.ok 2> fallback_dirs.log
# mv fallback_dirs.inc.ok src/
or
/fallback_dirs.inc
# mv fallback_dirs.inc.ok src/
app/config
/fallback_dirs.inc
#
# This script should be run from a stable, reliable network connection,
# with no other network activity (and not over tor).
...
...
@@ -112,7 +112,7 @@ DOWNLOAD_MICRODESC_CONSENSUS = True
# expired consensus. This makes them fail the download check.
# We use a tolerance of 0, so that 0.2.x series relays also fail the download
# check if they serve an expired consensus.
CONSENSUS_EXPIRY_TOLERANCE
=
0
CONSENSUS_EXPIRY_TOLERANCE
=
0
# Output fallback name, flags, bandwidth, and ContactInfo in a C comment?
OUTPUT_COMMENTS
=
True
if
OUTPUT_CANDIDATES
else
False
...
...
@@ -161,7 +161,7 @@ BLACKLIST_EXCLUDES_WHITELIST_ENTRIES = True
WHITELIST_FILE_NAME
=
'scripts/maint/fallback.whitelist'
BLACKLIST_FILE_NAME
=
'scripts/maint/fallback.blacklist'
FALLBACK_FILE_NAME
=
'src/
or
/fallback_dirs.inc'
FALLBACK_FILE_NAME
=
'src/
app/config
/fallback_dirs.inc'
# The number of bytes we'll read from a filter file before giving up
MAX_LIST_FILE_SIZE
=
1024
*
1024
...
...
scripts/test/coverage
View file @
f720a5a4
...
...
@@ -7,7 +7,7 @@
dst
=
$1
for
fn
in
src/or/
*
.c src/
or
/
*
/
*
.c src/
common
/
*
.c src/lib/
*
/
*
.c
;
do
for
fn
in
src/
c
or
e/
*
/
*
.c src/
feature
/
*
/
*
.c src/
app/
*
/
*
.c src/lib/
*
/
*
.c
;
do
BN
=
`
basename
$fn
`
DN
=
`
dirname
$fn
`
F
=
`
echo
$BN
|
sed
-e
's/\.c$//;'
`
...
...
src/core/or/git_revision.c
View file @
f720a5a4
...
...
@@ -7,11 +7,10 @@
/** String describing which Tor Git repository version the source was
* built from. This string is generated by a bit of shell kludging in
* src/or/include.am, and is usually right.
* src/
c
or
e
/include.am, and is usually right.
*/
const
char
tor_git_revision
[]
=
#ifndef _MSC_VER
#include
"micro-revision.i"
#endif
""
;
src/rust/external/external.rs
View file @
f720a5a4
...
...
@@ -11,7 +11,7 @@ extern "C" {
)
->
c_int
;
}
/// Wrap calls to tor_version_as_new_as, defined in
src/or/
routerparse.c
/// Wrap calls to tor_version_as_new_as, defined in routerparse.c
pub
fn
c_tor_version_as_new_as
(
platform
:
&
str
,
cutoff
:
&
str
)
->
bool
{
// CHK: These functions should log a warning if an error occurs. This
// can be added when integration with tor's logger is added to rust
...
...
src/rust/protover/ffi.rs
View file @
f720a5a4
...
...
@@ -3,7 +3,7 @@
//! FFI functions, only to be called from C.
//!
//! Equivalent C versions of this api are in `
src/or/
protover.c`
//! Equivalent C versions of this api are in `protover.c`
use
libc
::{
c_char
,
c_int
,
uint32_t
};
use
std
::
ffi
::
CStr
;
...
...
@@ -18,7 +18,7 @@ use protover::*;
/// Translate C enums to Rust Proto enums, using the integer value of the C
/// enum to map to its associated Rust enum.
///
/// C_RUST_COUPLED:
src/or/
protover.h `protocol_type_t`
/// C_RUST_COUPLED: protover.h `protocol_type_t`
fn
translate_to_rust
(
c_proto
:
uint32_t
)
->
Result
<
Protocol
,
ProtoverError
>
{
match
c_proto
{
0
=>
Ok
(
Protocol
::
Link
),
...
...
src/rust/protover/protover.rs
View file @
f720a5a4
...
...
@@ -19,13 +19,13 @@ use protoset::ProtoSet;
/// Authorities should use this to decide whether to guess proto lines.
///
/// C_RUST_COUPLED:
///
src/or/
protover.h `FIRST_TOR_VERSION_TO_ADVERTISE_PROTOCOLS`
/// protover.h `FIRST_TOR_VERSION_TO_ADVERTISE_PROTOCOLS`
const
FIRST_TOR_VERSION_TO_ADVERTISE_PROTOCOLS
:
&
'static
str
=
"0.2.9.3-alpha"
;
/// The maximum number of subprotocol version numbers we will attempt to expand
/// before concluding that someone is trying to DoS us
///
/// C_RUST_COUPLED:
src/or/
protover.c `MAX_PROTOCOLS_TO_EXPAND`
/// C_RUST_COUPLED: protover.c `MAX_PROTOCOLS_TO_EXPAND`
const
MAX_PROTOCOLS_TO_EXPAND
:
usize
=
(
1
<<
16
);
/// The maximum size an `UnknownProtocol`'s name may be.
...
...
@@ -33,7 +33,7 @@ pub(crate) const MAX_PROTOCOL_NAME_LENGTH: usize = 100;
/// Known subprotocols in Tor. Indicates which subprotocol a relay supports.
///
/// C_RUST_COUPLED:
src/or/
protover.h `protocol_type_t`
/// C_RUST_COUPLED: protover.h `protocol_type_t`
#[derive(Clone,
Hash,
Eq,
PartialEq,
Debug)]
pub
enum
Protocol
{
Cons
,
...
...
@@ -57,7 +57,7 @@ impl fmt::Display for Protocol {
/// Translates a string representation of a protocol into a Proto type.
/// Error if the string is an unrecognized protocol name.
///
/// C_RUST_COUPLED:
src/or/
protover.c `PROTOCOL_NAMES`
/// C_RUST_COUPLED: protover.c `PROTOCOL_NAMES`
impl
FromStr
for
Protocol
{
type
Err
=
ProtoverError
;
...
...
@@ -130,7 +130,7 @@ impl From<Protocol> for UnknownProtocol {
/// Rust code can use the `&'static CStr` as a normal `&'a str` by
/// calling `protover::get_supported_protocols`.
///
// C_RUST_COUPLED:
src/or/
protover.c `protover_get_supported_protocols`
// C_RUST_COUPLED: protover.c `protover_get_supported_protocols`
pub
(
crate
)
fn
get_supported_protocols_cstr
()
->
&
'static
CStr
{
cstr!
(
"Cons=1-2
\
Desc=1-2
\
...
...
@@ -601,7 +601,7 @@ impl ProtoverVote {
/// let vote = ProtoverVote::compute(protos, &2);
/// assert_eq!("Link=3", vote.to_string());
/// ```
// C_RUST_COUPLED:
/src/or/
protover.c protover_compute_vote
// C_RUST_COUPLED: protover.c protover_compute_vote
pub
fn
compute
(
proto_entries
:
&
[
UnvalidatedProtoEntry
],
threshold
:
&
usize
)
->
UnvalidatedProtoEntry
{
let
mut
all_count
:
ProtoverVote
=
ProtoverVote
::
default
();
let
mut
final_output
:
UnvalidatedProtoEntry
=
UnvalidatedProtoEntry
::
default
();
...
...
src/rust/tor_log/tor_log.rs
View file @
f720a5a4
...
...
@@ -129,7 +129,7 @@ pub mod log {
}
/// The main entry point into Tor's logger. When in non-test mode, this
/// will link directly with `tor_log_string` in
/src/
or
/
log.c
/// will link directly with `tor_log_string` in
t
orlog.c
extern
"C"
{
pub
fn
tor_log_string
(
severity
:
c_int
,
...
...
src/test/test-network.sh
View file @
f720a5a4
...
...
@@ -52,12 +52,12 @@ done
# - if $PWD looks like a tor build directory, set it to $PWD, or
# - unset $TOR_DIR, and let chutney fall back to finding tor binaries in $PATH
if
[
!
-d
"
$TOR_DIR
"
]
;
then
if
[
-d
"
$BUILDDIR
/src/or"
-a
-d
"
$BUILDDIR
/src/tools"
]
;
then
if
[
-d
"
$BUILDDIR
/src/
core/
or"
-a
-d
"
$BUILDDIR
/src/tools"
]
;
then
# Choose the build directory
# But only if it looks like one
$ECHO
"
$myname
:
\$
TOR_DIR not set, trying
\$
BUILDDIR"
TOR_DIR
=
"
$BUILDDIR
"
elif
[
-d
"
$PWD
/src/or"
-a
-d
"
$PWD
/src/tools"
]
;
then
elif
[
-d
"
$PWD
/src/
core/
or"
-a
-d
"
$PWD
/src/tools"
]
;
then
# Guess the tor directory is the current directory
# But only if it looks like one
$ECHO
"
$myname
:
\$
TOR_DIR not set, trying
\$
PWD"
...
...
src/test/test_bridges.c
View file @
f720a5a4
...
...
@@ -3,7 +3,7 @@
/**
* \file test_bridges.c
* \brief Unittests for code in
src/or/
bridges.c
* \brief Unittests for code in bridges.c
**/
#define TOR_BRIDGES_PRIVATE
...
...
@@ -609,4 +609,3 @@ struct testcase_t bridges_tests[] = {
B_TEST
(
transport_is_needed
,
0
),
END_OF_TESTCASES
};
src/test/test_router.c
View file @
f720a5a4
...
...
@@ -4,7 +4,7 @@
/**
* \file test_router.c
* \brief Unittests for code in
src/or/
router.c
* \brief Unittests for code in router.c
**/
#include
"core/or/or.h"
...
...
@@ -111,4 +111,3 @@ struct testcase_t router_tests[] = {
ROUTER_TEST
(
dump_router_to_string_no_bridge_distribution_method
,
TT_FORK
),
END_OF_TESTCASES
};
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment