--- /dev/null
+ o Major bugfixes
+ - Avoid an assertion failure when we as an authority receive a
+ duplicate upload of a router descriptor that we already have,
+ but which we previously considered an obsolete descriptor.
+ Fixes another case of bug 1776. Bugfix on 0.2.2.16-alpha.
tor_free(sd);
}
-/** Extract a signed_descriptor_t from a routerinfo, and free the routerinfo.
+/** Extract a signed_descriptor_t from a general routerinfo, and free the
+ * routerinfo.
*/
static signed_descriptor_t *
signed_descriptor_from_routerinfo(routerinfo_t *ri)
{
- signed_descriptor_t *sd = tor_malloc_zero(sizeof(signed_descriptor_t));
+ signed_descriptor_t *sd;
+ tor_assert(ri->purpose == ROUTER_PURPOSE_GENERAL);
+ sd = tor_malloc_zero(sizeof(signed_descriptor_t));
memcpy(sd, &(ri->cache_info), sizeof(signed_descriptor_t));
sd->routerlist_index = -1;
ri->cache_info.signed_descriptor_body = NULL;
/* If we have this descriptor already and the new descriptor is a bridge
* descriptor, replace it. If we had a bridge descriptor before and the
* new one is not a bridge descriptor, don't replace it. */
- tor_assert(old_router);
+
+ /* Only members of routerlist->identity_map can be bridges; we don't
+ * put bridges in old_routers. */
+ const int was_bridge = old_router &&
+ old_router->purpose == ROUTER_PURPOSE_BRIDGE;
+
if (! (routerinfo_is_a_configured_bridge(router) &&
- (router->purpose == ROUTER_PURPOSE_BRIDGE ||
- old_router->purpose != ROUTER_PURPOSE_BRIDGE))) {
+ (router->purpose == ROUTER_PURPOSE_BRIDGE || !was_bridge))) {
log_info(LD_DIR,
"Dropping descriptor that we already have for router '%s'",
router->nickname);