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

Re: [libvirt] [PATCH] remove port filter on detachment of a network device



On Tue, 2009-11-10 at 13:28 +0100, Gerhard Stenzel wrote:
> This patch removes the port filter if the network device is detached 
> via virDomainDetachDevice.
> 
> Signed-off-by: Gerhard Stenzel <gerhard stenzel de ibm com>
> Index: libvirt/src/qemu/qemu_driver.c
> ===================================================================
> --- libvirt.orig/src/qemu/qemu_driver.c
> +++ libvirt/src/qemu/qemu_driver.c
> @@ -4829,6 +4829,7 @@ qemudDomainDetachNetDevice(virConnectPtr
>  {
>      int i, ret = -1;
>      virDomainNetDefPtr detach = NULL;
> +    struct qemud_driver *driver = qemu_driver;
> 
>      for (i = 0 ; i < vm->def->nnets ; i++) {
>          virDomainNetDefPtr net = vm->def->nets[i];
> @@ -4863,6 +4864,15 @@ qemudDomainDetachNetDevice(virConnectPtr
>      if (qemuMonitorRemoveHostNetwork(vm, detach->vlan,
> detach->hostnet_name) < 0)
>          goto cleanup;
> 
> +    if ((driver->macFilter) && (detach->ifname != NULL)) {
> +        if ((errno = networkDisallowMacOnPort(conn, driver,
> detach->ifname,
> +                                              detach->mac))) {
> +            virReportSystemError(conn, errno,
> +             _("failed to remove ebtables rule on '%s'"),
> +                                 detach->ifname);
> +        }
> +    }
> +
>      if (vm->def->nnets > 1) {
>          memmove(vm->def->nets + i,
>                  vm->def->nets + i + 1,
> 
This was probably overlooked. Resending for 0.7.5.

This patch removes the port filter if the network device is detached 
via virDomainDetachDevice

Signed-off-by: Gerhard Stenzel <gerhard stenzel de ibm com>
Index: libvirt/src/qemu/qemu_driver.c
===================================================================
--- libvirt.orig/src/qemu/qemu_driver.c
+++ libvirt/src/qemu/qemu_driver.c
@@ -5284,6 +5284,17 @@ qemudDomainDetachNetDevice(virConnectPtr
     }
     qemuDomainObjExitMonitorWithDriver(driver, vm);
 
+    if ((driver->macFilter) && (detach->ifname != NULL)) {
+        if ((errno = networkDisallowMacOnPort(conn,
+                                              driver,
+                                              detach->ifname,
+                                              detach->mac))) {
+            virReportSystemError(conn, errno,
+             _("failed to remove ebtables rule on  '%s'"),
+                                 detach->ifname);
+        }
+    }
+
     if (vm->def->nnets > 1) {
         memmove(vm->def->nets + i,
                 vm->def->nets + i + 1,


-- 
Best regards, 

Gerhard Stenzel, 
-----------------------------------------------------------------------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


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