Author: arty
Date: Sat May 13 11:11:22 2006
New Revision: 21900
URL:
http://svn.reactos.ru/svn/reactos?rev=21900&view=rev
Log:
Fix duplicate default routes when IP address is set manually.
Modified:
trunk/reactos/lib/drivers/ip/network/router.c
Modified: trunk/reactos/lib/drivers/ip/network/router.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/lib/drivers/ip/network/rout…
==============================================================================
--- trunk/reactos/lib/drivers/ip/network/router.c (original)
+++ trunk/reactos/lib/drivers/ip/network/router.c Sat May 13 11:11:22 2006
@@ -219,7 +219,7 @@
return NULL;
}
- INIT_TAG(Router, TAG('R','O','U','T'));
+ INIT_TAG(Router, TAG('R','O','U','T'));
RtlCopyMemory( &FIBE->NetworkAddress, NetworkAddress,
sizeof(FIBE->NetworkAddress) );
@@ -414,8 +414,33 @@
* for providing this reference
*/
{
+ KIRQL OldIrql;
+ PFIB_ENTRY FIBE;
+ PLIST_ENTRY CurrentEntry;
+ PLIST_ENTRY NextEntry;
+ PFIB_ENTRY Current;
PNEIGHBOR_CACHE_ENTRY NCE;
- PFIB_ENTRY FIBE;
+
+ TcpipAcquireSpinLock(&FIBLock, &OldIrql);
+
+ CurrentEntry = FIBListHead.Flink;
+ while (CurrentEntry != &FIBListHead) {
+ NextEntry = CurrentEntry->Flink;
+ Current = CONTAINING_RECORD(CurrentEntry, FIB_ENTRY, ListEntry);
+
+ NCE = Current->Router;
+
+ if( AddrIsEqual(NetworkAddress, &Current->NetworkAddress) &&
+ AddrIsEqual(Netmask, &Current->Netmask) ) {
+ TI_DbgPrint(DEBUG_ROUTER,("Attempting to add duplicate route to %s\n",
A2S(NetworkAddress)));
+ TcpipReleaseSpinLock(&FIBLock, OldIrql);
+ return NULL;
+ }
+
+ CurrentEntry = NextEntry;
+ }
+
+ TcpipReleaseSpinLock(&FIBLock, OldIrql);
/* The NCE references RouterAddress. The NCE is referenced for us */
NCE = NBFindOrCreateNeighbor(Interface, RouterAddress);