summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2020-07-02 14:18:00 -0400
committerDavid Goulet <dgoulet@torproject.org>2020-07-02 14:18:00 -0400
commit064e23e95c8d0d0fb762e1cb7699c4bd4c75ecb8 (patch)
treefae8c54d09c53e133f8ce8b658c0b6abbf687ef4 /src/lib
parentb0a716dfb0a73920ac4f6531f39fd4a303f6bd44 (diff)
parentc5707d6cf0d3009655ce4681a228c8d2767a9063 (diff)
downloadtor-064e23e95c8d0d0fb762e1cb7699c4bd4c75ecb8.tar.gz
tor-064e23e95c8d0d0fb762e1cb7699c4bd4c75ecb8.zip
Merge branch 'tor-github/pr/1968'
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/net/address.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/net/address.h b/src/lib/net/address.h
index 5ab654ef1d..6b18919f6d 100644
--- a/src/lib/net/address.h
+++ b/src/lib/net/address.h
@@ -95,6 +95,7 @@ static inline uint32_t tor_addr_to_ipv4n(const tor_addr_t *a);
static inline uint32_t tor_addr_to_ipv4h(const tor_addr_t *a);
static inline uint32_t tor_addr_to_mapped_ipv4h(const tor_addr_t *a);
static inline sa_family_t tor_addr_family(const tor_addr_t *a);
+static inline bool tor_addr_is_unspec(const tor_addr_t *a);
static inline const struct in_addr *tor_addr_to_in(const tor_addr_t *a);
static inline int tor_addr_eq_ipv4h(const tor_addr_t *a, uint32_t u);
@@ -188,6 +189,15 @@ tor_addr_family(const tor_addr_t *a)
return a->family;
}
+/**
+ * Return true if the address @a is in the UNSPEC family.
+ **/
+static inline bool
+tor_addr_is_unspec(const tor_addr_t *a)
+{
+ return a->family == AF_UNSPEC;
+}
+
/** Return an in_addr* equivalent to <b>a</b>, or NULL if <b>a</b> is not
* an IPv4 address. */
static inline const struct in_addr *