add_status = RTR_INVALID;
} else if (!strcasecmp(nickname, "!middleonly")) {
add_status = RTR_MIDDLEONLY;
+ } else if (!strcasecmp(nickname, "!stripexit")) {
+ add_status = RTR_STRIPGUARD;
+ } else if (!strcasecmp(nickname, "!striphsdir")) {
+ add_status = RTR_STRIPHSDIR;
+ } else if (!strcasecmp(nickname, "!stripv2dir")) {
+ add_status = RTR_STRIPV2DIR;
}
/* Check if fingerprint is RSA or ed25519 by verifying it. */
node->is_valid = (authstatus & RTR_INVALID) ? 0 : 1;
node->is_bad_exit = (authstatus & RTR_BADEXIT) ? 1 : 0;
node->is_middle_only = (authstatus & RTR_MIDDLEONLY) ? 1 : 0;
+ node->strip_guard = (authstatus & RTR_STRIPGUARD) ? 1 : 0;
+ node->strip_hsdir = (authstatus & RTR_STRIPHSDIR) ? 1 : 0;
+ node->strip_v2dir = (authstatus & RTR_STRIPV2DIR) ? 1 : 0;
}
/** True iff <b>a</b> is more severe than <b>b</b>. */
(r & RTR_MIDDLEONLY) ? "" : "not");
node->is_middle_only = (r&RTR_MIDDLEONLY) ? 1: 0;
}
+ if (bool_neq((r & RTR_STRIPGUARD), node->strip_guard)) {
+ log_info(LD_DIRSERV, "Router '%s' is now %s guard", description,
+ (r & RTR_STRIPGUARD) ? "stripped of" : "not");
+ node->strip_guard = (r&RTR_STRIPGUARD) ? 1: 0;
+ }
+ if (bool_neq((r & RTR_STRIPHSDIR), node->strip_hsdir)) {
+ log_info(LD_DIRSERV, "Router '%s' is now %s hidden service directory",
+ description, (r & RTR_STRIPHSDIR) ? "stripped of" : "not");
+ node->strip_hsdir = (r&RTR_STRIPHSDIR) ? 1: 0;
+ }
+ if (bool_neq((r & RTR_STRIPV2DIR), node->strip_v2dir)) {
+ log_info(LD_DIRSERV, "Router '%s' is now %s v2 directory",
+ description, (r & RTR_STRIPV2DIR) ? "stripped of" : "not");
+ node->strip_v2dir = (r&RTR_STRIPV2DIR) ? 1: 0;
+ }
} SMARTLIST_FOREACH_END(node);
routerlist_assert_ok(rl);
rs->is_exit = rs->is_possible_guard = rs->is_hs_dir = rs->is_v2_dir = 0;
}
+ /* Strip rs flags based on node flags. */
+ if (node->strip_guard) {
+ rs->is_possible_guard = 0;
+ }
+ if (node->strip_hsdir) {
+ rs->is_hs_dir = 0;
+ }
+ if (node->strip_v2dir) {
+ rs->is_v2_dir = 0;
+ }
+
/* Set rs->is_staledesc. */
rs->is_staledesc =
(ri->cache_info.published_on + DESC_IS_STALE_INTERVAL) < now;
unsigned int is_middle_only:1;
unsigned int is_hs_dir:1; /**< True iff this router is a hidden service
* directory according to the authorities. */
+ unsigned int strip_guard:1; /**< True iff we should strip the Guard flag. */
+ unsigned int strip_hsdir:1; /**< True iff we should strip the HSDir flag. */
+ unsigned int strip_v2dir:1; /**< True iff we should strip the V2Dir flag. */
/* Local info: warning state. */