BOOLEAN AddrLocateADEv4(
IPv4_RAW_ADDRESS MatchAddress, PIP_ADDRESS Address);
-BOOLEAN IPGetDefaultAddress( PIP_ADDRESS Address );
-
PADDRESS_FILE AddrSearchFirst(
PIP_ADDRESS Address,
USHORT Port,
return Matched;
}
-BOOLEAN IPGetDefaultAddress( PIP_ADDRESS Address ) {
- KIRQL OldIrql;
- BOOLEAN Matched = FALSE;
- IF_LIST_ITER(CurrentIF);
-
- TcpipAcquireSpinLock(&InterfaceListLock, &OldIrql);
-
- /* Find the first 'real' interface */
- ForEachInterface(CurrentIF) {
- if( CurrentIF->Context ) {
- *Address = CurrentIF->Unicast;
- Matched = TRUE; break;
- }
- } EndFor(CurrentIF);
-
- /* Not matched, use the first one */
- if( !Matched ) {
- ForEachInterface(CurrentIF) {
- *Address = CurrentIF->Unicast;
- Matched = TRUE; break;
- } EndFor(CurrentIF);
- }
-
- TcpipReleaseSpinLock(&InterfaceListLock, OldIrql);
-
- return Matched;
-}
-
BOOLEAN HasPrefix(
PIP_ADDRESS Address,
PIP_ADDRESS Prefix,
return STATUS_UNSUCCESSFUL;
}
+ TI_DbgPrint(MID_TRACE,("About to get route to destination\n"));
+
+ if(!(NCE = RouteGetRouteToDestination( &RemoteAddress )))
+ return STATUS_NETWORK_UNREACHABLE;
+
LocalAddress = AddrFile->Address;
if (AddrIsUnspecified(&LocalAddress))
{
- if (!IPGetDefaultAddress(&LocalAddress))
- return STATUS_UNSUCCESSFUL;
+ /* If the local address is unspecified (0),
+ * then use the unicast address of the
+ * interface we're sending over
+ */
+ LocalAddress = NCE->Interface->Unicast;
}
Status = BuildRawIpPacket( &Packet,
if( !NT_SUCCESS(Status) )
return Status;
- TI_DbgPrint(MID_TRACE,("About to get route to destination\n"));
-
- if(!(NCE = RouteGetRouteToDestination( &RemoteAddress ))) {
- FreeNdisPacket(Packet.NdisPacket);
- return STATUS_NETWORK_UNREACHABLE;
- }
-
TI_DbgPrint(MID_TRACE,("About to send datagram\n"));
if (!NT_SUCCESS(Status = IPSendDatagram( &Packet, NCE, RawIpSendPacketComplete, NULL )))
IP_PACKET Packet;
PTA_IP_ADDRESS RemoteAddressTa = (PTA_IP_ADDRESS)ConnInfo->RemoteAddress;
IP_ADDRESS RemoteAddress;
- IP_ADDRESS LocalAddress;
+ IP_ADDRESS LocalAddress;
USHORT RemotePort;
NTSTATUS Status;
PNEIGHBOR_CACHE_ENTRY NCE;
return STATUS_NETWORK_UNREACHABLE;
}
- LocalAddress = AddrFile->Address;
- if (AddrIsUnspecified(&LocalAddress))
- {
- if (!IPGetDefaultAddress(&LocalAddress))
- return FALSE;
- }
+ LocalAddress = AddrFile->Address;
+ if (AddrIsUnspecified(&LocalAddress))
+ {
+ /* If the local address is unspecified (0),
+ * then use the unicast address of the
+ * interface we're sending over
+ */
+ LocalAddress = NCE->Interface->Unicast;
+ }
Status = BuildUDPPacket( &Packet,
&RemoteAddress,