public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: dhowells@redhat.com, jlayton@redhat.com, libc-alpha@sourceware.org
Subject: Can getaddrinfo() be extended to return the record TTL
Date: Fri, 02 Aug 2019 16:42:00 -0000	[thread overview]
Message-ID: <13914.1564764142@warthog.procyon.org.uk> (raw)

Hi Florian,

The Linux kernel has an upcall to get name -> address mappings for network
filesystems.  The userspace side (key.dns_resolver.c in keyutils) uses
getaddrinfo() to perform the lookup as this gives a greater range of sources
than, say, using res_send(), giving access to NIS, YP, LDAP, files or
whatever, but getaddrinfo() does not include any expiry information for the
information.

The userspace side of the upcall *should* be setting the expiry time on the
record - but it can't as the C library doesn't give us that (and, indeed, it's
not available from all sources).

The userspace upcall program *does* do it for AFSDB records for the afs
filesystem since those are looked up directly in the DNS and the TTL record is
thus available.


Anyway, looking at getaddrinfo(), it looks like the addrinfo struct should be
extensible.  Perhaps a flag, say AI_EXTENDED, could be provided that indicates
that is replaced with a larger struct that has additional fields such as
expiry time and a flag, AI_HAS_EXPIRY that indicates if the expiry time is
actually set.

This looks like it should work as the result records appear to be in a list
rather than being an array.

Another possible additional field would be a source indicator of some kind
that says where the data came from (e.g. 0=file, 1=dns, 2=yp, 3=ldap, ...).


If it's not possible to extend getaddrinfo() in this way, would it be possible
to provide a getaddrinfo2() that returns this information through an
additional parameter?

Thanks,
David

             reply	other threads:[~2019-08-02 16:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-02 16:42 David Howells [this message]
2019-08-02 17:21 ` Florian Weimer
2019-08-06 15:16   ` Eric Wong
2019-08-07 13:35     ` Florian Weimer
2019-08-02 19:33 ` David Howells
2019-08-02 21:47   ` Carlos O'Donell
2020-04-14 14:15     ` Jeff Layton
2019-08-07 13:32   ` Florian Weimer
2020-04-14 13:42   ` David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=13914.1564764142@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=jlayton@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).