This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH COMMITTED] nss_dns: Remove dead PTR IPv4-to-IPv6 mapping code


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.

The added tests also show it's dead code.

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]