public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Can getaddrinfo() be extended to return the record TTL
@ 2019-08-02 16:42 David Howells
  2019-08-02 17:21 ` Florian Weimer
  2019-08-02 19:33 ` David Howells
  0 siblings, 2 replies; 9+ messages in thread
From: David Howells @ 2019-08-02 16:42 UTC (permalink / raw)
  To: Florian Weimer; +Cc: dhowells, jlayton, libc-alpha

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-04-14 14:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-02 16:42 Can getaddrinfo() be extended to return the record TTL David Howells
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

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).