summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-01-04 04:42:10 +0000
committerRoger Dingledine <arma@torproject.org>2006-01-04 04:42:10 +0000
commit485aa9415d0367dfbca34de116f0cff9fc16ffc1 (patch)
tree7cd0c4d50dfae078cdb6413cb4c25e220d6e07ff
parent7315483bba743983d4da6af661d903d7a73636a5 (diff)
downloadtor-485aa9415d0367dfbca34de116f0cff9fc16ffc1.tar.gz
tor-485aa9415d0367dfbca34de116f0cff9fc16ffc1.zip
authdirs now stop whining so loudly about bad descriptors that they fetch
from other dirservers. now when there's a log complaint, it's for sure from a freshly uploaded descriptor. svn:r5726
-rw-r--r--src/or/dirserv.c2
-rw-r--r--src/or/or.h2
-rw-r--r--src/or/routerlist.c16
3 files changed, 13 insertions, 7 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index d95fdd64dc..34a3cf5ed7 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -532,7 +532,7 @@ dirserv_add_descriptor(const char *desc, const char **msg)
control_event_or_authdir_new_descriptor("DROPPED", desc, *msg);
return 0;
}
- if ((r = router_add_to_routerlist(ri, msg, 0))<0) {
+ if ((r = router_add_to_routerlist(ri, msg, 0, 0))<0) {
if (r < -1) /* unless the routerinfo was fine, just out-of-date */
control_event_or_authdir_new_descriptor("REJECTED", desc, *msg);
return r == -1 ? 0 : -1;
diff --git a/src/or/or.h b/src/or/or.h
index 06b515b73d..fe78382420 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -2278,7 +2278,7 @@ void router_mark_as_down(const char *digest);
void routerlist_remove_old_routers(void);
void networkstatus_list_clean(time_t now);
int router_add_to_routerlist(routerinfo_t *router, const char **msg,
- int from_cache);
+ int from_cache, int from_fetch);
int router_load_single_router(const char *s, const char **msg);
void router_load_routers_from_string(const char *s, int from_cache,
smartlist_t *requested_fingerprints);
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 619425b507..eb8af3aa1b 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -1465,6 +1465,11 @@ router_mark_as_down(const char *digest)
* routerinfo was accepted, but we should notify the generator of the
* descriptor using the message *<b>msg</b>.
*
+ * If <b>from_cache</b>, this descriptor came from our disk cache. If
+ * <b>from_fetch</b>, we received it in response to a request we made.
+ * (If both are false, that means it was uploaded to us as an auth dir
+ * server or via the controller.)
+ *
* This function should be called *after*
* routers_update_status_from_networkstatus; subsequently, you should call
* router_rebuild_store and control_event_descriptors_changed.
@@ -1473,7 +1478,7 @@ router_mark_as_down(const char *digest)
*/
int
router_add_to_routerlist(routerinfo_t *router, const char **msg,
- int from_cache)
+ int from_cache, int from_fetch)
{
int i;
char id_digest[DIGEST_LEN];
@@ -1505,7 +1510,8 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
routerlist_remove_old_routers();
if (authdir) {
- if (authdir_wants_to_reject_router(router, msg, !from_cache)) {
+ if (authdir_wants_to_reject_router(router, msg,
+ !from_cache && !from_fetch)) {
routerinfo_free(router);
return -2;
}
@@ -1831,7 +1837,7 @@ router_load_single_router(const char *s, const char **msg)
smartlist_add(lst, ri);
routers_update_status_from_networkstatus(lst, 0);
- if (router_add_to_routerlist(ri, msg, 0)<0) {
+ if (router_add_to_routerlist(ri, msg, 0, 0)<0) {
warn(LD_DIR, "Couldn't add router to list: %s Dropping.",
*msg?*msg:"(No message).");
/* we've already assigned to *msg now, and ri is already freed */
@@ -1847,7 +1853,7 @@ router_load_single_router(const char *s, const char **msg)
/** Given a string <b>s</b> containing some routerdescs, parse it and put the
* routers into our directory. If <b>from_cache</b> is false, the routers
- * have come from the network: cache them.
+ * are in response to a query to the network: cache them.
*
* If <b>requested_fingerprints</b> is provided, it must contain a list of
* uppercased identity fingerprints. Do not update any router whose
@@ -1888,7 +1894,7 @@ router_load_routers_from_string(const char *s, int from_cache,
}
}
- if (router_add_to_routerlist(ri, &msg, from_cache) >= 0)
+ if (router_add_to_routerlist(ri, &msg, from_cache, !from_cache) >= 0)
smartlist_add(changed, ri);
});