This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH COMMITTED] nss_dns: Remove dead PTR IPv4-to-IPv6 mapping code
- From: Florian Weimer <fweimer at redhat dot com>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 6 Sep 2017 15:56:18 +0200
- Subject: Re: [PATCH COMMITTED] nss_dns: Remove dead PTR IPv4-to-IPv6 mapping code
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=fweimer at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 005C180473
- References: <20170906131329.924C94194EE17@oldenburg.str.redhat.com> <mvmmv68c5qa.fsf@suse.de> <7567217d-041d-4cae-f703-e716b81fded3@redhat.com> <mvmingwc4v6.fsf@suse.de>
On 09/06/2017 03:51 PM, Andreas Schwab wrote:
> On Sep 06 2017, Florian Weimer <fweimer@redhat.com> wrote:
>
>> On 09/06/2017 03:32 PM, Andreas Schwab wrote:
>>> On Sep 06 2017, fweimer@redhat.com (Florian Weimer) wrote:
>>>
>>>> Remove dead PTR IPv4-to-IPv6 mapping code from nss_dns.
>>>> * resolv/nss_dns/dns-host.c (getanswer_r): Remove dead code.
>>>
>>> In which way is that dead?
>>
>> if (type == T_A && qtype == T_AAAA && map)
>> have_to_map = 1;
>> else if (__glibc_unlikely (type != qtype))
>> {
>> cp += n;
>> continue; /* XXX - had_error++ ? */
>> }
>>
>> So have_to_map being true implies that qtype == T_AAAA. But this means
>> that after the if statement, type == T_A || type == T_AAAA. In
>> particular, type != T_PTR, which is why the have_to_map check is
>> superfluous.
>
> But it's inside a loop, and have_to_map is not reset.
And neither is qtype, which is why the type == T_A || type == T_AAAA
post-condition still holds.
Florian