summaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
AgeCommit message (Collapse)Author
2012-08-09Don't infer we have a FooPort from the presence of a FooPort lineNick Mathewson
Thanks to the changes we started making with SocksPort and friends in 0.2.3.3-alpha, any of our code that did "if (options->Sockport)" became wrong, since "SocksPort 0" would make that test true whereas using the default SocksPort value would make it false. (We didn't actually do "if (options->SockPort)" but we did have tests for TransPort. When we moved DirPort, ORPort, and ControlPort over to the same system in 0.2.3.9-alpha, the problem got worse, since our code is littered with checks for DirPort and ORPort as booleans. This code renames the current linelist-based FooPort options to FooPort_lines, and adds new FooPort_set options which get set at parse-and-validate time on the or_options_t. FooPort_set is true iff we will actually try to open a listener of the given type. (I renamed the FooPort options rather than leave them alone so that every previous user of a FooPort would need to get inspected, and so that any new code that forgetfully uses FooPort will need fail to compile.) Fix for bug 6507.
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-15Triage the XXX023 and XXX022 comments: postpone many.Nick Mathewson
2012-06-07Merge remote-tracking branch 'arma/bug3886'Nick Mathewson
Conflicts: src/or/dirserv.c
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-05-16Merge remote-tracking branch 'public/bug2297'Nick Mathewson
2012-04-24peel off some unnecessary parensRoger Dingledine
2012-04-11Obsolete GiveGuardFlagTo_CVE_2011_2768_VulnerableRelaysNick Mathewson
Closes ticket 4572.
2012-03-30Exits don't need to fetch certs for unknown authoritiesNick Mathewson
When we started RefuseUnknownExits back in 0.2.2.11-alpha, we started making exits act like they cache directory info (since they need an up-to-date idea of who is really a router). But this included fetching needless (unrecognized) authorities' certs, which doesn't make any sense for them. This is related to, but not necessarily the same as, the issue that Ian reported for bug #2297. (This patch is based on a patch from a user who I believe has asked not to be named. If I'm wrong about that, please add the appropriate name onto the changelog.)
2012-03-30Move router lookup to _after_ we assert that its argument is setNick Mathewson
A previous commit in the 5527 branch had moved router_get_mutable_by_digest(digest_rcvd) to happen before we did tor_assert(digest_rcvd), which would have defeated the purpose of the assert.
2012-03-29checking "same addr/port but with nonmatching keys" is obsoleteRoger Dingledine
Specifically, I believe it dates back to when extend cells had address:port but no digest in them. The special edge case is certainly not worth the complexity these days.
2012-03-29simplify furtherRoger Dingledine
2012-03-29Refactor dirserv_orconn_tls_done().Linus Nordberg
Look up the router using the digest instead of looping over all routers.
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-16Convert instances of tor_snprintf+strdup into tor_asprintfNick Mathewson
These were found by looking for tor_snprintf() instances that were followed closely by tor_strdup(), though I probably converted some other snprintfs as well.
2012-01-16Provide consensus params to constrain the threshold for FastNick Mathewson
resolves ticket 3946
2011-12-28Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-12-27Authorities reject insecure Tors.Nick Mathewson
This patch should make us reject every Tor that was vulnerable to CVE-2011-0427. Additionally, it makes us reject every Tor that couldn't handle RELAY_EARLY cells, which helps with proposal 110 (#4339).
2011-11-30Initial hacking for proposal 186.Nick Mathewson
This code handles the new ORPort options, and incidentally makes all remaining port types use the new port configuration systems. There are some rough edges! It doesn't do well in the case where your Address says one thing but you say to Advertise another ORPort. It doesn't handle AllAddrs. It doesn't actually advertise anything besides the first listed advertised IPv4 ORPort and DirPort. It doesn't do port forwarding to them either. It's not tested either, it needs more documentation, and it probably forgets to put the milk back in the refrigerator.
2011-11-27Add the ability to append and clear linelist options from cmdlineNick Mathewson
This will be important for getting stuff to work right across zones.
2011-11-23Fix a compile warning on 64bit OS XSebastian Hahn
Backport of 68475fc5c5a806ebbb5657de1667dab2c3e09b7c which accidentally only made it into master. Fixes bug 4547. Bug isn't in any released version.
2011-11-23Fix a compile warning on 64bit OS Xtor-0.2.3.8-alphaSebastian Hahn
2011-11-21apparently or_options_t likes being a const in masterRoger Dingledine
2011-11-21Merge branch 'maint-0.2.2'Roger Dingledine
Conflicts: src/or/dirserv.c
2011-11-21parameterize bw cutoffs to guarantee Fast and Guard flagsRoger Dingledine
Now it will be easier for researchers to simulate Tor networks with different values. Resolves ticket 4484.
2011-11-16trivial code cleanup in generate_v2_networkstatus_opinion()Roger Dingledine
2011-11-02Fix a check-spaces complaintSebastian Hahn
2011-11-02Resolve a crash when running as dirauthSebastian Hahn
When we're asked for our own descriptor, don't crash.
2011-10-27Merge branch 'maint-0.2.2_secfix' into master_secfixSebastian Hahn
Conflicts: src/common/tortls.c src/or/connection_or.c src/or/dirserv.c src/or/or.h
2011-10-26Add option to give guard flag to relays without the CVE-2011-2768 fixRobert Ransom
This way, all of the DA operators can upgrade immediately, without nuking every client's set of entry guards as soon as a majority of them upgrade. Until enough guards have upgraded, a majority of dirauths should set this config option so that there are still enough guards in the network. After a few days pass, all dirauths should use the default.
2011-10-26Don't give the Guard flag to relays without the CVE-2011-2768 fixRobert Ransom
2011-10-25Add percentiles to the desc stats reportingSebastian Hahn
To get a better idea what's going on on Tonga, add some code to report how often the most and least frequently fetched descriptor was fetched, as well as 25, 50, 75 percentile. Also ensure we only count bridge descriptors here.
2011-10-21Add new stats type: descriptor fetch statsSebastian Hahn
This is used for the bridge authority currently, to get a better intuition on how many descriptors are actually fetched from it and how many fetches happen in total. Implements ticket 4200.
2011-10-21remove code related to tracking descriptor serving timesSebastian Hahn
This had broken due to bitrot - it doesn't know about microdescriptors at all, and afaik hasn't generally been used in ages.
2011-10-11Fix names of functions that convert strings to addrsNick Mathewson
Now let's have "lookup" indicate that there can be a hostname resolution, and "parse" indicate that there wasn't. Previously, we had one "lookup" function that did resolution; four "parse" functions, half of which did resolution; and a "from_str()" function that didn't do resolution. That's confusing and error-prone! The code changes in this commit are exactly the result of this perl script, run under "perl -p -i.bak" : s/tor_addr_port_parse/tor_addr_port_lookup/g; s/parse_addr_port(?=[^_])/addr_port_lookup/g; s/tor_addr_from_str/tor_addr_parse/g; This patch leaves aton and pton alone: their naming convention and behavior is is determined by the sockets API. More renaming may be needed.
2011-09-07Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
Conflicts: src/or/dirserv.c src/or/networkstatus.c Conflicts were related to routerinfo->node shift.
2011-09-07Merge remote-tracking branch 'public/bug2649_squashed' into maint-0.2.2Nick Mathewson
2011-09-01let private tor networks more reliably handle hidden servicesRoger Dingledine
this is a tweak on the fix in f87c6f100d (see also #2088)
2011-07-01Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-07-01Use strlcpy when copying node IDs into measured_bw_line_tNick Mathewson
We were using strncpy before, which isn't our style for stuff like this. This isn't a bug, though: before calling strncpy, we were checking that strlen(src) was indeed == HEX_DIGEST_LEN, which is less than sizeof(dst), so there was no way we could fail to NUL-terminate. Still, strncpy(a,b,sizeof(a)) is an idiom that we ought to squash everyplace. Fixes CID #427.
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-03Add a VoteOnHidServDirectoriesV2 configuration optionRobert Ransom
2011-06-02Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
Conflicts: src/or/dirserv.c
2011-06-02Fix unit test failure in dir/formatsSebastian Hahn
options->DirPort is 0 in the unit tests, so router_get_advertised_dir_port() would return 0 so we wouldn't pick a dirport. This isn't what we want for the unit tests. Fixes bug introduced in 95ac3ea5946.
2011-05-30Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
The conflicts were mainly caused by the routerinfo->node transition. Conflicts: src/or/circuitbuild.c src/or/command.c src/or/connection_edge.c src/or/directory.c src/or/dirserv.c src/or/relay.c src/or/rendservice.c src/or/routerlist.c
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-13Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
Conflicts: src/or/config.c src/or/dirserv.c src/or/or.h