getinfo exit-policy/ipv6 does not show masks >= 32
After enabling IPv6 on an exit node, I was discouraged by the lack of IPv6 policy displayed on Atlas, where there is a section in which IPv6 policy should be displayed, but the list is empty for my node, causing me to fear that my exit node could be used to relay spam on port 25 over IPv6, etc.
So I connected to the ControlPort and issued "getinfo exit-policy/ipv6" to confirm that there are sane defaults being applied to IPv6 policy. Indeed there are, and even private networks like "reject6 [fc00::]/7:*" are automatically configured, great!
However policies that I manually added, for example:
ExitPolicy reject6 [2610:148:1f10::]/48:*
...are not being output correctly by the getinfo command, for example:
reject6 [2610:148:1f10::]:*
...no mask!
Turns out that in function policy_write_item in src/or/policies.c the mask is being hidden if mask bits is >= 32, which makes sense for IPv4, but for IPv6 the test should be 128.
Attached is a trivial patch which I've tested and confirmed it corrects the getinfo policy output.
Trac:
Username: gturner