Currently the DNS resolver handles CNAME by skipping that record in the answer and looking for the subsequent A/AAAA/PTR record. There are other record types which could be handled in the same way, e.g. DNAME, but their presence currently causes the answer parsing to be abandoned. A better approach would be to skip *any* other record and just use the first A, AAAA or PTR in the answer, regardless of what comes before it.
The random_socket function isn't used, and the code can only be
compiled if the function is optimised away (because it's static
and unused) otherwise it will fail to link when "ipv4_addr" and
"ipv6_addr" are not found.
Fix this by modifying ipv4_addr and ipv6_addr so that they're not
external variables.