diff options
author | Roger Dingledine <arma@torproject.org> | 2007-12-10 16:49:54 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2007-12-10 16:49:54 +0000 |
commit | ee6ae92670b587baa45c5088f52278db4bef0205 (patch) | |
tree | ae261f5f2ba3938db84e92c7c0dc4d6057e81274 /src/or/policies.c | |
parent | 5928203e9f117e9022ff780fbb0f0c560869b0bc (diff) | |
download | tor-ee6ae92670b587baa45c5088f52278db4bef0205.tar.gz tor-ee6ae92670b587baa45c5088f52278db4bef0205.zip |
New config options AuthDirBadDir and AuthDirListBadDirs for
authorities to mark certain relays as "bad directories" in the
networkstatus documents. Also supports the "!baddir" directive in
the approved-routers file.
svn:r12754
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(); |