Return EAI_AGAIN for AF_UNSPEC when herrno is TRY_AGAIN (BZ #16849)
diff mbox

Message ID 20140416140823.GA30967@spoyarek.pnq.redhat.com
State New
Headers show

Commit Message

Siddhesh Poyarekar April 16, 2014, 2:08 p.m. UTC
getaddrinfo correctly returns EAI_AGAIN for AF_INET and AF_INET6
queries.  For AF_UNSPEC however, an older change
(a682a1bf553b1efe4dbb03207fece5b719cec482) broke the check and due to
that the returned error was EAI_NONAME.

This patch fixes the check so that a non-authoritative not-found is
returned as EAI_AGAIN to the user instead of EAI_NONAME.

Tested on x86_64.

Siddhesh

	[BZ #16849]
	* sysdeps/posix/getaddrinfo.c (gaih_inet): Only check for
	herrno to return EAI_AGAIN.

---
 sysdeps/posix/getaddrinfo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Siddhesh Poyarekar April 22, 2014, 9:46 a.m. UTC | #1
Ping!

On Wed, Apr 16, 2014 at 07:38:24PM +0530, Siddhesh Poyarekar wrote:
> getaddrinfo correctly returns EAI_AGAIN for AF_INET and AF_INET6
> queries.  For AF_UNSPEC however, an older change
> (a682a1bf553b1efe4dbb03207fece5b719cec482) broke the check and due to
> that the returned error was EAI_NONAME.
> 
> This patch fixes the check so that a non-authoritative not-found is
> returned as EAI_AGAIN to the user instead of EAI_NONAME.
> 
> Tested on x86_64.
> 
> Siddhesh
> 
> 	[BZ #16849]
> 	* sysdeps/posix/getaddrinfo.c (gaih_inet): Only check for
> 	herrno to return EAI_AGAIN.
> 
> ---
>  sysdeps/posix/getaddrinfo.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
> index 3385bed..f62df19 100644
> --- a/sysdeps/posix/getaddrinfo.c
> +++ b/sysdeps/posix/getaddrinfo.c
> @@ -863,8 +863,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
>  		      if (status != NSS_STATUS_TRYAGAIN
>  			  || rc != ERANGE || herrno != NETDB_INTERNAL)
>  			{
> -			  if (status == NSS_STATUS_TRYAGAIN
> -			      && herrno == TRY_AGAIN)
> +			  if (herrno == TRY_AGAIN)
>  			    no_data = EAI_AGAIN;
>  			  else
>  			    no_data = herrno == NO_DATA;
> -- 
> 1.8.3.1
>
Siddhesh Poyarekar April 28, 2014, 2:49 p.m. UTC | #2
Ping!

On Tue, Apr 22, 2014 at 03:16:57PM +0530, Siddhesh Poyarekar wrote:
> Ping!
> 
> On Wed, Apr 16, 2014 at 07:38:24PM +0530, Siddhesh Poyarekar wrote:
> > getaddrinfo correctly returns EAI_AGAIN for AF_INET and AF_INET6
> > queries.  For AF_UNSPEC however, an older change
> > (a682a1bf553b1efe4dbb03207fece5b719cec482) broke the check and due to
> > that the returned error was EAI_NONAME.
> > 
> > This patch fixes the check so that a non-authoritative not-found is
> > returned as EAI_AGAIN to the user instead of EAI_NONAME.
> > 
> > Tested on x86_64.
> > 
> > Siddhesh
> > 
> > 	[BZ #16849]
> > 	* sysdeps/posix/getaddrinfo.c (gaih_inet): Only check for
> > 	herrno to return EAI_AGAIN.
> > 
> > ---
> >  sysdeps/posix/getaddrinfo.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
> > index 3385bed..f62df19 100644
> > --- a/sysdeps/posix/getaddrinfo.c
> > +++ b/sysdeps/posix/getaddrinfo.c
> > @@ -863,8 +863,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
> >  		      if (status != NSS_STATUS_TRYAGAIN
> >  			  || rc != ERANGE || herrno != NETDB_INTERNAL)
> >  			{
> > -			  if (status == NSS_STATUS_TRYAGAIN
> > -			      && herrno == TRY_AGAIN)
> > +			  if (herrno == TRY_AGAIN)
> >  			    no_data = EAI_AGAIN;
> >  			  else
> >  			    no_data = herrno == NO_DATA;
> > -- 
> > 1.8.3.1
> > 
> 
>
Ondřej Bílka May 12, 2014, 7:13 p.m. UTC | #3
On Wed, Apr 16, 2014 at 07:38:24PM +0530, Siddhesh Poyarekar wrote:
> getaddrinfo correctly returns EAI_AGAIN for AF_INET and AF_INET6
> queries.  For AF_UNSPEC however, an older change
> (a682a1bf553b1efe4dbb03207fece5b719cec482) broke the check and due to
> that the returned error was EAI_NONAME.
> 
> This patch fixes the check so that a non-authoritative not-found is
> returned as EAI_AGAIN to the user instead of EAI_NONAME.
> 
> Tested on x86_64.
> 
looks ok for me

Patch
diff mbox

diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 3385bed..f62df19 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -863,8 +863,7 @@  gaih_inet (const char *name, const struct gaih_service *service,
 		      if (status != NSS_STATUS_TRYAGAIN
 			  || rc != ERANGE || herrno != NETDB_INTERNAL)
 			{
-			  if (status == NSS_STATUS_TRYAGAIN
-			      && herrno == TRY_AGAIN)
+			  if (herrno == TRY_AGAIN)
 			    no_data = EAI_AGAIN;
 			  else
 			    no_data = herrno == NO_DATA;