summaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2010-10-01 21:31:09 -0400
committerRoger Dingledine <arma@torproject.org>2010-10-01 21:31:09 -0400
commit22f723e4a3fc32983480c7403af9d7e77a3200ea (patch)
treeb33e4fec4ffa0e350e5c4193e050cb3441e2958e /src/or/dirserv.c
parent165aaf560a7249a388e916659d55ec6fa1d2fd24 (diff)
downloadtor-22f723e4a3fc32983480c7403af9d7e77a3200ea.tar.gz
tor-22f723e4a3fc32983480c7403af9d7e77a3200ea.zip
refactor all these tor_inet_ntoa idioms
but don't refactor the ones that look messy
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r--src/or/dirserv.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 75e3e86109..5f94cebe1c 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1954,20 +1954,16 @@ routerstatus_format_entry(char *buf, size_t buf_len,
routerstatus_format_type_t format)
{
int r;
- struct in_addr in;
char *cp;
char *summary;
char published[ISO_TIME_LEN+1];
- char ipaddr[INET_NTOA_BUF_LEN];
char identity64[BASE64_DIGEST_LEN+1];
char digest64[BASE64_DIGEST_LEN+1];
format_iso_time(published, rs->published_on);
digest_to_base64(identity64, rs->identity_digest);
digest_to_base64(digest64, rs->descriptor_digest);
- in.s_addr = htonl(rs->addr);
- tor_inet_ntoa(&in, ipaddr, sizeof(ipaddr));
r = tor_snprintf(buf, buf_len,
"r %s %s %s%s%s %s %d %d\n",
@@ -1976,7 +1972,7 @@ routerstatus_format_entry(char *buf, size_t buf_len,
(format==NS_V3_CONSENSUS_MICRODESC)?"":digest64,
(format==NS_V3_CONSENSUS_MICRODESC)?"":" ",
published,
- ipaddr,
+ fmt_addr32(rs->addr),
(int)rs->or_port,
(int)rs->dir_port);
if (r<0) {
@@ -2693,10 +2689,8 @@ generate_v2_networkstatus_opinion(void)
char *outp, *endp;
or_options_t *options = get_options();
char fingerprint[FINGERPRINT_LEN+1];
- char ipaddr[INET_NTOA_BUF_LEN];
char published[ISO_TIME_LEN+1];
char digest[DIGEST_LEN];
- struct in_addr in;
uint32_t addr;
crypto_pk_env_t *private_key;
routerlist_t *rl = router_get_routerlist();
@@ -2717,8 +2711,6 @@ generate_v2_networkstatus_opinion(void)
log_warn(LD_NET, "Couldn't resolve my hostname");
goto done;
}
- in.s_addr = htonl(addr);
- tor_inet_ntoa(&in, ipaddr, sizeof(ipaddr));
format_iso_time(published, now);
@@ -2764,7 +2756,7 @@ generate_v2_networkstatus_opinion(void)
"dir-options%s%s%s%s\n"
"%s" /* client version line, server version line. */
"dir-signing-key\n%s",
- hostname, ipaddr, (int)options->DirPort,
+ hostname, fmt_addr32(addr), (int)options->DirPort,
fingerprint,
contact,
published,