Commit Graph

756 Commits

Author SHA1 Message Date
teor
97da440f9e
scripts: Improve a usage message in git-push-all.sh
Part of 31677.
2019-09-10 12:12:04 +10:00
teor
51b792b000
scripts: Allow git-push-all.sh to be run from any directory
Closes 31678.
2019-09-10 12:10:28 +10:00
David Goulet
796a9b37ea Merge branch 'tor-github/pr/1264' 2019-09-09 14:53:12 -04:00
Nick Mathewson
a642a4cbd7 Merge branch 'ticket30924_042_04_squashed' into ticket30924_042_04_squashed_merged 2019-09-09 11:10:53 -04:00
David Goulet
a8a1ea4e0e practracker: Make you happy funny script
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-09-09 11:06:51 -04:00
Nick Mathewson
bc4ddbf4ac New practracker exceptions for dependency violations in headers
I've done this manually, since I don't want to override the existing
exceptions in this branch.
2019-09-05 16:17:50 -04:00
Nick Mathewson
318de94e49 Fix a bug in practracker's handling of .may_include in headers
I was expecting our filter code to work in a way it didn't.  I
thought that saying that DependencyViolation applied to "*" would
hit all of the files -- but actually, "*" wasn't implemented.  I had
to say "*.c" and "*.h"
2019-09-05 16:16:20 -04:00
teor
5c2941e69f
shellcheck: Add shellcheck to the pre-commit hook
* Move the shellcheck script from the Makefile to its own script file
* Reformat the shellcheck script so it's easier to read and modify
* Call the shellcheck script from the pre-commit hook

Fixes bug 30967; not in any released version of Tor.
2019-09-05 11:15:26 +10:00
David Goulet
6210c75076 Merge branch 'tor-github/pr/1246' 2019-09-04 08:27:36 -04:00
Nick Mathewson
03040903e6 practracker: handle empty files.
Previously practracker would fail on a file with no lines.
2019-09-02 15:40:35 -04:00
Nick Mathewson
3a2964577e practracker: Fix indentation in util.py
This commit only changes whitespace and removes a temporary comment.
2019-09-02 15:40:35 -04:00
Nick Mathewson
651bbe8a0d Practracker: only consider files under "src/" 2019-09-02 15:40:35 -04:00
Nick Mathewson
e3f7e5e65e practracker: make filename terminology uniform
Previously we often referred to "C files" and "H files", which is
more ambiguous than ".c files" and ".h files".
2019-08-29 09:20:27 -04:00
teor
e155598fe3
scripts/git: fix shellcheck issues in git-push-all.sh
Part of 31314.
2019-08-29 23:13:29 +10:00
teor
340ff7f5f8
scripts/git: fix an env var typo in git-merge-forward.sh
Part of 31314.
2019-08-29 22:58:53 +10:00
teor
d0e31b4d1f
scripts/git: Quote shell arguments where possible
Most shell arguments should be quoted to avoid mistakes.

But since all branch names are hard-coded, or supplied by the script user,
we don't need to be too concerned about command injection.

Quoting all shell arguments would take a major refactor.
(Probably using arrays.)

Part of 31314.
2019-08-29 22:53:44 +10:00
teor
664e6a392e
scripts/git: Improve usage documentation for merge-forward and push-all
Part of 31314.
2019-08-29 22:52:21 +10:00
teor
b47b71ad2f
scripts/git: Let git-push-all.sh skip unchanged test branches
Skip test branches that are the same as remote maint/release/master
branches.

Add a TOR_PUSH_SAME and -s argument to git-push-all.sh to change this
default.

Part of 31314.
2019-08-29 22:50:47 +10:00
teor
70387054b9
scripts/git: Make the git push command and args configurable
TOR_GIT_PUSH provides the git push command and default arguments.

Also fix handling of git-push-all.sh script arguments and arguments that
are passed through to $TOR_GIT_PUSH, using a "--" argument as a separator.

Fix on 29879.
2019-08-29 22:50:37 +10:00
teor
15782758c7
scripts/git: Allow git-merge-forward.sh to re-use existing test branches
Add a -u argument to git-merge-forward.sh, so that the script can
re-use existing test branches after a merge failure and fix.

Part of 31314.
2019-08-29 22:47:50 +10:00
teor
667311ebbd
scripts/git: Add test branch support to the git scripts
Add a -t <test-branch-prefix> argument to git-merge-forward.sh and
git-push-all.sh, which makes these scripts create, merge forward, and
push test branches.

Add a -r <remote-name> argument to git-push-all.sh, so the script can
push test branches to a personal remote.

Closes ticket 31314.
2019-08-29 22:47:43 +10:00
teor
c98724b022
scripts/git: Cleanup and fix minor git scripts issues
Fix typos, clean up formatting, rewrite some comments, add headings.

