* RE: Having TTL of resolved IP addresses in 'getaddrinfo' or 'getaddrinfo_a'
[not found] ` <CS1PR8401MB050236FE63C077687BC1C1D7C0599@CS1PR8401MB0502.NAMPRD84.PROD.OUTLOOK.COM>
@ 2021-05-05 9:41 ` JOSHI, RAHUL
2021-05-05 12:27 ` JOSHI, RAHUL
2021-05-06 8:05 ` JOSHI, RAHUL
2 siblings, 0 replies; 10+ messages in thread
From: JOSHI, RAHUL @ 2021-05-05 9:41 UTC (permalink / raw)
To: Florian Weimer; +Cc: libc-help, libc-alpha
-----Original Message-----
From: JOSHI, RAHUL
Sent: Wednesday, May 05, 2021 2:26 PM
To: Florian Weimer <fweimer@redhat.com>
Subject: RE: Having TTL of resolved IP addresses in 'getaddrinfo' or 'getaddrinfo_a'
Thanks Weimer for the response, I did look into the glibc code and the TTL is already calculated(as minimum TTL value among list of resolved addresses) by some of the API but not accessed by 'getaddrinfo' (passed NULL as argument to TTL pointer). Is it better to modify existing getaddrinfo API or have a similar API to it??
And can I make changes to glibc and if yes, is there any reference or procedure to do that??
Thanks,
Rahul
-----Original Message-----
From: Florian Weimer [mailto:fweimer@redhat.com]
Sent: Wednesday, May 05, 2021 2:10 PM
To: JOSHI, RAHUL via Libc-help <libc-help@sourceware.org>
Cc: JOSHI, RAHUL <rahulj@hpe.com>
Subject: Re: Having TTL of resolved IP addresses in 'getaddrinfo' or 'getaddrinfo_a'
* RAHUL via Libc-help JOSHI:
> Hi all, in current implementation of 'getaddrinfo' or 'getaddrinfo_a'
> , the TTL(expiry time) of resolved IP addresses isn't provided. Is
> there any alternate API in libc which will provide resolved IP
> addresses along with TTL??
>
> If no, what needs to be done to get the resolved addresses along with
> TTL??
We can't put the TTL directly into struct addrinfo because we shouldn't change its size. We'd have to add an accessor function and change the way getaddrinfo allocates the result list. Fortunately, there is a freeaddrinfo function, so we can maintain a data structure on the side that keeps track of TTLs, for use by the accessor function.
It's not super-hard, but also not exactly trivial, either. I'm not aware of anyone working on this feature, but it is requested from time to time, so it would be a nice addition to glibc.
Thanks,
Florian
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: Having TTL of resolved IP addresses in 'getaddrinfo' or 'getaddrinfo_a'
[not found] ` <CS1PR8401MB050236FE63C077687BC1C1D7C0599@CS1PR8401MB0502.NAMPRD84.PROD.OUTLOOK.COM>
2021-05-05 9:41 ` JOSHI, RAHUL
@ 2021-05-05 12:27 ` JOSHI, RAHUL
2021-05-06 8:05 ` JOSHI, RAHUL
2 siblings, 0 replies; 10+ messages in thread
From: JOSHI, RAHUL @ 2021-05-05 12:27 UTC (permalink / raw)
To: Florian Weimer; +Cc: libc-help, libc-alpha
Sorry Weimer I didn't get what you suggested previously, did you mean allocating memory for TTL after allocating result list??
Example :
If 2 addresses have been resolved, then the allocation for result should be
2 * sizeof(addrinfo) + allocate memory for TTL
Is my understanding correct??
Thanks,
Rahul
-----Original Message-----
From: JOSHI, RAHUL
Sent: Wednesday, May 05, 2021 3:11 PM
To: 'Florian Weimer' <fweimer@redhat.com>
Cc: 'libc-help@sourceware.org' <libc-help@sourceware.org>; 'libc-alpha@sourceware.org' <libc-alpha@sourceware.org>
Subject: RE: Having TTL of resolved IP addresses in 'getaddrinfo' or 'getaddrinfo_a'
-----Original Message-----
From: JOSHI, RAHUL
Sent: Wednesday, May 05, 2021 2:26 PM
To: Florian Weimer <fweimer@redhat.com>
Subject: RE: Having TTL of resolved IP addresses in 'getaddrinfo' or 'getaddrinfo_a'
Thanks Weimer for the response, I did look into the glibc code and the TTL is already calculated(as minimum TTL value among list of resolved addresses) by some of the API but not accessed by 'getaddrinfo' (passed NULL as argument to TTL pointer). Is it better to modify existing getaddrinfo API or have a similar API to it??
And can I make changes to glibc and if yes, is there any reference or procedure to do that??
Thanks,
Rahul
-----Original Message-----
From: Florian Weimer [mailto:fweimer@redhat.com]
Sent: Wednesday, May 05, 2021 2:10 PM
To: JOSHI, RAHUL via Libc-help <libc-help@sourceware.org>
Cc: JOSHI, RAHUL <rahulj@hpe.com>
Subject: Re: Having TTL of resolved IP addresses in 'getaddrinfo' or 'getaddrinfo_a'
* RAHUL via Libc-help JOSHI:
> Hi all, in current implementation of 'getaddrinfo' or 'getaddrinfo_a'
> , the TTL(expiry time) of resolved IP addresses isn't provided. Is
> there any alternate API in libc which will provide resolved IP
> addresses along with TTL??
>
> If no, what needs to be done to get the resolved addresses along with
> TTL??
We can't put the TTL directly into struct addrinfo because we shouldn't change its size. We'd have to add an accessor function and change the way getaddrinfo allocates the result list. Fortunately, there is a freeaddrinfo function, so we can maintain a data structure on the side that keeps track of TTLs, for use by the accessor function.
It's not super-hard, but also not exactly trivial, either. I'm not aware of anyone working on this feature, but it is requested from time to time, so it would be a nice addition to glibc.
Thanks,
Florian
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: Having TTL of resolved IP addresses in 'getaddrinfo' or 'getaddrinfo_a'
[not found] ` <CS1PR8401MB050236FE63C077687BC1C1D7C0599@CS1PR8401MB0502.NAMPRD84.PROD.OUTLOOK.COM>
2021-05-05 9:41 ` JOSHI, RAHUL
2021-05-05 12:27 ` JOSHI, RAHUL
@ 2021-05-06 8:05 ` JOSHI, RAHUL
2021-05-06 9:20 ` Florian Weimer
2 siblings, 1 reply; 10+ messages in thread
From: JOSHI, RAHUL @ 2021-05-06 8:05 UTC (permalink / raw)
To: Florian Weimer; +Cc: libc-help, libc-alpha
Hi Weimer, is there any update on this??
https://code.woboq.org/userspace/glibc/sysdeps/posix/getaddrinfo.c.html#1068 -> here we need to allocate memory for TTL and access it by accessor function??
Thanks,
Rahul
-----Original Message-----
From: JOSHI, RAHUL
Sent: Wednesday, May 05, 2021 5:57 PM
To: 'Florian Weimer' <fweimer@redhat.com>
Cc: 'libc-help@sourceware.org' <libc-help@sourceware.org>; 'libc-alpha@sourceware.org' <libc-alpha@sourceware.org>
Subject: RE: Having TTL of resolved IP addresses in 'getaddrinfo' or 'getaddrinfo_a'
Sorry Weimer I didn't get what you suggested previously, did you mean allocating memory for TTL after allocating result list??
Example :
If 2 addresses have been resolved, then the allocation for result should be
2 * sizeof(addrinfo) + 2 * allocate memory for TTL
Is my understanding correct??
Thanks,
Rahul
-----Original Message-----
From: JOSHI, RAHUL
Sent: Wednesday, May 05, 2021 3:11 PM
To: 'Florian Weimer' <fweimer@redhat.com>
Cc: 'libc-help@sourceware.org' <libc-help@sourceware.org>; 'libc-alpha@sourceware.org' <libc-alpha@sourceware.org>
Subject: RE: Having TTL of resolved IP addresses in 'getaddrinfo' or 'getaddrinfo_a'
-----Original Message-----
From: JOSHI, RAHUL
Sent: Wednesday, May 05, 2021 2:26 PM
To: Florian Weimer <fweimer@redhat.com>
Subject: RE: Having TTL of resolved IP addresses in 'getaddrinfo' or 'getaddrinfo_a'
Thanks Weimer for the response, I did look into the glibc code and the TTL is already calculated(as minimum TTL value among list of resolved addresses) by some of the API but not accessed by 'getaddrinfo' (passed NULL as argument to TTL pointer). Is it better to modify existing getaddrinfo API or have a similar API to it??
And can I make changes to glibc and if yes, is there any reference or procedure to do that??
Thanks,
Rahul
-----Original Message-----
From: Florian Weimer [mailto:fweimer@redhat.com]
Sent: Wednesday, May 05, 2021 2:10 PM
To: JOSHI, RAHUL via Libc-help <libc-help@sourceware.org>
Cc: JOSHI, RAHUL <rahulj@hpe.com>
Subject: Re: Having TTL of resolved IP addresses in 'getaddrinfo' or 'getaddrinfo_a'
* RAHUL via Libc-help JOSHI:
> Hi all, in current implementation of 'getaddrinfo' or 'getaddrinfo_a'
> , the TTL(expiry time) of resolved IP addresses isn't provided. Is
> there any alternate API in libc which will provide resolved IP
> addresses along with TTL??
>
> If no, what needs to be done to get the resolved addresses along with
> TTL??
We can't put the TTL directly into struct addrinfo because we shouldn't change its size. We'd have to add an accessor function and change the way getaddrinfo allocates the result list. Fortunately, there is a freeaddrinfo function, so we can maintain a data structure on the side that keeps track of TTLs, for use by the accessor function.
It's not super-hard, but also not exactly trivial, either. I'm not aware of anyone working on this feature, but it is requested from time to time, so it would be a nice addition to glibc.
Thanks,
Florian
^ permalink raw reply [flat|nested] 10+ messages in thread