commit d71690160f98e776f82d642eb741e67ed6a404de Author: Damian Johnson atagar@torproject.org Date: Mon Nov 24 11:14:04 2014 -0800
Don't balk when getting our exit policy if address is unknown
When tor doesn't know our address (I think due to not having router status entries - it's when router_pick_published_address() is unsuccessful), our get_exit_policy() method failed with...
====================================================================== ERROR: test_get_exit_policy ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/atagar/Desktop/stem/test/integ/control/controller.py", line 338, in test_get_exit_policy policy_str = str(controller.get_exit_policy()) File "/home/atagar/Desktop/stem/stem/control.py", line 384, in wrapped raise exc ProtocolError: GETINFO response didn't have an OK status: Address unknown
This is because our external address is part of our effective exit policy (due to rejecting private addresses). If tor doesn't know our address itself then it can't enforce this part of the policy, so it's better for us to just exclude it rather than error like this. --- stem/control.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/stem/control.py b/stem/control.py index 320fcab..6e34ec0 100644 --- a/stem/control.py +++ b/stem/control.py @@ -1119,7 +1119,7 @@ class Controller(BaseController):
policy += self.get_info('exit-policy/default').split(',')
- config_policy = stem.exit_policy.get_config_policy(policy, self.get_info('address')) + config_policy = stem.exit_policy.get_config_policy(policy, self.get_info('address', None)) self._set_cache({'exit_policy': config_policy})
return config_policy