summaryrefslogtreecommitdiff
path: root/lib/wmi.c
Commit message (Collapse)AuthorAgeFilesLines
* Use xmalloc instead of malloc in some Windows code.Shashank Ram2017-05-191-12/+2
| | | | | | | | xmalloc checks if the size is valid before allocating memory, and also if the allocation was successful. Signed-off-by: Shashank Ram <rams@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* windows: wmi add includeAlin Serdean2017-01-301-0/+1
| | | | | | | | | | | | Add 'util.h' to includes otherwise the result of the function 'ovs_format_message' will be unknown and be converted to int, triggering an abort of vswitchd. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/123 Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* Windows: Fix wmi.c to use count of wchar_t instead of sizeofSairam Venugopal2017-01-271-17/+21
| | | | | | | | | | | | | wcscat_s and wcscpy_s requires number of elements as argument. wchar_t uses 2 bytes for storage and using sizeof(internal_port_query) causes access violation error on Windows 2012 R2 (64 bit). This patch introduces a #define WMI_QUERY_COUNT set to 2048 and uses that instead. Reported-by: Sairam Venugopal <vsairam@vmware.com> Reported-at: openvswitch/ovs-issues#121 Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* Windows: Add internal switch port per OVS bridgeAlin Serdean2016-12-201-0/+1277
This patch updates the following commands in the vswitch: ovs-vsctl add-br br-test ovs-vsctl del-br br-test ovs-vsctl add-br br-test: This command will now create an internal port on the MSFT virtual switch using the WMI interface from Msvm_VirtualEthernetSwitchManagementService leveraging the method AddResourceSettings. Before creating the actual port, the switch will be queried to see if there is not a port already created (good for restarts when restarting the vswitch daemon). If there is a port defined it will return success and log a message. After checking if the port already exists the command will also verify if the forwarding extension (windows datapath) is enabled and on a single switch. If it is not activated or if it is activated on multiple switches it will return an error and a message will be logged. After the port was created on the switch, we will disable the adapter on the host and rename to the corresponding OVS bridge name for consistency. The user will enable and set the values he wants after creation. ovs-vsctl del-br br-test This command will remove an internal port on the MSFT virtual switch using the Msvm_VirtualEthernetSwitchManagementService class and executing the method RemoveResourceSettings. Both commands will be blocking until the WMI job is finished, this allows us to guarantee that the ports are created and their name are set before issuing a netlink message to the windows datapath. This patch also includes helpers for normal WMI retrievals and initializations. Appveyor and documentation has been modified to include the libraries needed for COM objects. This patch was tested individually using IMallocSpy and CRT heap checks to ensure no new memory leaks are introduced. Tested on the following OS's: Windows 2012, Windows 2012r2, Windows 2016 Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Paul Boca <pboca@cloudbasesolutions.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>