[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r9669: Fix a bug found by Udo van den Heuvel: avoid an assertion fa (in tor/trunk: . src/or)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] r9669: Fix a bug found by Udo van den Heuvel: avoid an assertion fa (in tor/trunk: . src/or)
- From: nickm@xxxxxxxx
- Date: Tue, 27 Feb 2007 19:23:07 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Tue, 27 Feb 2007 19:23:15 -0500
- Reply-to: or-talk@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Author: nickm
Date: 2007-02-27 19:23:05 -0500 (Tue, 27 Feb 2007)
New Revision: 9669
Modified:
tor/trunk/
tor/trunk/ChangeLog
tor/trunk/src/or/circuitbuild.c
tor/trunk/src/or/or.h
Log:
r11970@catbus: nickm | 2007-02-27 19:17:27 -0500
Fix a bug found by Udo van den Heuvel: avoid an assertion failure when a controller sets and clears EntryNodes before the next call to choose_random_entry(). Also make a function static.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r11970] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog 2007-02-27 19:02:37 UTC (rev 9668)
+++ tor/trunk/ChangeLog 2007-02-28 00:23:05 UTC (rev 9669)
@@ -7,7 +7,11 @@
- Do not rotate onion key immediately after setting it for the first
time.
+ o Minor bugfixes (other):
+ - Fix an assert that could trigger if a controller quickly set then
+ cleared EntryNodes. (Bug found by Udo van den Heuvel.)
+
Changes in version 0.1.2.8-beta - 2007-02-26
o Major bugfixes (crashes):
- Stop crashing when the controller asks us to resetconf more than
Modified: tor/trunk/src/or/circuitbuild.c
===================================================================
--- tor/trunk/src/or/circuitbuild.c 2007-02-27 19:02:37 UTC (rev 9668)
+++ tor/trunk/src/or/circuitbuild.c 2007-02-28 00:23:05 UTC (rev 9669)
@@ -2251,7 +2251,7 @@
/** Add all nodes in EntryNodes that aren't currently guard nodes to the list
* of guard nodes, at the front. */
-void
+static void
entry_guards_prepend_from_config(void)
{
or_options_t *options = get_options();
@@ -2259,10 +2259,18 @@
smartlist_t *old_entry_guards_on_list = smartlist_create();
smartlist_t *old_entry_guards_not_on_list = smartlist_create();
smartlist_t *entry_fps = smartlist_create();
-
tor_assert(entry_guards);
- tor_assert(options->EntryNodes);
+ should_add_entry_nodes = 0;
+
+ if (!options->EntryNodes) {
+ /* It's possible that a controller set EntryNodes, thus making
+ * should_add_entry_nodes set, then cleared it again, all before the
+ * call to choose_random_entry() that triggered us. If so, just return.
+ */
+ return;
+ }
+
log_info(LD_CIRC,"Adding configured EntryNodes '%s'.",
options->EntryNodes);
@@ -2300,7 +2308,6 @@
smartlist_add_all(entry_guards, old_entry_guards_not_on_list);
}
- should_add_entry_nodes = 0;
smartlist_free(entry_routers);
smartlist_free(entry_fps);
smartlist_free(old_entry_guards_on_list);
Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h 2007-02-27 19:02:37 UTC (rev 9668)
+++ tor/trunk/src/or/or.h 2007-02-28 00:23:05 UTC (rev 9669)
@@ -1980,7 +1980,6 @@
int entry_guard_register_connect_status(const char *digest, int succeeded,
time_t now);
void entry_nodes_should_be_added(void);
-void entry_guards_prepend_from_config(void);
void entry_guards_update_state(or_state_t *state);
int entry_guards_parse_state(or_state_t *state, int set, char **msg);
int getinfo_helper_entry_guards(control_connection_t *conn,