NetworkTools: Remove unspecified hostnames from tracert workqueue
@@ -168,12 +168,6 @@ NTSTATUS TracertHostnameLookupCallback(
{
IN_ADDR inAddr4 = ((PSOCKADDR_IN)&workitem->SocketAddress)->sin_addr;
- if (IN4_IS_ADDR_UNSPECIFIED(&inAddr4))
- {
- PhFree(workitem);
- return STATUS_SUCCESS;
- }
-
if (IN4_IS_ADDR_LOOPBACK(&inAddr4) ||
IN4_IS_ADDR_BROADCAST(&inAddr4) ||
IN4_IS_ADDR_MULTICAST(&inAddr4) ||
@@ -188,12 +182,6 @@ NTSTATUS TracertHostnameLookupCallback(
{
IN6_ADDR inAddr6 = ((PSOCKADDR_IN6)&workitem->SocketAddress)->sin6_addr;
- if (IN6_IS_ADDR_UNSPECIFIED(&inAddr6))
- {
- PhFree(workitem);
- return STATUS_SUCCESS;
- }
-
if (IN6_IS_ADDR_LOOPBACK(&inAddr6) ||
IN6_IS_ADDR_MULTICAST(&inAddr6) ||
IN6_IS_ADDR_LINKLOCAL(&inAddr6) ||
@@ -292,7 +280,6 @@ VOID TracertQueueHostLookup(
if (Context->RemoteEndpoint.Address.Type == PH_IPV4_NETWORK_TYPE)
{
IN_ADDR sockAddrIn;
- PTRACERT_RESOLVE_WORKITEM resolve;
memset(&sockAddrIn, 0, sizeof(IN_ADDR));
memcpy(&sockAddrIn, SocketAddress, sizeof(IN_ADDR));
@@ -317,6 +304,10 @@ VOID TracertQueueHostLookup(
}
}
+ if (!IN4_IS_ADDR_UNSPECIFIED(&sockAddrIn))
+ {
+ PTRACERT_RESOLVE_WORKITEM resolve;
+
resolve = PhAllocateZero(sizeof(TRACERT_RESOLVE_WORKITEM));
resolve->Type = PH_IPV4_NETWORK_TYPE;
resolve->WindowHandle = Context->WindowHandle;
@@ -326,6 +317,7 @@ VOID TracertQueueHostLookup(
((PSOCKADDR_IN)&resolve->SocketAddress)->sin_addr = sockAddrIn;
PhQueueItemWorkQueue(&Context->WorkQueue, TracertHostnameLookupCallback, resolve);
+ }
if (LookupSockInAddr4CountryCode(
sockAddrIn,
@@ -340,7 +332,6 @@ VOID TracertQueueHostLookup(
else if (Context->RemoteEndpoint.Address.Type == PH_IPV6_NETWORK_TYPE)
{
IN6_ADDR sockAddrIn6;
- PTRACERT_RESOLVE_WORKITEM resolve;
memset(&sockAddrIn6, 0, sizeof(IN6_ADDR));
memcpy(&sockAddrIn6, SocketAddress, sizeof(IN6_ADDR));
@@ -365,6 +356,10 @@ VOID TracertQueueHostLookup(
}
}
+ if (!IN6_IS_ADDR_UNSPECIFIED(&sockAddrIn6))
+ {
+ PTRACERT_RESOLVE_WORKITEM resolve;
+
resolve = PhAllocateZero(sizeof(TRACERT_RESOLVE_WORKITEM));
resolve->Type = PH_IPV6_NETWORK_TYPE;
resolve->WindowHandle = Context->WindowHandle;
@@ -374,6 +369,7 @@ VOID TracertQueueHostLookup(
((PSOCKADDR_IN6)&resolve->SocketAddress)->sin6_addr = sockAddrIn6;
PhQueueItemWorkQueue(&Context->WorkQueue, TracertHostnameLookupCallback, resolve);
+ }
if (LookupSockInAddr6CountryCode(
sockAddrIn6,
