Loading src/or/dirserv.c +7 −5 Original line number Diff line number Diff line Loading @@ -1810,20 +1810,22 @@ generate_networkstatus_opinion(int v2) "vote-status vote\n" "published %s\n" "valid-after %s\n" "fresh-until %s\n" "valid-until %s\n" "%s" /* versions */ "known-flags Authority Exit Fast Guard Stable " "Running Valid V2Dir%s%s\n" "dir-source %s %s %s %s %d\n" "known-flags Authority%s Exit Fast Guard%s Running Stable " "Valid V2Dir\n" "dir-source %s %s %s %s %d %d\n" "contact %s\n", published, published, /* XXXX020 should be valid-after*/ published, /* XXXX020 should be fresh-until*/ published, /* XXXX020 should be valid-until*/ version_lines, naming ? " Named" : "", listbadexits ? " BadExit" : "", naming ? " Named" : "", options->Nickname, fingerprint, options->Address, ipaddr, (int)options->DirPort, ipaddr, (int)options->DirPort, (int)options->ORPort, contact); outp = status + strlen(status); endp = status + len; Loading src/or/or.h +27 −1 Original line number Diff line number Diff line Loading @@ -1252,7 +1252,7 @@ typedef struct local_routerstatus_t { * up? */ #define MAX_ROUTERDESC_DOWNLOAD_FAILURES 8 /** Contents of a (v2 or later) network status object. */ /** Contents of a v2 (non-consensus, non-vote) network status object. */ typedef struct networkstatus_t { /** When did we receive the network-status document? */ time_t received_on; Loading Loading @@ -1293,6 +1293,32 @@ typedef struct networkstatus_t { * sorted by identity_digest. */ } networkstatus_t; /** DOCDOC */ typedef struct ns_vote_routerstatus_t { routerstatus_t status; uint64_t flags; char *version; } ns_vote_routerstatus_t; /** DOCDOC */ typedef struct networkstatus_vote_t { time_t published; time_t valid_after; time_t fresh_until; time_t valid_until; char *client_versions; char *server_versions; char **known_flags; char identity_digest[DIGEST_LEN]; char *address; uint32_t addr; uint16_t dir_port; uint16_t or_port; struct authority_cert_t *cert; char *contact; smartlist_t *routerstatus_list; } networkstatus_vote_t; /** Contents of a directory of onion routers. */ typedef struct { /** Map from server identity digest to a member of routers. */ Loading src/or/routerparse.c +17 −4 Original line number Diff line number Diff line Loading @@ -1448,15 +1448,17 @@ find_start_of_next_routerstatus(const char *s) * object in the string, and advance *<b>s</b> to just after the end of the * router status. Return NULL and advance *<b>s</b> on error. */ static routerstatus_t * routerstatus_parse_entry_from_string(const char **s, smartlist_t *tokens) routerstatus_parse_entry_from_string(const char **s, smartlist_t *tokens, networkstatus_vote_t *vote, uint64_t *flags_out) { const char *eos; routerstatus_t *rs = NULL; directory_token_t *tok; char timebuf[ISO_TIME_LEN+1]; struct in_addr in; tor_assert(tokens); tor_assert(bool_eq(flags_out, vote)); eos = find_start_of_next_routerstatus(*s); Loading Loading @@ -1511,7 +1513,18 @@ routerstatus_parse_entry_from_string(const char **s, smartlist_t *tokens) rs->or_port =(uint16_t) tor_parse_long(tok->args[6],10,0,65535,NULL,NULL); rs->dir_port = (uint16_t) tor_parse_long(tok->args[7],10,0,65535,NULL,NULL); if ((tok = find_first_by_keyword(tokens, K_S))) { tok = find_first_by_keyword(tokens, K_S); if (tok && vote) { int i, j; for (i=0; i < tok->n_args; ++i) { for (j=0; vote->known_flags[j]; ++j) { if (!strcmp(tok->args[i], vote->known_flags[j])) { *flags_out |= (1<<j); break; } } } } else if (tok) { int i; for (i=0; i < tok->n_args; ++i) { if (!strcmp(tok->args[i], "Exit")) Loading Loading @@ -1708,7 +1721,7 @@ networkstatus_parse_from_string(const char *s) smartlist_clear(tokens); while (!strcmpstart(s, "r ")) { routerstatus_t *rs; if ((rs = routerstatus_parse_entry_from_string(&s, tokens))) if ((rs = routerstatus_parse_entry_from_string(&s, tokens, NULL, NULL))) smartlist_add(ns->entries, rs); } smartlist_sort(ns->entries, _compare_routerstatus_entries); Loading Loading
src/or/dirserv.c +7 −5 Original line number Diff line number Diff line Loading @@ -1810,20 +1810,22 @@ generate_networkstatus_opinion(int v2) "vote-status vote\n" "published %s\n" "valid-after %s\n" "fresh-until %s\n" "valid-until %s\n" "%s" /* versions */ "known-flags Authority Exit Fast Guard Stable " "Running Valid V2Dir%s%s\n" "dir-source %s %s %s %s %d\n" "known-flags Authority%s Exit Fast Guard%s Running Stable " "Valid V2Dir\n" "dir-source %s %s %s %s %d %d\n" "contact %s\n", published, published, /* XXXX020 should be valid-after*/ published, /* XXXX020 should be fresh-until*/ published, /* XXXX020 should be valid-until*/ version_lines, naming ? " Named" : "", listbadexits ? " BadExit" : "", naming ? " Named" : "", options->Nickname, fingerprint, options->Address, ipaddr, (int)options->DirPort, ipaddr, (int)options->DirPort, (int)options->ORPort, contact); outp = status + strlen(status); endp = status + len; Loading
src/or/or.h +27 −1 Original line number Diff line number Diff line Loading @@ -1252,7 +1252,7 @@ typedef struct local_routerstatus_t { * up? */ #define MAX_ROUTERDESC_DOWNLOAD_FAILURES 8 /** Contents of a (v2 or later) network status object. */ /** Contents of a v2 (non-consensus, non-vote) network status object. */ typedef struct networkstatus_t { /** When did we receive the network-status document? */ time_t received_on; Loading Loading @@ -1293,6 +1293,32 @@ typedef struct networkstatus_t { * sorted by identity_digest. */ } networkstatus_t; /** DOCDOC */ typedef struct ns_vote_routerstatus_t { routerstatus_t status; uint64_t flags; char *version; } ns_vote_routerstatus_t; /** DOCDOC */ typedef struct networkstatus_vote_t { time_t published; time_t valid_after; time_t fresh_until; time_t valid_until; char *client_versions; char *server_versions; char **known_flags; char identity_digest[DIGEST_LEN]; char *address; uint32_t addr; uint16_t dir_port; uint16_t or_port; struct authority_cert_t *cert; char *contact; smartlist_t *routerstatus_list; } networkstatus_vote_t; /** Contents of a directory of onion routers. */ typedef struct { /** Map from server identity digest to a member of routers. */ Loading
src/or/routerparse.c +17 −4 Original line number Diff line number Diff line Loading @@ -1448,15 +1448,17 @@ find_start_of_next_routerstatus(const char *s) * object in the string, and advance *<b>s</b> to just after the end of the * router status. Return NULL and advance *<b>s</b> on error. */ static routerstatus_t * routerstatus_parse_entry_from_string(const char **s, smartlist_t *tokens) routerstatus_parse_entry_from_string(const char **s, smartlist_t *tokens, networkstatus_vote_t *vote, uint64_t *flags_out) { const char *eos; routerstatus_t *rs = NULL; directory_token_t *tok; char timebuf[ISO_TIME_LEN+1]; struct in_addr in; tor_assert(tokens); tor_assert(bool_eq(flags_out, vote)); eos = find_start_of_next_routerstatus(*s); Loading Loading @@ -1511,7 +1513,18 @@ routerstatus_parse_entry_from_string(const char **s, smartlist_t *tokens) rs->or_port =(uint16_t) tor_parse_long(tok->args[6],10,0,65535,NULL,NULL); rs->dir_port = (uint16_t) tor_parse_long(tok->args[7],10,0,65535,NULL,NULL); if ((tok = find_first_by_keyword(tokens, K_S))) { tok = find_first_by_keyword(tokens, K_S); if (tok && vote) { int i, j; for (i=0; i < tok->n_args; ++i) { for (j=0; vote->known_flags[j]; ++j) { if (!strcmp(tok->args[i], vote->known_flags[j])) { *flags_out |= (1<<j); break; } } } } else if (tok) { int i; for (i=0; i < tok->n_args; ++i) { if (!strcmp(tok->args[i], "Exit")) Loading Loading @@ -1708,7 +1721,7 @@ networkstatus_parse_from_string(const char *s) smartlist_clear(tokens); while (!strcmpstart(s, "r ")) { routerstatus_t *rs; if ((rs = routerstatus_parse_entry_from_string(&s, tokens))) if ((rs = routerstatus_parse_entry_from_string(&s, tokens, NULL, NULL))) smartlist_add(ns->entries, rs); } smartlist_sort(ns->entries, _compare_routerstatus_entries); Loading