Microsoft Knowledge Base Email Alertz

Winsock name resolution APIs use separate cache entries for AF_UNSPEC and AF_INET/AF_INET6 queries

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 2299432 - Last Review: August 4, 2010 - Revision: 1.0

Winsock name resolution APIs use separate cache entries for AF_UNSPEC and AF_INET/AF_INET6 queries

SYMPTOMS

After an application calls getaddrinfo with AF_UNSPEC on hints, if you call getaddrinfo again with AF_INET/AF_INET6, the function doesn't use the DNS cache and sends a DNS query to the wire. DnsQuery with option DNS_QUERY_NO_WIRE_QUERY may fail with DNS_ERROR_RECORD_DOES_NOT_EXIST even after an application calls getaddrinfo.

CAUSE

When IE or an application calls getaddrinfo with AF_UNSPEC on a machine which has IPv4 and Ipv6 addresses, it results in dual address query from winsock to dns. Dns caches these dual address queries into a bucket with a specific private flag so that it can only be retrieved through application calling that flag (only winsock APIs calling getaddrinfo but not through DnsQuery publicly documented flags).

RESOLUTION

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section of this article.

MORE INFORMATION

Below are two common scenarios for this issue.


Scenario A:

1 Start Network monitor and monitor DNS traffic.

2 Call getaddrinfo for a name using AF_UNSPEC flags on hints (A pointer to an addrinfo structure)
for the addrinfo Structure, please refer to MSDN document:
http://msdn.microsoft.com/en-us/library/ms737530(v=VS.85).aspx (http://msdn.microsoft.com/en-us/library/ms737530(v=VS.85).aspx)

3 Call getaddrinfo for the same name using AF_INET.

4 Call getaddrinfo for the same name using AF_UNSPEC.


Expected result:

Only the second step should send a query to the wire.


Actual result:

Steps 3 and 4 also send a query to the wire and not use cache.



Scenario B:

1 Call getaddrinfo for a name using AF_UNSPEC on hints.

2 Call DnsQuery with option DNS_QUERY_NO_WIRE_QUERY
(Windows 2000 Server and Windows 2000 Professional: use DNS_QUERY_CACHE_ONLY flag instead.)

Expected result:

DsnQuery can get the record from DNS cache.


Actual result:

DnsQuery fails with DNS_ERROR_RECORD_DOES_NOT_EXIST.
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use (http://go.microsoft.com/fwlink/?LinkId=151500) for other considerations.

APPLIES TO
  • Windows 7 Home Basic
  • Windows 7 Home Premium
  • Windows 7 Professional
  • Windows 7 Starter
  • Windows 7 Ultimate
  • Windows Vista Enterprise
  • Windows Vista Home Basic
  • Windows Vista Home Premium
  • Windows Vista Starter
  • Windows Vista Ultimate
  • Windows Server 2008 Standard
  • Windows Server 2008 Enterprise
  • Windows Server 2008 Datacenter
Keywords: 
kbwinsock kbdns KB2299432
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate