diff --git a/src/common/address.c b/src/common/address.c index 3f00c1e617..7a2ce6eef8 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -181,6 +181,14 @@ tor_addr_make_unspec(tor_addr_t *a) a->family = AF_UNSPEC; } +/** DOCDOC */ +void +tor_addr_make_null(tor_addr_t *a, sa_family_t family) +{ + memset(a, 0, sizeof(*a)); + a->family = family; +} + /** Similar behavior to Unix gethostbyname: resolve name, and set * *addr to the proper IP address and family. The family * argument (which must be AF_INET, AF_INET6, or AF_UNSPEC) declares a diff --git a/src/common/address.h b/src/common/address.h index 6bf94610c8..9c0df6c24f 100644 --- a/src/common/address.h +++ b/src/common/address.h @@ -55,6 +55,7 @@ socklen_t tor_addr_to_sockaddr(const tor_addr_t *a, uint16_t port, int tor_addr_from_sockaddr(tor_addr_t *a, const struct sockaddr *sa, uint16_t *port_out); void tor_addr_make_unspec(tor_addr_t *a); +void tor_addr_make_null(tor_addr_t *a, sa_family_t family); char *tor_sockaddr_to_str(const struct sockaddr *sa); /** Return an in6_addr* equivalent to a, or NULL if a is not