Preparation for 31314.
2019-08-29 22:42:37 +10:00
Nick Mathewson
c710518825 Add integration tests for new practracker features
These tests check our .may_include checking, and our header file
checking.

They do not pass yet: we have a bug in our filtering code.
2019-08-26 12:28:46 -04:00
George Kadianakis
859514d477 Merge branch 'tor-github/pr/1263' 2019-08-26 17:35:34 +03:00
Nick Mathewson
eff95429fd Merge remote-tracking branch 'tor-github/pr/1241' 2019-08-26 10:15:25 -04:00
Nick Mathewson
ca667b9a8a Fix/suppress shellcheck warnings in git-push-all.sh
(I've chosen to suppress some instances rather than 'fix' them,
since the fix would require arrays or major refactoring.)

Fixes bug 31519; bug not in any released Tor.
2019-08-26 09:58:38 -04:00
David Goulet
24bc2cd7b5 Merge branch 'tor-github/pr/1254' 2019-08-26 09:38:24 -04:00
Nick Mathewson
7a45c9c1d2 Merge remote-tracking branch 'tor-github/pr/1215' 2019-08-24 16:30:55 -04:00
Nick Mathewson
2780cbb9cb Merge branch 'ticket30935' into ticket30935_merged 2019-08-22 17:25:35 -04:00
David Goulet
d475d7c2fb Merge branch 'tor-github/pr/1244' 2019-08-22 17:10:22 -04:00
Nick Mathewson
5b3741e05a Document new practracker violation types, and add a practracker readme
Closes ticket 31476.
2019-08-21 10:17:26 -04:00
Nick Mathewson
cc48eff2d3 Merge branch 'ticket31176' into ticket31176_merged 2019-08-21 09:46:20 -04:00
Nick Mathewson
edf5a327c5 Merge branch 'ticket30914' into ticket30914_merged 2019-08-20 13:57:05 -04:00
teor
bdcccb9776
scripts/git: Remove a duplicate practracker call from the pre-push hook
The pre-push hook already calls the pre-commit hook, which calls
practracker.

Also update the script comments to avoid similar issues in future.

Fixes bug 31462; bugfix on 0.4.1.1-alpha.
2019-08-20 12:21:02 +10:00
Nick Mathewson
29bd43ab03 Merge remote-tracking branch 'tor-github/pr/1224' 2019-08-19 11:26:58 -04:00
Nick Mathewson
e7aabfce61 Merge remote-tracking branch 'tor-github/pr/1235' 2019-08-19 11:10:21 -04:00
George Kadianakis
e411fcabd7 Merge branch 'tor-github/pr/1220' 2019-08-19 18:02:44 +03:00
George Kadianakis
b257e8e553 Merge remote-tracking branch 'mike/bug31356+logs-rebased2' into bug31356_final 2019-08-19 17:53:00 +03:00
David Goulet
81e37b81f1 practracker: Make exceptions.txt happy
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-19 09:47:52 -04:00
Mike Perry
6deba34fee Practracker 2019-08-12 14:06:08 -05:00
Neel
64d2133a61 Move the connection_edge_process_relay_cell() assignments out of if statements in circuit_receive_relay_cell() 2019-08-08 13:05:46 -04:00
Nick Mathewson
71e5af0221 pre-push hook: Only run practracker when a special file is present
Closes ticket 30979.
2019-08-08 11:36:05 -04:00
teor
d6202d3128
scripts/git: add TOR_PUSH_DELAY to git-push-all.sh
Add a TOR_PUSH_DELAY variable to git-push-all.sh, which makes the script
push master and maint branches with a delay between each branch. These
delays trigger the CI jobs in a set order, which should show the most
likely failures first.

Also:
* make pushes atomic by default, and
* make the script pass any command-line arguments to git push.

