From e27b448c578d279f3f0b2c1a29e17dcdaaff22ee Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Thu, 14 Aug 2008 23:01:21 +0000 Subject: [PATCH] Do not split stored exit policy summary into type(accept/reject) and portlist. At least not just yet svn:r16553 --- src/or/or.h | 2 -- src/or/routerparse.c | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/or/or.h b/src/or/or.h index 3849dc40c8..ceecd9296b 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1420,8 +1420,6 @@ typedef struct routerstatus_t { uint32_t bandwidth; /**< Bandwidth (capacity) of the router as reported in * the vote/consensus, in kilobytes/sec. */ - addr_policy_action_t exitsummary_type; /**< is the list of ports a list of - * rejected or accepted ports? */ char *exitsummary; /**< exit policy summary - * XXX weasel: this probably should not stay a string. */ diff --git a/src/or/routerparse.c b/src/or/routerparse.c index f5dc3ff0b7..d1f3dfe92a 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -266,7 +266,7 @@ static token_rule_t extrainfo_token_table[] = { /** List of tokens allowable in the body part of v2 and v3 networkstatus * documents. */ static token_rule_t rtrstatus_token_table[] = { - T01("p", K_P, GE(2), NO_OBJ ), + T01("p", K_P, CONCAT_ARGS, NO_OBJ ), T1( "r", K_R, GE(8), NO_OBJ ), T1( "s", K_S, ARGS, NO_OBJ ), T01("v", K_V, CONCAT_ARGS, NO_OBJ ), @@ -1886,18 +1886,18 @@ routerstatus_parse_entry_from_string(memarea_t *area, /* parse exit policy summaries */ if ((tok = find_first_by_keyword(tokens, K_P))) { - tor_assert(tok->n_args == 2); - if (!strcmp(tok->args[0], "accept")) - rs->exitsummary_type = ADDR_POLICY_ACCEPT; - else if (!strcmp(tok->args[0], "reject")) - rs->exitsummary_type = ADDR_POLICY_REJECT; - else { - log_warn(LD_DIR, "Unknown exit policy summary type %s.", + tor_assert(tok->n_args == 1); + if (strcmpstart(tok->args[0], "accept ") && + strcmpstart(tok->args[0], "reject ")) { + log_err(LD_DIR, "Unknown exit policy summary type %s.", escaped(tok->args[0])); goto err; } - /* XXX weasel: parse this into ports and represent them somehow smart */ - rs->exitsummary = tor_strdup(tok->args[1]); + /* XXX weasel: parse this into ports and represent them somehow smart, + * maybe not here but somewhere on if we need it for the client. + * we should still parse it here to check it's valid tho. + */ + rs->exitsummary = tor_strdup(tok->args[0]); rs->has_exitsummary = 1; }