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.

519 lines
18 KiB

  1. TO DO LIST
  2. ----------
  3. 0. Change ip address to bind string in connect-dialog, first ping for the
  4. address, etc...
  5. 1. Switch from events to using two mutexes
  6. 2. Explicitly report the following errors
  7. - other update pending
  8. - netcfg write lock held
  9. 3. Report true client description, not "unspecified WMI client."
  10. 4. Use resource strings
  11. 6. Use internal constants for error codes and literal strings
  12. 7. Remove client-side dependency on wlbsctrl.dll.
  13. 4. Hook into nlb manager
  14. 4. Add "partial-update" semantics
  15. New parameter: BOOL PartialUpdate
  16. OPTIONAL parameter Generation -- if specified, we'll verify that the
  17. Generation matches the current generation.
  18. parameter value NULL === don't change
  19. port rules: require the following property on each PR for partial-updates:
  20. action=[ADD|DELETE|UPDATE]
  21. IP addresses: require the ip address to be prefixed by
  22. "add:" "delete:" or "update:" (latter for changing subnet masks)
  23. UI:
  24. add:{10.1.1.3}
  25. delete:{10.1.1.3, 255.0.0}
  26. update:{10.1.1.3, 255.0.0}
  27. EXAMPLE 1:
  28. PartialUpdate=TRUE
  29. PortRules="action=update ip=10.1.1.3 start=80 end=288 weight=20 ...."
  30. EXAMPLE 2:
  31. PartialUpdate=TRUE
  32. IpAddresses="add:10.0.0.1/255.255.0.0", "delete:10.0.0.2"
  33. Generation=8
  34. 9. Follow up on WMI SDK errors -- DaveIce
  35. WBEM_E_SERVER_NOT_FOUND -- where is this defined.
  36. 0x800706bf -- no definition in any header (and I checked in
  37. index2a with interesting results), recoverable error.
  38. 0x80070767 -- no defn
  39. 0x80070005 -- no defn
  40. control ip=x port=y start/stop/enable/disable/nop
  41. ------------------------------------
  42. "Persistant" state for a particular NIC is mainained as a (for now)
  43. volatile key under SYSTEM\CurrentControlSet\Services\WLBS\ConfigurationHistory\{GUID}
  44. Under this GUID, there is are a set of reg-binary values (which are lighter weight than keys). They value-name is the generation number, and the value is a struct concatenated with a log. The struct has the format:
  45. typedef struct {
  46. UINT Version;
  47. UINT HeaderSize;
  48. UINT Generation;
  49. UINT CompletionCode;
  50. UINT OffsetToLog; // from start of this structure
  51. UINT LogSize; // 0 == no log
  52. UINT Reserved1;
  53. UINT Reserved2;
  54. };
  55. swprintf (reg_path, L"SYSTEM\\CurrentControlSet\\Services\\WLBS\\Parameters\
  56. \Interface\\%s",
  57. szAdapterGuid);
  58. RegOpenKeyEx (HKEY_LOCAL_MACHINE, reg_path, 0L,
  59. fReadOnly? KEY_READ : KEY_WRITE, & hKey);
  60. return hKey;
  61. status = RegOpenKeyEx (HKEY_LOCAL_MACHINE, reg_path, 0L,
  62. KEY_QUERY_VALUE, & key);
  63. HKEY hKey;
  64. status = RegCreateKeyEx (HKEY_LOCAL_MACHINE, reg_path, 0L, L"",
  65. REG_OPTION_NON_VOLATILE,
  66. KEY_ALL_ACCESS, NULL, & key, & disp);
  67. [HLKM\SYSTEM\CurrentControlSet\Services\WLBS\ConfigurationHistory]
  68. [{EBE09517-07B4-4E88-AAF1-E06F5540608B}]
  69. Generation (DWORD)
  70. [PendingOperation]
  71. Generation (DWORD)
  72. ThreadId (String)
  73. [Completions]
  74. 1 Binary
  75. 2 Binary
  76. Mutex Name
  77. NLB_D6901862{EBE09517-07B4-4E88-AAF1-E06F5540608B}
  78. HANDLE CreateMutex(
  79. LPSECURITY_ATTRIBUTES lpMutexAttributes,
  80. // pointer to security attributes
  81. BOOL bInitialOwner, // flag for initial ownership
  82. LPCTSTR lpName // pointer to mutex-object name
  83. );
  84. 04/10/2001 JosephJ Mutex vs Event vs Registry
  85. Finally settled on a named event because:
  86. 1. Needs to recover from a process crash (so can't use registry)
  87. 2. Needs to be cross process -- so must used named object
  88. 3. Need to "acquire" in one thread and "release" in another -- so can't
  89. use mutex.
  90. The auto-reset event is normally signalled. It is non-signalled whenever
  91. an operation is pending. It is manually set back to signalled whenever
  92. the operation is completed.
  93. bp tprov!NlbConfigurationUpdate__DoUpdate
  94. bp tprov!NlbConfigurationUpdate__s_AsyncUpdateThreadProc
  95. -------
  96. Sean, you can do this semi-automatically by creating a new and temporary tree just for the merging process.
  97. So for example, create a new directory driver2 in the private tree (or your scratch depot) and checkin the latest netvbl2 checked-in sources..
  98. From one enlistment, open the files for edit, and copy over your BDA privates (but dont checkin).
  99. From a second enlistment, open the files for edit, and copy over the latest privates from the private tree (this has virtual cluster support), and check this in.
  100. Go back to the first enlistment and resolve.
  101. -------
  102. 04/15/2001 JosephJ lightweight wmi wrapper.
  103. Connect-to-machine
  104. Get-object
  105. 04/15/2001 JosephJ Consider using IWbemServices::ExecQuery
  106. 04/25/2001 JosephJ Adding/removing IP addresses.
  107. Binding/Re-binding NLB:
  108. we require the explicit list of IP addresses to be specified.
  109. We'll check that
  110. (a) dedicated ip address, if specified, is first.
  111. (b) cluster_vip and subnet mask match are present.
  112. (c) vips for any per-ip port rules are present.
  113. We honor the specified order of ip addresses.
  114. Unbinding NLB:
  115. We set the specified list of ip addresses.
  116. If NULL, we'll switch the adapter to DHCP, which could take a while.
  117. z:\nt\net\wlbs\api\obj\i386;Z:\nt\net\wlbs\nlbmgr\provider\tests\obj\i386;symsrv*symsrv.dll*\\symbols\symbols
  118. 10.1.x.x {A25EF21A-4634-4B15-AE7F-6825DFAD9FA6}
  119. 10.0.x.x {AD4DA14D-CAAE-42DD-97E3-5355E55247C2}
  120. Utility function wrappers for exec method
  121. CfgUtilGetWmiObjectInstance(szRoot, szPropertyName, szPropertyValue)
  122. CfgUtilGetWmiRelPath(szRoot, szPropertyName, szPropertyValue)
  123. CfgUtilGetWmiInputInstance(
  124. IN szRoot,
  125. IN szPropertyName, "NlbsNic"
  126. IN szPropertyValue, "guid"
  127. IN szMethod "EnableStatic"
  128. OUT IInputInstance,
  129. OUT szRelPath,
  130. GetMethodInstanceByProperty
  131. SetupInParams -->
  132. ExecMethod
  133. GetOutParams
  134. bp tprov!CfgUtilGetWmiInputInstanceAndRelPath
  135. WBEMSTATUS
  136. IWbemSvc *pSvc
  137. WBEMSTATUS
  138. ConnectToWMi(
  139. MACHINE-NAME, // NULL == Don't us WMI, "" == local,
  140. szAdminPassword, // OPTIONAL
  141. szAdminDomain, // OPTIONAL
  142. szNicGuid,
  143. info
  144. );
  145. WBEMSTATUS
  146. GetClusterConfig(
  147. MACHINE-NAME, // NULL == Don't us WMI, "" == local,
  148. szAdminPassword, // OPTIONAL
  149. szAdminDomain, // OPTIONAL
  150. szNicGuid,
  151. info
  152. );
  153. 05/12/2001 JosephJ
  154. To do:
  155. 1. Remove NlbState property, add BOOL NlbBound property
  156. 2. Get rid of SubnetMask string array -- Instead place subnet mask
  157. after ip address: "10.1.1.1/255.255.255.255"
  158. 3. Demonstrate fundamental plumbing is working:
  159. x Modify existing test to optionally go through WMI
  160. -- get rid of nlbhost class (nlbhost.cpp)
  161. x Verify we can get partial input and output parameters for GetConfig
  162. x Implement and test GetClusterConfig with partial params
  163. x Re-test local (non-wmi) functionality, including bind/unbind, change IPs
  164. x Implement QueryUpdate and UpdateConfig
  165. x test UpdateConfig with partial params
  166. - Implement and test getting port rules information
  167. - Implement and test settings port rule information
  168. - Implement and test getting full information
  169. - Implement and test setting full information
  170. 4. Hook into nlb manager
  171. 4. Add "partial-update" semantics
  172. New parameter: BOOL PartialUpdate
  173. OPTIONAL parameter Generation -- if specified, we'll verify that the
  174. Generation matches the current generation.
  175. parameter value NULL === don't change
  176. port rules: require the following property on each PR for partial-updates:
  177. action=[ADD|DELETE|UPDATE]
  178. IP addresses: require the ip address to be prefixed by
  179. "add:" "delete:" or "update:" (latter for changing subnet masks)
  180. UI:
  181. add:{10.1.1.3}
  182. delete:{10.1.1.3, 255.0.0}
  183. update:{10.1.1.3, 255.0.0}
  184. EXAMPLE 1:
  185. PartialUpdate=TRUE
  186. PortRules="action=update ip=10.1.1.3 start=80 end=288 weight=20 ...."
  187. EXAMPLE 2:
  188. PartialUpdate=TRUE
  189. IpAddresses="add:10.0.0.1/255.255.0.0", "delete:10.0.0.2"
  190. Generation=8
  191. 5. Switch from events to using two mutexes
  192. 6. Explicitly report the following errors
  193. - other update pending
  194. - netcfg write lock held
  195. 7. Use resource strings
  196. 8. Use internal constants for error codes and literal strings
  197. 9. Follow up on WMI SDK errors -- DaveIce
  198. WBEM_E_SERVER_NOT_FOUND -- where is this defined.
  199. 0x800706bf -- no definition in any header (and I checked in
  200. index2a with interesting results), recoverable error.
  201. 0x80070767 -- no defn
  202. 0x80070005 -- no defn
  203. !sympath .\obj\i386;symsrv*symsrv.dll*\\symbols\symbols
  204. bp tprov!CfgUtilGetWmiInputInstanceAndRelPath
  205. bp tprov!NlbHostGetConfiguration
  206. 05/17/2001 JosephJ more on partial updates
  207. // Determine if this is a partial or full update.
  208. // If partial update, we allow a subset of cluster configuration
  209. // parameters to be specified, but allow only a restricted set
  210. // of update operations.
  211. //
  212. // Disallowed partial update operations:
  213. // - Transitions between bound and !bound
  214. // - Currently bound but nlb parameters are invalid
  215. //
  216. // Some allowed partial updates:
  217. // - Modifying IP address lists
  218. // - Modifying cluster / dedicated addresses/subnets
  219. // - Modifying existing portrules
  220. // - Adding/deleting port rules
  221. //
  222. Successfully connected to NLB on JOSEPHJ4E...
  223. Going call QueryConfigurationUpdateStatus...
  224. QueryConfigurationUpdateStatus returns successfully
  225. Connecting to NLB on JOSEPHJ4E ...
  226. Successfully connected to NLB on JOSEPHJ4E...
  227. Going call QueryConfigurationUpdateStatus...
  228. QueryConfigurationUpdateStatus returns successfully
  229. Connecting to NLB on JOSEPHJ4E ...
  230. Sample framework provier...
  231. C:\Microsoft Platform SDK\Samples\SysMgmt\WMI\VC\FrameworkProv
  232. http://msdn.microsoft.com/library/default.asp?URL=/library/psdk/wmisdk/framework_1h0l.htm
  233. Static methods -- implementation
  234. Declaring static: add "static" in mof ... [Implemented, static, ...]
  235. Them in the ExecMethod class, simply ignore the Instance parameter.
  236. Static methods -- calling
  237. A method may or may not be static. Static methods are designated by the presence of the Static qualifier on their definition. Static methods are executed against a class, not a particular instance of that class. The path specified to a method execution API for a static method must, therefore, be a class name. Non-static methods are executed against a particular instance of a class. The path specified to a method execution for a non-static method must, therefore, be an instance path
  238. Nadir Ahmed
  239. Nadir Ahmed
  240. PortRules= {
  241. ip=1.1.1.1 protocol=TCP start=80 end=288 mode=SINGLE,
  242. ip=1.1.1.1 protocol=TCP start=80 end=288 mode=SINGLE,
  243. ip=1.1.1.1 protocol=TCP start=80 end=288 mode=SINGLE
  244. }
  245. NA = {
  246. 1.1.1.1/255.255.0.0,
  247. }
  248. read_string_array(out ppStrings,):
  249. look for { [xxx,]* }
  250. wmiupdate
  251. nlbcfg wmiupdate>AdapterGuid={....}
  252. nlbcfg \\asdasdfasdfsadf /u:ntdev\josephj *
  253. enter password: *****
  254. nlbcfg> wmiupdate {asdfasdfasdfsdf}
  255. nlbcfg wmiupdate> niclist
  256. blah
  257. blah
  258. blah
  259. niclist> wmiupdate {guid}
  260. blah
  261. blah
  262. blah
  263. nlbcfg wmiupdate> NLBBound=true
  264. nlbcfg wmiupdate> PortRules = {
  265. ip=1.1.1.1 protocol=TCP start=80 end=288 mode=SINGLE
  266. }
  267. nlbcfg wmiupdate>
  268. while(1)
  269. {
  270. Parse();
  271. }
  272. if (!scanf("%ws")==1)
  273. {
  274. if (!strncmpi(...., wmiupdate))
  275. return ParseWmiUpdate());
  276. }
  277. SPECIFICATION --- COMMAND LINE
  278. nlbcfg [machinename|-|.] [command_and_parameters] [options]
  279. machinemame machine name
  280. OR IP address
  281. OR fully-qualified machine name
  282. - Indicates not to use WMI -- call lower-level functions
  283. directly
  284. . Connect to local machine using wmi
  285. command_and_parameters AdapterList
  286. OR Update [adapter_guid]
  287. OR Help
  288. options /u domain\user [password | *]
  289. Examples:
  290. nlbcfg . AdapterList
  291. nlbcfg . al
  292. nlbcfg - Update
  293. nlbcfg josephj4c /u:ntdev\josephj *
  294. SPECIFICATION --- SHELL
  295. AdapterList al
  296. Update u
  297. Quit q
  298. Help h, ?
  299. AdapterGuid ag
  300. PartialUpdate pu
  301. NetworkAddresses na
  302. NLBBound nb
  303. ClusterNetworkAddress cna
  304. ClusterName cn
  305. TrafficMode tm
  306. PortRules pr
  307. HostPriority hp
  308. DedicatedNetworkAddress dna
  309. ClusterModeOnStart cmos
  310. RemoteControlEnabled rce
  311. Password p
  312. [IN] String ClientDescription,
  313. [IN] String AdapterGuid,
  314. [IN] uint32 Generation,
  315. [IN] Boolean PartialUpdate,
  316. [IN] String NetworkAddresses[], // "10.1.1.1/255.255.255.255"
  317. [IN] Boolean NLBBound,
  318. [IN] String ClusterNetworkAddress, // "10.1.1.1/255.0.0.0"
  319. [IN] String ClusterName,
  320. [IN] String TrafficMode, // UNICAST MULTICAST IGMPMULTICAST
  321. [IN] String PortRules[],
  322. [IN] uint32 HostPriority,
  323. [IN] String DedicatedNetworkAddress, // "10.1.1.1/255.0.0.0"
  324. [IN] Boolean ClusterModeOnStart,
  325. [IN] Boolean RemoteControlEnabled,
  326. [IN] String Password,
  327. [OUT] uint32 NewGeneration,
  328. [OUT] String Log
  329. nlbcfg> update {guid}
  330. Enter Adapter GUID: {guid}
  331. NLB Configuration for Adapter xxxx xxxx:
  332. Enter updated configuration, or type help for more information.
  333. nlbcfg update> cna=10.0.0.1/255.255.255.0
  334. nlbcfg update> cna=10.0.0.1/255.255.255.0
  335. nlbcfg update> cna=10.0.0.1/255.255.255.0
  336. nlbcfg update> .
  337. Proposed new configuration:
  338. .....
  339. Enter y to confirm:
  340. nlbcfg update> y
  341. Going to perform update
  342. ...
  343. ....
  344. complete
  345. Reading configuration:
  346. .......
  347. Enter updated configuration or other command.
  348. nlbcfg update>q
  349. ----------------
  350. 07/22/2001 JosephJ Reorganization
  351. --------
  352. Identifying dependencies on wlbsctrl.dll
  353. CfgUtilInitialize(VOID);
  354. CfgUtilDeitialize(VOID);
  355. CfgUtilGetNlbConfig <- touches registry
  356. CfgUtilSetNlbConfig <- touches registry
  357. CfgUtilControlCluster <- touches driver
  358. Following have no side effects....
  359. CfgUtilInitializeParams
  360. CfgUtilsAnalyzeNlbUpdate
  361. CfgUtilGetPortRules
  362. CfgUtilSetPortRules
  363. To Do:
  364. -----
  365. Create two libs:
  366. 1. CfgUtil -- current CfgUtil* functionality
  367. Used by: NlbClient (below) and nlbmprov.dll (wmi provider)
  368. - Dynamically loads wlbsctrl.dll
  369. - Works with W2K wlbsctrl.dll too!
  370. - Unlike current version, it does NOT use the
  371. wlbsctrl!CWlbsControl class.
  372. 2. NlbClient -- current NlbHost functionality (client side wmi wrappers)
  373. Used by: tprov.exe, nlbmprov.dll
  374. tprov.exe -- continues to live where it is -- because it directly compiles
  375. the update functionality. Update functionality lives where it
  376. is (in nlbmprov.dll) because we want to use it on w2k as-is (i.e.
  377. xp nlbmprov.dll can be used as-is on W2K.
  378. cfgutil.h cfgutil.lib
  379. nlbclient.h nlbclient.lib
  380. 08/08/2001 JosephJ got this error from tracing. Turned out to because I'd
  381. defined USE_MSVCRT=1 building cfgutil.lib but NOT when building tprov.exe.
  382. Linking Executable - obj\i386\tprov.exe for i386
  383. cfgutil.lib(cfgutil.obj) : warning LNK4217: locally defined symbol _wcslen
  384. imported in function "void __stdcall WPP_SF_S(unsigned __int64,unsigned
  385. short,struct _GUID const *,unsigned short const *)"
  386. (?WPP_SF_S@@YGX_KGPBU_GUID@@PBG@Z)
  387. link() : error LNK1218: warning treated as error; no output file generated
  388. 09/10/2001 JosephJ added ..\..\..\util\$(O)\wlbsutil.lib \
  389. This is because cfgutil.lib needs it
  390. and the latter needs it for a trivial
  391. reason (see nlbmgr\cfgutillib\notes.txt) which we should consider
  392. cleaning up so we don't need to do this.
  393. 09/27/2001 JosephJ tprov in demo mode:
  394. dot cheese-a u back1
  395. nb=t
  396. na={10.0.0.1/255.0.0.0, 10.0.0.11/255.0.0.0}
  397. dna=10.0.0.1/255.0.0.0
  398. cna=10.0.0.11/255.0.0.0
  399. 09/27/2001 THings to change for multi-value initial state, and persist state.
  400. o
  401. add new cmos state "suspend" or "s"
  402. parse_cluster_mode_on_start:
  403. parse new initial state
  404. PersistSuspend = true/false
  405. display_config2: display new stuff
  406. You can test by commenting out the // NlbHostFake line in tprov.cpp
  407. To test
  408. dot cheese-x u nic1
  409. TO update, type a final "." character, followed by y to actually do
  410. the update.
  411. 10/09/2001 JosephJ Support for control cluster.
  412. Added support for control cluster. To use, use the "update" command.
  413. The sub command is "control".
  414. Format:
  415. control [start|stop|drain|query] <- adapter wide
  416. control port=xxx [ip=yyy] [enable|disable|drain|query] <- port specific
  417. Samples:
  418. control start
  419. control ip=10.0.0.1 port=80 enable
  420. control query
  421. control port=80 query
  422. control ip=10.0.0.1 port=80 query
  423. At this point, to actually enable this, #define NEWSTUFF in function
  424. tprov.cpp: parse_control.
  425. 01/01/2002 JosephJ Changes to make TPROV.EXE build again
  426. sources: added a line ..\log_msgs.mc
  427. tprov.cpp: added a global ghModule (referred to by ..\updatecfg.cpp)
  428. 04/15/2002 JosephJ