summaryrefslogtreecommitdiff
path: root/src/common/address_set.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-02-08 12:13:56 -0500
committerDavid Goulet <dgoulet@torproject.org>2018-02-08 14:38:14 -0500
commit0640da42696a666382dd569839e98312d720a22a (patch)
tree059aefcf8cd992840e3f3761e653ba58991d13a6 /src/common/address_set.c
parent46bd2aed915f17d520f9ff237262d1510fe25e12 (diff)
downloadtor-0640da42696a666382dd569839e98312d720a22a.tar.gz
tor-0640da42696a666382dd569839e98312d720a22a.zip
Function to add an ipv4 address to an address_set
This is a convenience function, so callers don't need to wrap the IPv4 address.
Diffstat (limited to 'src/common/address_set.c')
-rw-r--r--src/common/address_set.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common/address_set.c b/src/common/address_set.c
index df7022174c..6fa942b0dc 100644
--- a/src/common/address_set.c
+++ b/src/common/address_set.c
@@ -97,6 +97,15 @@ address_set_add(address_set_t *set, const struct tor_addr_t *addr)
}
}
+/** As address_set_add(), but take an ipv4 address in host order. */
+void
+address_set_add_ipv4h(address_set_t *set, uint32_t addr)
+{
+ tor_addr_t a;
+ tor_addr_from_ipv4h(&a, addr);
+ address_set_add(set, &a);
+}
+
/**
* Return true if <b>addr</b> if a member of <b>set</b>. (And probably,
* return false if <b>addr</b> is not a member of set.)