aboutsummaryrefslogtreecommitdiff
path: root/src/common/address.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-10-15 17:08:18 -0400
committerNick Mathewson <nickm@torproject.org>2010-10-15 17:08:18 -0400
commita7cf788740f9cb8befc8c46d175dbc23a4aaa6ea (patch)
tree6736644858d343a292db3beffe84fbf157a0eb8a /src/common/address.c
parentd6bd2e55a67a9260f0fa2d4c91eb3ee9368c9f8a (diff)
parentb97da61b5a26e67dca11a81d28b5e26e3a3f5a59 (diff)
downloadtor-a7cf788740f9cb8befc8c46d175dbc23a4aaa6ea.tar
tor-a7cf788740f9cb8befc8c46d175dbc23a4aaa6ea.tar.gz
Merge branch 'bug1992_part1'
Diffstat (limited to 'src/common/address.c')
-rw-r--r--src/common/address.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common/address.c b/src/common/address.c
index c7e8109fa..323e0eeac 100644
--- a/src/common/address.c
+++ b/src/common/address.c
@@ -925,6 +925,18 @@ fmt_addr(const tor_addr_t *addr)
return buf;
}
+/** Like fmt_addr(), but for IPv4 addresses. Also not thread-safe, also
+ * clobbers its return buffer on repeated calls. */
+const char *
+fmt_addr32(uint32_t addr)
+{
+ static char buf[INET_NTOA_BUF_LEN];
+ struct in_addr in;
+ in.s_addr = htonl(addr);
+ tor_inet_ntoa(&in, buf, sizeof(buf));
+ return buf;
+}
+
/** Convert the string in <b>src</b> to a tor_addr_t <b>addr</b>. The string
* may be an IPv4 address, an IPv6 address, or an IPv6 address surrounded by
* square brackets.