Fix firefox exit. Implement a simple work queue for possibly dispatch level
[reactos.git] / reactos / drivers / lib / ip / network / receive.c
index d6c0587..f53a2e0 100644 (file)
@@ -521,6 +521,8 @@ VOID IPv4Receive(PIP_INTERFACE IF, PIP_PACKET IPPacket)
  *     IPPacket = Pointer to IP packet
  */
 {
+    IP_ADDRESS Address;
+
     TI_DbgPrint(DEBUG_IP, ("Received IPv4 datagram.\n"));
 
     IPPacket->HeaderSize = (((PIPv4_HEADER)IPPacket->Header)->VerIHL & 0x0F) << 2;
@@ -562,7 +564,16 @@ VOID IPv4Receive(PIP_INTERFACE IF, PIP_PACKET IPPacket)
 
     /* FIXME: Should we allow packets to be received on the wrong interface? */
     /* XXX Find out if this packet is destined for us */
-    ProcessFragment(IF, IPPacket);
+
+    if( AddrLocateADEv4( IPPacket->DstAddr.Address.IPv4Address, &Address ) ) {
+       ProcessFragment( IF, IPPacket );
+    } else {
+       PNEIGHBOR_CACHE_ENTRY NCE;
+
+       if((NCE = RouteGetRouteToDestination( &IPPacket->DstAddr ))) {
+           IPSendDatagram( IPPacket, NCE, NULL, NULL );
+       }
+    }
 #if 0
     } else {
        /* This packet is not destined for us. If we are a router,