Commit Graph

140 Commits

Author SHA1 Message Date
Nick Mathewson
4845ab53f0 Make all our struct names end with "_t".
This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
        address_ttl_s address_ttl_t \
        aes_cnt_cipher aes_cnt_cipher_t \
        authchallenge_data_s authchallenge_data_t \
        authenticate_data_s authenticate_data_t \
        cached_bw_event_s cached_bw_event_t \
        cbuf cbuf_t \
        cell_ewma_s cell_ewma_t \
        certs_data_s certs_data_t \
        channel_idmap_entry_s channel_idmap_entry_t \
        channel_listener_s channel_listener_t \
        channel_s channel_t \
        channel_tls_s channel_tls_t \
        circuit_build_times_s circuit_build_times_t \
        circuit_muxinfo_s circuit_muxinfo_t \
        circuitmux_policy_circ_data_s circuitmux_policy_circ_data_t \
        circuitmux_policy_data_s circuitmux_policy_data_t \
        circuitmux_policy_s circuitmux_policy_t \
        circuitmux_s circuitmux_t \
        coord coord_t \
        cpuworker_job_u cpuworker_job_u_t \
        cv_testinfo_s cv_testinfo_t \
        ddmap_entry_s ddmap_entry_t \
        dircollator_s dircollator_t \
        dist_ops dist_ops_t \
        ecdh_work_s ecdh_work_t \
        ewma_policy_circ_data_s ewma_policy_circ_data_t \
        ewma_policy_data_s ewma_policy_data_t \
        fp_pair_map_entry_s fp_pair_map_entry_t \
        fp_pair_map_s fp_pair_map_t \
        guard_selection_s guard_selection_t \
        mbw_cache_entry_s mbw_cache_entry_t \
        outbuf_table_ent_s outbuf_table_ent_t \
        queued_event_s queued_event_t \
        replyqueue_s replyqueue_t \
        rsa_work_s rsa_work_t \
        sandbox_cfg_elem sandbox_cfg_elem_t \
        scheduler_s scheduler_t \
        smp_param smp_param_t \
        socket_table_ent_s socket_table_ent_t \
        state_s state_t \
        threadpool_s threadpool_t \
        timeout_cb timeout_cb_t \
        tor_libevent_cfg tor_libevent_cfg_t \
        tor_threadlocal_s tor_threadlocal_t \
        url_table_ent_s url_table_ent_t \
        worker_state_s worker_state_t \
        workerthread_s workerthread_t \
        workqueue_entry_s workqueue_entry_t
2019-11-07 08:41:22 -05:00
Nick Mathewson
a33d1dce8a directory-level documentation for feature/* 2019-11-04 17:07:38 -05:00
Nick Mathewson
62a473debf Doxygen: Avoid ambiguity in @dir directives
This commit was automatically generated with:

find src -name '*.dox' |xargs perl -i -pe 's{\@dir ([^/])}{\@dir /$1};'
2019-11-04 10:23:36 -05:00
Nick Mathewson
7fc077ed25 Add stub directory-level documentation for most source directories
This includes app, core, feature, lib, and tools, but excludes
ext, test, and trunnel.

This was generated by the following shell script:

cd src
for dname in $(find lib core feature app tools -type d |grep -v \\.deps$); do
    keyword="$(echo "$dname" |sed -e "s/\//_/" )"
    target="${dname}/${keyword}.dox"
    echo "$target"
    cat <<EOF >"$target"
/**
@dir ${dname}
@brief ${dname}
**/
EOF

    git add "$target"
done
2019-11-04 07:40:14 -05:00
David Goulet
b98631d280 Merge branch 'tor-github/pr/1476' 2019-10-28 08:47:57 -04:00
Nick Mathewson
68f8086041 doxygen: add @file declarations for src/feature/
If a file doesn't use the file command (either \file or @file),
Doxygen won't try to process it.
2019-10-26 12:05:28 -04:00
Nick Mathewson
16dffa523e Rename confparse.[ch] identifiers to confmgt.[ch] identifiers.
This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
        confparse.h confmgt.h \
        confparse.c confmgt.c \
        CONFPARSE_PRIVATE CONFMGT_PRIVATE \
        TOR_CONFPARSE_H TOR_CONFMGT_H
