mbox

[v3,00/12] getaddrinfo facelift and fixes

Message ID 20220317081140.3098156-1-siddhesh@sourceware.org (mailing list archive)
Headers

Message

Siddhesh Poyarekar March 17, 2022, 8:11 a.m. UTC
  The gaih_inet implementation, which forms the core of getaddrinfo, is
quite complex in its implementation, making it hard to follow or debug.
Particularly, allocations for gaih_addrtuples to store intermediate
results are particularly hard to track because of the way in which it is
written.

This patchset is an attempt at cleaning up the implementation to make it
much easier to follow.  In the process, it also fixes a couple of bugs,
one that was the trigger for this cleanup and another that was
discovered during the cleanup.

Changes from v2:
- 1/12: reinitialized got_ipv6 too, changed test case to run in a
  container.
- 8/12: Fix leak on realloc failure
- Rest: updated review comments.

Changes from v1:
- Fixed nit: boolean coercion in convert_hostent_to_gaih_addrtuple
- Dropped DNS tests in tst-nss-gai-actions test since they are
  unnecessary and the files tests are sufficient.

Siddhesh Poyarekar (12):
  Simplify allocations and fix merge and continue actions [BZ #28931]
  gaih_inet: Simplify canon name resolution
  getaddrinfo: Fix leak with AI_ALL [BZ #28852]
  gaih_inet: Simplify service resolution
  gaih_inet: make numeric lookup a separate routine
  gaih_inet: Split simple gethostbyname into its own function
  gaih_inet: Split nscd lookup code into its own function.
  gaih_inet: separate nss lookup loop into its own function
  gaih_inet: make gethosts into a function
  gaih_inet: split loopback lookup into its own function
  gaih_inet: Split result generation into its own function
  gethosts: Return EAI_MEMORY on allocation failure

 nss/Makefile                               |    1 +
 nss/tst-nss-gai-actions.c                  |  149 ++
 nss/tst-nss-gai-actions.root/etc/host.conf |    1 +
 nss/tst-nss-gai-actions.root/etc/hosts     |  508 +++++++
 sysdeps/posix/getaddrinfo.c                | 1520 +++++++++++---------
 5 files changed, 1464 insertions(+), 715 deletions(-)
 create mode 100644 nss/tst-nss-gai-actions.c
 create mode 100644 nss/tst-nss-gai-actions.root/etc/host.conf
 create mode 100644 nss/tst-nss-gai-actions.root/etc/hosts