Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

774 lines
20 KiB

  1. #include "precomp.h"
  2. #pragma hdrstop
  3. #include <wdbgexts.h>
  4. #include "rtkmext.h"
  5. #include "kdmacros.h"
  6. INT Item;
  7. HANDLE _hInstance;
  8. HANDLE _hAdditionalReference;
  9. HANDLE _hProcessHeap;
  10. int _Indent = 0;
  11. char IndentBuf[ 80 ]={"\0 "};
  12. BOOL
  13. dprint_enum_name
  14. (
  15. ULONG Value,
  16. PENUM_INFO pEnumInfo
  17. )
  18. {
  19. while ( pEnumInfo->pszDescription != NULL )
  20. {
  21. if ( pEnumInfo->Value == Value )
  22. {
  23. dprintf( "%.40s", pEnumInfo->pszDescription );
  24. return( TRUE );
  25. }
  26. pEnumInfo ++;
  27. }
  28. dprintf( "Unknown enumeration value." );
  29. return( FALSE );
  30. }
  31. BOOL
  32. dprint_flag_names
  33. (
  34. ULONG Value,
  35. PFLAG_INFO pFlagInfo
  36. )
  37. {
  38. BOOL bFoundOne = FALSE;
  39. while ( pFlagInfo->pszDescription != NULL )
  40. {
  41. if ( pFlagInfo->Value & Value )
  42. {
  43. if ( bFoundOne )
  44. {
  45. dprintf( " | " );
  46. }
  47. bFoundOne = TRUE;
  48. dprintf( "%.15s", pFlagInfo->pszDescription );
  49. }
  50. pFlagInfo ++;
  51. }
  52. return( bFoundOne );
  53. }
  54. VOID
  55. dprint_IP_address
  56. (
  57. IPAddr Address
  58. )
  59. {
  60. uchar IPAddrBuffer[(sizeof(IPAddr) * 4)];
  61. uint i;
  62. uint IPAddrCharCount;
  63. //
  64. // Convert the IP address into a string.
  65. //
  66. IPAddrCharCount = 0;
  67. for (i = 0; i < sizeof(IPAddr); i++) {
  68. uint CurrentByte;
  69. CurrentByte = Address & 0xff;
  70. if (CurrentByte > 99) {
  71. IPAddrBuffer[IPAddrCharCount++] = (CurrentByte / 100) + '0';
  72. CurrentByte %= 100;
  73. IPAddrBuffer[IPAddrCharCount++] = (CurrentByte / 10) + '0';
  74. CurrentByte %= 10;
  75. } else if (CurrentByte > 9) {
  76. IPAddrBuffer[IPAddrCharCount++] = (CurrentByte / 10) + '0';
  77. CurrentByte %= 10;
  78. }
  79. IPAddrBuffer[IPAddrCharCount++] = CurrentByte + '0';
  80. if (i != (sizeof(IPAddr) - 1))
  81. IPAddrBuffer[IPAddrCharCount++] = '.';
  82. Address >>= 8;
  83. }
  84. IPAddrBuffer[IPAddrCharCount] = '\0';
  85. dprintf( "%s", IPAddrBuffer );
  86. }
  87. #ifdef _obj
  88. # undef _obj
  89. # undef _objAddr
  90. # undef _objType
  91. #endif
  92. #define _obj IpsecGlobal
  93. #define _objAddr pIpsecGlobal
  94. #define _objType IPSEC_GLOBAL
  95. VOID
  96. Iglobal(DWORD opts, LPSTR args)
  97. {
  98. ULONG deviceToDump = 0;
  99. ULONG pDevice = 0;
  100. ULONG result;
  101. UCHAR cmdline[MAX_PATH]="0";
  102. UCHAR arg[MAX_PATH]="0";
  103. IPSEC_GLOBAL IpsecGlobal;
  104. PIPSEC_GLOBAL pIpsecGlobal;
  105. pDevice = GetExpression( "ipsec!g_ipsec" );
  106. if ( !pDevice ) {
  107. dprintf("Could not get g_ipsec, Try !reload\n");
  108. return;
  109. } else {
  110. if ( !ReadMemory( pDevice,
  111. &IpsecGlobal,
  112. sizeof(IPSEC_GLOBAL),
  113. &result )) {
  114. dprintf("%08lx: Could not read device context\n", pDevice);
  115. return;
  116. }
  117. }
  118. pIpsecGlobal = &IpsecGlobal;
  119. PrintBool(DriverUnloading);
  120. PrintBool(BoundToIP);
  121. PrintBool(SendBoundToIP);
  122. PrintULong(NumSends);
  123. PrintULong(NumThreads);
  124. PrintULong(NumWorkers);
  125. PrintULong(NumTimers);
  126. PrintLL(LarvalSAList);
  127. PrintLock(LarvalListLock);
  128. PrintLock(SADBLock.SpinLock);
  129. PrintULong(SADBLock.RefCount);
  130. PrintLock(SPIListLock.SpinLock);
  131. PrintULong(SPIListLock.RefCount);
  132. PrintLL(FilterList[INBOUND_TRANSPORT_FILTER]);
  133. PrintLL(FilterList[OUTBOUND_TRANSPORT_FILTER]);
  134. PrintLL(FilterList[INBOUND_TUNNEL_FILTER]);
  135. PrintLL(FilterList[OUTBOUND_TUNNEL_FILTER]);
  136. PrintULong(NumPolicies);
  137. PrintULong(NumTunnelFilters);
  138. PrintULong(NumMaskedFilters);
  139. PrintULong(NumOutboundSAs);
  140. PrintULong(NumMulticastFilters);
  141. PrintPtr(pSADb);
  142. PrintULong(NumSA);
  143. PrintULong(SAHashSize);
  144. PrintPtr(ppCache);
  145. PrintULong(CacheSize);
  146. PrintPtr(IPSecDevice);
  147. PrintPtr(IPSecDriverObject);
  148. PrintULong(EnableOffload);
  149. PrintULong(DefaultSAIdleTime);
  150. PrintULong(LogInterval);
  151. PrintULong(EventQueueSize);
  152. PrintULong(NoDefaultExempt);
  153. PrintULong(IPSecBufferedEvents);
  154. PrintPtr(IPSecLogMemory);
  155. PrintPtr(IPSecLogMemoryLoc);
  156. PrintPtr(IPSecLogMemoryEnd);
  157. PrintULong(OperationMode);
  158. return;
  159. }
  160. FLAG_INFO FlagsFilter[] =
  161. {
  162. { FILTER_FLAGS_PASS_THRU , "Pass Thru'" },
  163. { FILTER_FLAGS_DROP , "Drop" },
  164. { 0, NULL }
  165. };
  166. #ifdef _obj
  167. # undef _obj
  168. # undef _objAddr
  169. # undef _objType
  170. #endif
  171. #define _obj Filter
  172. #define _objAddr pFilter
  173. #define _objType FILTER
  174. VOID
  175. DumpFilter(PFILTER pFilter, FILTER Filter)
  176. {
  177. ULARGE_INTEGER uliSrcDstAddr;
  178. ULARGE_INTEGER uliSrcDstMask;
  179. ULARGE_INTEGER uliProtoSrcDstPort;
  180. uliSrcDstAddr = Filter.uliSrcDstAddr;
  181. uliSrcDstMask = Filter.uliSrcDstMask;
  182. uliProtoSrcDstPort = Filter.uliProtoSrcDstPort;
  183. dprintf("\n--------------------------- FILTER: %lx -------------------------------\n", pFilter);
  184. PrintLL(MaskedLinkage);
  185. PrintXULong(Signature);
  186. PrintFlags(Flags, FlagsFilter);
  187. PrintFieldName("SrcAddr");
  188. dprint_IP_address( SRC_ADDR );
  189. PrintNL();
  190. PrintFieldName("SrcMask");
  191. dprint_IP_address( SRC_MASK );
  192. PrintNL();
  193. PrintFieldName("DestAddr");
  194. dprint_IP_address( DEST_ADDR );
  195. PrintNL();
  196. PrintFieldName("DestMask");
  197. dprint_IP_address( DEST_MASK );
  198. PrintNL();
  199. PrintUShort(PROTO);
  200. PrintFieldName("SrcPort");
  201. dprintf("%-10hu%s", SRC_PORT, EOL);
  202. PrintFieldName("DestPort");
  203. dprintf("%-10hu%s", DEST_PORT, EOL);
  204. PrintIPAddress(TunnelAddr);
  205. PrintULong(SAChainSize);
  206. PrintULong(Index);
  207. PrintGUID(PolicyId);
  208. PrintGUID(FilterId);
  209. }
  210. VOID
  211. Imfl(DWORD opts, LPSTR args)
  212. {
  213. ULONG deviceToDump = 0;
  214. ULONG result;
  215. UCHAR cmdline[MAX_PATH]="0";
  216. UCHAR arg[MAX_PATH]="0";
  217. ULONG pDevice=0;
  218. IPSEC_GLOBAL g_ipsec;
  219. PFILTER pFilter;
  220. FILTER Filter;
  221. PLIST_ENTRY pEntry;
  222. LONG Index;
  223. pDevice = GetExpression( "ipsec!g_ipsec" );
  224. if ( !pDevice ) {
  225. dprintf("Could not get g_ipsec, Try !reload\n");
  226. return;
  227. } else {
  228. if ( !ReadMemory( pDevice,
  229. &g_ipsec,
  230. sizeof(IPSEC_GLOBAL),
  231. &result )) {
  232. dprintf("%08lx: Could not read device context\n", pDevice);
  233. return;
  234. }
  235. }
  236. for (Index = MIN_TRANSPORT_FILTER; Index <= MAX_TRANSPORT_FILTER; Index++) {
  237. pEntry = g_ipsec.FilterList[Index].Flink;
  238. while (pEntry != (PLIST_ENTRY)(pDevice + FIELD_OFFSET(IPSEC_GLOBAL, FilterList[Index]))) {
  239. pFilter = CONTAINING_RECORD(pEntry,
  240. FILTER,
  241. MaskedLinkage);
  242. if ( !ReadMemory( (ULONG)pFilter,
  243. &Filter,
  244. sizeof(Filter),
  245. &result )) {
  246. dprintf("%08lx: Could not read device context\n", pDevice);
  247. return;
  248. }
  249. DumpFilter(pFilter, Filter);
  250. pEntry = Filter.MaskedLinkage.Flink;
  251. }
  252. }
  253. return;
  254. }
  255. VOID
  256. Itfl(DWORD opts, LPSTR args)
  257. {
  258. ULONG deviceToDump = 0;
  259. ULONG result;
  260. UCHAR cmdline[MAX_PATH]="0";
  261. UCHAR arg[MAX_PATH]="0";
  262. ULONG pDevice=0;
  263. IPSEC_GLOBAL g_ipsec;
  264. PFILTER pFilter;
  265. FILTER Filter;
  266. PLIST_ENTRY pEntry;
  267. LONG Index;
  268. pDevice = GetExpression( "ipsec!g_ipsec" );
  269. if ( !pDevice ) {
  270. dprintf("Could not get g_ipsec, Try !reload\n");
  271. return;
  272. } else {
  273. if ( !ReadMemory( pDevice,
  274. &g_ipsec,
  275. sizeof(IPSEC_GLOBAL),
  276. &result )) {
  277. dprintf("%08lx: Could not read device context\n", pDevice);
  278. return;
  279. }
  280. }
  281. for (Index = MIN_TUNNEL_FILTER; Index <= MAX_TUNNEL_FILTER; Index++) {
  282. pEntry = g_ipsec.FilterList[Index].Flink;
  283. while (pEntry != (PLIST_ENTRY)(pDevice + FIELD_OFFSET(IPSEC_GLOBAL, FilterList[Index]))) {
  284. pFilter = CONTAINING_RECORD(pEntry,
  285. FILTER,
  286. MaskedLinkage);
  287. if ( !ReadMemory( (ULONG)pFilter,
  288. &Filter,
  289. sizeof(Filter),
  290. &result )) {
  291. dprintf("%08lx: Could not read device context\n", pDevice);
  292. return;
  293. }
  294. DumpFilter(pFilter, Filter);
  295. pEntry = Filter.MaskedLinkage.Flink;
  296. }
  297. }
  298. return;
  299. }
  300. FLAG_INFO FlagsSA[] =
  301. {
  302. { FLAGS_SA_INITIATOR , "Initiator" },
  303. { FLAGS_SA_OUTBOUND , "Outbound" },
  304. { FLAGS_SA_TUNNEL , "Tunnel" },
  305. { FLAGS_SA_REPLAY , "Replay" },
  306. { FLAGS_SA_REKEY , "Rekey" },
  307. { FLAGS_SA_MANUAL , "Manual" },
  308. { FLAGS_SA_MTU_BUMPED , "MTU_Bumped" },
  309. { FLAGS_SA_PENDING , "Pending" },
  310. { FLAGS_SA_TIMER_STARTED , "Timer_Started" },
  311. { FLAGS_SA_HW_PLUMBED , "HW_Plumbed" },
  312. { FLAGS_SA_HW_PLUMB_FAILED, "HW_Plumb_failed" },
  313. { FLAGS_SA_HW_CRYPTO_ONLY , "HW_Crpto_only" },
  314. { FLAGS_SA_REFERENCED , "SA_referenced" },
  315. { 0, NULL }
  316. };
  317. ENUM_INFO StateSA[] =
  318. {
  319. { STATE_SA_CREATED, "Created" },
  320. { STATE_SA_LARVAL, "Larval" },
  321. { STATE_SA_ASSOCIATED,"Associated"},
  322. { STATE_SA_ACTIVE, "Active" },
  323. { STATE_SA_ZOMBIE, "Zombie" },
  324. { 0, NULL }
  325. };
  326. ENUM_INFO OperationSA[] =
  327. {
  328. { None, "None" },
  329. { Auth, "Auth" },
  330. { Encrypt,"Encrypt"},
  331. { Compress,"Compress"},
  332. { 0, NULL }
  333. };
  334. ENUM_INFO AHAlgo[] =
  335. {
  336. { IPSEC_AH_NONE, "IPSEC_AH_NONE"},
  337. { IPSEC_AH_MD5, "IPSEC_AH_MD5"},
  338. { IPSEC_AH_SHA, "IPSEC_AH_SHA"},
  339. { IPSEC_AH_MAX, "IPSEC_AH_MAX"},
  340. { 0, NULL }
  341. };
  342. ENUM_INFO ESPAlgo[] =
  343. {
  344. { IPSEC_ESP_NONE, "IPSEC_ESP_NONE"},
  345. { IPSEC_ESP_DES, "IPSEC_ESP_DES"},
  346. { IPSEC_ESP_DES_40, "IPSEC_ESP_DES_40"},
  347. { IPSEC_ESP_3_DES, "IPSEC_ESP_3_DES"},
  348. { IPSEC_ESP_MAX, "IPSEC_ESP_MAX"},
  349. { 0, NULL }
  350. };
  351. #ifdef _obj
  352. # undef _obj
  353. # undef _objAddr
  354. # undef _objType
  355. #endif
  356. #define _obj SA
  357. #define _objAddr pSA
  358. #define _objType SA_TABLE_ENTRY
  359. VOID
  360. DumpSA(PSA_TABLE_ENTRY pSA, SA_TABLE_ENTRY SA)
  361. {
  362. ULARGE_INTEGER uliSrcDstAddr;
  363. ULARGE_INTEGER uliSrcDstMask;
  364. ULARGE_INTEGER uliProtoSrcDstPort;
  365. LONG i;
  366. uliSrcDstAddr = SA.sa_uliSrcDstAddr;
  367. uliProtoSrcDstPort = SA.sa_uliProtoSrcDstPort;
  368. dprintf("\n---------------------- Security Association: %lx -----------------------\n", pSA);
  369. PrintLL(sa_SPILinkage);
  370. PrintLL(sa_FilterLinkage);
  371. PrintLL(sa_LarvalLinkage);
  372. PrintLL(sa_PendingLinkage);
  373. PrintXULong(sa_AssociatedSA);
  374. PrintXULong(sa_RekeyLarvalSA);
  375. PrintXULong(sa_RekeyOriginalSA);
  376. PrintXULong(sa_Filter);
  377. PrintXULong(sa_Signature);
  378. PrintULong(sa_Reference);
  379. PrintFlags(sa_Flags, FlagsSA);
  380. PrintEnum(sa_State, StateSA);
  381. PrintFieldName("SrcAddr");
  382. dprint_IP_address( SRC_ADDR );
  383. PrintNL();
  384. PrintFieldName("DestAddr");
  385. dprint_IP_address( DEST_ADDR );
  386. PrintNL();
  387. PrintUShort(SA_PROTO);
  388. PrintFieldName("SrcPort");
  389. dprintf("%-10hu%s", SA_SRC_PORT(&SA), EOL);
  390. PrintFieldName("DestPort");
  391. dprintf("%-10hu%s", SA_DEST_PORT(&SA), EOL);
  392. PrintIPAddress(sa_TunnelAddr);
  393. PrintXULong(sa_SPI);
  394. PrintULong(sa_NumOps);
  395. for (i=0; i<SA.sa_NumOps; i++) {
  396. PrintXULong(sa_OtherSPIs[i]);
  397. switch (SA.sa_Operation[i]) {
  398. case None:
  399. break;
  400. case Auth:
  401. PrintEnum(sa_Algorithm[i].integrityAlgo.algoIdentifier, AHAlgo);
  402. PrintFieldName("algoKey");
  403. dprintf("%lx %lx", SA.sa_Algorithm[i].integrityAlgo.algoKey, EOL);
  404. PrintNL();
  405. PrintULong(sa_Algorithm[i].integrityAlgo.algoKeylen);
  406. break;
  407. case Encrypt:
  408. PrintEnum(sa_Algorithm[i].integrityAlgo.algoIdentifier, AHAlgo);
  409. PrintFieldName("algoKey");
  410. dprintf("%lx %lx", SA.sa_Algorithm[i].integrityAlgo.algoKey, EOL);
  411. PrintNL();
  412. PrintULong(sa_Algorithm[i].integrityAlgo.algoKeylen);
  413. PrintEnum(sa_Algorithm[i].confAlgo.algoIdentifier, ESPAlgo);
  414. PrintFieldName("algoKey");
  415. dprintf("%lx %lx", SA.sa_Algorithm[i].confAlgo.algoKey, EOL);
  416. PrintNL();
  417. PrintULong(sa_Algorithm[i].confAlgo.algoKeylen);
  418. break;
  419. }
  420. }
  421. PrintULong(sa_TruncatedLen);
  422. PrintULong(sa_ReplayStartPoint);
  423. PrintULong(sa_ReplayLastSeq);
  424. PrintULong(sa_ReplayBitmap);
  425. PrintULong(sa_ReplaySendSeq);
  426. PrintULong(sa_ReplayLen);
  427. PrintULong(sa_BlockedDataLen);
  428. PrintXULong(sa_BlockedBuffer);
  429. PrintULong(sa_ExpiryTime);
  430. }
  431. VOID
  432. Isas(DWORD opts, LPSTR args)
  433. {
  434. ULONG deviceToDump = 0;
  435. ULONG result;
  436. UCHAR cmdline[MAX_PATH]="0";
  437. UCHAR arg[MAX_PATH]="0";
  438. ULONG pDevice=0;
  439. IPSEC_GLOBAL g_ipsec;
  440. PFILTER pFilter;
  441. FILTER Filter;
  442. PLIST_ENTRY pEntry;
  443. PLIST_ENTRY pEntry1;
  444. PSA_TABLE_ENTRY pSA;
  445. SA_TABLE_ENTRY SA;
  446. SA_TABLE_ENTRY NextSA;
  447. LONG Index, SAIndex;
  448. LIST_ENTRY SAChain[256 * sizeof(LIST_ENTRY)];
  449. pDevice = GetExpression( "ipsec!g_ipsec" );
  450. if ( !pDevice ) {
  451. dprintf("Could not get g_ipsec, Try !reload\n");
  452. return;
  453. } else {
  454. if ( !ReadMemory( pDevice,
  455. &g_ipsec,
  456. sizeof(IPSEC_GLOBAL),
  457. &result )) {
  458. dprintf("%08lx: Could not read device context\n", pDevice);
  459. return;
  460. }
  461. }
  462. for (Index = MIN_TRANSPORT_FILTER; Index <= MAX_TRANSPORT_FILTER; Index++) {
  463. pEntry = g_ipsec.FilterList[Index].Flink;
  464. while (pEntry != (PLIST_ENTRY)(pDevice + FIELD_OFFSET(IPSEC_GLOBAL, FilterList[Index]))) {
  465. pFilter = CONTAINING_RECORD(pEntry,
  466. FILTER,
  467. MaskedLinkage);
  468. if ( !ReadMemory( (ULONG)pFilter,
  469. &Filter,
  470. sizeof(Filter),
  471. &result )) {
  472. dprintf("%08lx: Could not read filter context\n", pFilter);
  473. return;
  474. }
  475. if ( !ReadMemory( (ULONG)pFilter + FIELD_OFFSET(FILTER, SAChain[0]),
  476. SAChain,
  477. Filter.SAChainSize * sizeof(LIST_ENTRY),
  478. &result )) {
  479. dprintf("%08lx: Could not read SAChain context\n", pFilter + FIELD_OFFSET(FILTER, SAChain[0]));
  480. return;
  481. }
  482. DumpFilter(pFilter, Filter);
  483. for (SAIndex = 0; SAIndex < Filter.SAChainSize; SAIndex++) {
  484. pEntry1 = SAChain[SAIndex].Flink;
  485. while (pEntry1 != (PLIST_ENTRY)((PUCHAR)pFilter + FIELD_OFFSET(FILTER, SAChain[SAIndex]))) {
  486. pSA = CONTAINING_RECORD(pEntry1,
  487. SA_TABLE_ENTRY,
  488. sa_FilterLinkage);
  489. if ( !ReadMemory( (ULONG)pSA,
  490. &SA,
  491. sizeof(SA),
  492. &result )) {
  493. dprintf("%08lx: Could not read SA context\n", pSA);
  494. return;
  495. }
  496. DumpSA(pSA, SA);
  497. pEntry1 = SA.sa_FilterLinkage.Flink;
  498. }
  499. }
  500. pEntry = Filter.MaskedLinkage.Flink;
  501. }
  502. }
  503. return;
  504. }
  505. VOID
  506. Itsas(DWORD opts, LPSTR args)
  507. {
  508. ULONG deviceToDump = 0;
  509. ULONG result;
  510. UCHAR cmdline[MAX_PATH]="0";
  511. UCHAR arg[MAX_PATH]="0";
  512. ULONG pDevice=0;
  513. IPSEC_GLOBAL g_ipsec;
  514. PFILTER pFilter;
  515. FILTER Filter;
  516. PLIST_ENTRY pEntry;
  517. PLIST_ENTRY pEntry1;
  518. PSA_TABLE_ENTRY pSA;
  519. SA_TABLE_ENTRY SA;
  520. SA_TABLE_ENTRY NextSA;
  521. LONG Index, SAIndex;
  522. LIST_ENTRY SAChain[256 * sizeof(LIST_ENTRY)];
  523. pDevice = GetExpression( "ipsec!g_ipsec" );
  524. if ( !pDevice ) {
  525. dprintf("Could not get g_ipsec, Try !reload\n");
  526. return;
  527. } else {
  528. if ( !ReadMemory( pDevice,
  529. &g_ipsec,
  530. sizeof(IPSEC_GLOBAL),
  531. &result )) {
  532. dprintf("%08lx: Could not read device context\n", pDevice);
  533. return;
  534. }
  535. }
  536. for (Index = MIN_TUNNEL_FILTER; Index <= MAX_TUNNEL_FILTER; Index++) {
  537. pEntry = g_ipsec.FilterList[Index].Flink;
  538. while (pEntry != (PLIST_ENTRY)(pDevice + FIELD_OFFSET(IPSEC_GLOBAL, FilterList[Index]))) {
  539. pFilter = CONTAINING_RECORD(pEntry,
  540. FILTER,
  541. MaskedLinkage);
  542. if ( !ReadMemory( (ULONG)pFilter,
  543. &Filter,
  544. sizeof(Filter),
  545. &result )) {
  546. dprintf("%08lx: Could not read filter context\n", pFilter);
  547. return;
  548. }
  549. if ( !ReadMemory( (ULONG)pFilter + FIELD_OFFSET(FILTER, SAChain[0]),
  550. SAChain,
  551. Filter.SAChainSize * sizeof(LIST_ENTRY),
  552. &result )) {
  553. dprintf("%08lx: Could not read SAChain context\n", pFilter + FIELD_OFFSET(FILTER, SAChain[0]));
  554. return;
  555. }
  556. DumpFilter(pFilter, Filter);
  557. for (SAIndex = 0; SAIndex < Filter.SAChainSize; SAIndex++) {
  558. pEntry1 = SAChain[SAIndex].Flink;
  559. while (pEntry1 != (PLIST_ENTRY)((PUCHAR)pFilter + FIELD_OFFSET(FILTER, SAChain[SAIndex]))) {
  560. pSA = CONTAINING_RECORD(pEntry1,
  561. SA_TABLE_ENTRY,
  562. sa_FilterLinkage);
  563. if ( !ReadMemory( (ULONG)pSA,
  564. &SA,
  565. sizeof(SA),
  566. &result )) {
  567. dprintf("%08lx: Could not read SA context\n", pSA);
  568. return;
  569. }
  570. DumpSA(pSA, SA);
  571. pEntry1 = SA.sa_FilterLinkage.Flink;
  572. }
  573. }
  574. pEntry = Filter.MaskedLinkage.Flink;
  575. }
  576. }
  577. return;
  578. }
  579. VOID
  580. Ilarvalsas(DWORD opts, LPSTR args)
  581. {
  582. ULONG deviceToDump = 0;
  583. ULONG result;
  584. UCHAR cmdline[MAX_PATH]="0";
  585. UCHAR arg[MAX_PATH]="0";
  586. ULONG pDevice=0;
  587. IPSEC_GLOBAL g_ipsec;
  588. PFILTER pFilter;
  589. FILTER Filter;
  590. PLIST_ENTRY pEntry;
  591. PLIST_ENTRY pEntry1;
  592. PSA_TABLE_ENTRY pSA;
  593. SA_TABLE_ENTRY SA;
  594. SA_TABLE_ENTRY NextSA;
  595. pDevice = GetExpression( "ipsec!g_ipsec" );
  596. if ( !pDevice ) {
  597. dprintf("Could not get g_ipsec, Try !reload\n");
  598. return;
  599. } else {
  600. if ( !ReadMemory( pDevice,
  601. &g_ipsec,
  602. sizeof(IPSEC_GLOBAL),
  603. &result )) {
  604. dprintf("%08lx: Could not read device context\n", pDevice);
  605. return;
  606. }
  607. }
  608. pEntry = g_ipsec.LarvalSAList.Flink;
  609. while (pEntry != (PLIST_ENTRY)(pDevice + FIELD_OFFSET(IPSEC_GLOBAL, LarvalSAList))) {
  610. pSA = CONTAINING_RECORD(pEntry,
  611. SA_TABLE_ENTRY,
  612. sa_LarvalLinkage);
  613. if ( !ReadMemory( (ULONG)pSA,
  614. &SA,
  615. sizeof(SA),
  616. &result )) {
  617. dprintf("%08lx: Could not read device context\n", pDevice);
  618. return;
  619. }
  620. DumpSA(pSA, SA);
  621. pEntry = SA.sa_LarvalLinkage.Flink;
  622. }
  623. return;
  624. }