torspec lies about accepting both IPv4 and IPv6 for ORAddress lines
(From this comment on #9380)
"or-address" lines, in implementation, only happen once each per router, and only ever contain IPv6 addresses, despite what
The spec says:
"a" SP address ":" port NL [Any number] The "or-address" element as specified in section 2.1.1.
"or-address" SP ADDRESS ":" PORT NL [Any number] ADDRESS = IP6ADDR | IP4ADDR IPV6ADDR = an ipv6 address, surrounded by square brackets. IPV4ADDR = an ipv4 address, represented as a dotted quad. PORT = a number between 1 and 65535 inclusive. An alternative for the address and ORPort of the "router" line, but with two added capabilities: * or-address can be either an IPv4 or IPv6 address * or-address allows for multiple ORPorts and addresses A descriptor SHOULD NOT include an or-address line that does nothing but duplicate the address:port pair from its "router" line. The ordering of or-address lines and their PORT entries matter because Tor MAY accept a limited number of addresses or ports. As of Tor 0.2.3.x only the first address and the first port are used.
In terms of how many
"or-address"lines there may be, the spec is only correct if you pay super close attention to the last sentence (this is actually the first time I've noticed it :) ).
In terms of whether IPv4 and/or IPv6 addresses are acceptable, the spec is currently wrong, according to the functions
router_rebuild_descriptor()[https://gitweb.torproject.org/tor.git/blob/9f9b19ed7b06d8313a9bcbd6647fa097ec0a059d:/src/or/router.c#l1811 [source]] and
router_dump_router_to_string()[https://gitweb.torproject.org/tor.git/blob/9f9b19ed7b06d8313a9bcbd6647fa097ec0a059d:/src/or/router.c#l2330 [source]] in
src/or/router.cin tor's source code.