27 char tbuf[ISO_TIME_LEN+1];
29 "%s 00:00:00", APPROX_RELEASE_DATE);
56 int found_newer = 0, found_older = 0, found_newer_in_series = 0,
57 found_any_in_series = 0, r, same;
61 log_debug(
LD_CONFIG,
"Checking whether version '%s' is in '%s'",
62 myversion, versionlist);
65 log_err(
LD_BUG,
"I couldn't parse my own version (%s)", myversion);
71 if (!strlen(versionlist)) {
85 found_any_in_series = 1;
93 found_newer_in_series = 1;
98 } SMARTLIST_FOREACH_END(cp);
101 if (found_any_in_series && !found_newer_in_series && found_newer) {
103 }
else if (found_newer && !found_older) {
105 }
else if (found_older && !found_newer) {
113 smartlist_free(version_sl);
132 char *s, *s2, *start;
138 if (!*start)
return -1;
144 if ((
size_t)(s-start+1) >=
sizeof(tmp))
146 strlcpy(tmp, start, s-start+1);
149 log_info(
LD_DIR,
"Router version '%s' unparseable.",tmp);
154 if (router_version->major < 0 ||
155 router_version->minor < 0 ||
156 router_version->micro < 0 ||
157 router_version->patchlevel < 0 ||
158 router_version->svn_revision < 0) {
178 log_warn(
LD_BUG,
"cutoff version '%s' unparseable.",cutoff);
218 out->
status = VER_RELEASE;
226 if (!cp || *cp < '0' || *cp > '9') \
228 out->m = (int)tor_parse_uint64(cp, 10, 0, INT32_MAX, &ok, &eos); \
231 if (!eos || eos == cp) \
256 }
else if (*cp ==
'.') {
258 }
else if (*cp ==
'-') {
260 }
else if (0==strncmp(cp,
"pre", 3)) {
263 }
else if (0==strncmp(cp,
"rc", 2)) {
274 if (*cp ==
'-' || *cp ==
'.')
277 if (eos-cp >= (
int)
sizeof(out->status_tag))
278 strlcpy(out->status_tag, cp,
sizeof(out->status_tag));
280 memcpy(out->status_tag, cp, eos-cp);
281 out->status_tag[eos-cp] = 0;
287 out->svn_revision = (int) strtol(cp,&eos,10);
289 char *close_paren = strchr(cp,
')');
297 hexlen = (int)(close_paren-cp);
298 memwipe(digest, 0,
sizeof(digest));
299 if (hexlen == 0 || (hexlen % 2) == 1)
303 memcpy(out->git_tag, digest, hexlen/2);
304 out->git_tag_len = hexlen/2;
326#define CMP(field) do { \
327 unsigned aval = (unsigned) a->field; \
328 unsigned bval = (unsigned) b->field; \
329 int result = (int) (aval - bval); \
332 else if (result > 0) \
341 if ((i = strcmp(a->status_tag, b->status_tag)))
346 return fast_memcmp(a->git_tag, b->git_tag, a->git_tag_len);
360 return ((a->major == b->major) &&
361 (a->minor == b->minor) &&
362 (a->micro == b->micro));
371 const char *a = *_a, *b = *_b;
395 if (remove_duplicates)
418 const char *protocols)
432 if (cached != NULL) {
439 memset(out, 0,
sizeof(*out));
515 const char *protocols,
519 memset(out, 0,
sizeof(*out));
520 if (protocols && strcmp(protocols,
"")) {
523 if (version && strcmp(version,
"") && !
strcmpstart(version,
"Tor ")) {
int base16_decode(char *dest, size_t destlen, const char *src, size_t srclen)
void memwipe(void *mem, uint8_t byte, size_t sz)
Common functions for cryptographic routines.
#define fast_memcmp(a, b, c)
void tor_free_(void *mem)
Master header file for Tor-specific functionality.
int tor_snprintf(char *str, size_t size, const char *format,...)
int protocol_list_supports_protocol(const char *list, protocol_type_t tp, uint32_t version)
int protocol_list_supports_protocol_or_later(const char *list, protocol_type_t tp, uint32_t version)
Headers and type declarations for protover.c.
#define PROTOVER_RELAY_CANONICAL_IPV6
#define PROTOVER_FLOWCTRL_CC
#define PROTOVER_HS_INTRO_DOS
#define PROTOVER_HSDIR_V3
#define PROTOVER_HS_RENDEZVOUS_POINT_V3
#define PROTOVER_RELAY_ACCEPT_IPV6
#define PROTOVER_RELAY_EXTEND_IPV6
#define PROTOVER_HS_INTRO_V3
#define PROTOVER_LINKAUTH_ED25519_HANDSHAKE
#define PROTOVER_CONFLUX_V1
#define PROTOVER_RELAY_NTOR_V3
#define PROTOVER_RELAY_EXTEND2
#define PROTOVER_HS_SETUP_PADDING
void smartlist_sort(smartlist_t *sl, int(*compare)(const void **a, const void **b))
void smartlist_uniq(smartlist_t *sl, int(*compare)(const void **a, const void **b), void(*free_fn)(void *a))
smartlist_t * smartlist_new(void)
#define SMARTLIST_FOREACH_BEGIN(sl, type, var)
#define SMARTLIST_FOREACH(sl, type, var, cmd)
int smartlist_split_string(smartlist_t *sl, const char *str, const char *sep, int flags, int max)
unsigned int supports_extend2_cells
unsigned int supports_ed25519_link_handshake_compat
unsigned int supports_v3_rendezvous_point
unsigned int supports_hs_setup_padding
unsigned int supports_initiating_ipv6_extends
unsigned int supports_v3_hsdir
unsigned int supports_ed25519_link_handshake_any
unsigned int supports_congestion_control
unsigned int supports_canonical_ipv6_conns
unsigned int supports_conflux
unsigned int protocols_known
unsigned int supports_accepting_ipv6_extends
unsigned int supports_ed25519_hs_intro
unsigned int supports_establish_intro_dos_extension
enum tor_version_t::@13 status
int parse_iso_time(const char *cp, time_t *t)
Parsed Tor version structure.
int strcasecmpstart(const char *s1, const char *s2)
int strcmpstart(const char *s1, const char *s2)
const char * find_whitespace(const char *s)
const char * eat_whitespace(const char *s)
void protover_summary_cache_free_all(void)
static strmap_t * protover_summary_map
time_t tor_get_approx_release_date(void)
void summarize_protover_flags(protover_summary_flags_t *out, const char *protocols, const char *version)
int tor_version_as_new_as(const char *platform, const char *cutoff)
void sort_version_list(smartlist_t *versions, int remove_duplicates)
int tor_version_parse_platform(const char *platform, tor_version_t *router_version, int strict)
static void memoize_protover_summary(protover_summary_flags_t *out, const char *protocols)
int tor_version_compare(tor_version_t *a, tor_version_t *b)
static int compare_tor_version_str_ptr_(const void **_a, const void **_b)
static const int MAX_PROTOVER_SUMMARY_MAP_LEN
int tor_version_parse(const char *s, tor_version_t *out)
int tor_version_same_series(tor_version_t *a, tor_version_t *b)
version_status_t tor_version_is_obsolete(const char *myversion, const char *versionlist)
Header file for versions.c.