addrfam: New arrangements for protocol address types
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 12 Jul 2014 11:56:46 +0000 (12:56 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 13 Oct 2014 00:27:18 +0000 (01:27 +0100)
commit421c1f2e4e36ec8b46e041ea023e178c1d48f34b
tree0091676c9ed1146e849dc3661c3e11a928748055
parentcf9a79d9bcf0f3885f9823ec6cdc6847e12b0ab2
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.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/addrfam.c
src/check.c
src/event.c
src/internal.h
src/setup.c
src/types.c