diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-12-11 09:44:57 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-12-11 09:44:57 -0500 |
commit | b915b6cd2171dd9b810bd318739e191db1a810b5 (patch) | |
tree | 1d16bc690925b233a9b421323a449392f08e59c6 /src | |
parent | 27e42699296c1a024db294a77ebb1c0c0bbbd179 (diff) | |
parent | 7da06e43da96f4253a756af546f27f03141b3784 (diff) | |
download | tor-b915b6cd2171dd9b810bd318739e191db1a810b5.tar.gz tor-b915b6cd2171dd9b810bd318739e191db1a810b5.zip |
Merge remote-tracking branch 'github/prop297'
Diffstat (limited to 'src')
-rw-r--r-- | src/core/or/versions.c | 19 | ||||
-rw-r--r-- | src/core/or/versions.h | 2 | ||||
-rw-r--r-- | src/feature/nodelist/networkstatus.c | 5 |
3 files changed, 25 insertions, 1 deletions
diff --git a/src/core/or/versions.c b/src/core/or/versions.c index a1336c7a78..7bd1f5899f 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 <b>myversion</b> is contained in * <b>versionlist</b>. 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, diff --git a/src/feature/nodelist/networkstatus.c b/src/feature/nodelist/networkstatus.c index ed01576242..65ea3cc491 100644 --- a/src/feature/nodelist/networkstatus.c +++ b/src/feature/nodelist/networkstatus.c @@ -2681,6 +2681,9 @@ networkstatus_check_required_protocols(const networkstatus_t *ns, const char *required, *recommended; char *missing = NULL; + const bool consensus_postdates_this_release = + ns->valid_after >= tor_get_approx_release_date(); + tor_assert(warning_out); if (client_mode) { @@ -2698,7 +2701,7 @@ networkstatus_check_required_protocols(const networkstatus_t *ns, "%s on the Tor network. The missing protocols are: %s", func, missing); tor_free(missing); - return 1; + return consensus_postdates_this_release ? 1 : 0; } if (! protover_all_supported(recommended, &missing)) { |