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

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



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,


-- 
Best regards, 

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


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