Closes ticket 29879.
2019-08-08 18:59:44 +10:00
Nick Mathewson
35cfe2e776 Merge remote-tracking branch 'tor-github/pr/1208' 2019-08-07 09:49:49 -04:00
David Goulet
2b225aaa77 practracker: Make it happy after rebase
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-06 08:01:26 -04:00
David Goulet
c5b00c5a51 hs-v3: Add consensus parameters for DoS defenses
Part of #15516

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-06 07:58:14 -04:00
George Kadianakis
d7afdb3b0f Merge branch 'tor-github/pr/1195' 2019-08-06 14:51:47 +03:00
Nick Mathewson
0f4b245b20 update exceptions file for depencency violations 2019-08-05 17:48:06 -04:00
Nick Mathewson
a5971d732e Move include-violation checking into its own function. 2019-08-05 17:48:06 -04:00
Nick Mathewson
2a3c727dfe Make includes interface more like the rest of practracker
Everything else assumes that somebody else will open the file for it.
2019-08-05 17:48:06 -04:00
Nick Mathewson
6b26281b50 practracker: a violation of a .may_include rule is now a problem.
We treat "0" as the expected number, and warn about everything
else.  The problem type is "dependency-violation".
2019-08-05 17:48:06 -04:00
Nick Mathewson
720951f056 Teach include-checker about advisory rules
A .may_includes file can be "advisory", which means that some
violations of the rules are expected.  We will track these
violations with practracker, not as automatic errors.
2019-08-05 17:04:00 -04:00
Nick Mathewson
9abbde2c24 Update pre-commit hook to find checkIncludes in its new location
Also add a temporary script to redirect the hook, if people don't
upgrade for a bit.
2019-08-05 14:12:39 -04:00
Nick Mathewson
6fb74753c2 Move checkIncludes inside practracker
Update the makefile accordingly.
2019-08-05 14:10:40 -04:00
Nick Mathewson
9eb12dde18 checkIncludes: add a real main function and CLI 2019-08-05 13:40:59 -04:00
Nick Mathewson
3f4e89a7ab checkIncludes: refactor to use error-iteration style
This makes checkIncludes match practracker more closely, and lets us
eliminate a global.
2019-08-05 13:40:59 -04:00
Nick Mathewson
47d9bcfef8 checkIncludes: Separate file-handling from rule-handling
This is our shift from directory-at-a-time processing to
file-at-a-time processing.
2019-08-05 13:40:59 -04:00
Nick Mathewson
65a69f861e checkIncludes.py: extract topological sort code
Our topological sort code really deserves a function of its own.

Additionally, don't print from inside the topological sort code:
instead, return a result, and let the caller print it.
2019-08-05 13:40:59 -04:00
Nick Mathewson
3f35ac772b checkIncludes: introduce rules-file caching.
We'll want this so that we can have each file evaluated
independently, rather than a directory at a time.
2019-08-05 11:35:13 -04:00
Nick Mathewson
475749351d Move the executable part of checkIncludes.py inside an if block.
I'll want to make this block into a series of functions in a
subsequent commit, but I'm doing this separately to get the
indentation change out of the way.

This branch will end up with making checkIncludes.py an integrated
part of practracker, for ticket 31176.
2019-08-05 11:30:22 -04:00
George Kadianakis
ce477da8a7 Ignore regular cells in padding circuits.
Padding circuits were regular cells that got closed before their padding
machine could finish. This means that they can still receive regular cells from
their past life, but they have no way or reason to answer them anymore. Hence
let's ignore them before they even get to the proper subsystems.
2019-08-05 18:03:23 +03:00
Nick Mathewson
d5ccd0fa84 Add exceptions for current .h practracker problems. 2019-08-05 10:32:39 -04:00
Nick Mathewson
9a1e9b1d6c Teach practracker about .h files
I'm using 500 as a file size limit, and 15 as an include limit.
This affects comparatively few files, but I think they are the worst
ones.

Closes ticket 31175.
2019-08-05 10:31:02 -04:00
Nick Mathewson
1440c2cb34 Adjust test_practracker.sh to work on windows
The required change is to ignore trailing CRs when diffing files.
2019-08-01 15:43:54 -04:00
Nick Mathewson
fa60fee8d5 practracker: Add unit tests to test script, and test script to makefile
This makes all of the practracker tests get run by make check, and
hence by our CI.

Closes ticket 31304.
2019-08-01 14:01:43 -04:00
Nick Mathewson
5d98b54725 Port practracker unit tests to python 3 2019-08-01 14:00:48 -04:00
Nick Mathewson
e57209dc32 Regenerate the practracker exceptions.txt file 2019-08-01 10:25:42 -04:00
Nick Mathewson
a4e4896e66 practracker: restore exceptions.txt header when running --regen 2019-08-01 10:25:20 -04:00
David Goulet
c4864de573 Merge branch 'tor-github/pr/1177' 2019-08-01 10:18:10 -04:00
Nick Mathewson
19536fd18d practracker: replaces "overstrict" with "overbroad"
I had the logic reversed here.
2019-08-01 09:35:33 -04:00
Nick Mathewson
3221dc1b32 Lower check of TOR_DISABLE_PRACTRACKER
Since we sometimes call practracker directly, that's where we should
check the TOR_DISABLE_PRACTRACKER envvar.
2019-08-01 08:40:56 -04:00
Nick Mathewson
8d3f3e5d30 Practracker: add an integration test.
This test runs practracker with a set of 0 thresholds, to make sure
that it enumerates all its values right.  It tries running with an
empty exceptions file, and with an exceptions file that covers
_some_ of the data, and it makes sure that the outputs are as expected.
2019-07-30 12:14:46 -04:00
Nick Mathewson
a79e2c2975 practracker: better warning/regen handling
Now that there is only one toplevel place where we print problems,
we can redirect just that one print to a file when we are
regenerating the exceptions.txt file.  Previously we redirected
sys.stdout, which is naughty, and forced us to send warnings (and
warnings alone) to stderr.
2019-07-30 11:54:05 -04:00
Nick Mathewson
3f303c102a Practracker: new flags to control output.
These flags let you suppress the message about the number of
problems and warnings, and let you control the thresholds above
which something counts as a problem.

