diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-09-04 18:23:18 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-09-04 18:23:18 -0400 |
commit | ec94d0307e06b9ea5732e86e369dcf5c727f05cb (patch) | |
tree | 6938e13ac3fd516a0b2de4c79310986239238f0f /src/common | |
parent | 730dd9a6d0c84afb981818652c41cf14b881a2db (diff) | |
parent | d34c690e54568a1b7813202509491b75f206e8b9 (diff) | |
download | tor-ec94d0307e06b9ea5732e86e369dcf5c727f05cb.tar.gz tor-ec94d0307e06b9ea5732e86e369dcf5c727f05cb.zip |
Merge remote-tracking branch 'linus/bug6363_only-ln'
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/address.c | 12 | ||||
-rw-r--r-- | src/common/address.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/common/address.c b/src/common/address.c index e88869f1d8..e5862be1e9 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -1697,3 +1697,15 @@ tor_addr_hostname_is_local(const char *name) !strcasecmpend(name, ".local"); } + +/** Return a newly allocated tor_addr_port_t with <b>addr</b> and + <b>port</b> filled in. */ +tor_addr_port_t * +tor_addr_port_new(const tor_addr_t *addr, uint16_t port) +{ + tor_addr_port_t *ap = tor_malloc_zero(sizeof(tor_addr_port_t)); + if (addr) + tor_addr_copy(&ap->addr, addr); + ap->port = port; + return ap; +} diff --git a/src/common/address.h b/src/common/address.h index e0e1ec6606..7a779d8880 100644 --- a/src/common/address.h +++ b/src/common/address.h @@ -221,5 +221,7 @@ int tor_inet_ntoa(const struct in_addr *in, char *buf, size_t buf_len); char *tor_dup_ip(uint32_t addr) ATTR_MALLOC; int get_interface_address(int severity, uint32_t *addr); +tor_addr_port_t *tor_addr_port_new(const tor_addr_t *addr, uint16_t port); + #endif |