ReactOS 0.4.16-dev-2491-g3dc6630
router.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS TCP/IP protocol driver
4 * FILE: network/router.c
5 * PURPOSE: IP routing subsystem
6 * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
7 * NOTES:
8 * This file holds authoritative routing information.
9 * Information queries on the route table should be handled here.
10 * This information should always override the route cache info.
11 * REVISIONS:
12 * CSH 01/08-2000 Created
13 */
14
15#include "precomp.h"
16
19
20UINT
23{
24 if (Interface == Loopback)
25 return 1;
26
27 if (Interface->Metric != 0)
28 return Interface->Metric;
29
30 /* Auto metric */
31 if (Interface->Speed > 2000000000)
32 return 5;
33 else if (Interface->Speed > 200000000)
34 return 10;
35 else if (Interface->Speed > 80000000)
36 return 20;
37 else if (Interface->Speed > 20000000)
38 return 25;
39 else if (Interface->Speed > 4000000)
40 return 30;
41 else if (Interface->Speed > 500000)
42 return 40;
43 else
44 return 50;
45}
46
47
48VOID
50{
51 PLIST_ENTRY CurrentEntry;
52 PLIST_ENTRY NextEntry;
53 PFIB_ENTRY Current;
55
56 TI_DbgPrint(DEBUG_ROUTER,("Dumping Routes\n"));
57
58 CurrentEntry = FIBListHead.Flink;
59 while (CurrentEntry != &FIBListHead) {
60 NextEntry = CurrentEntry->Flink;
61 Current = CONTAINING_RECORD(CurrentEntry, FIB_ENTRY, ListEntry);
62
63 NCE = Current->Router;
64
65 TI_DbgPrint(DEBUG_ROUTER,("Examining FIBE %x\n", Current));
66 TI_DbgPrint(DEBUG_ROUTER,("... NetworkAddress %s\n", A2S(&Current->NetworkAddress)));
67 TI_DbgPrint(DEBUG_ROUTER,("... NCE->Address . %s\n", A2S(&NCE->Address)));
68
69 CurrentEntry = NextEntry;
70 }
71
72 TI_DbgPrint(DEBUG_ROUTER,("Dumping Routes ... Done\n"));
73}
74
77/*
78 * FUNCTION: Frees an forward information base object
79 * ARGUMENTS:
80 * Object = Pointer to an forward information base structure
81 */
82{
84}
85
86
88 PFIB_ENTRY FIBE)
89/*
90 * FUNCTION: Destroys an forward information base entry
91 * ARGUMENTS:
92 * FIBE = Pointer to FIB entry
93 * NOTES:
94 * The forward information base lock must be held when called
95 */
96{
97 TI_DbgPrint(DEBUG_ROUTER, ("Called. FIBE (0x%X).\n", FIBE));
98
99 /* Unlink the FIB entry from the list */
101
102 /* And free the FIB entry */
103 FreeFIB(FIBE);
104}
105
106
108 VOID)
109/*
110 * FUNCTION: Destroys all forward information base entries
111 * NOTES:
112 * The forward information base lock must be held when called
113 */
114{
115 PLIST_ENTRY CurrentEntry;
116 PLIST_ENTRY NextEntry;
117 PFIB_ENTRY Current;
118
119 /* Search the list and remove every FIB entry we find */
120 CurrentEntry = FIBListHead.Flink;
121 while (CurrentEntry != &FIBListHead) {
122 NextEntry = CurrentEntry->Flink;
123 Current = CONTAINING_RECORD(CurrentEntry, FIB_ENTRY, ListEntry);
124 /* Destroy the FIB entry */
125 DestroyFIBE(Current);
126 CurrentEntry = NextEntry;
127 }
128}
129
130
132 UINT FibCount = 0;
133 PLIST_ENTRY CurrentEntry;
134 PLIST_ENTRY NextEntry;
135 PFIB_ENTRY Current;
136
137 CurrentEntry = FIBListHead.Flink;
138 while (CurrentEntry != &FIBListHead) {
139 NextEntry = CurrentEntry->Flink;
140 Current = CONTAINING_RECORD(CurrentEntry, FIB_ENTRY, ListEntry);
141 if (Current->Router->Interface == IF)
142 FibCount++;
143 CurrentEntry = NextEntry;
144 }
145
146 return FibCount;
147}
148
149
151 UINT FibCount = 0;
152 PLIST_ENTRY CurrentEntry;
153 PLIST_ENTRY NextEntry;
154 PFIB_ENTRY Current;
155
156 CurrentEntry = FIBListHead.Flink;
157 while (CurrentEntry != &FIBListHead) {
158 NextEntry = CurrentEntry->Flink;
159 Current = CONTAINING_RECORD(CurrentEntry, FIB_ENTRY, ListEntry);
160 if (Current->Router->Interface == IF)
161 {
162 Target[FibCount] = *Current;
163 FibCount++;
164 }
165 CurrentEntry = NextEntry;
166 }
167
168 return FibCount;
169}
170
171
173 PIP_ADDRESS Address1,
174 PIP_ADDRESS Address2)
175/*
176 * FUNCTION: Computes the length of the longest prefix common to two addresses
177 * ARGUMENTS:
178 * Address1 = Pointer to first address
179 * Address2 = Pointer to second address
180 * NOTES:
181 * The two addresses must be of the same type
182 * RETURNS:
183 * Length of longest common prefix
184 */
185{
186 PUCHAR Addr1, Addr2;
187 UINT Size;
188 UINT i, j;
189 UINT Bitmask;
190
191 TI_DbgPrint(DEBUG_ROUTER, ("Called. Address1 (0x%X) Address2 (0x%X).\n", Address1, Address2));
192
193 /*TI_DbgPrint(DEBUG_ROUTER, ("Target (%s) \n", A2S(Address1)));*/
194 /*TI_DbgPrint(DEBUG_ROUTER, ("Adapter (%s).\n", A2S(Address2)));*/
195
196 if (Address1->Type == IP_ADDRESS_V4)
197 Size = sizeof(IPv4_RAW_ADDRESS);
198 else
199 Size = sizeof(IPv6_RAW_ADDRESS);
200
201 Addr1 = (PUCHAR)&Address1->Address.IPv4Address;
202 Addr2 = (PUCHAR)&Address2->Address.IPv4Address;
203
204 /* Find first non-matching byte */
205 for (i = 0; i < Size && Addr1[i] == Addr2[i]; i++);
206 if( i == Size ) return 8 * i;
207
208 /* Find first non-matching bit */
209 Bitmask = 0x80;
210 for (j = 0; (Addr1[i] & Bitmask) == (Addr2[i] & Bitmask); j++)
211 Bitmask >>= 1;
212
213 TI_DbgPrint(DEBUG_ROUTER, ("Returning %d\n", 8 * i + j));
214
215 return 8 * i + j;
216}
217
218
221 PIP_ADDRESS Netmask,
223 UINT Metric)
224/*
225 * FUNCTION: Adds a route to the Forward Information Base (FIB)
226 * ARGUMENTS:
227 * NetworkAddress = Pointer to address of network
228 * Netmask = Pointer to netmask of network
229 * Router = Pointer to NCE of router to use
230 * Metric = Cost of this route
231 * RETURNS:
232 * Pointer to FIB entry if the route was added, NULL if not
233 * NOTES:
234 * The FIB entry references the NetworkAddress, Netmask and
235 * the NCE of the router. The caller is responsible for providing
236 * these references
237 */
238{
239 PFIB_ENTRY FIBE;
240
241 TI_DbgPrint(DEBUG_ROUTER, ("Called. NetworkAddress (0x%X) Netmask (0x%X) "
242 "Router (0x%X) Metric (%d).\n", NetworkAddress, Netmask, Router, Metric));
243
244 TI_DbgPrint(DEBUG_ROUTER, ("NetworkAddress (%s) Netmask (%s) Router (%s).\n",
246 A2S(Netmask),
247 A2S(&Router->Address)));
248
250 if (!FIBE) {
251 TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
252 return NULL;
253 }
254
256 sizeof(FIBE->NetworkAddress) );
257 RtlCopyMemory( &FIBE->Netmask, Netmask,
258 sizeof(FIBE->Netmask) );
259 FIBE->Router = Router;
260 FIBE->Metric = Metric;
261
262 /* Add FIB to the forward information base */
264
265 return FIBE;
266}
267
268
270/*
271 * FUNCTION: Finds a router to use to get to Destination
272 * ARGUMENTS:
273 * Destination = Pointer to destination address (NULL means don't care)
274 * RETURNS:
275 * Pointer to NCE for router, NULL if none was found
276 * NOTES:
277 * If found the NCE is referenced
278 */
279{
281 PLIST_ENTRY CurrentEntry;
282 PLIST_ENTRY NextEntry;
283 PFIB_ENTRY Current;
284 UCHAR State;
285 UINT Length, BestLength = 0, MaskLength;
286 PNEIGHBOR_CACHE_ENTRY NCE, BestNCE = NULL;
287
288 TI_DbgPrint(DEBUG_ROUTER, ("Called. Destination (0x%X)\n", Destination));
289
290 TI_DbgPrint(DEBUG_ROUTER, ("Destination (%s)\n", A2S(Destination)));
291
293
294 CurrentEntry = FIBListHead.Flink;
295 while (CurrentEntry != &FIBListHead) {
296 NextEntry = CurrentEntry->Flink;
297 Current = CONTAINING_RECORD(CurrentEntry, FIB_ENTRY, ListEntry);
298
299 NCE = Current->Router;
300 State = NCE->State;
301
303 MaskLength = AddrCountPrefixBits(&Current->Netmask);
304
305 TI_DbgPrint(DEBUG_ROUTER,("This-Route: %s (Sharing %d bits)\n",
306 A2S(&NCE->Address), Length));
307
308 if(Length >= MaskLength && (Length > BestLength || !BestNCE) &&
309 ((!(State & NUD_STALE) && !(State & NUD_INCOMPLETE)) || !BestNCE)) {
310 /* This seems to be a better router */
311 BestNCE = NCE;
312 BestLength = Length;
313 TI_DbgPrint(DEBUG_ROUTER,("Route selected\n"));
314 }
315
316 CurrentEntry = NextEntry;
317 }
318
320
321 if( BestNCE ) {
322 TI_DbgPrint(DEBUG_ROUTER,("Routing to %s\n", A2S(&BestNCE->Address)));
323 } else {
324 TI_DbgPrint(DEBUG_ROUTER,("Packet won't be routed\n"));
325 }
326
327 return BestNCE;
328}
329
331/*
332 * FUNCTION: Locates an RCN describing a route to a destination address
333 * ARGUMENTS:
334 * Destination = Pointer to destination address to find route to
335 * RCN = Address of pointer to an RCN
336 * RETURNS:
337 * Status of operation
338 * NOTES:
339 * The RCN is referenced for the caller. The caller is responsible
340 * for dereferencing it after use
341 */
342{
345
346 TI_DbgPrint(DEBUG_RCACHE, ("Called. Destination (0x%X)\n", Destination));
347
348 TI_DbgPrint(DEBUG_RCACHE, ("Destination (%s)\n", A2S(Destination)));
349
350#if 0
351 TI_DbgPrint(MIN_TRACE, ("Displaying tree (before).\n"));
352 PrintTree(RouteCache);
353#endif
354
355 /* Check if the destination is on-link */
357 if (Interface) {
358 /* The destination address is on-link. Check our neighbor cache */
360 } else {
361 /* Destination is not on any subnets we're on. Find a router to use */
363 }
364
365 if( NCE )
366 TI_DbgPrint(DEBUG_ROUTER,("Interface->MTU: %d\n", NCE->Interface->MTU));
367
368 return NCE;
369}
370
372{
374 PLIST_ENTRY CurrentEntry;
375 PLIST_ENTRY NextEntry;
376 PFIB_ENTRY Current;
377
379
380 CurrentEntry = FIBListHead.Flink;
381 while (CurrentEntry != &FIBListHead) {
382 NextEntry = CurrentEntry->Flink;
383 Current = CONTAINING_RECORD(CurrentEntry, FIB_ENTRY, ListEntry);
384
385 if (Interface == Current->Router->Interface)
386 DestroyFIBE(Current);
387
388 CurrentEntry = NextEntry;
389 }
390
392}
393
395/*
396 * FUNCTION: Removes a route from the Forward Information Base (FIB)
397 * ARGUMENTS:
398 * Target: The machine or network targeted by the route
399 * Router: The router used to pass the packet to the destination
400 *
401 * Searches the FIB and removes a route matching the indicated parameters.
402 */
403{
405 PLIST_ENTRY CurrentEntry;
406 PLIST_ENTRY NextEntry;
407 PFIB_ENTRY Current;
410
411 TI_DbgPrint(DEBUG_ROUTER, ("Called\n"));
412 TI_DbgPrint(DEBUG_ROUTER, ("Deleting Route From: %s\n", A2S(Router)));
413 TI_DbgPrint(DEBUG_ROUTER, (" To: %s\n", A2S(Target)));
414
416
418
419 CurrentEntry = FIBListHead.Flink;
420 while (CurrentEntry != &FIBListHead) {
421 NextEntry = CurrentEntry->Flink;
422 Current = CONTAINING_RECORD(CurrentEntry, FIB_ENTRY, ListEntry);
423
424 NCE = Current->Router;
425
426 if( AddrIsEqual( &Current->NetworkAddress, Target ) &&
427 AddrIsEqual( &NCE->Address, Router ) ) {
428 Found = TRUE;
429 break;
430 }
431
432 Current = NULL;
433 CurrentEntry = NextEntry;
434 }
435
436 if( Found ) {
437 TI_DbgPrint(DEBUG_ROUTER, ("Deleting route\n"));
438 DestroyFIBE( Current );
439 }
440
442
444
445 TI_DbgPrint(DEBUG_ROUTER, ("Leaving\n"));
446
448}
449
450
453 PIP_ADDRESS Netmask,
454 PIP_ADDRESS RouterAddress,
456/*
457 * FUNCTION: Creates a route with IPv4 addresses as parameters
458 * ARGUMENTS:
459 * NetworkAddress = Address of network
460 * Netmask = Netmask of network
461 * RouterAddress = Address of router to use
462 * Interface = Network interface
463 * RETURNS:
464 * Pointer to FIB entry if the route was created, NULL if not.
465 * The FIB entry references the NTE. The caller is responsible
466 * for providing this reference
467 */
468{
470 PLIST_ENTRY CurrentEntry;
471 PLIST_ENTRY NextEntry;
472 PFIB_ENTRY Current;
474
476
477 CurrentEntry = FIBListHead.Flink;
478 while (CurrentEntry != &FIBListHead) {
479 NextEntry = CurrentEntry->Flink;
480 Current = CONTAINING_RECORD(CurrentEntry, FIB_ENTRY, ListEntry);
481
482 NCE = Current->Router;
483
485 AddrIsEqual(Netmask, &Current->Netmask) &&
486 NCE->Interface == Interface)
487 {
488 TI_DbgPrint(DEBUG_ROUTER,("Attempting to add duplicate route to %s\n", A2S(NetworkAddress)));
490 return NULL;
491 }
492
493 CurrentEntry = NextEntry;
494 }
495
497
498 /* The NCE references RouterAddress. The NCE is referenced for us */
499 NCE = NBFindOrCreateNeighbor(Interface, RouterAddress, TRUE);
500
501 if (!NCE) {
502 /* Not enough free resources */
503 return NULL;
504 }
505
507}
508
509
511 VOID)
512/*
513 * FUNCTION: Initializes the routing subsystem
514 * RETURNS:
515 * Status of operation
516 */
517{
518 TI_DbgPrint(DEBUG_ROUTER, ("Called.\n"));
519
520 /* Initialize the Forward Information Base */
523
524 return STATUS_SUCCESS;
525}
526
527
529 VOID)
530/*
531 * FUNCTION: Shuts down the routing subsystem
532 * RETURNS:
533 * Status of operation
534 */
535{
537
538 TI_DbgPrint(DEBUG_ROUTER, ("Called.\n"));
539
540 /* Clear Forward Information Base */
542 DestroyFIBEs();
544
545 return STATUS_SUCCESS;
546}
547
548/* EOF */
unsigned char BOOLEAN
Definition: actypes.h:127
UINT AddrCountPrefixBits(PIP_ADDRESS Netmask)
Definition: address.c:64
BOOLEAN AddrIsEqual(PIP_ADDRESS Address1, PIP_ADDRESS Address2)
Definition: address.c:221
LONG NTSTATUS
Definition: precomp.h:26
#define MIN_TRACE
Definition: debug.h:14
return Found
Definition: dirsup.c:1270
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define DEBUG_ROUTER
Definition: debug.h:30
#define DEBUG_RCACHE
Definition: debug.h:31
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
USHORT IPv6_RAW_ADDRESS[8]
Definition: ip.h:19
ULONG IPv4_RAW_ADDRESS
Definition: ip.h:15
#define IP_ADDRESS_V4
Definition: ip.h:32
VOID TcpipReleaseSpinLock(PKSPIN_LOCK SpinLock, KIRQL Irql)
Definition: lock.c:26
VOID TcpipInterlockedInsertTailList(PLIST_ENTRY ListHead, PLIST_ENTRY Item, PKSPIN_LOCK Lock)
Definition: lock.c:34
VOID TcpipInitializeSpinLock(PKSPIN_LOCK SpinLock)
Definition: lock.c:14
VOID TcpipAcquireSpinLock(PKSPIN_LOCK SpinLock, PKIRQL Irql)
Definition: lock.c:18
#define FIB_TAG
Definition: tags.h:29
PCHAR A2S(PIP_ADDRESS Address)
Definition: address.c:17
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
UCHAR KIRQL
Definition: env_spec_w32.h:591
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
PIP_INTERFACE Loopback
Definition: loopback.c:13
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
_Must_inspect_result_ _Out_ PNDIS_STATUS _Outptr_result_bytebuffer_to_ NetworkAddressLength PVOID * NetworkAddress
Definition: ndis.h:3956
unsigned int UINT
Definition: ndis.h:50
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:3051
PNEIGHBOR_CACHE_ENTRY NBFindOrCreateNeighbor(PIP_INTERFACE Interface, PIP_ADDRESS Address, BOOLEAN NoTimeout)
Definition: neighbor.c:515
#define NUD_INCOMPLETE
Definition: neighbor.h:41
#define NUD_STALE
Definition: neighbor.h:43
PIP_INTERFACE FindOnLinkInterface(PIP_ADDRESS Address)
Definition: interface.c:233
#define _In_
Definition: no_sal2.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
VOID RouterRemoveRoutesForInterface(PIP_INTERFACE Interface)
Definition: router.c:371
VOID DestroyFIBE(PFIB_ENTRY FIBE)
Definition: router.c:87
VOID RouterDumpRoutes(VOID)
Definition: router.c:49
VOID FreeFIB(PVOID Object)
Definition: router.c:75
NTSTATUS RouterShutdown(VOID)
Definition: router.c:528
UINT CountFIBs(PIP_INTERFACE IF)
Definition: router.c:131
VOID DestroyFIBEs(VOID)
Definition: router.c:107
UINT CommonPrefixLength(PIP_ADDRESS Address1, PIP_ADDRESS Address2)
Definition: router.c:172
LIST_ENTRY FIBListHead
Definition: router.c:17
NTSTATUS RouterStartup(VOID)
Definition: router.c:510
PNEIGHBOR_CACHE_ENTRY RouterGetRoute(PIP_ADDRESS Destination)
Definition: router.c:269
UINT ProcessAutoMetric(_In_ PIP_INTERFACE Interface)
Definition: router.c:21
KSPIN_LOCK FIBLock
Definition: router.c:18
PFIB_ENTRY RouterCreateRoute(PIP_ADDRESS NetworkAddress, PIP_ADDRESS Netmask, PIP_ADDRESS RouterAddress, PIP_INTERFACE Interface)
Definition: router.c:451
PFIB_ENTRY RouterAddRoute(PIP_ADDRESS NetworkAddress, PIP_ADDRESS Netmask, PNEIGHBOR_CACHE_ENTRY Router, UINT Metric)
Definition: router.c:219
PNEIGHBOR_CACHE_ENTRY RouteGetRouteToDestination(PIP_ADDRESS Destination)
Definition: router.c:330
UINT CopyFIBs(PIP_INTERFACE IF, PFIB_ENTRY Target)
Definition: router.c:150
NTSTATUS RouterRemoveRoute(PIP_ADDRESS Target, PIP_ADDRESS Router)
Definition: router.c:394
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: ip.h:23
union IP_ADDRESS::@1101 Address
UCHAR Type
Definition: ip.h:24
IPv4_RAW_ADDRESS IPv4Address
Definition: ip.h:26
Definition: neighbor.h:28
PIP_INTERFACE Interface
Definition: neighbor.h:33
IP_ADDRESS Address
Definition: neighbor.h:36
UCHAR State
Definition: neighbor.h:30
Definition: router.h:14
PNEIGHBOR_CACHE_ENTRY Router
Definition: router.h:19
LIST_ENTRY ListEntry
Definition: router.h:15
UINT Metric
Definition: router.h:20
IP_ADDRESS Netmask
Definition: router.h:18
IP_ADDRESS NetworkAddress
Definition: router.h:17
UINT MTU
Definition: ip.h:157
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
unsigned char * PUCHAR
Definition: typedefs.h:53
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
Definition: wdffdo.h:465
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
unsigned char UCHAR
Definition: xmlstorage.h:181