aboutsummaryrefslogtreecommitdiff
path: root/src/or/router.c
AgeCommit message (Collapse)Author
2013-09-18Fix an assert when disabling ORPort with accounting disabled.Nick Mathewson
The problem was that the server_identity_key_is_set() function could return true under conditions where we don't really have an identity key -- specifically, where we used to have one, but we stopped being a server. This is a fix for 6979; bugfix on 0.2.2.18-alpha where we added that assertion to get_server_identity_key().
2013-02-12oops; add a missing semicolonNick Mathewson
(Cherry-picked from fc35ee4910326dc1ae718482b30e57666a71df85)
2013-02-11Check whether ei is non-NULL before altering it.Nick Mathewson
This fixes a crash bug if we fail to generate an extrainfo descriptor. Fixes bug 8208; bugfix on 0.2.3.16-alpha.
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-06-05Merge remote-tracking branch 'public/bug4657'Nick Mathewson
Conflicts: src/or/router.c
2012-06-05Fix "make check-spaces" issuesNick Mathewson
2012-06-05Resolve about 24 DOCDOCsNick Mathewson
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-24Warn and ignore the MyFamily setting if BridgeRelay is also setNick Mathewson
Roger explains at http://archives.seul.org/tor/talk/Nov-2011/msg00209.html : "If you list your bridge as part of your family in the relay descriptor, then everybody can learn your bridge fingerprint, and they can look up your bridge's descriptor (and thus location) at the bridge directory authority." Now, we can't stop relays from listing bridges, but we can warn when we notice a bridge listing anybody, which might help some. This fixes bug 4657; it's a fix on 0.2.0.3-alpha, where bridges were first introduced.
2012-05-16Merge remote-tracking branch 'public/bug5139'Nick Mathewson
2012-05-11Do not publish the "git-XXX" tag in server descriptorsNick Mathewson
Instead, allow packagers to put a 'TOR_BUILD_TAG' field in the server descriptor to indicate a platform-specific value, if they need to. (According to weasel, this was his use for the git- tag previously.) This is part of 2988
2012-05-11Merge remote-tracking branch 'asn/bug4865_take2'Nick Mathewson
2012-05-10Fix O(n^2) performance when parsing a big pile of extrainfosNick Mathewson
We were doing an O(n) strlen in router_get_extrainfo_hash() for every one we tried to parse. Instead, have router_get_extrainfo_hash() take the length of the extrainfo as an argument, so that when it's called from extrainfo_parse_from_string(), it doesn't do a strlen() over the whole pile of extrainfos.
2012-05-03Ignore [::] when building descriptors.Linus Nordberg
This is how IPv6 says "0.0.0.0" and something we will have to translate into a globally reachable address before putting it in a descriptor. The fix is a short term solution until a real one is implemented. Closes #5146.
2012-04-27Bridges should never set the send_unencrypted flag on any of their descsNick Mathewson
Fix for bug 5139.
2012-04-24Merge branch 'bug4438-v2'Nick Mathewson
2012-04-24Tweak the bug4438 fix a little: different check, better logNick Mathewson
Instead of checking for 'rejected' and calling everything else okay, let's check for 'outdated' and call everythign else a problem. This way we don't risk missing future errors so much. When logging a message that _looks_ like an error message at info, we should mention that it isn't really a problem.
2012-04-12Fix issues found by nickm.George Kadianakis
* Document fmt_addr_impl() and friends. * Parenthesize macro arguments. * Rename get_first_listener_addrport_for_pt() to get_first_listener_addrport_string(). * Handle port_cfg_t with no_listen. * Handle failure of router_get_active_listener_port_by_type(). * Add an XXX to router_get_active_listener_port_by_type().
2012-04-02Suppress "decided to publish new descriptor" message when not a serverNick Mathewson
The message only means that we're publishing a new descriptor when we are actually in some kind of server mode, and publication is on. Fix for bug 3942; bugfix on 0.2.3.2-alpha.
2012-03-31Introduce and use router_get_active_listener_port_by_type().George Kadianakis
router_get_active_listener_port_by_type() iterates all connections, trying to find a listener of a specific type, and returns its TCP port.
2012-03-29Merge remote-tracking branch 'linus/bug4875_2'Nick Mathewson
2012-03-28Make relays handle an address suggestion from a directory server giving an ↵Linus Nordberg
IPv6 address. last_guessed_ip becomes a tor_addr_t. Most parts of router_new_address_suggestion() learns about IPv6 (resolve_my_address() is still IPv4 only).
2012-03-19Move the logging of 'My line' to debug level (#5151).Linus Nordberg
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-16whitespace fixesNick Mathewson
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-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.)
2012-01-10Advertise dirport if accountingmax is large enoughSebastian Hahn
When we have an effective bandwidthrate configured so that we cannot exceed our bandwidth limit in one accounting interval, don't disable advertising the dirport. Implements ticket 2434.
2011-11-30Whitespace changes.Linus Nordberg
2011-11-30Make the router_get_*_orport interface consistent with node_*.Linus Nordberg
2011-11-30Make router_get_{prim,alt,pref}_addr_port take tor_addr_port_t *.Linus Nordberg
Rename to *_orport for consistency with node_*.
2011-11-30First chunk of support for bridges on IPv6Linus Nordberg
Comments below focus on changes, see diff for added code. New type tor_addr_port_t holding an IP address and a TCP/UDP port. New flag in routerinfo_t, ipv6_preferred. This should go in the node_t instead but not now. Replace node_get_addr() with - node_get_prim_addr() for primary address, i.e. IPv4 for now - node_get_pref_addr() for preferred address, IPv4 or IPv6. Rename node_get_addr_ipv4h() node_get_prim_addr_ipv4h() for consistency. The primary address will not allways be an IPv4 address. Same for node_get_orport() -> node_get_prim_orport(). Rewrite node_is_a_configured_bridge() to take all OR ports into account. Extend argument list to extend_info_from_node and extend_info_from_router with a flag indicating if we want to use the routers primary address or the preferred address. Use the preferred address in as few situtations as possible for allowing clients to connect to bridges over IPv6.
2011-11-30Bridges can advertise a single IPv6 address with orportNick Mathewson
This is deliberately more restrictive than we'd want to be. Needs testing!
2011-11-30Initial support for simplest use of prop186 or-address linesNick Mathewson
This lets a routerinfo_t have a single IPv6 or-address, and adds support for formatting and parsing those lines.
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-29Merge remote-tracking branch 'asn-mytor/bug4548_take2'Nick Mathewson
2011-11-28New 'DisableNetwork' option to prevent Tor from using the networkNick Mathewson
Some controllers want this so they can mess with Tor's configuration for a while via the control port before actually letting Tor out of the house. We do this with a new DisableNetwork option, that prevents Tor from making any outbound connections or binding any non-control listeners. Additionally, it shuts down the same functionality as shuts down when we are hibernating, plus the code that launches directory downloads. To make sure I didn't miss anything, I added a clause straight to connection_connect, so that we won't even try to open an outbound socket when the network is disabled. In my testing, I made this an assert, but since I probably missed something, I've turned it into a BUG warning for testing.
2011-11-26Write dynamic DH parameters to a file.George Kadianakis
Instead of only writing the dynamic DH prime modulus to a file, write the whole DH parameters set for forward compatibility. At the moment we only accept '2' as the group generator. The DH parameters gets stored in base64-ed DER format to the 'dynamic_dh_params' file.
2011-11-25Simply initialize TLS context if DynamicDHGroups change.George Kadianakis
We used to do init_keys() if DynamicDHGroups changed after a HUP, so that the dynamic DH modulus was stored on the disk. Since we are now doing dynamic DH modulus storing in crypto.c, we can simply initialize the TLS context and be good with it. Introduce a new function router_initialize_tls_context() which initializes the TLS context and use it appropriately.
2011-11-25Do dynamic DH modulus storing in crypto.c.George Kadianakis
2011-11-25Rename 'dynamic prime' to 'dynamic DH modulus'.George Kadianakis
2011-11-25s/DynamicPrimes/DynamicDHGroups/gGeorge Kadianakis
2011-11-24Move crypto_get_stored_dynamic_prime() to crypto.cGeorge Kadianakis
2011-11-24Move store_dynamic_prime() to crypto.c.George Kadianakis
2011-11-24Tone down the logging.George Kadianakis
2011-11-24Implement dynamic prime reading and storing to disk.George Kadianakis
2011-11-24Introduce the DynamicPrimes configuration option.George Kadianakis
2011-11-16fix trivial typoRoger Dingledine
somebody should s/authoritative directory server/directory authority/g at some point
2011-11-08Don't exit on dirauths for some config transitionsSebastian Hahn