diff options
author | Peter Palfrader <peter@palfrader.org> | 2008-08-14 12:37:07 +0000 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2008-08-14 12:37:07 +0000 |
commit | 1a2c6b41e323e5db7dd3d7c50ba8bc8594b37411 (patch) | |
tree | 14c7a4b9427401f33c16d37fc1d67705fe82fc6e /src/or | |
parent | 24da63ea7b8757fd26fc58da922784e6f6ec5379 (diff) | |
download | tor-1a2c6b41e323e5db7dd3d7c50ba8bc8594b37411.tar.gz tor-1a2c6b41e323e5db7dd3d7c50ba8bc8594b37411.zip |
Do not show policy and bw in v2 statuses
svn:r16537
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/dirserv.c | 31 | ||||
-rw-r--r-- | src/or/dirvote.c | 4 | ||||
-rw-r--r-- | src/or/networkstatus.c | 2 | ||||
-rw-r--r-- | src/or/or.h | 2 |
4 files changed, 25 insertions, 14 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c index d7dd46ba66..e316ce4225 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -1861,7 +1861,10 @@ version_from_platform(const char *platform) int routerstatus_format_entry(char *buf, size_t buf_len, routerstatus_t *rs, const char *version, - int first_line_only) + int first_line_only, int v2_format) +/* XXX: first_line_only and v2_format should probably be be both + * replaced by a single purpose parameter. + */ { int r; struct in_addr in; @@ -1912,8 +1915,7 @@ routerstatus_format_entry(char *buf, size_t buf_len, cp = buf + strlen(buf); /* NOTE: Whenever this list expands, be sure to increase MAX_FLAG_LINE_LEN*/ r = tor_snprintf(cp, buf_len - (cp-buf), - "s%s%s%s%s%s%s%s%s%s%s%s%s%s\n" - "w Bandwidth=%d\n", + "s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", /* These must stay in alphabetical order. */ rs->is_authority?" Authority":"", rs->is_bad_directory?" BadDirectory":"", @@ -1927,8 +1929,7 @@ routerstatus_format_entry(char *buf, size_t buf_len, rs->is_stable?" Stable":"", rs->is_unnamed?" Unnamed":"", rs->is_v2_dir?" V2Dir":"", - rs->is_valid?" Valid":"", - router_get_advertised_bandwidth_capped(desc)); + rs->is_valid?" Valid":""); if (r<0) { log_warn(LD_BUG, "Not enough space in buffer."); return -1; @@ -1944,14 +1945,24 @@ routerstatus_format_entry(char *buf, size_t buf_len, } } - summary = policy_summarize(desc->exit_policy); - if (summary) { - r = tor_snprintf(cp, buf_len - (cp-buf), "p %s\n", summary); + if (!v2_format) { + r = tor_snprintf(cp, buf_len - (cp-buf), + "w Bandwidth=%d\n", + router_get_advertised_bandwidth_capped(desc)); if (r<0) { log_warn(LD_BUG, "Not enough space in buffer."); return -1; } - tor_free(summary); + + summary = policy_summarize(desc->exit_policy); + if (summary) { + r = tor_snprintf(cp, buf_len - (cp-buf), "p %s\n", summary); + if (r<0) { + log_warn(LD_BUG, "Not enough space in buffer."); + return -1; + } + tor_free(summary); + } } return 0; @@ -2459,7 +2470,7 @@ generate_v2_networkstatus_opinion(void) if (digestmap_get(omit_as_sybil, ri->cache_info.identity_digest)) clear_status_flags_on_sybil(&rs); - if (routerstatus_format_entry(outp, endp-outp, &rs, version, 0)) { + if (routerstatus_format_entry(outp, endp-outp, &rs, version, 0, 1)) { log_warn(LD_BUG, "Unable to print router status."); tor_free(version); goto done; diff --git a/src/or/dirvote.c b/src/or/dirvote.c index 42710a40d5..b704a94f08 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -145,7 +145,7 @@ format_networkstatus_vote(crypto_pk_env_t *private_signing_key, SMARTLIST_FOREACH(v3_ns->routerstatus_list, vote_routerstatus_t *, vrs, { if (routerstatus_format_entry(outp, endp-outp, &vrs->status, - vrs->version, 0) < 0) { + vrs->version, 0, 0) < 0) { log_warn(LD_BUG, "Unable to print router status."); goto err; } @@ -924,7 +924,7 @@ networkstatus_compute_consensus(smartlist_t *votes, /* Okay!! Now we can write the descriptor... */ /* First line goes into "buf". */ - routerstatus_format_entry(buf, sizeof(buf), &rs_out, NULL, 1); + routerstatus_format_entry(buf, sizeof(buf), &rs_out, NULL, 1, 0); smartlist_add(chunks, tor_strdup(buf)); /* Second line is all flags. The "\n" is missing. */ smartlist_add(chunks, diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 35b65cf106..0b07f659c4 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -1779,7 +1779,7 @@ char * networkstatus_getinfo_helper_single(routerstatus_t *rs) { char buf[RS_ENTRY_LEN+1]; - routerstatus_format_entry(buf, sizeof(buf), rs, NULL, 0); + routerstatus_format_entry(buf, sizeof(buf), rs, NULL, 0, 0); return tor_strdup(buf); } diff --git a/src/or/or.h b/src/or/or.h index c4995f405c..714f148938 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -3301,7 +3301,7 @@ size_t dirserv_estimate_data_size(smartlist_t *fps, int is_serverdescs, int compressed); int routerstatus_format_entry(char *buf, size_t buf_len, routerstatus_t *rs, const char *platform, - int first_line_only); + int first_line_only, int v2_format); void dirserv_free_all(void); void cached_dir_decref(cached_dir_t *d); cached_dir_t *new_cached_dir(char *s, time_t published); |