I need this for testing.
2019-07-30 11:49:50 -04:00
Nick Mathewson
31a0b81854 practracker: Remove problemvault global. 2019-07-30 10:17:56 -04:00
Nick Mathewson
65cb4fead5 practracker: Move the warning/error distinction to a higher level.
Previously warnings were generated by magic inside ProblemVault; now
they're printed on demand.
2019-07-30 10:17:47 -04:00
Nick Mathewson
bcef6a5802 practracker: Refactor flow to use generators
Instead of having "consider" functions that have to call a global
ProblemVault, we can now generate all the metrics for the code
separately from the decision about what to do for them.
2019-07-30 09:24:41 -04:00
Nick Mathewson
ec13a727b0 practracker: Rename "Problem" to "Item".
I'm about to refactor the code into a set of iterators that yield
*all* the metrics for the code, and then add a filter on top of that
to return the problems.
2019-07-30 09:03:58 -04:00
David Goulet
57f955a38b practracker: Make it happing for circuitpadding.c
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-07-25 10:28:38 -04:00
Nick Mathewson
f306d12b58 Refactor handling of TestingTorNetwork
Previously, when TestingTorNetwork was set, we would manually adjust
the initvalue members of a bunch of other config_var_t, and then
re-run the early parts or parsing the options.

Now we treat the initvalue fields as immutable, but instead assign
to them in options_init(), as early as possible.  Rather than
re-running the early parts of options, we just re-call the
options_init_from_string() function.

This patch de-kludges some of our code pretty handily.  I think it
could later handle authorities and fallbacks, but for now I think we
should leave those alone.
2019-07-24 15:21:56 -04:00
George Kadianakis
91f04d006b Merge branch 'tor-github/pr/1165' 2019-07-24 12:29:57 +03:00
Nick Mathewson
f6db290e5a Merge remote-tracking branch 'tor-github/pr/1186' 2019-07-23 12:30:19 -04:00
David Goulet
ef2dd1ba96 Merge branch 'tor-github/pr/1116' 2019-07-23 09:46:29 -04:00
George Kadianakis
fdfee3d06f Changes file for #31113. 2019-07-23 12:44:43 +03:00
Nick Mathewson
d6a3636cdc Add a TOR_DISABLE_PRACTRACKER envvar for use by folks who don't care
Fixes part of bug 30752
2019-07-18 09:28:08 -04:00
Nick Mathewson
6303c9aa26 Practracker: add tolerances for exceptions
When an exception is present, we can now violate the limit by a little
bit and only produce a warning.  The strict flag overrides this
behavior.

I've given file sizes a 2% tolerances and function sizes/include
counts a 10% tolerance.

Part of 30752
2019-07-18 09:28:08 -04:00
Nick Mathewson
a5e1fa3a03 Practracker: add a --list-overstrict option
This option lists every exception that is stricter than it needs to
be.

Part of 30752
2019-07-18 09:28:08 -04:00
Nick Mathewson
43f163de80 Practracker: improve exclude-directory logic
Instead of excluding directories at the last minute if they happen
to appear in our filenames, we exclude them early, before recursing
into all their subdirectories.

Part of 29746.
2019-07-17 14:33:49 +02:00
Nick Mathewson
f93057fc0a Pracktracker: give the number of new errors found.
Part of 29746.
2019-07-17 14:33:49 +02:00
Nick Mathewson
86d3d310f5 Practracker: allow tabs in include lines
This isn't actually something that Tor does, but it's cleaner to do
it this way.  Part of 29746.
2019-07-17 14:33:49 +02:00
Nick Mathewson
4c09532996 Fix practracker_tests.py and practracker line counting.
The practracker_tests.py unit test file called a function by its old
name.

Also, practracker counted functions as starting one line after the
function name, and ending with the closing brace.  Now they start
with the open brace and end with the closing brace.
2019-07-17 14:33:49 +02:00
George Kadianakis
5303dbe624 Merge branch 'tor-github/pr/1152' 2019-07-04 17:14:06 +03:00
Nick Mathewson
fdbd139495 Merge remote-tracking branch 'tor-github/pr/1136' 2019-07-02 13:33:50 -04:00
rl1987
59e523f058 Early exit from post-merge git hook script when not merging to master 2019-07-02 20:06:23 +03:00
Nick Mathewson
0fa3dc3228 begin_cell_parse(): Add an assertion to please coverity.
Coverity doesn't understand that if begin_cell_parse() returns 0 and
sets is_begindir to 0, its address field will always be set.

