tor-spec says additional fields in exitpolicy response are "optional" when they're not
A #tor user reported seeing
if (rh.length < 9) { /* reason+ipv4+dns_ttl */
log_notice(LD_PROTOCOL,
"Short path bias probe response length field (%d).", rh.length);
return - END_CIRC_REASON_TORPROTOCOL;
}
I think this was triggered by Tom's new relay implementation.
It turns out our spec says
The payload of a RELAY_END cell begins with a single 'reason' byte to
describe why the stream is closing, plus optional data (depending on
the reason.)
[...]
(With REASON_EXITPOLICY, the 4-byte IPv4 address or 16-byte IPv6 address
forms the optional data, along with a 4-byte TTL; no other reason
currently has extra data.)
Tom and I are now thinking that this word 'optional' means 'required for some types of end cells but not included in others'. But he misinterpreted 'optional' to mean 'you don't have to implement it'. Which is a fine interpretation, except Tor clients complain at log-level notice when you don't.
I think it was originally optional because some very old Tor versions didn't implement it. But now they all do (well, up until yesterday, when Tom's version came online). Should we just make this extra data for reason-exitpolicy be optionally mandatory?