aboutsummaryrefslogtreecommitdiff
path: root/src/common/address.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-10-24 12:33:18 -0400
committerNick Mathewson <nickm@torproject.org>2012-11-14 23:16:21 -0500
commit2eb7eafc9d789cb5063dd36021412434b656bf75 (patch)
tree6fb621cd10a3d41a242d2588c9a533a743570194 /src/common/address.h
parent462ebb270a10f02573b1847649db45b94c0e0fc3 (diff)
downloadtor-2eb7eafc9d789cb5063dd36021412434b656bf75.tar
tor-2eb7eafc9d789cb5063dd36021412434b656bf75.tar.gz
Add a new family-specific syntax for tor_addr_parse_mask_ports
By default, "*" means "All IPv4 addresses" with tor_addr_parse_mask_ports, so I won't break anything. But if the new EXTENDED_STAR flag is provided, then * means "any address", *4 means "any IPv4 address" (that is, 0.0.0.0/0), and "*6" means "any IPv6 address" (that is, [::]/0). This is going to let us have a syntax for specifying exit policies in torrc that won't drive people mad. Also, add a bunch of unit tests for tor_addr_parse_mask_ports to test these new features, and to increase coverage.
Diffstat (limited to 'src/common/address.h')
-rw-r--r--src/common/address.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common/address.h b/src/common/address.h
index 067b7a0ca..6bf94610c 100644
--- a/src/common/address.h
+++ b/src/common/address.h
@@ -183,7 +183,8 @@ int tor_addr_parse_PTR_name(tor_addr_t *result, const char *address,
int tor_addr_port_lookup(const char *s, tor_addr_t *addr_out,
uint16_t *port_out);
-int tor_addr_parse_mask_ports(const char *s,
+#define TAPMP_EXTENDED_STAR 1
+int tor_addr_parse_mask_ports(const char *s, unsigned flags,
tor_addr_t *addr_out, maskbits_t *mask_out,
uint16_t *port_min_out, uint16_t *port_max_out);
const char * tor_addr_to_str(char *dest, const tor_addr_t *addr, size_t len,