Re: [PATCH v3 01/36] network: restrict usage of port management APIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/19/19 8:46 AM, Daniel P. Berrangé wrote:
The port allocation APIs are currently called unconditionally for all
types of NIC, but (mostly) only do anything for NICs with type=network.

The exception is the port allocate API which does some validation even
for NICs with type!=network. Relying on this validation is flawed,
however, since the network driver may not even be installed. IOW virt
drivers must not delegate validation to the network driver for NICs
with type != network.

This change allows us to report errors when the virtual network driver
is not registered.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
  src/conf/domain_conf.c      | 26 ++++++++------
  src/libxl/libxl_domain.c    |  6 ++--
  src/libxl/libxl_driver.c    |  9 +++--
  src/lxc/lxc_driver.c        |  6 ++--
  src/lxc/lxc_process.c       |  9 +++--
  src/network/bridge_driver.c | 72 +++++++++++++++++++------------------
  src/qemu/qemu_driver.c      |  6 ++--
  src/qemu/qemu_hotplug.c     | 17 +++++----
  src/qemu/qemu_process.c     |  9 +++--
  9 files changed, 94 insertions(+), 66 deletions(-)

[...]


diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 4d4ab0f375..cf37a16c64 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -4371,8 +4371,11 @@ networkAllocateActualDevice(virDomainDefPtr dom,
      size_t i;
      int ret = -1;
- if (iface->type != VIR_DOMAIN_NET_TYPE_NETWORK)
-        goto validate;
+    if (iface->type != VIR_DOMAIN_NET_TYPE_NETWORK) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("Expected a interface for a virtual network"));


Oops. Missed this the first time through - should be "an interface", not "a interface". There's a second occurence of this in networkReleaseActualDevice().


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux