Fix incorrect masquerade rules in multivip LBs

The up scripts of the interface files were called only when the
interface moved from down to up, it means that they were not called
during the update of the configuration of an interface. So if during an
update, if an ipv6 subnet was plugged while the ipv4 subnet was already
there, the up script that sets the masquerade rules was not called.

It broke connectivity for either ipv4 or ipv6 between the client and the
members in UDP listeners in multivip load balancers.

Closes-Bug: #2037943

Change-Id: Iad78de1764bc3a3f699b5feef9e58999d2efe613
This commit is contained in:
Gregory Thiemonge 2023-10-02 03:11:29 -04:00
parent 05616ab7cc
commit 5c051a6ab6
3 changed files with 13 additions and 6 deletions

View File

@ -356,11 +356,10 @@ class InterfaceController(object):
**rule)
def _scripts_up(self, interface, current_state):
if current_state == consts.IFACE_DOWN:
for script in interface.scripts[consts.IFACE_UP]:
LOG.debug("%s: Running command '%s'",
interface.name, script[consts.COMMAND])
subprocess.check_output(script[consts.COMMAND].split())
for script in interface.scripts[consts.IFACE_UP]:
LOG.debug("%s: Running command '%s'",
interface.name, script[consts.COMMAND])
subprocess.check_output(script[consts.COMMAND].split())
def down(self, interface):
LOG.info("Setting interface %s down", interface.name)

View File

@ -714,7 +714,9 @@ class TestInterface(base.TestCase):
table=254,
family=socket.AF_INET)])
mock_check_output.assert_not_called()
mock_check_output.assert_has_calls([
mock.call(["post-up", "eth1"])
])
@mock.patch('pyroute2.IPRoute.rule')
@mock.patch('pyroute2.IPRoute.route')

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fixed an issue when using UDP listeners in dual-stack (IPv4 and IPv6) load
balancers, some masquerade rules needed by UDP were not correctly set on the
member interfaces.