2019-10-26 10:09:03 -04:00
Nick Mathewson
931a5db2a7 Re-run make autostyle. 2019-10-22 09:40:31 -04:00
Nick Mathewson
b2d487ae22 Merge branch 'ticket31705_v2' into ticket31705_v2_merged
Conflicts:
	src/feature/dirparse/authcert_parse.c
	src/feature/dirparse/ns_parse.c
	src/feature/hs/hs_service.c
	src/lib/conf/conftesting.h
	src/lib/log/log.h
	src/lib/thread/threads.h
	src/test/test_options.c

These conflicts were mostly related to autostyle improvements, with
one or two due to doxygen fixes.
2019-10-22 09:39:06 -04:00
Nick Mathewson
54c5366aa1 feature/control: wrap some problem macros in COCCI 2019-10-22 09:32:13 -04:00
Nick Mathewson
2d013bbe5c Merge remote-tracking branch 'tor-github/pr/1417' 2019-10-22 08:36:32 -04:00
teor
7a72e71f74
Merge remote-tracking branch 'tor-github/pr/1434' 2019-10-21 15:24:22 +10:00
teor
92fa5239fc
control/getinfo: Use standard error handling
Use BUG() for coding errors, and `< 0` for error checks.

Fix to 31684.
2019-10-21 13:57:02 +10:00
teor
3b2525c375
Fix changes file and string typos
Part of 31684.
2019-10-21 13:56:58 +10:00
AmreshVenugopal
6413b2102f
control: Add GETINFO support for dumping microdesc consensus
- Allows control port to read microdesc consensus using:
GETINFO dir/status-vote/microdesc/consensus

add: Helper function `getinfo_helper_current_consensus`
test: check if GETINFO commands return expected consensus data.

Resolves 31684.
2019-10-21 13:54:55 +10:00
Tobias Stoeckmann
d91ad5112e Check tor_vasprintf for error return values.
In case of error, a negative value will be returned or NULL written into
first supplied argument.

This patch uses both cases to comply with style in the specific files.

A tor_vasprintf error in process_vprintf would lead to a NULL dereference
later on in buf_add, because the return value -1 casted to size_t would
pass an assertion check inside of buf_add.

On the other hand, common systems will fail on such an operation, so it
is not a huge difference to a simple assertion. Yet it is better to
properly fail instead of relying on such behaviour on all systems.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2019-10-16 17:56:12 +02:00
David Goulet
52b7ae71b3 hs: ADD_ONION NEW:BEST now defaults to ED25519-V3
From RSA1024 (v2) to v3 now.

Closes #29669

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-03 15:43:03 -04:00
Nick Mathewson
5fd137c482 Merge remote-tracking branch 'tor-github/pr/1358' 2019-10-03 09:11:49 -04:00
teor
3d17fafa04
control/control: Refactor some error handling code
Split some protocol error handling out of
connection_control_process_inbuf().

This refactor reduces the size of a practracker exception.

Closes 31840.
2019-10-03 11:35:42 +10:00
teor
0cb57a4908
feature/control: add a missing word to the send_control_done() comment 2019-09-24 15:08:37 +10:00
Nick Mathewson
d6d3e829dd Merge branch 'maint-0.4.1' 2019-09-18 08:07:56 -04:00
Nick Mathewson
25af8ada30 Correct the syntax description for the MAPADDRESS command.
In 0.4.1.1-alpha I introduced a bug where we would require and
ignore a single positional argument.

Fixes bug 31772.
2019-09-17 19:26:45 -04:00
Nick Mathewson
a90d1918af Update #includes to point to confparse.h in its new location.
This commit was automatically generated by running
scripts/maint/rectify_include_paths.py .
2019-09-11 10:17:20 -04:00
teor
81256c079f nodelist: Move router_get_verbose_nickname() declaration
The declaration was in nodelist/routerinfo.h, but the implementation
was in nodelist/describe.h.

