diff options
Diffstat (limited to 'src/or/policies.c')
-rw-r--r-- | src/or/policies.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/or/policies.c b/src/or/policies.c index 358f766bd5..4148fa471e 100644 --- a/src/or/policies.c +++ b/src/or/policies.c @@ -23,6 +23,9 @@ static addr_policy_t *authdir_reject_policy = NULL; * to be marked as valid in our networkstatus. */ static addr_policy_t *authdir_invalid_policy = NULL; /** Policy that addresses for incoming router descriptors must <b>not</b> + * match in order to not be marked as BadDirectory. */ +static addr_policy_t *authdir_baddir_policy = NULL; +/** Policy that addresses for incoming router descriptors must <b>not</b> * match in order to not be marked as BadExit. */ static addr_policy_t *authdir_badexit_policy = NULL; @@ -206,6 +209,16 @@ authdir_policy_valid_address(uint32_t addr, uint16_t port) return addr_policy_permits_address(addr, port, authdir_invalid_policy); } +/** Return 1 if <b>addr</b>:<b>port</b> should be marked as a bad dir, + * based on <b>authdir_baddir_policy</b>. Else return 0. + */ +int +authdir_policy_baddir_address(uint32_t addr, uint16_t port) +{ + return ! addr_policy_permits_address(addr, port, authdir_baddir_policy); +} + + /** Return 1 if <b>addr</b>:<b>port</b> should be marked as a bad exit, * based on <b>authdir_badexit_policy</b>. Else return 0. */ @@ -289,6 +302,8 @@ policies_parse_from_options(or_options_t *options) &authdir_reject_policy, ADDR_POLICY_REJECT); load_policy_from_option(options->AuthDirInvalid, &authdir_invalid_policy, ADDR_POLICY_REJECT); + load_policy_from_option(options->AuthDirBadDir, + &authdir_baddir_policy, ADDR_POLICY_REJECT); load_policy_from_option(options->AuthDirBadExit, &authdir_badexit_policy, ADDR_POLICY_REJECT); parse_reachable_addresses(); |