summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Contreras <alberto.contreras@canonical.com>2023-02-27 14:31:45 +0100
committerAlberto Contreras <alberto.contreras@canonical.com>2023-02-27 20:41:16 +0100
commit76f3853dd24e59f79122762efb3aa5ea230f512d (patch)
treee3b7dde82ea36a5f8d57010b1ba15383fb7fb005
parent833157a329cf17d8abb7b234a61270729163f44e (diff)
downloadcloud-init-git-76f3853dd24e59f79122762efb3aa5ea230f512d.tar.gz
d/patches/netplan99-cannot-use-default.patch:
Retain routes' definitions compatible with netplan 0.99 Co-authored-by: Chad Smith <chad.smith@canonical.com>
-rw-r--r--debian/patches/netplan99-cannot-use-default.patch173
-rw-r--r--debian/patches/series1
2 files changed, 174 insertions, 0 deletions
diff --git a/debian/patches/netplan99-cannot-use-default.patch b/debian/patches/netplan99-cannot-use-default.patch
new file mode 100644
index 00000000..c164cccf
--- /dev/null
+++ b/debian/patches/netplan99-cannot-use-default.patch
@@ -0,0 +1,173 @@
+Description: Retain compatible route definition for netplan 0.99
+ bionic-updates contains netplan v0.99 which is not compatible
+ with Routes' definitions containing `to: default`. This patch
+ retains the previous way to define routes.
+Author: alberto.contreras@canonical.com
+Origin: backport
+Forwarded: not-needed
+Last-Update: 2023-02-27
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: b/cloudinit/net/netplan.py
+===================================================================
+--- a/cloudinit/net/netplan.py 2023-02-27 20:40:42.534650863 +0100
++++ b/cloudinit/net/netplan.py 2023-02-27 20:40:42.514650609 +0100
+@@ -119,7 +119,7 @@ def _extract_addresses(config: dict, ent
+ if subnet.get("gateway"):
+ new_route = {
+ "via": subnet.get("gateway"),
+- "to": "default",
++ "to": "::/0" if ":" in subnet["gateway"] else "0.0.0.0/0",
+ }
+ try:
+ subnet_gateway = ipaddress.ip_address(subnet["gateway"])
+Index: b/tests/unittests/test_net.py
+===================================================================
+--- a/tests/unittests/test_net.py 2023-02-27 20:40:42.534650863 +0100
++++ b/tests/unittests/test_net.py 2023-02-27 20:40:42.522650711 +0100
+@@ -403,7 +403,7 @@ network:
+ transmit-hash-policy: layer3+4
+ up-delay: 0
+ routes:
+- - to: default
++ - to: 0.0.0.0/0
+ via: 10.101.11.254
+ vlans:
+ bond0.3502:
+@@ -2264,7 +2264,7 @@ pre-down route del -net 10.0.0.0/8 gw 11
+ - sacchromyces.maas
+ - brettanomyces.maas
+ routes:
+- - to: default
++ - to: 0.0.0.0/0
+ via: 192.168.0.1
+ """
+ ).rstrip(" "),
+@@ -2993,7 +2993,7 @@ pre-down route del -net 10.0.0.0/8 gw 11
+ transmit-hash-policy: layer3+4
+ up-delay: 20
+ routes:
+- - to: default
++ - to: 0.0.0.0/0
+ via: 192.168.0.1
+ - to: 10.1.3.0/24
+ via: 192.168.0.3
+@@ -6047,9 +6047,9 @@ class TestNetplanNetRendering:
+ macaddress: 00:11:22:33:44:55
+ set-name: interface0
+ routes:
+- - to: default
++ - to: 0.0.0.0/0
+ via: 192.168.23.1
+- - to: default
++ - to: 0.0.0.0/0
+ via: 11.0.0.1
+ """,
+ id="physical_gateway46",
+@@ -6086,9 +6086,9 @@ class TestNetplanNetRendering:
+ - eth0
+ - eth1
+ routes:
+- - to: default
++ - to: 0.0.0.0/0
+ via: 192.168.23.1
+- - to: default
++ - to: 0.0.0.0/0
+ via: 11.0.0.1
+ eth0: {}
+ eth1: {}
+@@ -6125,9 +6125,9 @@ class TestNetplanNetRendering:
+ interfaces:
+ - eth0
+ routes:
+- - to: default
++ - to: 0.0.0.0/0
+ via: 192.168.23.1
+- - to: default
++ - to: 0.0.0.0/0
+ via: 11.0.0.1
+ """,
+ id="bridge_gateway46",
+@@ -6161,9 +6161,9 @@ class TestNetplanNetRendering:
+ id: 101
+ link: eth0
+ routes:
+- - to: default
++ - to: 0.0.0.0/0
+ via: 192.168.23.1
+- - to: default
++ - to: 0.0.0.0/0
+ via: 11.0.0.1
+ """,
+ id="vlan_gateway46",
+@@ -6212,7 +6212,7 @@ class TestNetplanNetRendering:
+ - exemplary
+ set-name: interface0
+ routes:
+- - to: default
++ - to: 0.0.0.0/0
+ via: 192.168.23.1
+ """,
+ id="nameserver_gateway4",
+@@ -6247,7 +6247,7 @@ class TestNetplanNetRendering:
+ match:
+ macaddress: 00:11:22:33:44:55
+ routes:
+- - to: default
++ - to: 0.0.0.0/0
+ via: 192.168.23.1
+ - to: 10.176.0.0/24
+ via: 10.184.225.121
+@@ -6282,7 +6282,7 @@ class TestNetplanNetRendering:
+ match:
+ macaddress: 00:11:22:33:44:55
+ routes:
+- - to: default
++ - to: 0.0.0.0/0
+ via: 192.168.23.1
+ - to: 192.167.225.122/24
+ via: 192.168.23.1
+@@ -6318,10 +6318,10 @@ class TestNetplanNetRendering:
+ match:
+ macaddress: 00:11:22:33:44:55
+ routes:
+- - to: default
++ - to: 0.0.0.0/0
+ via: 192.168.255.1
+ on-link: true
+- - to: default
++ - to: "::/0"
+ via: 2001:ffff::1
+ on-link: true
+ set-name: interface0
+Index: b/tests/unittests/distros/test_netconfig.py
+===================================================================
+--- a/tests/unittests/distros/test_netconfig.py 2023-02-27 20:40:42.534650863 +0100
++++ b/tests/unittests/distros/test_netconfig.py 2023-02-27 20:40:42.522650711 +0100
+@@ -199,7 +199,7 @@ network:
+ addresses:
+ - 192.168.1.5/24
+ routes:
+- - to: default
++ - to: 0.0.0.0/0
+ via: 192.168.1.254
+ eth1:
+ dhcp4: true
+@@ -218,7 +218,7 @@ network:
+ addresses:
+ - 2607:f0d0:1002:0011::2/64
+ routes:
+- - to: default
++ - to: ::/0
+ via: 2607:f0d0:1002:0011::1
+ eth1:
+ dhcp4: true
+@@ -1057,7 +1057,7 @@ class TestNetCfgDistroArch(TestNetCfgDis
+ addresses:
+ - 192.168.1.5/24
+ routes:
+- - to: default
++ - to: 0.0.0.0/0
+ via: 192.168.1.254
+ eth1:
+ dhcp4: true
diff --git a/debian/patches/series b/debian/patches/series
index b68eab27..03ab8234 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@ renderer-do-not-prefer-netplan.patch
retain-apt-partner-pocket.patch
expire-on-hashed-users.patch
retain-netplan-world-readable.patch
+netplan99-cannot-use-default.patch