LB Trunk: Stop matching MAC of subport to port model

Matching the MAC of the tap interface on the hypervisor
to the MAC that the VM will actually use to send traffic
through the tap causes the following error messages:

brq9e974900-cd: received packet on tapa8a6ce4a-e8 with
own address as source address

This is triggering a warning because there are now two
forwarding entries on the bridge, a static one from the
tap device, and a learned one from the packets received.[1]

Due to the presence of a static MAC entry, this will break
things like allowed_address_pair use cases that allow a MAC
to be used by multiple ports.

This patch removes all of the logic to set the MAC
address on the TAP device because it didn't serve any
other purpose than easy to correlate output from
ip link show commands and neutron port MAC addresses.

TAP devices will now just get whatever MAC address the kernel
selects for them.


Closes-Bug: #1668209
Change-Id: I0ff46f9550a79f486063a8e2810ed3b1140a4769
Kevin Benton 2017-02-21 08:27:56 -08:00
parent e674034aa1
commit 1fae7ad108
5 changed files with 0 additions and 53 deletions

View File

@ -99,12 +99,6 @@ class LinuxBridgeTrunkDriver(trunk_rpc.TrunkSkeleton):
# clear any VLANs in case this was a trunk that changed status while
# agent was offline.
if self._tapi.get_trunk_for_subport(context,
# This is a subport. We need to ensure the correct mac address is
# set now that we have the port data to see the data model MAC.
def wire_trunk(self, context, trunk):
"""Wire up subports while keeping the server trunk status apprised."""

View File

@ -76,25 +76,6 @@ class Plumber(object):
dict(name=subname, tag=vlan_id))
def set_port_mac(self, port_id, mac_address):
"""Sets mac address of physical device for port_id to mac_address."""
dev_name = self._get_tap_device_name(port_id)
ipd = ip_lib.IPDevice(dev_name, namespace=self.namespace)
if mac_address ==
return False
LOG.debug("Changing MAC from %(old)s to %(new)s for device "
"%(dev)s", dict(, new=mac_address,
except Exception:
with excutils.save_and_reraise_exception() as ectx:
ectx.reraise = ip_lib.IPDevice(
dev_name, namespace=self.namespace).exists()
return True
def _trunk_lock(self, trunk_dev):
lock_name = 'trunk-%s' % trunk_dev
return lockutils.lock(lock_name, utils.SYNCHRONIZED_PREFIX)

View File

@ -18,7 +18,6 @@ from oslo_utils import uuidutils
import testtools
from neutron.agent.linux import ip_lib
from neutron.common import utils
from neutron.objects import trunk
from neutron.plugins.ml2.drivers.linuxbridge.agent import \
@ -60,19 +59,6 @@ class LinuxBridgeAgentTests(test_ip_lib.IpLibTestFramework):
lba.LinuxBridgeManager(mappings, {})
def test_set_port_mac(self):
attr = self.generate_device_details()
plumber = trunk_plumber.Plumber(namespace=attr.namespace)
# force it to return name of above
plumber._get_tap_device_name = lambda x:
new_mac = utils.get_random_mac('fa:16:3e:00:00:00'.split(':'))
self.assertTrue(plumber.set_port_mac('port_id', new_mac))
self.assertFalse(plumber.set_port_mac('port_id', new_mac))
new_mac = utils.get_random_mac('fa:16:3e:00:00:00'.split(':'))
self.assertTrue(plumber.set_port_mac('port_id', new_mac))
self.assertFalse(plumber.set_port_mac('port_id', new_mac))
def test_vlan_subinterfaces(self):
attr = self.generate_device_details()
device = self.manage_device(attr)

View File

@ -107,10 +107,6 @@ class LinuxBridgeTrunkDriverTestCase(base.BaseTestCase):
'mac_address': 'mac_addr'})
mock.ANY, self.trunk.sub_ports[0].port_id)
self.trunk.sub_ports[0].port_id, 'mac_addr')
def test_wire_trunk_happy_path(self):
self.lbd.wire_trunk('ctx', self.trunk)

View File

@ -68,16 +68,6 @@ class PlumberTestCase(base.BaseTestCase):'dev1')],
def test_set_port_mac(self):
ipd = mock.patch.object(trunk_plumber.ip_lib, 'IPDevice').start()
ipdi = ipd.return_value
self.plumber.set_port_mac('port_id', mac_address='44')'44')
ipdi.exists.return_value = False = ValueError()
# exception suppressed since it no longer 'exists'
self.plumber.set_port_mac('port_id', mac_address='44')
def test__get_vlan_children(self):
expected = [('tap47198374-5a', 777),
('tap47198374-5b', 2),