Skip to content

Commit b24730e

Browse files
authored
Merge pull request #2511 from anarkiwi/master
LACP can cause a loop.
2 parents c84e082 + 8ee209c commit b24730e

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

faucet/valve_flood.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,18 @@ def _build_flood_local_rule_actions(vlan, exclude_unicast, in_port):
5959
flood_acts = []
6060
exclude_ports = set()
6161
lags = vlan.lags()
62+
lags_up = vlan.lags_up()
6263
if lags:
6364
if in_port is not None and in_port.lacp:
6465
# Don't flood from one LACP bundle member, to another.
6566
exclude_ports.update(lags[in_port.lacp])
6667
# Pick one up bundle member to flood to.
67-
for ports in list(lags.values()):
68-
exclude_ports.update(ports[1:])
68+
for lag, ports in list(lags.items()):
69+
ports_up = lags_up[lag]
70+
if ports_up:
71+
exclude_ports.update(ports[1:])
72+
else:
73+
exclude_ports.update(ports)
6974
tagged_ports = vlan.tagged_flood_ports(exclude_unicast)
7075
flood_acts.extend(valve_of.flood_tagged_port_outputs(
7176
tagged_ports, in_port=in_port, exclude_ports=exclude_ports))

faucet/vlan.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -492,11 +492,22 @@ def mirrored_ports(self):
492492
"""Return ports that are mirrored on this VLAN."""
493493
return tuple([port for port in self.get_ports() if port.mirror])
494494

495+
def lacp_ports(self):
496+
"""Return ports that have LACP on this VLAN."""
497+
return tuple([port for port in self.get_ports() if port.lacp])
498+
495499
def lacp_up_ports(self):
496500
"""Return ports that have LACP up on this VLAN."""
497-
return tuple([port for port in self.get_ports() if port.lacp and port.dyn_lacp_up])
501+
return tuple([port for port in self.lacp_ports() if port.dyn_lacp_up])
498502

499503
def lags(self):
504+
"""Return dict of LAGs mapped to member ports."""
505+
lags = collections.defaultdict(list)
506+
for port in self.lacp_ports():
507+
lags[port.lacp].append(port)
508+
return lags
509+
510+
def lags_up(self):
500511
"""Return dict of LAGs mapped to member ports that have LACP up."""
501512
lags = collections.defaultdict(list)
502513
for port in self.lacp_up_ports():

tests/integration/mininet_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6316,7 +6316,7 @@ def setUp(self): # pylint: disable=invalid-name
63166316
n_dps=self.NUM_DPS,
63176317
n_untagged=self.NUM_HOSTS,
63186318
untagged_vid=self.VID,
6319-
switch_to_switch_links=1,
6319+
switch_to_switch_links=2,
63206320
hw_dpid=self.hw_dpid,
63216321
lacp=True)
63226322
self.start_net()

0 commit comments

Comments
 (0)