- Bind to the address specified in AddressFile instead of always binding to the outgoing interface's unicast address
 - Get the NCE using the local address (if specified) so we don't end up sending from one interface using another interface's  address as the source

svn path=/branches/aicom-network-branch/; revision=44810
This commit is contained in:
Cameron Gutman 2009-12-30 12:46:14 +00:00
parent 94b49d77a3
commit 2caa9c0981
4 changed files with 53 additions and 20 deletions

View file

@ -178,9 +178,6 @@ NTSTATUS ICMPSendDatagram(
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))
{
@ -188,8 +185,16 @@ NTSTATUS ICMPSendDatagram(
* then use the unicast address of the
* interface we're sending over
*/
if(!(NCE = RouteGetRouteToDestination( &RemoteAddress )))
return STATUS_NETWORK_UNREACHABLE;
LocalAddress = NCE->Interface->Unicast;
}
else
{
if(!(NCE = NBLocateNeighbor( &LocalAddress )))
return STATUS_INVALID_PARAMETER;
}
Status = PrepareICMPPacket( NCE->Interface,
&Packet,

View file

@ -218,12 +218,6 @@ NTSTATUS RawIPSendDatagram(
TI_DbgPrint(MID_TRACE,("About to get route to destination\n"));
if(!(NCE = RouteGetRouteToDestination( &RemoteAddress )))
{
KeReleaseSpinLock(&AddrFile->Lock, OldIrql);
return STATUS_NETWORK_UNREACHABLE;
}
LocalAddress = AddrFile->Address;
if (AddrIsUnspecified(&LocalAddress))
{
@ -231,8 +225,20 @@ NTSTATUS RawIPSendDatagram(
* then use the unicast address of the
* interface we're sending over
*/
if(!(NCE = RouteGetRouteToDestination( &RemoteAddress ))) {
KeReleaseSpinLock(&AddrFile->Lock, OldIrql);
return STATUS_NETWORK_UNREACHABLE;
}
LocalAddress = NCE->Interface->Unicast;
}
else
{
if(!(NCE = NBLocateNeighbor( &LocalAddress ))) {
KeReleaseSpinLock(&AddrFile->Lock, OldIrql);
return STATUS_INVALID_PARAMETER;
}
}
Status = BuildRawIpPacket( AddrFile,
&Packet,

View file

@ -631,11 +631,6 @@ NTSTATUS TCPConnect
return Status;
}
if (!(NCE = RouteGetRouteToDestination(&RemoteAddress)))
{
return STATUS_NETWORK_UNREACHABLE;
}
/* Freed in TCPSocketState */
TI_DbgPrint(DEBUG_TCP,
("Connecting to address %x:%x\n",
@ -644,10 +639,30 @@ NTSTATUS TCPConnect
AddressToConnect.sin_family = AF_INET;
AddressToBind = AddressToConnect;
AddressToBind.sin_addr.s_addr = NCE->Interface->Unicast.Address.IPv4Address;
KeAcquireSpinLock(&Connection->Lock, &OldIrql);
if (!Connection->AddressFile)
{
KeReleaseSpinLock(&Connection->Lock, OldIrql);
return STATUS_INVALID_PARAMETER;
}
if (AddrIsUnspecified(&Connection->AddressFile->Address))
{
if (!(NCE = RouteGetRouteToDestination(&RemoteAddress)))
{
KeReleaseSpinLock(&Connection->Lock, OldIrql);
return STATUS_NETWORK_UNREACHABLE;
}
AddressToBind.sin_addr.s_addr = NCE->Interface->Unicast.Address.IPv4Address;
}
else
{
AddressToBind.sin_addr.s_addr = Connection->AddressFile->Address.Address.IPv4Address;
}
Status = TCPTranslateError
( OskitTCPBind( Connection->SocketContext,
&AddressToBind,

View file

@ -193,11 +193,6 @@ NTSTATUS UDPSendDatagram(
return STATUS_UNSUCCESSFUL;
}
if(!(NCE = RouteGetRouteToDestination( &RemoteAddress ))) {
KeReleaseSpinLock(&AddrFile->Lock, OldIrql);
return STATUS_NETWORK_UNREACHABLE;
}
LocalAddress = AddrFile->Address;
if (AddrIsUnspecified(&LocalAddress))
{
@ -205,8 +200,20 @@ NTSTATUS UDPSendDatagram(
* then use the unicast address of the
* interface we're sending over
*/
if(!(NCE = RouteGetRouteToDestination( &RemoteAddress ))) {
KeReleaseSpinLock(&AddrFile->Lock, OldIrql);
return STATUS_NETWORK_UNREACHABLE;
}
LocalAddress = NCE->Interface->Unicast;
}
else
{
if(!(NCE = NBLocateNeighbor( &LocalAddress ))) {
KeReleaseSpinLock(&AddrFile->Lock, OldIrql);
return STATUS_INVALID_PARAMETER;
}
}
Status = BuildUDPPacket( AddrFile,
&Packet,