[lxc-devel] [lxd/master] device/nic/sriov: Fixes mac_filtering when no hwaddr specified

tomponline on Github lxc-bot at linuxcontainers.org
Fri Aug 9 10:17:47 UTC 2019

A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 651 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190809/a8dd8cdc/attachment.bin>
-------------- next part --------------
From 60e5efab140e60dd5eac07697c6d2985c79f0579 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Fri, 9 Aug 2019 10:49:40 +0100
Subject: [PATCH] device/nic/sriov: Fixes mac_filtering when no hwaddr

When testing on mellanox cards, the mac_filtering feature wasn't working when no hwaddr address was specified.

This was because LXD is supposed to set the VF interface's MAC on the parent's VF setting first before enabling spoof checking. However it was using the wrong volatile key.

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
 lxd/device/nic_sriov.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/device/nic_sriov.go b/lxd/device/nic_sriov.go
index 3a827c200b..57186751f2 100644
--- a/lxd/device/nic_sriov.go
+++ b/lxd/device/nic_sriov.go
@@ -333,7 +333,7 @@ func (d *nicSRIOV) setupSriovParent(vfDevice string, vfID int, volatile map[stri
 		// If no MAC specified in config, use current VF interface MAC.
 		mac := d.config["hwaddr"]
 		if mac == "" {
-			mac = volatile["last_state.vf.hwaddr"]
+			mac = volatile["last_state.hwaddr"]
 		// Set MAC on VF (this combined with spoof checking prevents any other MAC being used).

More information about the lxc-devel mailing list