Fixes bug 30126; bugfix on 0.2.4.7-alpha; Fixes CID 1447296.
2019-06-28 11:29:51 -04:00
Nick Mathewson
089ef46063 Merge branch 'bug30721_squashed' 2019-06-26 09:57:20 -04:00
teor
fb93646c1c resolve: split sub-functions out of tor_addr_lookup()
And remove the practracker exception for tor_addr_lookup().

Cleanup after 30721.
2019-06-26 09:55:37 -04:00
Nick Mathewson
0fe9657c8c Merge remote-tracking branch 'tor-github/pr/1119' 2019-06-26 09:50:00 -04:00
Nick Mathewson
a91ed23403 Use structvar to find the types for config vars. 2019-06-25 12:51:25 -04:00
teor
c131b0763e
stats: add comments about the required chunk structure in extra info files
These comments should prevent future instances of 30958.

And allow a larger file in practracker.

Follow up after 30958.
2019-06-25 12:30:59 +10:00
Nick Mathewson
c60a85d22a Add a "typed_var" abstraction to implement lvalue access in C.
Right now, this has been done at a high level by confparse.c, but it
makes more sense to lower it.

This API is radically un-typesafe as it stands; we'll be wrapping it
in a safer API as we do #30914 and lower the struct manipulation
code as well.

Closes ticket 30864.
2019-06-24 17:50:43 -04:00
Nick Mathewson
81d16d8d0c checkSpace.pl: Allow 'bool' before a space and an open-paren
We need this so we can declare function pointers returning bool
without upsetting our style checker. :/
2019-06-24 15:11:57 -04:00
teor
45be44ed9c stats: Split extrainfo_dump_to_string() into smaller functions.
Closes ticket 30956.
2019-06-24 20:47:44 +10:00
David Goulet
9644f3462a Make the great grand practracker happy...
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-06-19 07:42:30 -04:00
David Goulet
05b6f73f12 Make the great grand practracker happy...
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-06-19 07:41:45 -04:00
Nick Mathewson
93ca08d66c Merge branch 'ticket29533_squashed' 2019-06-17 08:56:13 -04:00
rl1987
e8da65ee91 Fix SC2034 in pre-push.git-hook 2019-06-17 08:56:06 -04:00
Nick Mathewson
52d386c9b0 Merge remote-tracking branch 'tor-github/pr/1100' 2019-06-17 08:54:12 -04:00
teor
16e71c7fb0
practracker: accept an extra line in nt_service_install()
Part of 30799.
2019-06-13 18:23:50 +10:00
George Kadianakis
438b7eec85 Merge branch 'tor-github/pr/1099' 2019-06-12 13:02:49 +03:00
David Goulet
e9d99d2e15 Merge branch 'tor-github/pr/1083' 2019-06-11 11:43:15 -04:00
Nick Mathewson
eb02c323eb Merge branch 'maint-0.4.1' 2019-06-11 08:41:55 -04:00
teor
396134188f
Stop hard-coding env vars in the git scripts
Set the env vars:
* TOR_MASTER_NAME to override the tor master branch name, and
* TOR_WKT_NAME to override the worktree path

Fixes bug 30841; bugfix on 0.4.0.1-alpha.
2019-06-11 14:34:44 +10:00
teor
973800b847
scripts/git: Stop hard-coding the bash path in the git scripts
Some OSes don't have bash in /usr/bin, others have an ancient bash at
this path.

Fixes bug 30840; bugfix on 0.4.0.1-alpha.
2019-06-11 14:29:10 +10:00
Nick Mathewson
0635170cf1 Add an environment variable to set GIT_PATH in git scripts 2019-06-10 09:05:26 -04:00
Nick Mathewson
bbddda3a18 push-all: Use TOR_UPSTREAM_REMOTE_NAME to override UPSTREAM_BRANCH
We already allow this override in our pre-push hook, so let's allow
it here too.

(I call my upstream branches "origin")
2019-06-10 09:01:17 -04:00
Nick Mathewson
46da530431 Update git scripts for new versions
{maint,release}-0.4.1 are now real

{maint,release}-0.3.4 are now EOL

