aboutsummaryrefslogtreecommitdiff
path: root/src/or/routerparse.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-10-15 01:58:11 +0000
committerNick Mathewson <nickm@torproject.org>2004-10-15 01:58:11 +0000
commit7fa5d224d4469de9ff69f41a245ada9b329a2840 (patch)
tree65464005a80a12dd2e103bac4534ea23d212afdd /src/or/routerparse.c
parente448879e3cd1a664c76f4c586cc4fe6f893b1187 (diff)
downloadtor-7fa5d224d4469de9ff69f41a245ada9b329a2840.tar.gz
tor-7fa5d224d4469de9ff69f41a245ada9b329a2840.zip
Implement "families" of coadministered nodes; prevent them all from appearing on the same circuit.
svn:r2523
Diffstat (limited to 'src/or/routerparse.c')
-rw-r--r--src/or/routerparse.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 6ee1c3f915..540e8b338e 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -41,6 +41,7 @@ typedef enum {
K_NETWORK_STATUS,
K_UPTIME,
K_DIR_SIGNING_KEY,
+ K_FAMILY,
_UNRECOGNIZED,
_ERR,
_EOF,
@@ -115,6 +116,7 @@ static struct {
{ "network-status", K_NETWORK_STATUS, NO_ARGS, NO_OBJ, DIR_ONLY },
{ "uptime", K_UPTIME, ARGS, NO_OBJ, RTR_ONLY },
{ "dir-signing-key", K_DIR_SIGNING_KEY, ARGS, OBJ_OK, DIR_ONLY },
+ { "family", K_FAMILY, ARGS, NO_OBJ, RTR_ONLY },
{ NULL, -1, NO_ARGS, NO_OBJ, ANY }
};
@@ -769,6 +771,7 @@ routerinfo_t *router_parse_entry_from_string(const char *s,
router = tor_malloc_zero(sizeof(routerinfo_t));
router->onion_pkey = router->identity_pkey = NULL;
+ router->declared_family = NULL;
ports_set = bw_set = 0;
if (tok->n_args == 2 || tok->n_args == 5 || tok->n_args == 6) {
@@ -876,6 +879,19 @@ routerinfo_t *router_parse_entry_from_string(const char *s,
log_fn(LOG_WARN,"Error in exit policy"); goto err;}
);
+
+ if ((tok = find_first_by_keyword(tokens, K_FAMILY)) && tok->n_args) {
+ int i;
+ router->declared_family = smartlist_create();
+ for (i=0;i<tok->n_args;++i) {
+ if (!is_legal_nickname_or_hexdigest(tok->args[i])) {
+ log_fn(LOG_WARN, "Illegal nickname %s in family line", tok->args[i]);
+ goto err;
+ }
+ smartlist_add(router->declared_family, tor_strdup(tok->args[i]));
+ }
+ }
+
if (!(tok = find_first_by_keyword(tokens, K_ROUTER_SIGNATURE))) {
log_fn(LOG_WARN, "Missing router signature"); goto err;
}