[or-cvs] r16553: {tor} Do not split stored exit policy summary into type(accept/rej (tor/trunk/src/or)

weasel at seul.org weasel at seul.org
Thu Aug 14 23:01:22 UTC 2008


Author: weasel
Date: 2008-08-14 19:01:21 -0400 (Thu, 14 Aug 2008)
New Revision: 16553

Modified:
   tor/trunk/src/or/or.h
   tor/trunk/src/or/routerparse.c
Log:
Do not split stored exit policy summary into type(accept/reject) and portlist.  At least not just yet

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2008-08-14 23:01:09 UTC (rev 16552)
+++ tor/trunk/src/or/or.h	2008-08-14 23:01:21 UTC (rev 16553)
@@ -1420,8 +1420,6 @@
 
   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. */
 

Modified: tor/trunk/src/or/routerparse.c
===================================================================
--- tor/trunk/src/or/routerparse.c	2008-08-14 23:01:09 UTC (rev 16552)
+++ tor/trunk/src/or/routerparse.c	2008-08-14 23:01:21 UTC (rev 16553)
@@ -266,7 +266,7 @@
 /** 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 @@
 
   /* 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;
   }
 



More information about the tor-commits mailing list