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>
Sat, 19 Jul 2014 18:26:19 +0000 (19:26 +0100)
commit9ee3a72c6fa372f5545e8d29af56553f33e70ab1
tree34c82fda674e60d9386f0a0e0bd1602fa72cb2b8
parentb190a826f7fdb7e2fd8f9175b2f3f5e8296f3dee
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
src/addrfam.c
src/check.c
src/event.c
src/internal.h
src/setup.c
src/types.c