Part of 21003.
2019-08-19 16:40:41 +10:00
David Goulet
cfb15d513d Merge branch 'maint-0.4.1' 2019-07-25 09:03:01 -04:00
Nick Mathewson
2e55fa9587 Adjust log callback type to use log_domain_mask_t 2019-07-08 14:11:02 -04:00
Taylor Yu
5faf54970d Fix some onion helpers
Fix add_onion_helper_clientauth() and add_onion_helper_keyarg() to
explicitly call the appropriate control reply abstractions instead of
allocating a string to pass to their callers.

Part of ticket 30889.
2019-06-25 11:42:34 -05:00
Taylor Yu
e5e6953be7 Make control_write_reply() mockable
Part of ticket 30889.
2019-06-25 11:40:44 -05:00
Taylor Yu
0dd59fdb56 Clean up some uses of low-level control replies
Part of ticket 30889.
2019-06-25 11:39:59 -05:00
David Goulet
f7e8b3b68c Merge branch 'tor-github/pr/1040' 2019-06-11 11:59:39 -04:00
Taylor Yu
0bce0c339d Rework origin circuit tracking to use pubsub
Part of ticket 29976.
2019-06-11 11:59:30 -04:00
Taylor Yu
a8c0f4ddfe Rework orconn tracking to use pubsub
Part of ticket 29976.
2019-06-11 11:59:30 -04:00
Nick Mathewson
60213a3621 Run "make autostyle." 2019-06-05 09:33:35 -04:00
Nick Mathewson
2d66250d8a Remove want_cmddata from HSFETCH, which does not in fact want data
This looks a copy-and-paste error to me.  Fixes bug 30646; bugfix on
0.4.1.1-alpha.
2019-05-29 10:10:57 -04:00
Nick Mathewson
57ee0e3af9 Only reject POSTDESCRIPTOR purpose= when the purpose is unrecognized
Fixes bug 30580; bugfix on 0.4.1.1-alpha.
2019-05-23 08:24:29 -04: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
Nick Mathewson
6f42efaa59 Move voteflags.[ch] to become dirauth only.
For various reasons, this was a nontrivial movement.  There are
several places in the code where we do something like "update the
flags on this routerstatus or node if we're an authority", and at
least one where we pretended to be an authority when we weren't.
2019-05-02 09:22:13 -04:00
Taylor Yu
68caca58a8 Clean up formatting after Coccinelle
Clean up some minor formatting quirks after the Coccinelle run.
2019-04-30 13:18:46 -05:00
Taylor Yu
983452e221 Run Coccinelle for control.c refactor 2019-04-30 13:18:46 -05:00
Taylor Yu
769eb07a7a Manually fix some control replies
Manually fix up some reply-generating code that the Coccinelle scripts
won't match.  Some more complicated ones remain -- these are mostly
ones that accumulate data to send, and then call connection_buf_add()
or connection_write_str_to_buf() directly.
2019-04-30 13:18:46 -05:00
Taylor Yu
61976a4b1c Factor out control reply output
Create a set of abstractions for controller commands and events to
output replies to the control channel.  The control protocol has a
relatively consistent SMTP-like structure, so it's helpful when code
that implements control commands and events doesn't explicitly format
everything on its own.
2019-04-30 13:18:46 -05:00
Taylor Yu
482437754a Add clarifying comments to control_proto.c
Refer to control-spec.txt grammar productions in comments in
control_proto.c for clarity.
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
Taylor Yu
965c2064da Correct file name in doxygen comment 2019-04-30 13:18:46 -05: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
a5cced2b7a Extract keyword argument checking from argument parsing. 2019-04-25 14:13:03 -04:00
Nick Mathewson
a0299cd240 In control command api, rename "object" to "cmddata"
This makes it match control-spec.txt.
2019-04-25 14:13:03 -04:00
Nick Mathewson
ff9ba7d6c4 expand CMD_FL_WIPE to wipe the parsed arguments too 2019-04-25 14:13:03 -04:00
Nick Mathewson
88d22b898e Simplify handler logic in control_cmd.c
Now that the legacy handlers are gone, we can simplify the
structures and macros here.
2019-04-25 14:13:03 -04:00
Nick Mathewson
ddd33d39c7 Port the authenticate and authchallenge commands to the new parser
These two presented their own challenge, because of their use of
QString, and their distinguished handling of quoted versus
non-quoted values.
2019-04-25 14:13:03 -04:00