Closes ticket 30822
2019-06-10 09:01:17 -04:00
teor
6be9d3aed8
practracker: accept one extra line in routerlist.c
practracker exception for 30780.
2019-06-06 18:24:17 +10:00
teor
b07b1a4f6d
practracker: accept 3 extra lines in router_parse_entry_from_string()
practracker exception for bug 30781.
2019-06-06 13:42:30 +10:00
Nick Mathewson
2926f49b24 Regenerate practracker excpetions file 2019-06-05 09:34:14 -04:00
Nick Mathewson
ae490189f8 practracker update 2019-06-05 09:06:43 -04:00
Nick Mathewson
0c16ec4c07 Merge branch 'bug30286_2_squashed' 2019-06-05 08:32:39 -04:00
rl1987
e8aab46a3a Document TOR_UPSTREAM_REMOTE_NAME env variable 2019-06-05 08:29:55 -04:00
George Kadianakis
99bf3d8e14 Merge branch 'tor-github/pr/1072' 2019-06-05 14:40:38 +03:00
Nick Mathewson
dc5cdde60c update practracker 2019-06-04 08:29:43 -04:00
Nick Mathewson
5e594831c7 Practracker excpetions. 2019-05-31 12:41:44 -04:00
George Kadianakis
70553a9134 Merge branch 'tor-github/pr/1037' 2019-05-29 21:25:32 +03:00
David Goulet
ff9aa32143 Merge branch 'tor-github/pr/1047' 2019-05-28 14:59:07 -04:00
Nick Mathewson
0bc1241494 Make sure that we send at least some random data in RELAY_DATA cells
Proposal 289 prevents SENDME-flooding by requiring the other side to
authenticate the data it has received.  But this data won't actually
be random if they are downloading a known resource.  "No problem",
we said, "let's fell the empty parts of our cells with some
randomness!" and we did that in #26871.

Unfortunately, if the relay data payloads are all completely full,
there won't be any empty parts for us to randomize.

Therefore, we now pick random "randomness windows" between
CIRCWINDOW_INCREMENT/2 and CIRCWINDOW_INCREMENT. We remember whether we have
sent a cell containing at least 16 bytes of randomness in that window.  If we
haven't, then when the window is exhausted, we send one.  (This window approach
is designed to lower the number of rng checks we have to do.  The number 16 is
pulled out of a hat to change the attacker's guessing difficulty to
"impossible".)

Implements 28646.
2019-05-27 14:20:07 +03:00
Nick Mathewson
7893f2cd73 cov-test-determinism: use the same RNG seed as in travis.yml
We added this facility so that we could get deterministic PRNG
behavior for coverage testing on tests that use a replaced PRNG.
We need to have our coverage determinism tool test for this as well.
2019-05-23 14:36:01 -04:00
Nick Mathewson
e6b862e6a8 Merge branch 'ticket30428_041_02_squashed' 2019-05-22 11:48:43 -04:00
David Goulet
3835a3acf5 sendme: Properly record SENDMEs on both edges
Turns out that we were only recording the "b_digest" but to have
bidirectionnal authenticated SENDMEs, we need to use the "f_digest" in the
forward cell situation.

Because of the cpath refactoring, this commit plays with the crypt_path_ and
relay_crypto_t API a little bit in order to respect the abstractions.

Previously, we would record the cell digest as the SENDME digest in the
decrypt cell function but to avoid code duplication (both directions needs to
record), we now do that right after iff the cell is recognized (at the edge).
It is now done in circuit_receive_relay_cell() instead.

We now also record the cell digest as the SENDME digest in both relay cell
encryption functions since they are split depending on the direction.
relay_encrypt_cell_outbound() and relay_encrypt_cell_inbound() need to
consider recording the cell digest depending on their direction (f vs b
digest).

Fixes #30428

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-05-22 11:47:20 -04:00
David Goulet
59b9eecc19 sendme: Record cell digest on both client and exit
It turns out that only the exit side is validating the authenticated SENDME v1
logic and never the client side. Which means that if a client ever uploaded
data towards an exit, the authenticated SENDME logic wouldn't apply.

For this to work, we have to record the cell digest client side as well which
introduced a new function that supports both type of edges.

This also removes a test that is not valid anymore which was that we didn't
allow cell recording on an origin circuit (client).

Part of #30428

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-05-22 11:47:20 -04:00
Nick Mathewson
66eb0a5a32 updateCopyright: look at the current year. 2019-05-20 12:02:20 -04:00
Nick Mathewson
2f31c8146f rectify_include_paths: warn instead of aborting on duplicate headers
We have two sendme.h files at the moment; we should fix that, but
not in this branch.
2019-05-20 11:52:45 -04:00
Mike Perry
84274000d8 Yes, these functions really do have to be this long. 2019-05-16 20:29:09 +00:00
David Goulet
39a14421b1 Merge branch 'tor-github/pr/1021'
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-05-15 15:35:22 -04:00
George Kadianakis
d71fa707dd Merge branch 'bug28780-squashed3-rebased' into bug28780_rebase 2019-05-15 16:46:51 +03:00
Mike Perry
ff2a980935 The practracker beatings will continue until the files get smaller. 2019-05-15 16:44:59 +03:00
Mike Perry
5f47d582d5 Practracker beatings are even more fun when they get caused mid-PR due to a github auto-rebase of a PR
Because github PRs choose the most recent origin/master at the time of the PR
(and for any fixups pushed to a PR later to send to CI), there are tons of
conflicts and unexpected practracker issues.

