Author: cgutman
Date: Wed Oct 21 04:16:03 2009
New Revision: 43663
URL:
http://svn.reactos.org/svn/reactos?rev=43663&view=rev
Log:
- Fix an issue that broke ARP replies because we compared the source address with our
address instead of the destination address with our address
- What ended up happening was the router saved our gratuitous ARP hw address which
allowed communication until it sent an ARP request which we would discard instead of
replying to it, so the network connection would drop unexpectedly. "ipconfig
/renew" was a temporary fix because it caused another gratuitous ARP packet to be
sent and readded our hw address to the router's cache
- This should be the last major issue with running in bridged mode
Modified:
trunk/reactos/lib/drivers/ip/network/arp.c
Modified: trunk/reactos/lib/drivers/ip/network/arp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/network/arp…
==============================================================================
--- trunk/reactos/lib/drivers/ip/network/arp.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/network/arp.c [iso-8859-1] Wed Oct 21 04:16:03 2009
@@ -183,9 +183,11 @@
*/
{
PARP_HEADER Header;
- IP_ADDRESS Address;
+ IP_ADDRESS SrcAddress;
+ IP_ADDRESS DstAddress;
PVOID SenderHWAddress;
PVOID SenderProtoAddress;
+ PVOID TargetProtoAddress;
PNEIGHBOR_CACHE_ENTRY NCE;
PNDIS_PACKET NdisPacket;
PIP_INTERFACE Interface = (PIP_INTERFACE)Context;
@@ -208,12 +210,14 @@
SenderHWAddress = (PVOID)((ULONG_PTR)Header + sizeof(ARP_HEADER));
SenderProtoAddress = (PVOID)((ULONG_PTR)SenderHWAddress + Header->HWAddrLen);
+ TargetProtoAddress = (PVOID)((ULONG_PTR)SenderProtoAddress + Header->ProtoAddrLen
+ Header->HWAddrLen);
/* Check if we know the sender */
- AddrInitIPv4(&Address, *((PULONG)SenderProtoAddress));
-
- NCE = NBLocateNeighbor(&Address);
+ AddrInitIPv4(&SrcAddress, *((PULONG)SenderProtoAddress));
+ AddrInitIPv4(&DstAddress, *((PULONG)TargetProtoAddress));
+
+ NCE = NBLocateNeighbor(&SrcAddress);
if (NCE) {
/* We know the sender. Update the hardware address
and state in our neighbor address cache */
@@ -222,12 +226,12 @@
/* The packet had our protocol address as target. The sender
may want to communicate with us soon, so add his address
to our address cache */
- NCE = NBAddNeighbor(Interface, &Address, SenderHWAddress,
+ NCE = NBAddNeighbor(Interface, &SrcAddress, SenderHWAddress,
Header->HWAddrLen, 0, ARP_TIMEOUT);
}
if (Header->Opcode != ARP_OPCODE_REQUEST ||
- !AddrIsEqual(&Address, &Interface->Unicast))
+ !AddrIsEqual(&DstAddress, &Interface->Unicast))
return;
/* This is a request for our address. Swap the addresses and