|
@@ -39,6 +39,7 @@ typedef enum {
|
|
|
K_DIRCACHEPORT,
|
|
K_DIRCACHEPORT,
|
|
|
K_CONTACT,
|
|
K_CONTACT,
|
|
|
K_NETWORK_STATUS,
|
|
K_NETWORK_STATUS,
|
|
|
|
|
+ K_UPTIME,
|
|
|
_UNRECOGNIZED,
|
|
_UNRECOGNIZED,
|
|
|
_ERR,
|
|
_ERR,
|
|
|
_EOF,
|
|
_EOF,
|
|
@@ -111,6 +112,7 @@ static struct {
|
|
|
{ "dircacheport", K_DIRCACHEPORT, ARGS, NO_OBJ, RTR_ONLY },
|
|
{ "dircacheport", K_DIRCACHEPORT, ARGS, NO_OBJ, RTR_ONLY },
|
|
|
{ "contact", K_CONTACT, CONCAT_ARGS, NO_OBJ, ANY },
|
|
{ "contact", K_CONTACT, CONCAT_ARGS, NO_OBJ, ANY },
|
|
|
{ "network-status", K_NETWORK_STATUS, NO_ARGS, NO_OBJ, DIR_ONLY },
|
|
{ "network-status", K_NETWORK_STATUS, NO_ARGS, NO_OBJ, DIR_ONLY },
|
|
|
|
|
+ { "uptime", K_UPTIME, ARGS, NO_OBJ, RTR_ONLY },
|
|
|
{ NULL, -1 }
|
|
{ NULL, -1 }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -642,6 +644,7 @@ routerinfo_t *router_parse_entry_from_string(const char *s,
|
|
|
smartlist_t *tokens = NULL, *exit_policy_tokens = NULL;
|
|
smartlist_t *tokens = NULL, *exit_policy_tokens = NULL;
|
|
|
directory_token_t *tok;
|
|
directory_token_t *tok;
|
|
|
int t;
|
|
int t;
|
|
|
|
|
+ long lng;
|
|
|
int ports_set, bw_set;
|
|
int ports_set, bw_set;
|
|
|
|
|
|
|
|
if (!end) {
|
|
if (!end) {
|
|
@@ -745,6 +748,14 @@ routerinfo_t *router_parse_entry_from_string(const char *s,
|
|
|
bw_set = 1;
|
|
bw_set = 1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if ((tok = find_first_by_keyword(tokens, K_UPTIME))) {
|
|
|
|
|
+ if (tok->n_args != 1) {
|
|
|
|
|
+ log_fn(LOG_WARN, "Unrecognized number of args on K_UPTIME; skipping.");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ router->uptime = atol(tok->args[0]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (!(tok = find_first_by_keyword(tokens, K_PUBLISHED))) {
|
|
if (!(tok = find_first_by_keyword(tokens, K_PUBLISHED))) {
|
|
|
log_fn(LOG_WARN, "Missing published time"); goto err;
|
|
log_fn(LOG_WARN, "Missing published time"); goto err;
|
|
|
}
|
|
}
|