* Object = Pointer to an forward information base structure
*/
{
- PoolFreeBuffer(Object);
+ exFreePool(Object);
}
}
-UINT CountFIBs() {
+UINT CountFIBs(PIP_INTERFACE IF) {
UINT FibCount = 0;
PLIST_ENTRY CurrentEntry;
PLIST_ENTRY NextEntry;
+ PFIB_ENTRY Current;
- /* Search the list and remove every FIB entry we find */
CurrentEntry = FIBListHead.Flink;
while (CurrentEntry != &FIBListHead) {
NextEntry = CurrentEntry->Flink;
+ Current = CONTAINING_RECORD(CurrentEntry, FIB_ENTRY, ListEntry);
+ if (Current->Router->Interface == IF)
+ FibCount++;
CurrentEntry = NextEntry;
- FibCount++;
}
return FibCount;
}
-UINT CopyFIBs( PFIB_ENTRY Target ) {
+UINT CopyFIBs( PIP_INTERFACE IF, PFIB_ENTRY Target ) {
UINT FibCount = 0;
PLIST_ENTRY CurrentEntry;
PLIST_ENTRY NextEntry;
PFIB_ENTRY Current;
- /* Search the list and remove every FIB entry we find */
CurrentEntry = FIBListHead.Flink;
while (CurrentEntry != &FIBListHead) {
NextEntry = CurrentEntry->Flink;
Current = CONTAINING_RECORD(CurrentEntry, FIB_ENTRY, ListEntry);
- Target[FibCount] = *Current;
+ if (Current->Router->Interface == IF)
+ {
+ Target[FibCount] = *Current;
+ FibCount++;
+ }
CurrentEntry = NextEntry;
- FibCount++;
}
return FibCount;
A2S(Netmask),
A2S(&Router->Address)));
- FIBE = PoolAllocateBuffer(sizeof(FIB_ENTRY));
+ FIBE = exAllocatePool(NonPagedPool, sizeof(FIB_ENTRY));
if (!FIBE) {
TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
return NULL;
}
- INIT_TAG(Router, TAG('R','O','U','T'));
+ INIT_TAG(Router, 'TUOR');
RtlCopyMemory( &FIBE->NetworkAddress, NetworkAddress,
sizeof(FIBE->NetworkAddress) );
TI_DbgPrint(DEBUG_ROUTER,("This-Route: %s (Sharing %d bits)\n",
A2S(&NCE->Address), Length));
- if(Length >= MaskLength && (Length > BestLength || !BestLength)) {
+ if(Length >= MaskLength && (Length > BestLength || !BestNCE) &&
+ (!(State & NUD_STALE) || !BestNCE)) {
/* This seems to be a better router */
BestNCE = NCE;
BestLength = Length;
TI_DbgPrint(DEBUG_ROUTER, ("Leaving\n"));
- return Found ? STATUS_NO_SUCH_FILE : STATUS_SUCCESS;
+ return Found ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL;
}
*/
{
KIRQL OldIrql;
- PFIB_ENTRY FIBE;
PLIST_ENTRY CurrentEntry;
PLIST_ENTRY NextEntry;
PFIB_ENTRY Current;
return NULL;
}
- FIBE = RouterAddRoute(NetworkAddress, Netmask, NCE, Metric);
- if (!FIBE) {
- /* Not enough free resources */
- NBRemoveNeighbor(NCE);
- }
-
- return FIBE;
+ return RouterAddRoute(NetworkAddress, Netmask, NCE, Metric);
}