summaryrefslogtreecommitdiff
path: root/tests/unittests
diff options
context:
space:
mode:
authorEmanuele Giuseppe Esposito <eesposit@redhat.com>2021-12-06 18:34:26 +0100
committerGitHub <noreply@github.com>2021-12-06 11:34:26 -0600
commit0e25076b34fa995161b83996e866c0974cee431f (patch)
treec6f05f7ba56d61f42921b96f4a1714a612adbde2 /tests/unittests
parent6e39613da5cee66f2162f53c53358f2516b904d0 (diff)
downloadvyos-cloud-init-0e25076b34fa995161b83996e866c0974cee431f.tar.gz
vyos-cloud-init-0e25076b34fa995161b83996e866c0974cee431f.zip
cloudinit/net: handle two different routes for the same ip (#1124)
If we set a dhcp server side like this: $ cat /var/tmp/cloud-init/cloud-init-dhcp-f0rie5tm/dhcp.leases lease { ... option classless-static-routes 31.169.254.169.254 0.0.0.0,31.169.254.169.254 10.112.143.127,22.10.112.140 0.0.0.0,0 10.112.140.1; ... } cloud-init fails to configure the routes via 'ip route add' because to there are two different routes for 169.254.169.254: $ ip -4 route add 192.168.1.1/32 via 0.0.0.0 dev eth0 $ ip -4 route add 192.168.1.1/32 via 10.112.140.248 dev eth0 But NetworkManager can handle such scenario successfully as it uses "ip route append". So change cloud-init to also use "ip route append" to fix the issue: $ ip -4 route append 192.168.1.1/32 via 0.0.0.0 dev eth0 $ ip -4 route append 192.168.1.1/32 via 10.112.140.248 dev eth0 Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> RHBZ: #2003231
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/net/test_init.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/unittests/net/test_init.py b/tests/unittests/net/test_init.py
index 666e8425..82854ab3 100644
--- a/tests/unittests/net/test_init.py
+++ b/tests/unittests/net/test_init.py
@@ -723,13 +723,13 @@ class TestEphemeralIPV4Network(CiTestCase):
['ip', '-family', 'inet', 'link', 'set', 'dev', 'eth0', 'up'],
capture=True),
mock.call(
- ['ip', '-4', 'route', 'add', '192.168.2.1/32',
+ ['ip', '-4', 'route', 'append', '192.168.2.1/32',
'dev', 'eth0'], capture=True),
mock.call(
- ['ip', '-4', 'route', 'add', '169.254.169.254/32',
+ ['ip', '-4', 'route', 'append', '169.254.169.254/32',
'via', '192.168.2.1', 'dev', 'eth0'], capture=True),
mock.call(
- ['ip', '-4', 'route', 'add', '0.0.0.0/0',
+ ['ip', '-4', 'route', 'append', '0.0.0.0/0',
'via', '192.168.2.1', 'dev', 'eth0'], capture=True)]
expected_teardown_calls = [
mock.call(