Omit any exit rules that follow a catch-all rule when writing a router descriptor.

svn:r2459
This commit is contained in:
Nick Mathewson 2004-10-13 01:25:42 +00:00
parent 9c49947163
commit 9dc72de41f

View File

@ -709,7 +709,7 @@ int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router,
return -1; return -1;
written += result; written += result;
} }
if (tmpe->prt_min == 0 && tmpe->prt_max == 65535) { if (tmpe->prt_min <= 1 && tmpe->prt_max == 65535) {
/* There is no port set; write ":*" */ /* There is no port set; write ":*" */
if (written > maxlen-4) if (written > maxlen-4)
return -1; return -1;
@ -729,6 +729,9 @@ int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router,
return -1; return -1;
written += result; written += result;
} }
if (tmpe->msk == 0 && tmpe->prt_min <= 1 && tmpe->prt_max == 65535)
/* This was a catch-all rule, so future rules are irrelevant. */
break;
} /* end for */ } /* end for */
if (written > maxlen-256) /* Not enough room for signature. */ if (written > maxlen-256) /* Not enough room for signature. */
return -1; return -1;