Previous posting had an unused variable in the compile case of --without-macvtap.
This patch adds the mac_filter support to the macvtap device. Signed-off-by: Stefan Berger <stef...@us.ibm.com>
Index: libvirt-macvtap/src/qemu/qemu_conf.c =================================================================== --- libvirt-macvtap.orig/src/qemu/qemu_conf.c +++ libvirt-macvtap/src/qemu/qemu_conf.c @@ -335,7 +335,7 @@ int qemudLoadDriverConfig(struct qemud_d if (!(driver->ebtables = ebtablesContextNew("qemu"))) { driver->macFilter = 0; virReportSystemError(errno, - _("failed to enable mac filter in in '%s'"), + _("failed to enable mac filter in '%s'"), __FILE__); } @@ -1432,6 +1432,7 @@ int qemudExtractVersion(struct qemud_dri */ int qemudPhysIfaceConnect(virConnectPtr conn, + struct qemud_driver *driver, virDomainNetDefPtr net, char *linkdev, int brmode, @@ -1441,6 +1442,7 @@ qemudPhysIfaceConnect(virConnectPtr conn #if WITH_MACVTAP char *res_ifname = NULL; int vnet_hdr = 0; + int err; if (qemuCmdFlags & QEMUD_CMD_FLAG_VNET_HDR && net->model && STREQ(net->model, "virtio")) @@ -1452,12 +1454,21 @@ qemudPhysIfaceConnect(virConnectPtr conn VIR_FREE(net->ifname); net->ifname = res_ifname; } + + if (rc >=0 && driver->macFilter) { + if ((err = networkAllowMacOnPort(driver, net->ifname, net->mac))) { + virReportSystemError(err, + _("failed to add ebtables rule to allow MAC address on '%s'"), + net->ifname); + } + } #else (void)conn; (void)net; (void)linkdev; (void)brmode; (void)qemuCmdFlags; + (void)driver; qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("No support for macvtap device")); rc = -1; @@ -3757,7 +3768,7 @@ int qemudBuildCommandLine(virConnectPtr if (snprintf(tapfd_name, sizeof(tapfd_name), "%d", tapfd) >= sizeof(tapfd_name)) goto no_memory; } else if (net->type == VIR_DOMAIN_NET_TYPE_DIRECT) { - int tapfd = qemudPhysIfaceConnect(conn, net, + int tapfd = qemudPhysIfaceConnect(conn, driver, net, net->data.direct.linkdev, net->data.direct.mode, qemuCmdFlags); Index: libvirt-macvtap/src/qemu/qemu_conf.h =================================================================== --- libvirt-macvtap.orig/src/qemu/qemu_conf.h +++ libvirt-macvtap/src/qemu/qemu_conf.h @@ -251,6 +251,7 @@ int qemudNetworkIfaceConnect ATTRIBUTE_NONNULL(1); int qemudPhysIfaceConnect(virConnectPtr conn, + struct qemud_driver *driver, virDomainNetDefPtr net, char *linkdev, int brmode, Index: libvirt-macvtap/src/qemu/qemu_driver.c =================================================================== --- libvirt-macvtap.orig/src/qemu/qemu_driver.c +++ libvirt-macvtap/src/qemu/qemu_driver.c @@ -5723,7 +5723,7 @@ static int qemudDomainAttachNetDevice(vi return -1; } - if ((tapfd = qemudPhysIfaceConnect(conn, net, + if ((tapfd = qemudPhysIfaceConnect(conn, driver, net, net->data.direct.linkdev, net->data.direct.mode, qemuCmdFlags)) < 0)
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list