From 7da06e43da96f4253a756af546f27f03141b3784 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sat, 24 Nov 2018 20:40:48 -0500 Subject: No longer exit for missing required protocolversions on an old consensus Specifically, if the consensus is older than the (estimted or measured) release date for this version of tor, we assume that the required versions may have changed in between that consensus and this release. Implements ticket 27735 and proposal 297. --- src/core/or/versions.c | 19 +++++++++++++++++++ src/core/or/versions.h | 2 ++ 2 files changed, 21 insertions(+) (limited to 'src/core/or') diff --git a/src/core/or/versions.c b/src/core/or/versions.c index 5d4effcaf8..d978935f4f 100644 --- a/src/core/or/versions.c +++ b/src/core/or/versions.c @@ -16,6 +16,25 @@ #include "core/or/tor_version_st.h" +/** + * Return the approximate date when this release came out, or was + * scheduled to come out, according to the APPROX_RELEASE_DATE set in + * configure.ac + **/ +time_t +tor_get_approx_release_date(void) +{ + char tbuf[ISO_TIME_LEN+1]; + tor_snprintf(tbuf, sizeof(tbuf), + "%s 00:00:00", APPROX_RELEASE_DATE); + time_t result = 0; + int r = parse_iso_time(tbuf, &result); + if (BUG(r < 0)) { + result = 0; + } + return result; +} + /** Return VS_RECOMMENDED if myversion is contained in * versionlist. Else, return VS_EMPTY if versionlist has no * entries. Else, return VS_OLD if every member of diff --git a/src/core/or/versions.h b/src/core/or/versions.h index 4fc50a0018..acd8998918 100644 --- a/src/core/or/versions.h +++ b/src/core/or/versions.h @@ -26,6 +26,8 @@ typedef enum version_status_t { VS_UNKNOWN, /**< We have no idea. */ } version_status_t; +time_t tor_get_approx_release_date(void); + version_status_t tor_version_is_obsolete(const char *myversion, const char *versionlist); int tor_version_parse_platform(const char *platform, -- cgit v1.2.3-54-g00ecf