From: Ian Jackson Date: Sat, 12 Jul 2014 11:56:46 +0000 (+0100) Subject: addrfam: New arrangements for protocol address types X-Git-Tag: make-bug.2014-07-26~9 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/adns/commitdiff_plain/9ee3a72c6fa372f5545e8d29af56553f33e70ab1?hp=9ee3a72c6fa372f5545e8d29af56553f33e70ab1 addrfam: New arrangements for protocol address types Abolish union gen_addr and struct af_addr. It is not legitimate to up-cast to a union (since the alignment might be wrong), and the profusion of additonal address types is confusing. The new arrangements are: * Use adns_sockaddr wherever we can. That includes situations where the port (or v6 scope, etc.) is not relevant. * Where that's not possible, use a struct sockaddr if we can. * Where we need to deal with an IP address of unspecified family (we use the phrase `protocol address') we must use a void*. Other changes we make here: * Reorganise the set of functions provided by addrfam.c. Previously there was a comprehensive set of manipulators. Now, we have precisely the set of functions we need. The new functions are called adns__addr_* when they deal with adns_sockaddrs, and adns_sockaddr_* when dealing with struct sockaddrs. The new functions normally no longer need to take an explicit af parameter, since they can use the af field in the sockaddr. * adns__sockaddrs_equal (previously, adns__sockaddr_equal_p) now uses the generic protocol address comparison function; consequently remove the IN6_ADDR_EQUALP macro since it now has only one use site. * Remove the Lispy "-p" suffix from predicate function names. And of course the very formulaic changes to code which accesses addresses of various kinds. We introduce a small regression here: if the specified sortlist contains IPv6-mapped IPv4 addresses, we no longer honour those entries. This is because we simply un-v6-map the addresses before searching the sortlist, rather than searching the sortlist twice. XXX squash! addrfam: New arrangements for protocol address types ---