mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-14 07:03:44 +01:00
Add tor_addr_port_new().
This commit is contained in:
parent
68901da5a1
commit
585ef06978
@ -1697,3 +1697,15 @@ tor_addr_hostname_is_local(const char *name)
|
|||||||
!strcasecmpend(name, ".local");
|
!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;
|
||||||
|
}
|
||||||
|
@ -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;
|
char *tor_dup_ip(uint32_t addr) ATTR_MALLOC;
|
||||||
int get_interface_address(int severity, uint32_t *addr);
|
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
|
#endif
|
||||||
|
|
||||||
|
@ -479,7 +479,7 @@ compute_routerstatus_consensus(smartlist_t *votes, int consensus_method,
|
|||||||
if (compare_vote_rs(most, rs) == 0 &&
|
if (compare_vote_rs(most, rs) == 0 &&
|
||||||
!tor_addr_is_null(&rs->status.ipv6_addr)
|
!tor_addr_is_null(&rs->status.ipv6_addr)
|
||||||
&& rs->status.ipv6_orport) {
|
&& rs->status.ipv6_orport) {
|
||||||
smartlist_add(alt_orports, tor_addr_port_alloc(&rs->status.ipv6_addr,
|
smartlist_add(alt_orports, tor_addr_port_new(&rs->status.ipv6_addr,
|
||||||
rs->status.ipv6_orport));
|
rs->status.ipv6_orport));
|
||||||
log_debug(LD_DIR, "picking %s:%d (%s) for voting on \"a\" lines", /* FIXME: remove */
|
log_debug(LD_DIR, "picking %s:%d (%s) for voting on \"a\" lines", /* FIXME: remove */
|
||||||
fmt_and_decorate_addr(&rs->status.ipv6_addr), rs->status.ipv6_orport,
|
fmt_and_decorate_addr(&rs->status.ipv6_addr), rs->status.ipv6_orport,
|
||||||
|
Loading…
Reference in New Issue
Block a user