tor/changes
David Goulet c934fced31 relay: Report the entire content of a stats file
It turns out that 9 years ago, we stopped appending data into stats file and
rather overwrite everytime we have new stats (see commit
a6a127c833)

The load_stats_file() function was still thinking that we could have the same
line many times in the file which turns out to be false since 9 years ago.
However, that did not cause problem until IPv6 connection stats came along
which introduced a new line in conn-stats: "ipv6-conn-bi-direct ...".

Before, that file contained a single line starting with the tag
"conn-bi-direct".  That very tag appears also in the IPv6 tag (see above) so
the load_stats_file() function would consider that the IPv6 line as the last
tag to be appeneded to the file and fail to report the line above (for IPv4).
It would actually truncate the IPv6 line and report it (removing the "ipv6-"
part).

In other words, "conn-bi-direct" was not reported and instead
"ipv6-conn-bi-direct" was used without the "ipv6-" part.

This commit refactors the entire function so that now it looks for a
"timestamp tag" to validate and then if everything is fine, returns the entire
content of the file. The refactor simplifies the function, adds logging in
case of failures and modernize it in terms of coding standard.

Unit tests are also added that makes sure the loaded content matches the
entire file if timestamp validation passes.

Fixes #40226

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-12-21 13:18:20 -05:00
..
.dummy Add a .dummy file in the changes directory to stop git from removing it 2015-05-11 11:41:48 -04:00
bug30187 Implement WIN32 tor_cond_wait using condition variables #30187 2020-11-01 03:10:25 +00:00
bug32880 Use connection_or_change_state() in v3 handshaking state change 2020-11-12 12:06:34 -05:00
bug40015 Avoid asserts with flag 2020-10-27 14:47:42 -07:00
bug40017 Deliberately close OR connections if proxies leave extra data 2020-11-12 11:07:33 -05:00
bug40172 changes file for bug 40172. 2020-11-10 17:29:37 -05:00
bug40177 Fix another duplicate typedef. 2020-11-02 07:15:10 -05:00
bug40179_part1 Handle a change in the implementation of hashlib in Python 3.9 2020-11-05 09:34:36 -05:00
bug40179_part2 Make config/parse_tcp_proxy_line work in the presence of DNS hijacking 2020-11-05 09:47:32 -05:00
bug40187 Fake the current time when we're loading TEST_DESCRIPTORS. 2020-11-12 09:28:27 -05:00
ticket18888 Log a warning if Tor was built with any "risky" compile-time options 2020-10-28 11:34:30 -04:00
ticket22473 Remove "GETINFO network-status". 2020-10-28 11:48:23 -04:00
ticket25528 config: Bridge line with a transport must have a ClientTransportPlugin 2020-11-18 11:31:37 -05:00
ticket32178 Revise fix for bug 32178 (spaces at end of log msg). 2020-10-28 09:41:51 -04:00
ticket40071 changes: Add file for #40071 2020-11-17 07:58:26 -05:00
ticket40111 configure: Fix the --enable-static-tor switch 2020-12-08 09:14:49 -05:00
ticket40142 sendme: Turn log warning into debug 2020-11-17 13:23:34 -05:00
ticket40165 Changes file for #40165 (openssl deprecation warnings) 2020-10-28 10:34:22 -04:00
ticket40170 Fix a previously overstrict log message check. 2020-10-28 10:47:39 -04:00
ticket40174 configure: Check STAP_PROBEV macro when building with USDT tracing 2020-11-03 09:05:53 -05:00
ticket40183 port: Don't ignore ports of a different family 2020-11-13 08:38:22 -05:00
ticket40195 config: Really ignore non ORPorts when removing duplicates 2020-11-17 09:40:16 -05:00
ticket40205 relay: Avoid log reachability test for bandwidth test circuit 2020-12-08 14:51:31 -05:00
ticket40226 relay: Report the entire content of a stats file 2020-12-21 13:18:20 -05:00