- Merge aicom-network-fixes up to r38730
authorCameron Gutman <aicommander@gmail.com>
Tue, 13 Jan 2009 02:34:39 +0000 (02:34 +0000)
committerCameron Gutman <aicommander@gmail.com>
Tue, 13 Jan 2009 02:34:39 +0000 (02:34 +0000)
svn path=/trunk/; revision=38743

reactos/drivers/network/tcpip/tcpip/dispatch.c
reactos/lib/drivers/ip/network/ip.c

index 1aed38a..d018942 100644 (file)
@@ -1553,6 +1553,7 @@ NTSTATUS DispTdiSetIPAddress( PIRP Irp, PIO_STACK_LOCATION IrpSp ) {
             IF->Unicast.Address.IPv4Address = IpAddrChange->Address;
             IF->Netmask.Type = IP_ADDRESS_V4;
             IF->Netmask.Address.IPv4Address = IpAddrChange->Netmask;
+            IF->Broadcast.Type = IP_ADDRESS_V4;
            IF->Broadcast.Address.IPv4Address =
                IF->Unicast.Address.IPv4Address |
                ~IF->Netmask.Address.IPv4Address;
@@ -1587,6 +1588,8 @@ NTSTATUS DispTdiDeleteIPAddress( PIRP Irp, PIO_STACK_LOCATION IrpSp ) {
             IF->Unicast.Address.IPv4Address = 0;
             IF->Netmask.Type = IP_ADDRESS_V4;
             IF->Netmask.Address.IPv4Address = 0;
+            IF->Broadcast.Type = IP_ADDRESS_V4;
+            IF->Broadcast.Address.IPv4Address = 0;
             Status = STATUS_SUCCESS;
         }
     } EndFor(IF);
index 8a01b83..2365e13 100644 (file)
@@ -147,7 +147,8 @@ VOID IPDispatchProtocol(
         TI_DbgPrint(MIN_TRACE, ("IPv6 datagram discarded.\n"));
         return;
     default:
-        Protocol = 0;
+        TI_DbgPrint(MIN_TRACE, ("Unrecognized datagram discarded.\n"));
+        return;
     }
 
     if (Protocol < IP_PROTOCOL_TABLE_SIZE)
@@ -308,22 +309,20 @@ VOID IPRemoveInterfaceRoute( PIP_INTERFACE IF ) {
     PNEIGHBOR_CACHE_ENTRY NCE;
     IP_ADDRESS GeneralRoute;
 
-    TCPDisposeInterfaceData( IF->TCPContext );
-    IF->TCPContext = NULL;
+    NCE = NBLocateNeighbor(&IF->Unicast);
+    if (NCE)
+    {
+       TCPDisposeInterfaceData( IF->TCPContext );
 
-    TI_DbgPrint(DEBUG_IP,("Removing interface Addr %s\n", A2S(&IF->Unicast)));
-    TI_DbgPrint(DEBUG_IP,("                   Mask %s\n", A2S(&IF->Netmask)));
+       TI_DbgPrint(DEBUG_IP,("Removing interface Addr %s\n", A2S(&IF->Unicast)));
+       TI_DbgPrint(DEBUG_IP,("                   Mask %s\n", A2S(&IF->Netmask)));
 
-    AddrWidenAddress(&GeneralRoute,&IF->Unicast,&IF->Netmask);
+       AddrWidenAddress(&GeneralRoute,&IF->Unicast,&IF->Netmask);
 
-    RouterRemoveRoute(&GeneralRoute, &IF->Unicast);
+       RouterRemoveRoute(&GeneralRoute, &IF->Unicast);
 
-    /* Remove permanent NCE, but first we have to find it */
-    NCE = NBLocateNeighbor(&IF->Unicast);
-    if (NCE)
-       NBRemoveNeighbor(NCE);
-    else
-       TI_DbgPrint(DEBUG_IP, ("Could not delete IF route (0x%X)\n", IF));
+       NBRemoveNeighbor(NCE);
+    }
 }
 
 VOID IPUnregisterInterface(