*/
{
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;
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));
+ AddrInitIPv4(&SrcAddress, *((PULONG)SenderProtoAddress));
+ AddrInitIPv4(&DstAddress, *((PULONG)TargetProtoAddress));
- NCE = NBLocateNeighbor(&Address);
+ NCE = NBLocateNeighbor(&SrcAddress);
if (NCE) {
/* We know the sender. Update the hardware address
and state in our neighbor address cache */
/* 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