aboutsummaryrefslogtreecommitdiff
path: root/src/or/router.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-10-24 15:03:29 -0400
committerNick Mathewson <nickm@torproject.org>2012-11-14 23:16:21 -0500
commita96c0affcb4cda1a2e0d83d123993d10efc6e396 (patch)
tree179be96049286cae1b9b1aa4b633f60da2c29023 /src/or/router.c
parent2eb7eafc9d789cb5063dd36021412434b656bf75 (diff)
downloadtor-a96c0affcb4cda1a2e0d83d123993d10efc6e396.tar
tor-a96c0affcb4cda1a2e0d83d123993d10efc6e396.tar.gz
Better policy support for IPv6
Now, "accept *:80" means "accept all addresses on port 80", and not just IPv4. For just v4, say "accept *4:80"; for just v6 say "accept *6:80". We can parse these policies from torrc just fine, and we should be successfully keeping them out of descriptors for now. We also now include appropriate IPv6 addresses in "reject private:*"
Diffstat (limited to 'src/or/router.c')
-rw-r--r--src/or/router.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/or/router.c b/src/or/router.c
index 1cac63a3a..efe24d7cc 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -2001,7 +2001,6 @@ router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router,
size_t onion_pkeylen, identity_pkeylen;
size_t written;
int result=0;
- addr_policy_t *tmpe;
char *family_line;
char *extra_or_address = NULL;
const or_options_t *options = get_options();
@@ -2130,11 +2129,12 @@ router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router,
if (!router->exit_policy || !smartlist_len(router->exit_policy)) {
strlcat(s+written, "reject *:*\n", maxlen-written);
written += strlen("reject *:*\n");
- tmpe = NULL;
} else if (router->exit_policy) {
int i;
for (i = 0; i < smartlist_len(router->exit_policy); ++i) {
- tmpe = smartlist_get(router->exit_policy, i);
+ addr_policy_t *tmpe = smartlist_get(router->exit_policy, i);
+ if (tor_addr_family(&tmpe->addr) == AF_INET6)
+ continue; /* Don't include IPv6 parts of address policy */
result = policy_write_item(s+written, maxlen-written, tmpe, 1);
if (result < 0) {
log_warn(LD_BUG,"descriptor policy_write_item ran out of room!");