Skip to content
Commit f61e9131 authored by Damian Johnson's avatar Damian Johnson
Browse files

Fallback to GETCONF for getting exit policies

As pointed out by dmr on #25423 when tor is unable to determine our address
'GETINFO exit-policy/full' fails. I was able to easily repro this by running
our integ tests when disconnected...

  ======================================================================
  ERROR: test_get_exit_policy
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/home/atagar/Desktop/stem/test/require.py", line 58, in wrapped
      return func(self, *args, **kwargs)
    File "/home/atagar/Desktop/stem/test/integ/control/controller.py", line 278, in test_get_exit_policy
      self.assertEqual(ExitPolicy('reject *:*'), controller.get_exit_policy())
    File "/home/atagar/Desktop/stem/stem/control.py", line 481, in wrapped
      return func(self, *args, **kwargs)
    File "/home/atagar/Desktop/stem/stem/control.py", line 1289, in get_exit_policy
      policy = stem.exit_policy.ExitPolicy(*self.get_info('exit-policy/full').splitlines())
    File "/home/atagar/Desktop/stem/stem/control.py", line 481, in wrapped
      return func(self, *args, **kwargs)
    File "/home/atagar/Desktop/stem/stem/control.py", line 1186, in get_info
      stem.response.convert('GETINFO', response)
    File "/home/atagar/Desktop/stem/stem/response/__init__.py", line 124, in convert
      message._parse_message(**kwargs)
    File "/home/atagar/Desktop/stem/stem/response/getinfo.py", line 40, in _parse_message
      raise stem.ProtocolError("GETINFO response didn't have an OK status:\n%s" % self)
  ProtocolError: GETINFO response didn't have an OK status:
  router_get_my_routerinfo returned NULL

I'll shoot tor a ticket in a bit, but in the meantime when this happens
we'll now fall back to our prior method of getting the policy. One small
fix for the legacy method is that we now account for 'ExitRelay 0' in our
the torrc (otherwise our tests wouldn't pass).
parent cc95059d
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment