• Nick Mathewson's avatar
    Revise the DNS subsystem to handle IPv6 exits. · 2889bd26
    Nick Mathewson authored
    Now, every cached_resolve_t can remember an IPv4 result *and* an IPv6
    result.  As a light protection against timing-based distinguishers for
    IPv6 users (and against complexity!), every forward request generates
    an IPv4 *and* an IPv6 request, assuming that we're an IPv6 exit.  Once
    we have answers or errors for both, we act accordingly.
    This patch additionally makes some useful refactorings in the dns.c
    code, though there is quite a bit more of useful refactoring that could
    be done.
    Additionally, have a new interface for the argument passed to the
    evdns_callback function.  Previously, it was just the original address
    we were resolving.  But it turns out that, on error, evdns doesn't
    tell you the type of the query, so on a failure we didn't know whether
    IPv4 or IPv6 queries were failing.
    The new convention is to have the first byte of that argument include
    the query type.  I've refactored the code a bit to make that simpler.