aboutsummaryrefslogtreecommitdiff
path: root/src/or/geoip.c
AgeCommit message (Collapse)Author
2012-07-17Change all SMARTLIST_FOREACH loops of >=10 lines to use BEGIN/ENDNick Mathewson
The SMARTLIST_FOREACH macro is more convenient than BEGIN/END when you have a nice short loop body, but using it for long bodies makes your preprocessor tell the compiler that all the code is on the same line. That causes grief, since compiler warnings and debugger lines will all refer to that one line. So, here's a new style rule: SMARTLIST_FOREACH blocks need to be short.
2012-06-05Merge remote-tracking branch 'public/format_doubles'Nick Mathewson
Conflicts: src/or/geoip.c
2012-06-04Update copyright dates to 2012; add a few missing copyright statementsNick Mathewson
2012-06-04Add about 60 more DOCDOC comments to 0.2.3Nick Mathewson
Also, try to resolve some doxygen issues. First, define a magic "This is doxygen!" macro so that we take the correct branch in various #if/#else/#endifs in order to get the right documentation. Second, add in a few grouping @{ and @} entries in order to get some variables and fields to get grouped together.
2012-05-16Use %f, not %lf when formatting doublesNick Mathewson
%f is correct; %lf is only needed with scanf. Apparently, on some old BSDs, %lf is deprecated. Didn't we do this before? Yes, we did. But we only got the instances of %lf, not more complicated things like %.5lf . This patch tries to get everything. Based on a patch for 3894 by grarpamp.
2012-02-09Simply geoip_get_country_by_addr based on arma's comment.Karsten Loesing
2012-02-09Add braces around a two-line code block.Karsten Loesing
2012-02-09Count IPv6 connections in bridge and entry stats.Karsten Loesing
2012-01-18Rename nonconformant identifiers.Nick Mathewson
Fixes bug 4893. These changes are pure mechanical, and were generated with this perl script: /usr/bin/perl -w -i.bak -p s/crypto_pk_env_t/crypto_pk_t/g; s/crypto_dh_env_t/crypto_dh_t/g; s/crypto_cipher_env_t/crypto_cipher_t/g; s/crypto_digest_env_t/crypto_digest_t/g; s/aes_free_cipher/aes_cipher_free/g; s/crypto_free_cipher_env/crypto_cipher_free/g; s/crypto_free_digest_env/crypto_digest_free/g; s/crypto_free_pk_env/crypto_pk_free/g; s/_crypto_dh_env_get_dh/_crypto_dh_get_dh/g; s/_crypto_new_pk_env_rsa/_crypto_new_pk_from_rsa/g; s/_crypto_pk_env_get_evp_pkey/_crypto_pk_get_evp_pkey/g; s/_crypto_pk_env_get_rsa/_crypto_pk_get_rsa/g; s/crypto_new_cipher_env/crypto_cipher_new/g; s/crypto_new_digest_env/crypto_digest_new/g; s/crypto_new_digest256_env/crypto_digest256_new/g; s/crypto_new_pk_env/crypto_pk_new/g; s/crypto_create_crypto_env/crypto_cipher_new/g; s/connection_create_listener/connection_listener_new/g; s/smartlist_create/smartlist_new/g; s/transport_create/transport_new/g;
2012-01-16Try to use smartlist_add_asprintf consistentlyNick Mathewson
(To ensure correctness, in every case, make sure that the temporary variable is deleted, renamed, or lowered in scope, so we can't have any bugs related to accidentally relying on the no-longer-filled variable.)
2011-10-21Check for jumping clock in *format_*stats functionsSebastian Hahn
None of these were real bugs (yet), because the callers made sure everything was fine. Make it more explicit. Suggested by Nick
2011-08-04Clean up bridge-stats code.Karsten Loesing
Only write a bridge-stats string if bridge stats have been initialized. This behavior is similar to dirreq-stats, entry-stats, etc. Also add a few unit tests for the bridge-stats code.
2011-08-04Separate generation of an entry-stats string from writing it to disk.Karsten Loesing
This commit is similar to the previous two commits for dirreq-stats, but for entry-stats.
2011-08-04Separate generation of a dirreq-stats string from writing it to disk.Karsten Loesing
This patch separates the generation of a dirreq-stats string from actually writing it to disk. The new geoip_format_dirreq_stats() generates a dirreq-stats string that geoip_dirreq_stats_write() writes to disk. All the state changing (e.g., resetting the dirreq-stats history and initializing the next measurement interval) takes place in geoip_dirreq_stats_write(). That allows us to finally test the dirreq-stats code better.
2011-08-04Clean up geoip_dirreq_stats_write().Karsten Loesing
We later want to split this function into one function that generates the dirreq-stats string and one that writes it to disk.
2011-08-04Replace files in stats/ rather than appending to them.Karsten Loesing
Right now, we append statistics to files in the stats/ directory for half of the statistics, whereas we overwrite these files for the other half. In particular, we append buffer, dirreq, and entry stats and overwrite exit, connection, and bridge stats. Appending to files was useful when we didn't include stats in extra-info descriptors, because otherwise we'd have to copy them away to prevent Tor from overwriting them. But now that we include statistics in extra-info descriptors, it makes no sense to keep the old statistics forever. We should change the behavior to overwriting instead of appending for all statistics. Implements #2930.
2011-07-19Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-07-19Specify text or binary mode in every start_writing_to_stdio_file callRobert Ransom
2011-07-01Replace 4 more sscanf()s with tor_sscanf()Nick Mathewson
For some inexplicable reason, Coverity departs from its usual standards of avoiding false positives here, and warns about all sscanf usage, even when the formatting strings are totally safe. Addresses CID # 447, 446.
2011-06-14Make the get_options() return constNick Mathewson
This lets us make a lot of other stuff const, allows the compiler to generate (slightly) better code, and will make me get slightly fewer patches from folks who stick mutable stuff into or_options_t. const: because not every input is an output!
2011-06-14Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
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-04-07Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
Conflicts: src/common/address.c src/common/compat_libevent.c src/common/memarea.c src/common/util.h src/or/buffers.c src/or/circuitbuild.c src/or/circuituse.c src/or/connection.c src/or/directory.c src/or/networkstatus.c src/or/or.h src/or/routerlist.c
2011-04-07Merge remote-tracking branch 'public/xxx_fixups' into maint-0.2.2Nick Mathewson
Conflicts: src/or/or.h
2011-04-07Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-04-07Allow controllers a more up-to-date view of bridge usage.Nick Mathewson
Instead of answering GETINFO requests about our geoip usage only after running for 24 hours, this patch makes us answer GETINFO requests immediately. We still round and quantize as before. Implements bug2711. Also, refactor the heck out of the bridge usage formatting code. No longer should we need to do a generate-parse-and-regenerate cycle to get the controller string, and that lets us simplify the code a lot.
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-18Merge remote branch 'origin/maint-0.2.2'Nick Mathewson
Trivial Conflicts: configure.in
2011-03-18Fix signed/unsigned compare warningNick Mathewson
2011-03-17Futz with the clang patch a bit and tidy some geoip.c stuffNick Mathewson
2011-03-10Fix two compile warnings when using clangSebastian Hahn
Issue found by Steven Murdoch
2011-01-25Merge remote branch 'origin/maint-0.2.2'Nick Mathewson
Conflicts: src/or/geoip.c
2011-01-25Tell which geoip file we're parsingSebastian Hahn
2011-01-03Merge remote branch 'origin/maint-0.2.2'Nick 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-11-20Do cloexec on socketpairs and stdio filesNick Mathewson
2010-11-12Add two fixes to the new geoip-db-digest line.Karsten Loesing
2010-11-09Add GeoIP file digest to extra-info descriptor.Karsten Loesing
2010-09-27Fix a bridge segfaultSebastian Hahn
When we enabled support to change statistic options without restarting Tor we forgot to initialize geoip_countries. Fix that.
2010-09-20A start at a patch for bug 1943 (alignment issues)Roger Dingledine
2010-08-16Fix misplaced labelsSebastian Hahn
2010-08-13minor formatting / comment fixesRoger Dingledine
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.
2010-07-31Set up the geoip country table right even if not called normallyNick Mathewson
2010-07-31Move the "nowhereland" logic into geoip.cNick Mathewson
2010-07-31Make "Nowhere" explicitly listable in torrc.Nick Mathewson
We already had the country code ?? indicating an unknown country, so all we needed to do to make unknown countries excludable was to make the ?? code discoverable.
2010-07-27Create control.hSebastian Hahn
2010-07-27Create config.hSebastian Hahn
2010-07-27Create routerlist.hSebastian Hahn