o Forget ones that are very old.
- Download as needed.
o Actually invoke trusted_dirs_flush_certs_to_disk()
- * Serve list as needed.
+ - Serve list as needed.
* Detect whether votes are really all for the same period.
o Avoid double-checking signatures every time we get a vote.
- Warn about expired stuff.
- Push/pull documents as appropriate.
. Push vote on voting
o Push vote
- * Process vote when received
- * Even if we get it before we start voting ourself.
+ o Process vote when received
+ o Even if we get it before we start voting ourself.
* Push signature on forming consensus.
- * Push signature
- * Add signatures when received
- * Queue received signatures before consensus is ready
+ o Push signature
+ o Add signatures when received
+ o Queue received signatures before consensus is ready
+ * When consensus is ready, use queued signatures.
- Pull votes and signatures if we don't get them.
* Serve and store consensuses.
- Cache votes and signatures on disk.
if (dir_purpose == DIR_PURPOSE_FETCH_DIR ||
dir_purpose == DIR_PURPOSE_UPLOAD_DIR ||
dir_purpose == DIR_PURPOSE_UPLOAD_VOTE ||
+ dir_purpose == DIR_PURPOSE_UPLOAD_SIGNATURES ||
dir_purpose == DIR_PURPOSE_FETCH_RUNNING_LIST ||
dir_purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS ||
dir_purpose == DIR_PURPOSE_FETCH_SERVERDESC ||
case DIR_PURPOSE_UPLOAD_VOTE:
log_debug(LD_OR,"initiating server vote upload");
break;
+ case DIR_PURPOSE_UPLOAD_SIGNATURES:
+ log_debug(LD_OR,"initiating consensus signature upload");
+ break;
case DIR_PURPOSE_FETCH_RUNNING_LIST:
log_debug(LD_DIR,"initiating running-routers fetch");
break;
httpcommand = "POST";
url = tor_strdup("/tor/post/vote");
break;
+ case DIR_PURPOSE_UPLOAD_SIGNATURES:
+ tor_assert(!resource);
+ tor_assert(payload);
+ httpcommand = "POST";
+ url = tor_strdup("/tor/post/vote");
+ break;
case DIR_PURPOSE_FETCH_RENDDESC:
tor_assert(resource);
tor_assert(!payload);
}
break;
case 400:
- log_warn(LD_GENERAL,"http status 400 (%s) response after uploading "
+ log_warn(LD_DIR,"http status 400 (%s) response after uploading "
"vote to dirserver '%s:%d'. Please correct.",
escaped(reason), conn->_base.address, conn->_base.port);
break;
* dirservers down just because they don't like us. */
}
+ if (conn->_base.purpose == DIR_PURPOSE_UPLOAD_SIGNATURES) {
+ switch (status_code) {
+ case 200: {
+ log_notice(LD_DIR,"Uploaded a signatures to dirserver %s:%d",
+ conn->_base.address, conn->_base.port);
+ }
+ break;
+ case 400:
+ log_warn(LD_DIR,"http status 400 (%s) response after uploading "
+ "signatures to dirserver '%s:%d'. Please correct.",
+ escaped(reason), conn->_base.address, conn->_base.port);
+ break;
+ default:
+ log_warn(LD_GENERAL,
+ "http status %d (%s) reason unexpected while uploading "
+ "signatures to server '%s:%d').",
+ status_code, escaped(reason), conn->_base.address,
+ conn->_base.port);
+ break;
+ }
+ /* return 0 in all cases, since we don't want to mark any
+ * dirservers down just because they don't like us. */
+ }
+
if (conn->_base.purpose == DIR_PURPOSE_FETCH_RENDDESC) {
log_info(LD_REND,"Received rendezvous descriptor (size %d, status %d "
"(%s))",
goto done;
}
+ if (authdir_mode_v3(options) &&
+ !strcmp(url,"/tor/post/consensus-signature")) { /* sigs on consensus. */
+ if (dirvote_add_signatures(body)>=0) {
+ write_http_status_line(conn, 200, "Signatures stored");
+ } else {
+ write_http_status_line(conn, 400, "Unable to store signatures");
+ }
+ goto done;
+ }
+
/* we didn't recognize the url */
write_http_status_line(conn, 404, "Not found");
#define DIR_PURPOSE_UPLOAD_VOTE 10
/** A connection to a directory server: fetch a v3 networkstatus vote. */
#define DIR_PURPOSE_FETCH_VOTE 11
+/** A connection to a directory server: upload a v3 consensus signature */
+#define DIR_PURPOSE_UPLOAD_SIGNATURES 12
/** Purpose for connection at a directory server. */
-#define DIR_PURPOSE_SERVER 12
-#define _DIR_PURPOSE_MAX 12
+#define DIR_PURPOSE_SERVER 13
+#define _DIR_PURPOSE_MAX 13
#define _EXIT_PURPOSE_MIN 1
/** This exit stream wants to do an ordinary connect. */