public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: "JOSHI, RAHUL" <rahulj@hpe.com>
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'
Date: Thu, 6 May 2021 08:05:23 +0000	[thread overview]
Message-ID: <CS1PR8401MB05028BFA5EBFC0428EE76554C0589@CS1PR8401MB0502.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <CS1PR8401MB050236FE63C077687BC1C1D7C0599@CS1PR8401MB0502.NAMPRD84.PROD.OUTLOOK.COM>

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


  parent reply	other threads:[~2021-05-06  8:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-03  5:59 JOSHI, RAHUL
2021-05-05  8:27 ` JOSHI, RAHUL
2021-05-05  8:33 ` JOSHI, RAHUL
2021-05-05  8:39 ` Florian Weimer
     [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 [this message]
2021-05-06  9:20       ` Florian Weimer
2021-05-17 11:13 JOSHI, RAHUL
2021-05-17 11:16 ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CS1PR8401MB05028BFA5EBFC0428EE76554C0589@CS1PR8401MB0502.NAMPRD84.PROD.OUTLOOK.COM \
    --to=rahulj@hpe.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=libc-help@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).