summaryrefslogtreecommitdiff
path: root/src/or/main.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-23Catch a few more K&R violations with make check-spacesNick Mathewson
We now catch bare {s that should be on the previous line with a do, while, if, or for, and elses that should share a line with their preceding }. That is, if (foo) { and if (foo) { ... } else are now detected. We should think about maybe making Tor uncrustify-clean some day, but configuring uncrustify is an exercise in bizarreness, and reformatting huge gobs of Tor is always painful.
2012-06-19Disable warning for marked-but-reading in main.cNick Mathewson
It turns out this can happen. Even though there is no reason for connections to be marked but reading, we leave them reading anyway, so warning here is unwarranted. Let's turn that back on once we do something sensible and disable reading when we mark. Bugfix for 6203 on Tor 0.2.3.17-beta. Thanks to cypherpunks for pointing out the general stupidity of the original code here.
2012-06-15Triage the XXX023 and XXX022 comments: postpone many.Nick Mathewson
2012-06-15tab-man returneth (this time using the name 'rob')Roger Dingledine
2012-06-14Merge remote-tracking branch 'asn-mytor/bug5589_take2'Nick Mathewson
2012-06-14Remove validate_pluggable_transports_config(): redundant since 9d9b5ed0.George Kadianakis
The warning message of validate_pluggable_transports_config() is superseded by the changes in the warning message of connection_or_connect() when the proxy credentials can't be found.
2012-06-13Add rate-limited log message to bug5263 fixNick Mathewson
Initially I said, "I claim that we shouldn't be reading and marked; let's see if I'm right." But Rob finds that it does.
2012-06-13Fix busy Libevent loops (infinite loops in Shadow)Rob G. Jansen
There is a bug causing busy loops in Libevent and infinite loops in the Shadow simulator. A connection that is marked for close, wants to flush, is held open to flush, but is rate limited (the token bucket is empty) triggers the bug. This commit fixes the bug. Details are below. This currently happens on read and write callbacks when the active socket is marked for close. In this case, Tor doesn't actually try to complete the read or write (it returns from those methods when marked), but instead tries to clear the connection with conn_close_if_marked(). Tor will not close a marked connection that contains data: it must be flushed first. The bug occurs when this flush operation on the marked connection can not occur because the connection is rate-limited (its write token bucket is empty). The fix is to detect when rate limiting is preventing a marked connection from properly flushing. In this case, it should be flagged as read/write_blocked_on_bandwidth and the read/write events de-registered from Libevent. When the token bucket gets refilled, it will check the associated read/write_blocked_on_bandwidth flag, and add the read/write event back to Libevent, which will cause it to fire. This time, it will be properly flushed and closed. The reason that both read and write events are both de-registered when the marked connection can not flush is because both result in the same behavior. Both read/write events on marked connections will never again do any actual reads/writes, and are only useful to trigger the flush and close the connection. By setting the associated read/write_blocked_on_bandwidth flag, we ensure that the event will get added back to Libevent, properly flushed, and closed. Why is this important? Every Shadow event occurs at a discrete time instant. If Tor does not properly deregister Libevent events that fire but result in Tor essentially doing nothing, Libevent will repeatedly fire the event. In Shadow this means infinite loop, outside of Shadow this means wasted CPU cycles.
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-30Merge branch 'bug5604'Nick Mathewson
2012-05-16When ReloadTorrcOnSIGHUP=1, do non-reload activities anywayNick Mathewson
Previously, we skipped everything that got invoked from options_init_from_torrc. But some of the stuff in options_act_reversible and options_act is actually important, like reopening the logs. Now, a SIGHUP always makes the effects of an options_set() happen, even though the options haven't changed. Fix for bug 5095; bugfix on 0.2.1.9-alpha, which introduced __ReloadTorrcOnSIGHUP.
2012-04-18If DisableNetwork, don't even try to open non-controller listenersNick Mathewson
Fix for 5604; bugfix on 0.2.3.9-alpha, which introduced DisableNetwork.
2012-02-08Fix fencepost error with HearbeatPeriod optionSebastian Hahn
We'd only log every HeartbeatPeriod + 1 seconds. Discovered by Scott Bennett, reported as bug 4942.
2012-01-31Use the standard _WIN32, not the Torism MS_WINDOWS or deprecated WIN32Nick Mathewson
This commit is completely mechanical; I used this perl script to make it: #!/usr/bin/perl -w -i.bak -p if (/^\s*\#/) { s/MS_WINDOWS/_WIN32/g; s/\bWIN32\b/_WIN32/g; }
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;
2011-12-19Fixed build with GCC < 3.3Martin Hebnes Pedersen
Preprocessor directives should not be put inside the arguments of a macro. This is not supported on older GCC releases (< 3.3) thus broke compilation on Haiku (running gcc2).
2011-12-08paint bug2474's fix a different neon colorRoger Dingledine
this way people with 80-column logs may read more of the warning
2011-11-30Only define set_buffer_lengths_to_zero if bufferevents are enabledMurdoch@cl.cam.ac.uk
Otherwise, on Windows, gcc will warn about the function being unused
2011-11-30Merge branch 'feature2553-v4-rebased'Nick Mathewson
2011-11-30Warn loudly on startup and SIGHUP if Tor is built for a non-anonymous modeRobert Ransom
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-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-24Merge remote-tracking branch 'public/feature4516'Nick Mathewson
2011-11-24Implement dynamic prime reading and storing to disk.George Kadianakis
2011-11-24Make DynamicPrimes SIGHUP-able.George Kadianakis
Instead of passing the DynamicPrimes configuration option to crypto_global_init(), generate and set a new TLS DH prime when we read the torrc.
2011-11-24Introduce the DynamicPrimes configuration option.George Kadianakis
2011-11-23Merge branch 'bug2474'Nick Mathewson
Had to resolve conflicts wrt the " (using bufferevents)" addition to the startup string. Conflicts: src/or/main.c
2011-11-23Tweak the "this is not a stable release" warning some moreNick Mathewson
2011-11-18New UserspaceIOCPBuffers option to set SO_{SND,RCV}BUF to zeroNick Mathewson
When running with IOCP, we are in theory able to use userspace- allocated buffers to avoid filling up the stingy amount of kernel space allocated for sockets buffers. The bufferevent_async implementation in Libevent provides this ability, in theory. (There are likely to be remaining bugs). This patch adds a new option that, when using IOCP bufferevents, sets each socket's send and receive buffers to 0, so that we should use this ability. When all the bugs are worked out here, if we are right about bug 98, this might solve or mitigate bug 98. This option is experimental and will likely require lots of testing and debugging.
2011-10-26Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-10-26Merge remote-tracking branch 'public/cov_run224_022' into maint-0.2.2Nick Mathewson
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-07Merge remote-tracking branch 'asn2/bug3656'Nick Mathewson
Conflicts: src/common/util.c src/common/util.h src/or/config.h src/or/main.c src/test/test_util.c
2011-10-07Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-10-07Avoid running DNS self-tests if we're operating as a bridgewarms0x
2011-10-06Check return of init_keys() ip_address_changed: fix Coverity CID 484Nick Mathewson
2011-09-22New torrc option to allow bucket refill intervals of less than 1 secFlorian Tschorsch
Implements bug3630.
2011-09-13Merge branch 'maint-0.2.2'Roger Dingledine
2011-09-13Merge branch 'maint-0.2.1' into maint-0.2.2Roger Dingledine
Conflicts: src/or/main.c src/or/router.c
2011-09-13Generate our ssl session certs with a plausible lifetimeRoger Dingledine
Nobody but Tor uses certs on the wire with 2 hour lifetimes, and it makes us stand out. Resolves ticket 4014.
2011-09-11Don't warn of stray Bridges if managed proxies are still unconfigured.George Kadianakis
With managed proxies you would always get the error message: "You have a Bridge line using the X pluggable transport, but there doesn't seem to be a corresponding ClientTransportPlugin line." because the check happened directly after parse_client_transport_line() when managed proxies were not fully configured and their transports were not registered. The fix is to move the validation to run_scheduled_events() and make sure that all managed proxies are configured first.
2011-09-07Upload descriptors more often when recent desc is unlistedNick Mathewson
Right now we only force a new descriptor upload every 18 hours. This can make servers become unlisted if they upload a descriptor at time T which the authorities reject as being "too similar" to one they uploaded before. Nothing will actually make the server upload a new descriptor later on, until another 18 hours have passed. This patch changes the upload behavior so that the 18 hour interval applies only when we're listed in a live consensus with a descriptor published within the last 18 hours. Otherwise--if we're not listed in the live consensus, or if we're listed with a publication time over 18 hours in the past--we upload a new descriptor every 90 minutes. This is an attempted bugfix for #3327. If we merge it, it should obsolete #535.
2011-09-07Merge remote-tracking branch 'public/split_entry_conn'Nick Mathewson
Conflicts: src/or/connection.c src/or/connection_edge.c src/or/connection_edge.h src/or/dnsserv.c Some of these were a little tricky, since they touched code that changed because of the prop171 fixes.
2011-08-29Add a bufferevent note to startup logSebastian Hahn
This should help us easily spot if a tor was built with --enable-bufferevent or not
2011-08-04Make --quiet and --hush apply to default logs, not only initial logsNick Mathewson
Fixes bug 3550; bugfix on 0.2.0.10-alpha (where --quiet was introduced).
2011-07-21Move entry-only fields from edge_connection_t to entry_connection_tNick Mathewson
Also, refactor the code accordingly.