aboutsummaryrefslogtreecommitdiff
path: root/src/or/rephist.c
AgeCommit message (Collapse)Author
2011-08-30Use %f with printf-style formatting, not %lfNick Mathewson
For printf, %f and %lf are synonymous, since floats are promoted to doubles when passed as varargs. It's only for scanf that we need to say "%lf" for doubles and "%f" for floats. Apparenly, some older compilers think it's naughty to say %lf and like to spew warnings about it. Found by grarpamp.
2011-07-19Specify text or binary mode in every start_writing_to_stdio_file callRobert Ransom
2011-06-14Make ControlSocketsGroupWritable work with User.Jérémy Bobbio
Original message from bug3393: check_private_dir() to ensure that ControlSocketsGroupWritable is safe to use. Unfortunately, check_private_dir() only checks against the currently running user… which can be root until privileges are dropped to the user and group configured by the User config option. The attached patch fixes the issue by adding a new effective_user argument to check_private_dir() and updating the callers. It might not be the best way to fix the issue, but it did in my tests. (Code by lunar; changelog by nickm)
2011-06-08Fix a rare memleak during stats writingSebastian Hahn
If rep_hist_buffer_stats_write() was called unitinitalized, we'd leak memory.
2011-06-08remove some dead code, found by coveritySebastian Hahn
2011-05-15Log descriptions of nodes, not just nicknames.Nick Mathewson
This patch introduces a few new functions in router.c to produce a more helpful description of a node than its nickame, and then tweaks nearly all log messages taking a nickname as an argument to call these functions instead. There are a few cases where I left the old log messages alone: in these cases, the nickname was that of an authority (whose nicknames are useful and unique), or the message already included an identity and/or an address. I might have missed a couple more too. This is a fix for bug 3045.
2011-05-11Merge remote-tracking branch 'public/3122_memcmp_squashed' into ↵Nick Mathewson
bug3122_memcmp_022 Conflicts throughout. All resolved in favor of taking HEAD and adding tor_mem* or fast_mem* ops as appropriate. src/common/Makefile.am src/or/circuitbuild.c src/or/directory.c src/or/dirserv.c src/or/dirvote.c src/or/networkstatus.c src/or/rendclient.c src/or/rendservice.c src/or/router.c src/or/routerlist.c src/or/routerparse.c src/or/test.c
2011-05-11Hand-conversion and audit phase of memcmp transitionNick Mathewson
Here I looked at the results of the automated conversion and cleaned them up as follows: If there was a tor_memcmp or tor_memeq that was in fact "safe"[*] I changed it to a fast_memcmp or fast_memeq. Otherwise if there was a tor_memcmp that could turn into a tor_memneq or tor_memeq, I converted it. This wants close attention. [*] I'm erring on the side of caution here, and leaving some things as tor_memcmp that could in my opinion use the data-dependent fast_memcmp variant.
2011-04-28Merge remote-tracking branch 'sebastian/bug2497' into maint-0.2.2Nick Mathewson
2011-04-26fix some comments before they create conflictsRoger Dingledine
2011-04-26Fix compilation in last patchNick Mathewson
2011-04-26Fix more of bug 2704Sebastian Hahn
The last entry of the *Maxima values in the state file was inflated by a factor of NUM_SECS_ROLLING_MEASURE (currently 10). This could lead to a wrong maximum value propagating through the state file history.
2011-04-19Prevent hugely inflated observed bandwidth valuesSebastian Hahn
When reading the bw history from the state file, we'd add the 900-second value as traffic that occured during one second. Fix that by adding the average value to each second. This bug was present since 0.2.0.5-alpha, but was hidden until 0.2.23-alpha when we started using the saved values.
2011-04-19Don't sometimes undercount bw averageSebastian Hahn
This fixes the first part of bug 2704. It should occur only rarely when no bw maxima are known. Bugfix on 0.2.2.23-alpha. Fixes bug 2704.
2011-04-19Don't report empty bw-history lines in extrainfoSebastian Hahn
Some tor relays would report lines like these in their extrainfo documents: dirreq-write-history 2011-03-14 16:46:44 (900 s) This was confusing to some people who look at the stats. It would happen whenever a relay first starts up, or when a relay has dirport disabled. Change this so that lines without actual bw entries are omitted. Implements ticket 2497.
2011-04-07Free circuits_for_buffer_stats on shutdownNick Mathewson
2011-04-07Fix up some cell-queue stats issues in rephist.cNick Mathewson
- Document the structure and variables. - Make circuits_for_buffer_stats into a static variable. - Don't die horribly if interval_length is 0. - Remove the unused local_circ_id field. - Reorder the fields of circ_buffer_stats_t for cleaner alignment layout.
2011-04-07Merge remote-tracking branch 'public/xxx_fixups' into maint-0.2.2Nick Mathewson
Conflicts: src/or/or.h
2011-03-30Use timevals, not time_t, when expiring circuits.Nick Mathewson
We've got millisecond timers now, we might as well use them. This change won't actually make circuits get expiered with microsecond precision, since we only call the expiry functions once per second. Still, it should avoid the situation where we have a circuit get expired too early because of rounding. A couple of the expiry functions now call tor_gettimeofday: this should be cheap since we're only doing it once per second. If it gets to be called more often, though, we should onsider having the current time be an argument again.
2011-03-25Triage the XXX022 and XXX021 comments remaining in the codeNick Mathewson
Remove some, postpone others, leave some alone. Now the only remaining XXX022s are ones that seem important to fix or investigate.
2011-03-16Remove a useless doxygen commentNick Mathewson
2011-03-11Clarify threat description and avoid negative uptimes.Nick Mathewson
2011-03-11Use observed instead of declared uptime for HSDirSebastian Hahn
It is important to verify the uptime claim of a relay instead of just trusting it, otherwise it becomes too easy to blackhole a specific hidden service. rephist already has data available that we can use here. Bugfix on 0.2.0.10-alpha.
2011-03-08Merge remote branch 'sebastian/bug1035' into maint-0.2.2Nick Mathewson
2011-03-01Avoid spurious bwhist parsing failuresNick Mathewson
This should fix a bug that special ran into, where if your state file didn't record period maxima, it would never decide that it had successfully parsed itself unless you got lucky with your uninitialized-variable values. This patch also tries to improve error messags in the case where a maximum value legitimately doesn't parse.
2011-02-26clarify an assertSebastian Hahn
also log about running changes, even on a bridge authority.
2011-02-24Fix two potential bugs in the bug1863 code.Karsten Loesing
2011-02-08Routers count as down when they change ORPort, tooSebastian Hahn
rransom noticed that a change of ORPort is just as bad as a change of IP address from a client's perspective, because both mean that the relay is not available to them while the new information hasn't propagated. Change the bug1035 fix accordingly. Also make sure we don't log a bridge's IP address (which might happen when we are the bridge authority).
2011-02-07Fix spelling and an unused #defineSebastian Hahn
both noticed by rransom
2011-01-10fix some spelling in rephist commentsNick Mathewson
2011-01-10Add Maxima lists to bandwidth state.Nick Mathewson
Right now, Tor routers don't save the maxima values from the bw_history_t between sessions. That's no good, since we use those values to determine bandwidth. This code adds a new BWHist.*Maximum set of values to the state file. If they're not present, we estimate them by taking the observed total bandwidth and dividing it by the period length, which provides a lower bound. This should fix bug 1863. I'm calling it a feature.
2011-01-10On bwhist state load failure, clear dir_read/write hist tooNick Mathewson
2011-01-10Fix bug when parsing bwhist with unexpected IntervalNick Mathewson
Previously, our state parsing code would fail to parse a bwhist correctly if the Interval was anything other than the default hardcoded 15 minutes. This change makes the parsing less incorrect, though the resulting history array might get strange values in it if the intervals don't match the one we're using. (That is, if stuff was generated in 15 minute intervals, and we read it into an array that expects 30 minute intervals, we're fine, since values can be combined pairwise. But if we generate data at 30 minute intervals and read it into 15 minute intervals, alternating buckets will be empty.) Bugfix on 0.1.1.11-alpha.
2011-01-10Turn the loop bodies of rep_hist_save/load_state into functionsNick Mathewson
The trick of looping from i=0..4 , switching on i to set up some variables, then running some common code is much better expressed by just calling a function 4 times with 4 sets of arguments. This should make the code a little easier to follow and maintain here.
2011-01-03Fix a function formatting warning in rephist.cNick Mathewson
2011-01-03Merge remote branch 'origin/maint-0.2.1' into maint-0.2.2Nick Mathewson
Conflicts: src/common/test.h src/or/test.c
2011-01-03Bump copyright statements to 2011Nick Mathewson
2010-12-27Fix compile without warnings on OS X 10.6Sebastian Hahn
2010-11-29comment karsten's bug2196 patch a littleNick Mathewson
2010-11-24Report only the top 10 ports in exit-port stats.Karsten Loesing
2010-11-22Handle negative run lengths in wfu/mtbf calculationsNick Mathewson
2010-11-22Treat routers whose IPs have changed as having been down for MTBF/routerinfoNick Mathewson
calculation purposes.
2010-11-15Try harder not to exceed the 50 KB extra-info descriptor limit.Karsten Loesing
Our checks that we don't exceed the 50 KB size limit of extra-info descriptors apparently failed. This patch fixes these checks and reserves another 250 bytes for appending the signature. Fixes bug 2183.
2010-08-18Merge commit 'karsten/dirbytes2'Nick Mathewson
Conflicts: src/or/rephist.h
2010-08-18Count bytes we spend on answering directory requests.Karsten Loesing
2010-08-15Give rep_hist_exit_stats_history() a better name.Karsten Loesing
2010-08-15Fix memory leak spotted by Nick.Karsten Loesing
2010-08-11Refactor exit port statistics code and add unit tests.Karsten Loesing
2010-08-05Move exit-stats code to the end of rephist.c.Karsten Loesing
2010-08-05Allow enabling or disabling *Statistics while Tor is running.Karsten Loesing
With this patch we stop scheduling when we should write statistics using a single timestamp in run_scheduled_events(). Instead, we remember when a statistics interval starts separately for each statistic type in geoip.c and rephist.c. Every time run_scheduled_events() tries to write stats to disk, it learns when it should schedule the next such attempt. This patch also enables all statistics to be stopped and restarted at a later time. This patch comes with a few refactorings, some of which were not easily doable without the patch.