summaryrefslogtreecommitdiff
path: root/src/or/routerparse.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-08-26 12:49:00 -0400
committerNick Mathewson <nickm@torproject.org>2016-09-26 10:56:51 -0700
commite525f5697f9a0682b2cc24fa9779ebe9f0f3c233 (patch)
tree82d48a2023146861c13c04260faba130f2e7f996 /src/or/routerparse.c
parent90a6fe318cfae4d64fff034574153b8c96895a6c (diff)
downloadtor-e525f5697f9a0682b2cc24fa9779ebe9f0f3c233.tar.gz
tor-e525f5697f9a0682b2cc24fa9779ebe9f0f3c233.zip
Use protocols to see when EXTEND2 support exists.
(Technically, we could just remove extend2 cell checking entirely, since all Tor versions on our network are required to have it, but let's keep this around as an example of How To Do It.)
Diffstat (limited to 'src/or/routerparse.c')
-rw-r--r--src/or/routerparse.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 9428e4560a..459a939fb7 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -17,6 +17,7 @@
#include "dirserv.h"
#include "dirvote.h"
#include "policies.h"
+#include "protover.h"
#include "rendcommon.h"
#include "router.h"
#include "routerlist.h"
@@ -2904,12 +2905,21 @@ routerstatus_parse_entry_from_string(memarea_t *area,
}
}
}
+ int found_protocol_list = 0;
+ if ((tok = find_opt_by_keyword(tokens, K_PROTO))) {
+ found_protocol_list = 1;
+ rs->protocols_known = 1;
+ rs->supports_extend2_cells =
+ protocol_list_supports_protocol(tok->args[0], PRT_RELAY, 2);
+ }
if ((tok = find_opt_by_keyword(tokens, K_V))) {
tor_assert(tok->n_args == 1);
rs->version_known = 1;
- if (strcmpstart(tok->args[0], "Tor ")) {
- } else {
- rs->version_supports_extend2_cells =
+ if (!strcmpstart(tok->args[0], "Tor ") && !found_protocol_list) {
+ /* We only do version checks like this in the case where
+ * the version is a "Tor" version, and where there is no
+ * list of protocol versions that we should be looking at instead. */
+ rs->supports_extend2_cells =
tor_version_as_new_as(tok->args[0], "0.2.4.8-alpha");
}
if (vote_rs) {