ExitPolicy.can_exit_to() returns incorrect results when address is omitted
|Reported by:||nskinkel||Owned by:||atagar|
Note: this is with Stem version 1.3.0
When using ExitPolicy.can_exit_to(port=443, strict=False), an incorrect result is returned. Ex:
>>> policy = ExitPolicy('reject 184.108.40.206/8:*', 'accept *:*') >>> policy.can_exit_to(port=443, strict=False) >>> False
If an address is included, however, the results are as expected:
>>> policy = ExitPolicy('reject 220.127.116.11/8:*', 'accept *:*') >>> policy.can_exit_to(address='18.104.22.168', port=443, strict=False) >>> True
According to Stem's documentation for can_exit_to() for the 'strict' parameter:
strict (bool) -- if the address or port is excluded then check if we can exit to all instances of the defined address or port
I interpret this to mean:
If 'strict' is True, then can_exit_to() should return True iff exits to *all* possible IPs are allowed on the specified port when 'address' is omitted. If 'strict' is False, then can_exit_to() should return True if *any* exits to the specified port are allowed when 'address' is omitted.
Is this just a misunderstanding of the documentation on my part? Or is this actually a bug?
Attached: a script to reproduce the issue.