summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorteor (Tim Wilson-Brown) <teor2345@gmail.com>2015-09-09 23:48:33 +1000
committerteor (Tim Wilson-Brown) <teor2345@gmail.com>2015-09-14 11:12:28 +1000
commit60312dc08b30243740e85c2a944874014f682579 (patch)
treeb240681a50c1f34e8690d31821871d739bbc20fa
parenta444b11323799536b4cd7902e29f711b0806293a (diff)
downloadtor-60312dc08b30243740e85c2a944874014f682579.tar.gz
tor-60312dc08b30243740e85c2a944874014f682579.zip
Update comments about ExitPolicy parsing
Fix incomplete and incorrect comments. Comment changes only.
-rw-r--r--src/common/address.h3
-rw-r--r--src/or/policies.c2
-rw-r--r--src/or/routerparse.c10
3 files changed, 11 insertions, 4 deletions
diff --git a/src/common/address.h b/src/common/address.h
index cd80615f93..48a34cee31 100644
--- a/src/common/address.h
+++ b/src/common/address.h
@@ -227,6 +227,9 @@ 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);
+/* Does the address * yield an AF_UNSPEC wildcard address (1) and do we
+ * allow *4 and *6 for IPv4 and IPv6 wildcards, respectively;
+ * or does the address * yield IPv4 wildcard address (0). */
#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,
diff --git a/src/or/policies.c b/src/or/policies.c
index 560b8cb4c3..07a3e18597 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -152,7 +152,7 @@ policy_expand_unspec(smartlist_t **policy)
}
/**
- * Given a linked list of config lines containing "allow" and "deny"
+ * Given a linked list of config lines containing "accept[6]" and "reject[6]"
* tokens, parse them and append the result to <b>dest</b>. Return -1
* if any tokens are malformed (and don't append any), else return 0.
*
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index c2206f1075..d0b2cba19f 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -3676,10 +3676,14 @@ router_parse_addr_policy_item_from_string,(const char *s, int assume_action))
directory_token_t *tok = NULL;
const char *cp, *eos;
/* Longest possible policy is
- * "accept6 ffff:ffff:..255/ffff:...255:10000-65535",
- * which contains 2 max-length IPv6 addresses, plus 21 characters.
+ * "accept6 ffff:ffff:..255/128:10000-65535",
+ * which contains a max-length IPv6 address, plus 24 characters.
* But note that there can be an arbitrary amount of space between the
- * accept and the address:mask/port element. */
+ * accept and the address:mask/port element.
+ * We don't need to multiply TOR_ADDR_BUF_LEN by 2, as there is only one
+ * IPv6 address. But making the buffer shorter might cause valid long lines,
+ * which parsed in previous versions, to fail to parse in new versions.
+ * (These lines would have to have excessive amounts of whitespace.) */
char line[TOR_ADDR_BUF_LEN*2 + 32];
addr_policy_t *r;
memarea_t *area = NULL;