This means CI can suddenly fail after fixups to a branch that pass locally.

Then CI fails and we have to close and re-open the PR.
2019-05-15 15:10:48 +03:00
Nick Mathewson
b9f50a2d77 update practracker for tor_init 2019-05-14 19:56:20 -04:00
Nick Mathewson
dd537ba35f Update practracker for 30452 2019-05-14 19:22:35 -04:00
Nick Mathewson
43d4119454 Merge remote-tracking branch 'tor-github/pr/1004' 2019-05-14 11:43:10 -04:00
Nick Mathewson
9ad2eb8f73 Merge branch 'bug28683_30173_29203_squashed' 2019-05-13 14:33:31 -04:00
Mike Perry
507df74b31 The practracker beatings will continue until the functions get smaller. 2019-05-13 14:30:35 -04:00
Nick Mathewson
c6523a6398 Merge remote-tracking branch 'tor-github/pr/998' 2019-05-13 14:25:54 -04:00
rl1987
6f1527f888 pre-push.git-hook: Check remote name to see if it's upstream 2019-05-11 18:58:14 +03:00
George Kadianakis
501d1ae0bd Merge branch 'tor-github/pr/973' 2019-05-10 12:49:01 +03:00
Neel Chauhan
3cafdeb8c0 Only call tor_addr_parse() in circuit_is_acceptable() when needed 2019-05-07 11:52:56 -04:00
George Kadianakis
7f2cd6545c Hiding crypt_path_t: Hide 'crypto' usage in sendme.c 2019-05-03 18:29:51 +03:00
George Kadianakis
593b7726e9 Hiding crypt_path_t: Trivial changes to satisfy check-local. 2019-05-03 18:15:26 +03:00
David Goulet
b3492d53c3 Merge branch 'tor-github/pr/984'
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-05-03 10:56:12 -04:00
George Kadianakis
b2c2cb9287 Merge branch 'tor-github/pr/986' 2019-05-02 18:12:52 +03:00
Nick Mathewson
0f365e2f46 practracker updates. 2019-05-02 09:22:13 -04:00
Mike Perry
e1771aeb51 The practracker beatings will continue until our files get smaller. 2019-05-01 21:04:40 +00:00
rl1987
d91deeee45 pre-push.git-hook: Allow fixup and squash commits when pushing to non-upstream branches 2019-05-01 14:01:30 +03:00
Taylor Yu
58ec88e806 Coccinelle scripts for control.c refactor 2019-04-30 13:18:46 -05:00
Taylor Yu
8e7316bae4 Split reply formatting out of control_fmt.c
Split the core reply formatting code out of control_fmt.c into
control_proto.c.  The remaining code in control_format.c deals with
specific subsystems and will eventually move to join those subsystems.
2019-04-30 13:18:46 -05:00
George Kadianakis
9084a90b00 Merge branch 'tor-github/pr/936' 2019-04-30 19:21:15 +03:00
George Kadianakis
a44aca5453 Merge branch 'tor-github/pr/993' 2019-04-30 19:13:57 +03:00
George Kadianakis
86f8dfe419 Merge branch 'tor-github/pr/983' 2019-04-30 19:13:30 +03:00
David Goulet
43c119fedb Merge branch 'tor-github/pr/980'
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-04-30 11:50:36 -04:00
Nick Mathewson
b5a62b1ef5 Move dirauth periodic events into dirauth module.
Closes ticket 30294.
2019-04-30 11:14:59 -04:00
David Goulet
535ba0d7c5 practracker: Update exceptions for #26288
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-04-29 12:27:53 -04:00
Nick Mathewson
1d44ac9acd Make nodelist_get_list() return a const pointer. 2019-04-26 10:36:49 -04:00
Nick Mathewson
01b07c548b Use parsing code for the simpler controller commands.
(This should be all of the command that work nicely with positional
arguments only.)

Some of these commands should probably treat extra arguments as
incorrect, but for now I'm trying to be careful not to break
any existing users.
2019-04-25 14:13:03 -04:00
Nick Mathewson
dbfe1a14e4 When parsing a multiline controller command, be careful with linebreaks
The first line break in particular was mishandled: it was discarded
if no arguments came before it, which made it impossible to
distinguish arguments from the first line of the body.

To solve this, we need to allocate a copy of the command rather than
using NUL to separate it, since we might have "COMMAND\n" as our input.

