Can getaddrinfo() be extended to return the record TTL
Florian Weimer
fweimer@redhat.com
Wed Aug 7 13:35:00 GMT 2019
* 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
More information about the Libc-alpha
mailing list