Leaked source code of windows server 2003
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.

985 lines
40 KiB

  1. 3/24/1998 JosephJ Sample stack:
  2. ut
  3. ChildEBP RetAddr Args to Child
  4. f2caf9a0 802acd69 40010010 00000000 00000000 NDIS!NdisCmMakeCallComplete+0xf
  5. f2caf9cc f28f557c 80764828 807648c8 00000000 NDIS!NdisClMakeCall+0x9f
  6. f2cafa10 f28f746f 80583c88 805fdd68 80583f90 atmarpc!AtmArpMakeCall+0x156
  7. f2cafa34 f28f7693 805fdd74 8076b020 80583c88 atmarpc!AtmArpMcSendToMARS+0x67
  8. f2cafa54 f28f4578 8076a9c4 f2cafa78 00000103 atmarpc!AtmArpMcSendRequest+0xe5
  9. f2cafa7c f28f3ef5 8055e500 8055e568 80583c88 atmarpc!AtmArpResolveIpEntry+0x9e
  10. f2cafa8c f28f2200 8055e568 805f2028 00000000 atmarpc!AtmArpQueuePacketOnIPEntry+0x3d
  11. f2cafabc f28f1f79 8055e57c 805f2028 020000e0 atmarpc!AtmArpIfTransmit+0x25e
  12. f2cafad8 f804561a 80583c88 f2cafb10 00000001 atmarpc!AtmArpIfMultiTransmit+0x2b
  13. f2cafb00 f8030a42 80564ca8 020000e0 805f2028 tcpip!SendIPPacket+0x126
  14. f2cafb8c f804d2da 80564ca8 00000005 8055e908 tcpip!IPTransmit+0x12ad
  15. f2cafbe4 f8037e45 00000016 8055e908 020000e0 tcpip!SendIGMPReport+0xd2
  16. f2cafc38 f8038c06 805fbb00 020000e0 00000000 tcpip!IGMPAddrChange+0x24f
  17. f2cafc4c f80449dd 805fbb48 80583d90 80583c88 tcpip!InitIGMPForNTE+0x3a
  18. f2cafcc0 f28f51e4 00000001 00000000 8072d490 tcpip!IPAddInterface+0x3d7
  19. f2cafd74 802a4647 80584608 00000000 00000000 atmarpc!AtmArpCoAfRegisterNotifyHandler+0x18e
  20. f2cafd98 80298d0f 805b5800 00000000 f2cafddc NDIS!ndisNotifyAfRegistration+0x55
  21. 3/26/1998 JosephJ
  22. adapter.c: AtmArpPnpEventHandler checks if this is for us (atmarp) or IP.
  23. If it's us, it calls AtmArpPnPReconfigHandler which
  24. currently does nothing. I need to stop and restart the
  25. ip interface.
  26. Q: we specifically look for Reconfig and if not that we
  27. pass it up to IP -- shouldn't we be more discerning? How
  28. do IP reconfigs happen?
  29. callmgr.c AtmArpCoRequestHandler currently handles:
  30. OID_CO_ADDRESS_CHANGE
  31. OID_CO_AF_CLOSE
  32. Calls AtmArpShutdownInterface(pInterface), which
  33. is onlyc alled from here and AtmArpUnbindAdapterHandler.
  34. Q: what events lead to each of the above?
  35. Q: Useful debugger extensions? ndis/atm-specific?
  36. Q: Dumping pInterface and other atmarpc structures?
  37. Q: How to set bps on ALL (or most) AtmArpC entrypoints?
  38. Following is debug spew at aaDebugLevel=0x6, immediately after rt-clicking
  39. on disconnect from the connections entry:
  40. AtmArpC: MakeCall Complete: Status 0xc0000001, VC 0xfe75ace4, pAtmEntry 0xfe6a18
  41. 04
  42. AtmArpC: Closing call on VC 0xfe663e24, VC Flags 0x49, Ref 3, NdisVcHandle 0xfe6
  43. 68aa8
  44. AtmArpC: Abort IP entry 0xfe676364, Flags 0x4000, ATM Entry 0x0, IP Addr 224:0:0
  45. :2
  46. AtmArpC: Abort IP entry 0xfe746164, Flags 0x4000, ATM Entry 0x0, IP Addr 255:255
  47. :255:255
  48. AtmArpC: SendIPDelInterface: IF 0xfe6a1c64, IPContext 0xfe6a2868
  49. AtmArpC: IfDelAddress: Ctxt 0xfe6a1c64, Type 0x1, IPAddr 0x20000e0, Mask 0x0, Re
  50. t 1
  51. AtmArpC: IfDelAddress: Ctxt 0xfe6a1c64, Type 0x1, IPAddr 0x10000e0, Mask 0x0, Re
  52. t 1
  53. AtmArpC: IfGetEList: pIf 0xfe6a1c64, pList 0xfe6d4000, Cnt 11
  54. AtmArpC: IfGetEList: returning 1, MyAT 3, MyIF 4, pList 0xfe6d4058, Size 11
  55. AtmArpC: IfDelAddress: Ctxt 0xfe6a1c64, Type 0x0, IPAddr 0x284aa8c0, Mask 0x0, R
  56. et 1
  57. AtmArpC: IfClose: will deallocate pIf 0xfe6a1c64, RefCount 1
  58. AtmArpC: Deallocate Interface 0xfe6a1c64
  59. AtmArpC: PnPEventHandler: pIF 0x0, pEvent 0xf7c90b58, Status 0x0
  60. AtmArpC: UnbindAdapterHandler: pAdapter 0xfe6d1384, UnbindContext 0xf7c90b0c
  61. AtmArpC: CompleteUnbindAdapter: pAdapter 0xfe6d1384, UnbindContext 0xf7c90b0c
  62. 3/27/1998 JosephJ
  63. The ndispnpapi pnp irp eventually goes down to ndisPnPNotifyBinding()
  64. in ndis\ndis\ndispnp.c.
  65. Reconfig can complete asynchronously....
  66. Currently, TCPIP calls AtmArpPnpComplete, which calls ndisCompletePnPEvent.
  67. 4/3/1998 JosephJ
  68. To do the reconfig, I need to...
  69. 1. Identify the adapter and interface.
  70. 2. Save state, including async completion handle for the reconfig request.
  71. 2. Bring down that specific interface.
  72. 3. When interface is down (callback from ip), queue worker item
  73. 4.
  74. Vi settings to use:
  75. EXINIT=set ai sm showmode ts=4 hardtabs sw=4
  76. 4/21/1998 JosephJ
  77. Implementing GetCfInfoName handler. Other place which this is implemented:
  78. ndis\trfccntl\psched3\psched.
  79. Need to return a systemwide unique unicode string
  80. * (confirm with ofer).
  81. atmarpc needs to allocate this and keep it alive for the duration of
  82. the flowinfo object. Simplest solution is to allocate it on creation
  83. of the flow (in the AtmArpGpcAddCfInfoNotify function).
  84. Since it needs to be unique, we'll base it on the WMI interface name
  85. and keep a per-interface "flow index" which we'll tack on to the name.
  86. * Check with Ofer if this is ok.
  87. TODO: change to new address reporting format:
  88. NETWOR_ADDRESS: AttressType needs to be filled in to
  89. NDIS_PROTOCOL_ID_TCPIP
  90. NETWORK_ADDDRESS_LIST: the Address array needs to be filled with
  91. type NETWORK_ADDRESS_IP, not the dword-sized IP_ADDRESS.
  92. Fuction: AtmArpWmiGetAddressList
  93. 4/22/1998 JosephJ
  94. Removed the commented-out precomp-header lines from sources. Build was not
  95. handling these commented-out lines correctly, causing it to recompile all
  96. all files each time because it didn't find the precompiled headers!
  97. 5/8/ 1998 JosephJ
  98. Diagnostic statistics to add....
  99. Per interface IP statistics:
  100. arp:
  101. -
  102. send:
  103. - time of last send request
  104. - status of last send request
  105. - 1st 32 bytes of last send packet
  106. - number of pkts sent successfully
  107. - number of pkts sent unsuccessfully
  108. recv:
  109. - time of last recv request
  110. - status of last recv request
  111. - 1st 32 bytes of last recv packet
  112. - number of pkts recvd successfully
  113. - number of pkts recvd unsuccessfully
  114. 5/11/1998 JosephJ
  115. Places which mess with pInterface->pAtmArpList:
  116. adapter.c: AtmArpShutdownInterface
  117. arpproc.c: AtmArpSearchForAtmentry -- looks for an atmentry and optionally
  118. creates one if it doesn't match
  119. marspkt.c: AtmArpMcHandleMulti -- adds an atm entry.
  120. utils.c: AtmArpDereferenceAtmEntry -- unlink an atmentry.
  121. utils.c: AtmArpDeallocateInterface -- deallocating pInterface (goes
  122. through and MEM_FREEs all atmarp entries.)
  123. Interface shutdown operation:
  124. 1st thing to do is to claim interface lock and set "shutting down bit" for
  125. each list.
  126. 2nd: Do not allow list items to be added once this shutting-down bit
  127. is set.
  128. 3rd: list is NEVER unlocked with entries having ref-count zero.
  129. 4th: If entry is unlocked and in list and list, it is always
  130. in a consistant state -- even just before deallocating.
  131. 4th: If the entry is DOWN, don't do anything constructive with them.
  132. 5/12/1998 JosephJ
  133. pInterface->pJoinList; is not protected when shutting down.
  134. it is manipulated in ipmcast.c, with the interface lock held, so
  135. it would be a matter of aquiring the interface lock when cleaning
  136. up pJoinList in ShutdownInterface.
  137. pUnresolvedVcs: locked by pInterface, but it is not protected
  138. in AtmArpCallConnectedHandler(...):
  139. pVc->pNextVc = pInterface->pUnresolvedVcs;
  140. pInterface->pUnresolvedVcs = pVc;
  141. (there is a check that pInterface->AdminState is up, but
  142. we never claim the lock on pInterface!).
  143. (However, this applies only for PVCs, so perhaps this is not
  144. such a big deal.)
  145. pAtmEntry->pVcList;
  146. AtmArpHandleInARPReply(...) acquires locks in the following order...
  147. AA_ACQUIRE_IF_LOCK(pInterface);
  148. AA_ACQUIRE_IE_LOCK_DPC(pIpEntry);
  149. AA_ACQUIRE_AE_LOCK_DPC(pAtmEntry);
  150. AA_ACQUIRE_VC_LOCK_DPC(pVc);
  151. 5/12/1998 JosephJ
  152. ndis\uni\admin -- console app "atmadm"
  153. atmarps -- look at the M3 IOCTLS. Name of device to open is in ioctl.h.
  154. 5/15/1998 JosephJ More robustness-improving changes...
  155. typedef
  156. void (*PFNVALIDATE)(void *pObj);
  157. typedef struct
  158. {
  159. PFNVALIDATE pfnValidate;
  160. ULONG uFlags;
  161. // Lock
  162. // RefCount
  163. } ATMARP_HEADER;
  164. #define ATMARP_VALIDATE(_pObj) (_pObj)->Hdr.pfnValidate((PVOID)_pObj);
  165. 5/16/1998 JosephJ
  166. Information on Timers
  167. 5/21/1998 JosephJ suggested form of validation routines
  168. ValidateX(ExpectedState)
  169. {
  170. // General validation
  171. switch(ExpectedState)
  172. {
  173. case Loading:
  174. case Active:
  175. case Deallocating:
  176. // check that various timer are not pending
  177. // check that "in-parent-list" bit is clear
  178. }
  179. }
  180. Structures to validate:
  181. Following structures have timers/refcounts/locks
  182. ATMARP_ATM_ENTRY: RefCount Lock
  183. ATMARP_IPMC_ATM_ENTRY: Timer
  184. ATMARP_IPMC_JOIN_ENTRY: Timer RefCount
  185. ATMARP_IP_ENTRY: Timer RefCount Lock
  186. ATMARP_VC: Timer RefCount Lock
  187. ATMARP_INTERFACE: Timer RefCount InterfaceLock
  188. McTimer ArpTableLock
  189. AtmEntryListLock
  190. TimerLock
  191. WmiLock
  192. We can assert that contained timers are not active on deallocation of
  193. a structure.
  194. Following table lists the logical "parent" of each structure
  195. ATMARP_ATM_ENTRY: In INTERFACE:AtmEntryList
  196. flag:AA_ATM_ENTRY_ACTIVE
  197. ATMARP_IPMC_ATM_ENTRY: In AtmArpEntry
  198. flag:AA_IPMC_AE_VALID use this?
  199. ATMARP_IPMC_ATM_INFO:
  200. flag: AA_IPMC_AI_LOAD_ALIVE
  201. ATMARP_IPMC_JOIN_ENTRY: In AtmArpEntry flag:
  202. ATMARP_IP_ENTRY: In ArpTable
  203. flags: AA_IP_ENTRY_IDLE
  204. ATMARP_VC: In AtmEntry
  205. flags: AA_VC_OWNER
  206. ATMARP_INTERFACE: In Adapter.
  207. flags: AA_IF_, AAMC_IF_
  208. We can maintain a "keep alive" bit which is set once the item is in the
  209. the parent and cleared when it is removed from the
  210. parent. We will assert that the "keep alive" bit is clear when deallocating
  211. the structure.
  212. LOAD_STATE
  213. LS_LOADING -- don't use yet
  214. LS_LOADED -- ok to use
  215. LS_UNLOADING -- don't start any new activity
  216. LS_UNLOADED -- ok to delete.
  217. 5/28/1998 JosephJ
  218. Holes dealing with the McEntryList:
  219. In AtmArpMcPrepareAtmEntryForClose
  220. //
  221. // First, prune all members that aren't connected.
  222. //
  223. for (pMcAtmEntry = pAtmEntry->pMcAtmInfo->pMcAtmEntryList;
  224. pMcAtmEntry != NULL_PATMARP_IPMC_ATM_ENTRY;
  225. pMcAtmEntry = pNextMcAtmEntry)
  226. {
  227. pNextMcAtmEntry = pMcAtmEntry->pNextMcAtmEntry;
  228. //
  229. // Stop any timer running here.
  230. //
  231. (VOID)AtmArpStopTimer(&(pMcAtmEntry->Timer), pInterface);
  232. if (AA_IS_FLAG_SET(pMcAtmEntry->Flags,
  233. AA_IPMC_AE_CONN_STATE_MASK,
  234. AA_IPMC_AE_CONN_DISCONNECTED))
  235. {
  236. AtmArpMcUnlinkAtmMember(
  237. pAtmEntry,
  238. pMcAtmEntry
  239. );
  240. //
  241. // AE Lock is released within the above.
  242. //
  243. AA_ACQUIRE_AE_LOCK(pAtmEntry);
  244. }
  245. }
  246. 6/1/1998 JosephJ
  247. Fixed above problem: AtmArpMcUnlinkAtmMember now doesn't release the lock.
  248. 6/1/1998 JosephJ
  249. Other changes for today's checkin:
  250. * Added extra asserts that timer is not active when the containing
  251. structure is freed (look for TIMER_IS_ACTIVE)
  252. * Added ULONG Filler to AAD_ALLOCATION so that allocated structures
  253. retain 8-byte allignment -- not having this allighment was causing
  254. the checked alpha build to fault when executing the following:
  255. AA_PUSH_TO_SLIST(
  256. &(pInterface->HeaderPool[HdrType].HeaderBufList),
  257. STRUCT_OF(AA_SINGLE_LIST_ENTRY, &(pNdisBuffer->Next), Next),
  258. &(pInterface->BufferLock.SpinLock)
  259. );
  260. (&(pInterface->HeaderPool[HdrType].HeaderBufList) needs to
  261. be quadword (8-byte) aligned on the alpha, else it faults).
  262. Note: SLIST_HEADER is a union which includes "LONGLONG", so
  263. it WILL be quadword aligned provided it's hierarchy of parent
  264. structures is aligned, no matter where this occurs within the
  265. parent structures. Also added use of AA_INIT_SLIST to initialize
  266. BufferPool slists.
  267. * Fixed misuse of certain bits of the IPEntry.Flags which were resulting
  268. in Flags getting into an incorrect state. ("|=" was used instead
  269. of AA_SET_FLAG when setting AA_IP_ENTRY_ARPING and
  270. AA_IP_ENTRY_INARPING).
  271. * Make sure timer is stopped when unlinking a McAtmEntry.
  272. * Protected adding AtmEntry by locking the interface list lock
  273. in AtmArpMcHandleMulti. This also required some re-ordering
  274. of reference counting.
  275. 6/9/1998 JosephJ
  276. Note: intrinsic functions (/Oi) must be enabled in order for this
  277. to compile under the win98 environment (otherwise it can't find
  278. the prototoypes for functions like memcmp()).
  279. 6/9/1998 JosephJ
  280. Support adding a canned set of arp entries -- this is a request as well
  281. as useful for isolating problems with the arp server.
  282. typedef struct
  283. {
  284. ULONG Sig;
  285. ULONG Flags; // reserved.
  286. ATMADDRESS; // binary format.
  287. IPADDRESS; // network format.
  288. }
  289. ARPENTRYDATA;
  290. 6/30/1998 JosephJ
  291. On ArvindM's advice: Changed AtmArpCompleteUnbindAdapter() so that it
  292. doesn't block waiting for NdisCloseAdapter to complete if it returns
  293. pending -- instead we return immediately and do the actual cleanup
  294. in the AtmArpCloseAdapterCompleteHandler. This also eliminated a specific
  295. bug where were were faulting because we weren't blocking when we should.
  296. arpproc.c AtmArpAbortIPEntry: *ppNextIpEntry = pIpEntry->pNextToAtm;
  297. this is done while holding the ATM_ENTRY's lock, but
  298. in AtmArpInvalidateAtmEntry, we count the number of ip entries
  299. in the atm_entry's list, and use this count, all without holding
  300. the atm_entry's lock.
  301. Also in AtmArpMcHandleMulti, marspkt.c, line 793 -- the list is added to...
  302. we should fail the earlier SearchFor...
  303. Also in AtmArpUnlinkIpEntryFromAtmEntry (utils.c), but no one seems to
  304. call it.
  305. 7/8/1998 JosephJ
  306. This concerns bug 191188(Intermittent loss of connections during
  307. multicast IP and Ws stress).
  308. There are three issues so far:
  309. 1. Sometimes, an AtmEntry gets in the CLOSING state, but it never goes
  310. away. I still haven't figured why it doesn't go away, but the
  311. workaround (checked in today) is for AtmArpSearchForAtmEntry to
  312. clear the state from CLOSING if the entry is basically idle (no
  313. IP entries, multicast entries and vc attached to it).
  314. 2. The mars server was sending us too-short packets. This is fixed
  315. in the mars server (setting the ValidCounts field of the packet
  316. in the mars server to FALSE). I also made a change to our
  317. incoming packet handler to actually check packet length.
  318. 3. The multicast ip entries don't seem to ever get deleted -- I saw
  319. over 500 entries after an hour or so of anilth's multicast stress.
  320. This is still unresolved (bug#194613).
  321. Note: on startup, the initial attempt to connect to the arp/mars server
  322. often fails (when it's on the same machine as the client -- it's probably
  323. an order-of load problem). Anyway, as a consequence of the call failing,
  324. AtmArpInvalidateAtmEntry is called, which sets the AtmArpEntry state
  325. to CLOSING -- it stays in that state for as long is the entry is alive.
  326. However with the workaround #1 above, the CLOSING state is now cleared on
  327. the first call to AtmArpSearchForAtmEntry after the initial vc is
  328. cleared up.
  329. 7/8/1998 JosephJ
  330. AbortIpAddress -- investigate impact of abort when using MCS
  331. 7/8/1998 JosephJ
  332. One way to get the debugger to dump the calling function's name without
  333. stopping:
  334. db atmarpc!AtmArpSearchForAtmAddress "ln poi(esp); g"
  335. 0xFF8A6448
  336. 0xFF8A6448
  337. 0: kd> !aac ip[1]
  338. [1] ATMARP_IP_ENTRY@0xFF9BBEE8 (104 Bytes)
  339. aip_sig [0,4]: 0x41414950
  340. IPAddress [4,4]: 0x56feffeb
  341. pNextEntry [8,4]: 0x0
  342. pNextToAtm [c,4]: 0xff98a108
  343. Flags [10,4]: 0x6004 RESOLVED MC_NO_REVALIDATION MC_RESOLVED NUCAST
  344. RefCount [14,4]: 0x2
  345. pInterface [20,4]: 0xffa20028
  346. pAtmEntry [24,4]: 0xffa1d868
  347. pNextMcEntry [28,4]: 0x0
  348. NextMultiSeq [2c,2]: 0x1
  349. Timer [30,20]
  350. ff9bbf18: 00000000 00000000 00000000 00000000 |....|....|....|....|
  351. ff9bbf28: 00000003 00000000 f95dc48a ff9bbee8 |....|....|..].|....|
  352. RetriesLeft [50,4]: 0x3
  353. PacketList [54,4]: 0x0
  354. pRCEList [58,4]: 0x0
  355. Refs [60,5]
  356. ff9bbf48: 01000000 ffffff01 ffffffff ffffffff |....|. | | |
  357. 7/14/1998 JosephJ
  358. Looking at a an assert failure during reconfig -- the assert is
  359. in AtmArpCallCompleteHandler (assert(rc==0):
  360. else
  361. {
  362. //
  363. // The Interface is going down: clean up everything first.
  364. //
  365. ...
  366. else
  367. {
  368. // MakeCall had failed. (And the IF is going down)
  369. rc = AtmArpDereferenceVc(pVc); // Create Vc ref
  370. AA_ASSERT(rc == 0); // The VC should have been deallocated
  371. ^^^^^^^^^^^^^^^^^^ above asser failed.
  372. ...
  373. NOTE: AtmArpCloseCallMgr munges the pInterface but without holding
  374. its lock (it's called either on a failed init or on
  375. AtmArpShutdownInterface).
  376. NOTE: in AtmArpMakeCallCompleteHandler(), we look at the
  377. pInterface->AdminState without claiming its lock:
  378. if (pInterface->AdminState == IF_STATUS_UP)...
  379. NOTE: Since NdisCoDeleteVc is called only when rc==0 (in the context
  380. of AtmArpDereferenceVc), if the ref count doesn't go to zero, NdisCoDeleteVc
  381. will never be called. This means that the CloseCallMgr completion
  382. handler will never get called, which means that we'll never complete
  383. the reconfig request! So this explains why after hitting "g" after the
  384. assert, ndis complained that I never completed the reconfig request.
  385. So now I've got to track down why the ref count is still one. One thing
  386. in our favor is that this is a freshly created call -- it was make call
  387. that failed asynchronously.
  388. Some things to note:
  389. The only atm_entry has no vc links, and the vc has no atm_entry link.
  390. The interface is closing and it's af-handle is null, indicating that
  391. NdisClCloseAf has been called (as one would expect).
  392. The vc flags are: outgoing, svc, closing.
  393. rc = AtmArpDereferenceVc(pVc);
  394. // Create Vc ref -- derefed when calling NdisCoDeleteVc
  395. // Call ref -- derefed in closecall complete handler
  396. // Atm ref. -- derefed when unlinking linkage with atmentry.
  397. So in this particular case, the bug was that in the above code
  398. in AtmArpCallCompleteHandler we need an extra dereference (for
  399. call ref) just above the assert. So I added the following lines just
  400. before the assert:
  401. //
  402. // Delete the Call reference
  403. //
  404. rc = AtmArpDereferenceVc(pVc);
  405. AA_ASSERT(rc > 0);
  406. Case closed. (Code checked in 7/17/1998, callmgr.c).
  407. 7/14/1198 JosephJ
  408. QoS folks hit a bugcheck when sending on an unspecified flow.
  409. (198733 bugcheck in atmarpc!AtmArpDereferenceAtmEntry with best-effort
  410. flow installed).
  411. 7/17/1998 JosephJ
  412. Above bugcheck was due to a hole in AtmArpLearnIPToAtm -- it would
  413. not have a ref on the atmentry when it sent packets on the entry at the
  414. end of the function. Fixed this by adding a temp ref. Also changed
  415. some AA_ACQUIRE/RELEASE_IE/AE_LOCK_DPC in this function to the non-DPC
  416. versions (they should have been the non-DPC versions all along).
  417. 7/17/1998 JosephJ
  418. Another bugcheck hit during alpha mcast stress --
  419. The bugcheck in the tick handler happened because of a bogus timer entry.
  420. The timer entry itself was part of a freed structure that was formerly owned
  421. by arpc, and was clearly a previously freed ATMARP_IPMC_JOIN_ENTRY (also,
  422. the other, timers at that particular location in the timer list were all valid
  423. join entries).
  424. So the question is why was this join entry prematurely freed?
  425. Looking at the code, I see one place where there is a race condition.
  426. The entire join entry list is in general protected by the interface lock.
  427. However, in AtmArpMcSendPendingJoins, the lock is released briefly while
  428. processing the list -- this is not good and could definitely cause things
  429. like starting a timer on a just-released (by some other thread) join entry.
  430. I couldn't find any more race conditions or other problems on the join list--
  431. everywhere else the IF lock is held the whole time, plus the ref counting
  432. seems to be good everywhere as far as I can see.
  433. The workaround, in AtmArpMcSendPendingJoins, is to go through the list of
  434. joins with the interface lock held once, counting the number of joins that
  435. need to be sent. I then allocate space to hold all the ipaddresses and masks
  436. and then go through a 2nd time (still holding the interface lock), picking
  437. up the ip addresses and masks. I then send each of these ip addresses
  438. (the if lock gets released per send, but that's ok).
  439. This is checked in today.
  440. 8/31/1998 JosephJ Promiscuous mode multicast
  441. We treat promiscuous mode multicast as a special case:
  442. On enabling, we send a "JOIN-all" request.
  443. On disabling, we send a "LEAVE-all".
  444. Note, tcpip keeps a ref count of apps which request a particular type of
  445. filter, so if multiple apps request the same type, it sends down multiple
  446. calls to enable it, but only ONE call to disable it -- when the last app that
  447. requested it disables it. It does send each type independantly -- i.e., even
  448. if promiscuous mode is already requested, it will send down a ALL_MULTICAST
  449. if an app subsequently asks for that.
  450. Summary of changes made:
  451. arpif.c,util.c: new entrypoint AtmArpIfSetNdisRequest -- it calls
  452. AtmArpMcAdd/DelAddress, specifying the entire address range.
  453. ipmcast.c, marspkt.c: now deal with non-zero mask values in JOIN_ENTRY -- when
  454. searching for a particular join entry, checks both IP address
  455. and mask (so group 224.0.0.0 can coexist with the join
  456. entry representing the entire class-d address space -- both have
  457. IP address value of 224.0.0.0).
  458. AtmArpMcHandleJoinOrLeaveCompletion -- has extra parameter: Mask.
  459. atmarp.h: ATMARP_INTERFACE has a new DWORD: EnabledIPFilters -- used
  460. to track whether promiscuous mode is enabled or not -- required
  461. because we may get multiple enable requests but only one
  462. disable request.
  463. sources: cdefine PROMIS added, enabling promiscuous mode code.
  464. Test Using \\anilth_1\allpkts\obj\i386\allpkts.....
  465. Winsock(1)== all pkts == OID(0x20==NDIS_PACKET_TYPE_PROMISCUOUS)
  466. Winsock(2)== all mcast pkts == OID(0x04==NDIS_PACKET_TYPE_ALL_MULTICAST)
  467. Winsock(3)== all igmp pkts == OID(0x04==NDIS_PACKET_TYPE_ALL_MULTICAST)
  468. We specifically look for OID NDIS_TYPE_ALL_MULTICAST and fail for
  469. others.
  470. Test cases: start allpkts.exe before/after someone has started sending
  471. to a particular mcast exe. Boundary cases: have allpkts.exe running on
  472. a machine which is also monitoring 224.0.0.0 and 239.-1.-1.-1.
  473. Various combinations of MCS-served address ranges.
  474. 09/21/1998 JosephJ
  475. Fix for bug# 225578 ATMAPRC Hangs when disabling in UI
  476. Following changes to get rid of a atmarpc not completing shutdown because
  477. there was an active vc that (the vc to the arp/mars server was always
  478. in the closing state even as new calls were made to it).
  479. * AtmArpAtmEntryIsReallyClosing() also check if there are any VCs active
  480. when checking if the entry is truly idle.
  481. * AtmArpSearchForAtmAddress -- fail if interface is down.
  482. * AtmArpMakeCall -- fail if interface is down or if atm entry is REALLY
  483. closing (i.e., AtmArpAtmEntryIsReallyClosing returns TRUE).
  484. 09/23/1998 JosephJ
  485. A couple of anomalies:
  486. 1. When joining a vc-mesh mcast group for which there is already at least one
  487. member and there is a local send already in progress, the local host
  488. does not add itself to the vc mesh -- it gets the JOIN from the mars
  489. server on the cc vc, but simply treates as the JOIN completion. Fix
  490. is to ALSO process these "self-JOINS" which come on the ccvc to see
  491. if they must be added to current P2MP vc-mesh connections.
  492. [Fixed on 9/25/1998 checkin]
  493. 2. If a make-call fails with a non-NULL flow, the link between flow and vc
  494. is not deleted when the call is cleaned up -- leaving the flow referencing
  495. a dangling vc (only ref to the vc is the flow). This means that all
  496. subsequent vc's created for that flow will not be linked to the flow and
  497. so all send packets will need to explicitly look for vc's based on
  498. flow characteristics. Fix is to delete the flow-vc association if it
  499. exists when handling a failed makecallcomplete.
  500. [Fixed on 9/25/1998 checkin]
  501. NOTE: FlowsInfo's are not protected by a crit sect, so race conditions
  502. are possible, for example:
  503. (a) flow is removed (AtmArpGpcRemoveCfInfoNotify) at the same time that the
  504. vc is closing (AtmArpCloseCall) -- both could try to un-link the
  505. vc and flow at the same time. It doesn't help that both claim the vc
  506. lock. Potential fixes: (a) add lock to flows or (b) use
  507. Interlocked[Compare]ExchangePointer when modifying FlowInfo->pVc.
  508. [Fixed on 9/25/1998 checkin, using the Inerlocked functions approach]
  509. 09/23/1998 JosephJ
  510. Static validation of flows (when they are installed). BUG#156534
  511. Here are the relevant structures...
  512. typedef struct _TC_GEN_FLOW {
  513. FLOWSPEC SendingFlowspec;
  514. FLOWSPEC ReceivingFlowspec;
  515. ULONG TcObjectsLength; // number of optional bytes
  516. QOS_OBJECT_HDR TcObjects[1];
  517. } TC_GEN_FLOW, *PTC_GEN_FLOW;
  518. typedef struct _flowspec
  519. {
  520. ULONG TokenRate; /* In Bytes/sec */
  521. ULONG TokenBucketSize; /* In Bytes */
  522. ULONG PeakBandwidth; /* In Bytes/sec */
  523. ULONG Latency; /* In microseconds */
  524. ULONG DelayVariation; /* In microseconds */
  525. SERVICETYPE ServiceType;
  526. ULONG MaxSduSize; /* In Bytes */
  527. ULONG MinimumPolicedSize; /* In Bytes */
  528. } FLOWSPEC, *PFLOWSPEC, * LPFLOWSPEC;
  529. Here is the validation plan (added to AtmArpGpcValidateCfInfo()) for the
  530. fields of FLOWSPEC:
  531. Ignored fields:
  532. Latency
  533. DelayVariation
  534. Default handling
  535. MinimumPolicedSize: ignored
  536. TokenRate: BE:line-rate; GS:invalid CLS: invalid
  537. TokenBucketSize: MTU
  538. PeakBandwidth: line-rate
  539. ServiceType:BE
  540. MaxSduSize: MTU
  541. Valid ranges
  542. MinimumPolicedSize <= MTU
  543. 0<TokenRate <= LineRate
  544. 0<TokenBucketSize <=MTU
  545. 0<TokenRate <= PeakBandwidth
  546. ServiceType: valid type
  547. 0<MaxSduSize <= MTU
  548. MaxSduSize<TokenBucketSize
  549. [Fixed in 9/25/98 checkin]
  550. 9/25/1998
  551. Ageing of IP entries -- once resolved (via ARP reply typically) the IP
  552. entries' ageing timeout is started.
  553. RCE entries -- IP calls AtmArpIfInvalidate in which case we unlink the RCE
  554. and IP, potentially deleting the ip if the refcount goes to zero.
  555. What about the ageing timer for multicast entries?
  556. pIPEntry->pAtmEntry set to NULL in:
  557. AtmArpInvalidateEntry, which is called by ShutdownInterface, AbortIP,
  558. AtmArpIncomingCloseHandler, AtmArpMakeCallCompleteHandler,
  559. AtmArpCloseCallCompleteHandler (only if p2mp call).
  560. Set to non-null in McHandleMullti
  561. MarsHandleMulti marspkt.c line 1034: pAtmNumber = (PUCHAR)pAtmNumber + AtmNumberLength;
  562. NOTE: Should be AtmNumberLength+AtmSubaddressLength when we decide to support subaddresses.
  563. 9/28/1998 JosephJ
  564. arpif.c -- For WIN98 only, munged the 1st 2 bytes of the MAC reported up to
  565. IP to be be 0x0a and 0xac -- this is so that it will be different from the
  566. MAC reported by lane. This needs to be done only for win98 because on win98
  567. ip/atm's mac size is 6 (same as LANE's) while on NT it is 7. [9/29 checkin]
  568. 9/28/1998 JosephJ
  569. Fixed bug in AtmArpSearchForIPAddress -- when creating a new
  570. MCAST entry, it was not chaining itself to the interface's list of
  571. multicast entries -- instead it was just setting itself to be the first and
  572. only element of this list! [9/29 checkin]
  573. To clean up stale IPMCAST entries (bug#194613), added new function
  574. AtmArpCleanupArpTable (called from AtmArpServerRefreshTimeout). This
  575. function goes through the entries in pInterface->pMcSendList, calling
  576. AtmArpAbortIPAddress on those entries which have no associated atm address.
  577. (Note, this also required the fix to the bug in the above paragraph).
  578. [9/29 checkin]
  579. To clean up stale IPMCAST entries (bug#194613), added new function
  580. AtmArpCleanupArpTable (called from AtmArpServerRefreshTimeout). This
  581. function goes through the entries in pInterface->pMcSendList, calling
  582. AtmArpAbortIPAddress on those entries which have no associated atm address.
  583. (Note, this also required the fix to the bug in the above paragraph).
  584. [9/29 checkin]
  585. Fixed AtmArpMcHandleMARSFailure so that it doesn't restart timer when the
  586. interface is not up -- this was causing the interface to never go away because
  587. the refcount was 1 (for the timer) but the timer was never fired because the
  588. interface was down. [9/29 checkin]
  589. 9/29/1998 JosephJ Task Offload.
  590. ip\arp.c ARPRegister sets ai_OffloadFlags, TcpLargeSend
  591. ip\arp.c ARPBindAdapter sets BindInfo.lip_OffloadFlags, lip_MaxOffloadSize and
  592. lip_MaxSegments.
  593. ip\init.c IPAddInterface sets it's IF.if_Offloadflags etc to these.
  594. ip\iproute.c and ipxmit.c use these flags when deciding whether to do xsum
  595. computation or not.
  596. TCP_LARGE_SEND_OFFLOAD is used in tcp\tcpsend.c
  597. IPSEC_OFFLOAD_* only set in ip\ai_OffloadFlags
  598. 10/06/1998 JosephJ QOS interface changes
  599. Look at #if(NEWQOS) code in arpwmi.h
  600. AtmArpWmiSendTCIfIndication -- uses new struct TC_SUPPORTED_INFO_BUFFER.
  601. Took out check for BucketSize > MTU in qos.c, per ericeil.
  602. Added support for task offloading (not enabled) -- #ifdef ATMOFFLOAD --
  603. adapter.c: new functions AtmArpQueryAndEnableOffload and AtmArpDisableOffload
  604. atmarp.h: Adapter struct had new sub-struct "Offload"
  605. Also removed #ifndef NEWARP (obsolete) code from adapter.c, atmarp.h and
  606. utils.c
  607. [All of the above checked in today]
  608. 10/14/1998 JosephJ llipif.h change
  609. From: Amritansh Raghav
  610. Sent: Tuesday, October 13, 1998 2:27 PM
  611. Subject: RE: new llipif.h
  612. (i) Pass the old interface name as the DeviceName and NULL for the IfName
  613. (ii) Pass 0 for Requested Index
  614. (iii) You need to have place holders for the 3 functions, but you dont need
  615. to call those functions ever.
  616. Reasons:
  617. (i) If you multiplex different connections over the same device, s.t. at any
  618. given time only one connection is active, then the ifName allows you to
  619. associate a name different that the device name with the interface. This
  620. is done so that if you have a phonebook entry called Redmond and it is
  621. connected, doing ipconfig shows Redmond and not NdiswanIpOut{Guid}
  622. (ii) This allows wanarp to reserve certain indices so that the ifIndex
  623. doesnt change when the router starts
  624. (iii) The three functions basically change the info above
  625. Changes made in ntentry.c, utils.c and callmgr.c
  626. 10/20/1998 JosephJ
  627. Checked in above change
  628. Other changes in todays checkin:
  629. Added the assert AA_ASSERT(AA_IE_IS_ALIVE(pIpEntry)) pretty much every time
  630. we lock the pIpEntry. This is because in principle it's possible for
  631. the ip entry to be used justafter it's been removed from the the arp table.
  632. arpproc.c:
  633. AtmArpCleanupArpTable -- don't delete entries if they are in the ARPING
  634. state.
  635. AtmArpResolveIpEntry - don't do it if !AA_IE_IS_ALIVE
  636. AtmArpAbortIPEntry - remove packet queue AFTER claiming lock on IpEntry for
  637. the last time (otherwise others could queue packets in between us
  638. taking the packets and freeing the entry.
  639. AtmArpQueuePacketsOnIPEntry - dont do it if !AA_IE_IS_ALIVE
  640. marspkt.c: AtmArpMcHandleMulti -- don't bindly assume that if the pAtmEntry
  641. exists then it is compatible with the received MULTI pkt: i.e.,
  642. MCS served or VC-mesh served. Added code to abort the IP entry if
  643. they are incompatible.
  644. sources: enabled ATMOFFLOAD and IFCHANGE1 (which enables new llipif.h change
  645. referred to in the 10/14/1998 entry).
  646. 10/21/1998 JosephJ
  647. Chun Ye made changes to the IPSEC task offloading -- ip\arpc.c:
  648. 10-19-98@14:42 chunye in arp.c v69 ipsec offload spec. change
  649. So I reflected that in adapter.c,
  650. 11/12/1998 JosephJ
  651. Qos.c -- had an incorrect check of size of pQosInfo in AtmArpGpcValidateCfInfo.
  652. fixed and checked in today -- bug#249110
  653. 11/30/1998 JosephJ
  654. Following is a potential fix for bug#256385.
  655. arppkt.c v15 AtmArpSendInArprequest: release lock on failed exit
  656. (I saw a stress case where the vc lock was not released
  657. so and reviewed the code and found this place, although
  658. it's unlikely that this case was hit during stress).
  659. Following two are fixes for bug#256791
  660. (IDS: MM Break in atmarpc!AtmArpMcUnlinkAtmMember)
  661. callmgr.c v24 AtmArpCloseCall: pVc flags was being set here without
  662. holding the vc lock.
  663. ipmcast.c v11 McUpdateConnection: bail if vc is being closed. We
  664. were hitting a case where we were trying to add a party
  665. using an already-deleted entry, which we
  666. avoid by this check. The use of already-deleted entry was
  667. probably because we run through the list of entries
  668. but release the atm lock in the middle -- fixed that as
  669. well.
  670. 1/14/1999 JosephJ
  671. Added code to fail initialization if adapter does not support atleast 9188.
  672. adapter.c v22 #272355 DO not less than 9188 A
  673. atmarp.h v16 #272355 DO not less than 9188 A
  674. callmgr.c v25 #272355 DO not less than 9188 A
  675. externs.h v23 #272355 DO not less than 9188 A
  676. Added code to enable the ageing timer if the vc can't be associated with
  677. a flow (because some other vc is already associated with the flow). We
  678. made this fix in anticipation of the use of flows that could match multiple
  679. VCs, shuch as a flow that matches "all data sent to UDP port 80."
  680. arpproc.c v16 #272272 QOS: VCs don't age out
  681. I noticed that we were zeroing out the info structure after picking
  682. up the offload capabilities.
  683. utils.c v17 Fix typo in setting task offloa
  684. 2/12/1999 JosephJ
  685. This concerns the fact that we force IP to copy receive packets which
  686. have multiple mdls.
  687. The bugs in question are:
  688. 214430 PERF: atmarpc gives iprecv the wrong paramters for a multi-buffer packet
  689. 169877 ATM:ARPC: Bugcheck in TCPIP checksum, first MDL buffer
  690. We need to put back the 1-line fix in AtmArpCoReceivePacketHandler
  691. to avoid copy (arppkt.v8) which was backed out to "fix" 169877 (arppkt.v9).
  692. However we do this only if the buffer length is at-least 512, so that we don't
  693. report up partial IP and TCPIP headers.
  694. ---------- TDI\TCPIPMERGE\IPATMC\arppkt.c next ----------
  695. 683c683
  696. < BufferLength - sizeof(AA_PKT_LLC_SNAP_HEADER),
  697. ---
  698. > TotalLength - sizeof(AA_PKT_LLC_SNAP_HEADER),
  699. 2/12/1999 Josephj
  700. arppkt.c above fix (#214430)
  701. arpproc.c (1) incorrectly inserting mc ip entries into pMcSendList (#292305)
  702. (2) AtmArpAbortIPEntry was pAtmEntry->pIpEntryList
  703. callmgr.c Remove bogus assert in AtmArpMcTerminateMember
  704. 2/22/1998 JosephJ Inarp: dealing with multiple ip addresses.
  705. arpif.c, AtmArpIfAddAddress: adds to list of addresses.
  706. arppkt.c; AtmArpHandleInARPRequest -- sets src ip address to
  707. be the FIRST ip address: pInterface->LocalIPAddress.IPAddress.
  708. Fix is to cycle through, sending one inarp reply for each IP address.
  709. NOTE: above fix not checked in -- saved in .\save02
  710. 2/25/1998 JosephJ
  711. Unfortunately we have to back out YET AGAIN from the perf fix
  712. (see 2/12/1999 note above) because large pings (eg ping -l 4000) doesn't
  713. work -- bug#297784
  714. See arppkt.c, line 710.
  715. 2/25/1998 JosephJ
  716. When migrating arp/mars server to another machine on the fly, clients
  717. bugchecked during mcast stress, because an mcast address switched from
  718. being VC-mesh to MCS served, and we forget to deref the ipentry
  719. before aborting the address: marspkt.c, look for
  720. "HandleMulti: Type Mismatch!." Fix is to add the deref before
  721. calling AbortIpEntry.
  722. 03/16/1999 JosephJ
  723. arpwmi.c -- timothyw's code examination found some potential
  724. cases (bug 303707), plus potential mem leak (bug 296220).
  725. Trivial fixes.
  726. callmgr.c -- fix for following bugs:
  727. 305905 *ATMARPC: bugcheck running TDI test
  728. (needed to unlock vc if ref count is nonzero, instead of
  729. assuming that the refcount was zero)
  730. 303172 *ATMARPC: doesn't call NdisClCloseCall when the miniport
  731. fails to activate the VC
  732. (if we get an incoming close call while the vc was not yet
  733. connected, we need to act on it -- we "fake" the vc to be
  734. active so that subsequent processing works).
  735. qos.c -- fix for the following:
  736. 301210 *Traffic Control functional test failure on
  737. ATM: expect ERROR_INVALID_PEAK_RATE, got
  738. ERROR_INVALID_TOKEN_RATE
  739. (fix is to change the error returned for this case --
  740. see "3/15/1999 JosephJ: According to EricEil..." comment
  741. in qos.c).
  742. 03/24/1999 JosephJ Fix for #310493
  743. 310493 ATMARPC bugchks on getting bad control packet
  744. A rogue pkt was transmitted on the CCVC, causing all arp clients to bugchk
  745. in AtmArpMcProcessPacket(...). Fix is essentially to change all length
  746. variables in that function from SHORT to ULONG (SHORT vars could get -ve
  747. values, which mess up comparisons and additions).
  748. 04/20/1999 JosephJ Proposed fix for 284644 Only one IP can be associated with
  749. a PVC or group of PVCs
  750. We're going to fix this in a general way by allowing static arp entries.
  751. - On loading, we'll read a set of <atm-address>-to-<ip address> mappings and
  752. populate the arp cache with that. Support is already present in atmarpc.sys
  753. for static arp entries.
  754. - User has to create custom PVCs for each destination from the call mgr
  755. UI.
  756. - User has to directly enter these mappings into the registry -- under
  757. the atmarp settings under tcp settings for the adapter, we'll create a
  758. new key:
  759. StaticArpList - this is a REG_MULTI_SZ, with entries of the form:
  760. <ip-address>-<atm-address>
  761. <ip-address>-<atm-address>
  762. ...
  763. 5/19/99 ArvindM 330544 Fix for bugcheck in TickHandler
  764. The suspect is a Join Entry that has been freed in AtmArpMcHandleMARSFailure
  765. (the IF flags were 0x1100 in one case). The timer could have been in the
  766. expired list held by TickHandler. Added code to ref/deref Join Entries.
  767. 8/4/99 ArvindM 382619 Race between Unbind and AfRegisterNotify handlers
  768. NDIS isn't serializing calls to these handlers, so we hit a case where the
  769. AfRegisterNotify handler is chugging along when the Unbind handler comes in
  770. and deletes the Interface. Workaround is to note down the fact that we are
  771. processing an Af Notification and in Unbind handler, wait for that notification
  772. thread to complete. Added ATMARP_ADAPTER.UnbindBlock and an Adapter flag
  773. AA_ADAPTER_FLAGS_PROCESSING_AF for this. Note that this only shortens the
  774. window - the proper fix should be in NDIS.
  775. 08/09/1999 JosephJ Cleanup error handling code in DriverEntry
  776. We were deleting the device object twice in the error path.
  777. 08/12/1999 ArvindM 386639 Access NULL McAtmEntry in McMakeCallComplete.
  778. In McUpdateConnection, we used to simply pick up the first MC ATM Entry in the
  779. list to use as the party context in a MakeCall. Now this entry could
  780. be running the retry-delay timer. If this timer fires before the MakeCall
  781. completes, it will overwrite the MC ATM Entry state to DISCONNECTED.
  782. In McMakeCallComplete, we look for an MC ATM Entry whose state is WACK_ADD_xxx,
  783. and fail to find one.
  784. The fix is in AtmArpMcUpdateConnection: search the list of MC ATM entry
  785. structures for one that is VALID and DISCONNECTED. If there isn't any, bail out.
  786. If we find one, move it to the start of the MC Entry list, because AtmArpMakeCall
  787. always uses the first entry!
  788. 08/13/1999 ArvindM 387755 Add OutstandingSends counter to VC structure.
  789. We ran into an issue where we referenced a VC prior to sending a packet
  790. on it, but by the time NdisCoSendPackets was called, the VC was closed
  791. and DeleteVc'ed (it was owned by the call manager). So the call to NdisCoSendPackets
  792. bugchecked because the NdisVcHandle was bogus. To fix this, use this counter
  793. to keep track of outstanding (and on-the-verge-of-being-sent) packets on the VC. In
  794. AtmArpCloseCall, don't close the call if this count is non-zero. In CoSendComplete,
  795. check if the VC needs to be closed, and this count (after decrementing) just went
  796. to zero. If so, call AtmArpCloseCall.
  797. 10/15/1999 JosephJ dealing with suspend/resume and multiple AF registrations
  798. Fix for 415806:
  799. Now AtmArpCoAfRegisterNotifyHandler will skip adapter-wide init
  800. (calling AtmArpCfgOpenLISConfiguration and AtmArpAddInterfaceToAdapter)
  801. if it's already been called before for this adapter.
  802. The previously-checked-in version would return failure immediately if
  803. it's been called for this adapter -- this was causing failure to re-add
  804. the IF after a hybernate (we are not getting a unbind/bind after hybernate
  805. because we passon the pnp-request up to IP which returns that it *can*
  806. handle hybernate) -- so instead the AF goes away and a new registeraf
  807. notification comes in on resume.
  808. We *do* need to skip the adapter-wide init because doing it a 2nd time
  809. causes some memory to be leaked.