This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Can getaddrinfo() be extended to return the record TTL
- From: Florian Weimer <fweimer at redhat dot com>
- To: Eric Wong <normalperson at yhbt dot net>
- Cc: David Howells <dhowells at redhat dot com>, jlayton at redhat dot com, libc-alpha at sourceware dot org
- Date: Wed, 07 Aug 2019 15:35:12 +0200
- Subject: Re: Can getaddrinfo() be extended to return the record TTL
- References: <13914.1564764142@warthog.procyon.org.uk> <87v9vfcwkm.fsf@oldenburg2.str.redhat.com> <20190806151632.u454tetx762wrgzs@dcvr>
* Eric Wong:
> Florian Weimer <fweimer@redhat.com> wrote:
>> * David Howells:
>> > 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?
>>
>> That definitely would be a new ABI.
>>
>> New ABIs have a lead time of around three years before productization.
>> Is this something you could work with?
>
> Fwiw, gaicb has an "int __glibc_reserved[5]" field; so it's
> probably possible to extend the already-glibc-specific getaddrinfo_a(3)
> to return the TTL.
>
> I was looking into getting the TTL the other week for something
> else, but settled on using a dedicated thread to call
> getaddrinfo(3) every few seconds and publishing updates to other
> threads via URCU.
You could perform the request directly over DNS and if you get back the
same addresses as via getaddrinfo, you can use the TTL you see on DNS.
It's not really nice as far as a programming interface goes, but it
should give you accurate TTL information in most cases.
Thanks,
Florian