resolv: AAAA (28) is valid, no fallthrough to default

Message ID 20190110001717.25717-1-dilfridge@gentoo.org
State Committed
Commit 5494af04adabe72cbd0055fe9ed466af529eaafd
Headers

Commit Message

Andreas K. Huettel Jan. 10, 2019, 12:17 a.m. UTC
  The test resolv/tst-resolv-ai_idn-nolibidn2 kept failing, with the puzzling
output "invalid qtype: 28". Puzzling since 28 is an AAAA record.
Turns out the switch statement is missing a break, so the "T_AAAA" case
continues with "default".
---
 resolv/tst-resolv-ai_idn-common.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Florian Weimer Jan. 10, 2019, 11 a.m. UTC | #1
* Andreas K. Hüttel:

> The test resolv/tst-resolv-ai_idn-nolibidn2 kept failing, with the puzzling
> output "invalid qtype: 28". Puzzling since 28 is an AAAA record.
> Turns out the switch statement is missing a break, so the "T_AAAA" case
> continues with "default".
> ---
>  resolv/tst-resolv-ai_idn-common.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/resolv/tst-resolv-ai_idn-common.c b/resolv/tst-resolv-ai_idn-common.c
> index bb81c2ca23..61cc81b71f 100644
> --- a/resolv/tst-resolv-ai_idn-common.c
> +++ b/resolv/tst-resolv-ai_idn-common.c
> @@ -241,6 +241,7 @@ response (const struct resolv_response_context *ctx,
>                qname[0] };
>          resolv_response_add_data (b, &addr, sizeof (addr));
>        }
> +      break;
>      default:
>        FAIL_EXIT1 ("invalid qtype: %d", qtype);
>      }

The change is obviously correct. I will commit it for you.

However, how do you encounter this issue?  Did you change some test?
The current IDN tests do not actually send AAAA queries, I think.

Thanks,
Florian
  
Andreas K. Huettel Jan. 10, 2019, 1:47 p.m. UTC | #2
Am Donnerstag, 10. Januar 2019, 12:00:08 CET schrieb Florian Weimer:
> * Andreas K. Hüttel:
> > The test resolv/tst-resolv-ai_idn-nolibidn2 kept failing, with the
> > puzzling
> > output "invalid qtype: 28". Puzzling since 28 is an AAAA record.
> > Turns out the switch statement is missing a break, so the "T_AAAA" case
> > continues with "default".
> 
> The change is obviously correct. I will commit it for you.
> 
> However, how do you encounter this issue?  Did you change some test?
> The current IDN tests do not actually send AAAA queries, I think.
> 
> Thanks,
> Florian

That's a puzzling question indeed. I didnt change anything with the test 
suite; the code is ~ tip of 2.28 release branch (plus few Gentoo-specific 
patches).

The only Gentoo-specific commit which could be relevant is that we revert 
8479f23aa1d5e5477a37f46823856bdafaedfa46 ("sysdeps/posix/getaddrinfo.c 
(gaih_inet): Only use gethostbyname4_r ..."). For the background see
https://bugs.gentoo.org/600632
  
Florian Weimer Jan. 10, 2019, 1:51 p.m. UTC | #3
* Andreas K. Huettel:

> Am Donnerstag, 10. Januar 2019, 12:00:08 CET schrieb Florian Weimer:
>> * Andreas K. Hüttel:
>> > The test resolv/tst-resolv-ai_idn-nolibidn2 kept failing, with the
>> > puzzling
>> > output "invalid qtype: 28". Puzzling since 28 is an AAAA record.
>> > Turns out the switch statement is missing a break, so the "T_AAAA" case
>> > continues with "default".
>> 
>> The change is obviously correct. I will commit it for you.
>> 
>> However, how do you encounter this issue?  Did you change some test?
>> The current IDN tests do not actually send AAAA queries, I think.
>> 
>> Thanks,
>> Florian
>
> That's a puzzling question indeed. I didnt change anything with the test 
> suite; the code is ~ tip of 2.28 release branch (plus few Gentoo-specific 
> patches).
>
> The only Gentoo-specific commit which could be relevant is that we revert 
> 8479f23aa1d5e5477a37f46823856bdafaedfa46 ("sysdeps/posix/getaddrinfo.c 
> (gaih_inet): Only use gethostbyname4_r ..."). For the background see
> https://bugs.gentoo.org/600632

Yes, that is indeed the cause.  Reverting that commit is a bit
aggressive, though.  Clearly you do not need to perform dual queries if
the requested address family is AF_INET because that hasn't got any
scope IDs.

Thanks,
Florian
  

Patch

diff --git a/resolv/tst-resolv-ai_idn-common.c b/resolv/tst-resolv-ai_idn-common.c
index bb81c2ca23..61cc81b71f 100644
--- a/resolv/tst-resolv-ai_idn-common.c
+++ b/resolv/tst-resolv-ai_idn-common.c
@@ -241,6 +241,7 @@  response (const struct resolv_response_context *ctx,
               qname[0] };
         resolv_response_add_data (b, &addr, sizeof (addr));
       }
+      break;
     default:
       FAIL_EXIT1 ("invalid qtype: %d", qtype);
     }