Fixes ticket 29984.
2019-04-25 14:13:03 -04:00
Nick Mathewson
d0a0f3e8cd Allow do_resolve() to be longer. 2019-04-24 14:15:18 -04:00
David Goulet
4587e67dfd Merge branch 'tor-github/pr/930' 2019-04-24 09:39:32 -04:00
teor
de91b83849
practracker: Accept ~80 extra lines in src/core/or/policies.c
Part of 23588.
2019-04-24 17:31:02 +10:00
Nick Mathewson
15d4238383 Merge remote-tracking branch 'tor-github/pr/944' 2019-04-23 15:39:23 -04:00
Nick Mathewson
b0459de217 Merge branch 'ticket30051_take2_squashed' 2019-04-23 12:51:44 -04:00
rl1987
a85cd5b41b Call practracker from pre-push and pre-commit hooks 2019-04-23 12:51:29 -04:00
Nick Mathewson
a7599c5be2 Merge remote-tracking branch 'tor-github/pr/962' 2019-04-23 12:48:37 -04:00
teor
bffba9d26f
practracker: accept more lines in microdescs_parse_from_string()
Part of 28223.
2019-04-19 10:34:16 +10:00
George Kadianakis
78223ab0fc Merge branch 'tor-github/pr/938' 2019-04-18 13:23:32 +03:00
George Kadianakis
2db9bb02c7 Merge branch 'tor-github/pr/925' 2019-04-18 13:22:54 +03:00
teor
f12b990bbf
practracker: accept the extra 25 line string from 27821 2019-04-17 18:44:26 +10:00
Neel Chauhan
f643020e64 Update practracker exceptions.txt for policies.c 2019-04-16 09:16:52 -04:00
Nick Mathewson
82b690d7da Merge remote-tracking branch 'tor-github/pr/910' 2019-04-16 08:09:20 -04:00
Neel Chauhan
d4f980d29a Update exceptions.txt for Bug #29613 2019-04-14 14:27:29 -04:00
Nick Mathewson
7332346002 Changes file and practracker updates for 30149. 2019-04-11 18:58:44 -04:00
Nick Mathewson
e39b53ef7d changes file and practracker updates for 30147. 2019-04-11 17:59:21 -04:00
Nick Mathewson
98e08b452f Fix pre-commit hook to correctly allow empty changes files.
Fixes bug 30120; bugfix not in any released Tor.
2019-04-10 11:49:23 -04:00
teor
5722c6d12d
scripts: In git-pull-all.sh, also fetch the latest tor-github pull requests
Implements ticket 30114.
2019-04-10 19:26:47 +10:00
teor
60c46c6cd0
practracker: accept 4 extra lines due to 30041 2019-04-10 18:29:11 +10:00
teor
7741b21d0e
practracker: accept 6 extra lines in tortls_nss.c:tor_tls_context_new()
These lines were added to fix bug 29241.
2019-04-06 12:26:30 +10:00
rl1987
705c1c28c7 Call pre-commit hook from pre-push script 2019-04-05 18:59:48 +03:00
Nick Mathewson
f021ca2d52 practracker: allow config.c to be a touch larger. 2019-04-05 09:59:45 -04:00
Nick Mathewson
ee6f54ff3f Merge remote-tracking branch 'tor-github/pr/860' 2019-04-03 08:33:40 -04:00
Nick Mathewson
f0e39df5ce allow circuituse.c to get even longer. 2019-03-29 14:30:33 -04:00
teor
a10d4adc25
Stop assuming that /usr/bin/python3 exists
For scripts that work with python2, use /usr/bin/python.
Otherwise, use /usr/bin/env python3.

Fixes bug 29913; bugfix on 0.2.5.3-alpha.
2019-03-27 11:07:55 +10:00
Nick Mathewson
7b9732063c practracker updates from messaging_v3 merge
(main.c is a bit better, but shutdown.c is ugly)
2019-03-26 20:14:21 -04:00
teor
beceb079e1
practracker: regen in master, for bug28925 merged to 0.4.0 and later
python3 scripts/maint/practracker/practracker.py --regen
2019-03-27 09:40:03 +10:00
Nick Mathewson
7502e5467b Regenerate practracker file from scratch.
Closes ticket 29912.

Since this is the first time that practracker has had a stable
output order, this diff will be larger than usual.
2019-03-26 19:28:35 -04:00
Nick Mathewson
300e7d8c99 Merge branch 'practracker_regen' 2019-03-26 19:27:54 -04:00
George Kadianakis
989b6325d6 Merge branch 'tor-github/pr/842' 2019-03-26 16:41:07 +02:00
Nick Mathewson
e028ec6bb7 Add new exceptions.txt entries 2019-03-26 09:43:46 -04:00
Nick Mathewson
39e4494344 practracker: update usage note in docstring 2019-03-26 08:42:14 -04:00
teor
ec736f8729
Merge remote-tracking branch 'tor-github/pr/833' 2019-03-26 13:02:37 +10:00