This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Can getaddrinfo() be extended to return the record TTL


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]