SHA256
1
0
forked from pool/cloud-init

- Update cloud-init-write-routes.patch (bsc#1177526)

+ Fix missing default route when dual stack network setup is used. Once
    a default route was configured for Ipv6 or IPv4 the default route
    configuration for the othre protocol was skipped.

OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=175
This commit is contained in:
Robert Schweikert 2020-11-10 11:41:01 +00:00 committed by Git OBS Bridge
parent b0c63d0e77
commit e0a3626f42
2 changed files with 17 additions and 2 deletions

View File

@ -10,7 +10,7 @@ Index: cloudinit/distros/opensuse.py
from cloudinit import helpers from cloudinit import helpers
from cloudinit import log as logging from cloudinit import log as logging
@@ -174,7 +175,140 @@ class Distro(distros.Distro): @@ -174,7 +175,147 @@ class Distro(distros.Distro):
util.write_file(out_fn, str(conf), 0o644) util.write_file(out_fn, str(conf), 0o644)
def _write_network_config(self, netconfig): def _write_network_config(self, netconfig):
@ -34,6 +34,7 @@ Index: cloudinit/distros/opensuse.py
+ subnets = config.get('subnets', []) + subnets = config.get('subnets', [])
+ config_routes = '' + config_routes = ''
+ has_default_route = False + has_default_route = False
+ seen_default_gateway = None
+ for subnet in subnets: + for subnet in subnets:
+ # Render the default gateway if it is present + # Render the default gateway if it is present
+ gateway = subnet.get('gateway') + gateway = subnet.get('gateway')
@ -42,6 +43,8 @@ Index: cloudinit/distros/opensuse.py
+ ['default', gateway, '-', '-\n'] + ['default', gateway, '-', '-\n']
+ ) + )
+ has_default_route = True + has_default_route = True
+ if not seen_default_gateway:
+ seen_default_gateway = gateway
+ # Render subnet routes + # Render subnet routes
+ routes = subnet.get('routes', []) + routes = subnet.get('routes', [])
+ for route in routes: + for route in routes:
@ -58,7 +61,11 @@ Index: cloudinit/distros/opensuse.py
+ 'Skipping route; has no prefix "%s"', dest + 'Skipping route; has no prefix "%s"', dest
+ ) + )
+ continue + continue
+ if dest == 'default' and has_default_route: + if (
+ dest == 'default' and
+ has_default_route and
+ gateway == seen_default_gateway
+ ):
+ dest_info = dest + dest_info = dest
+ if gateway: + if gateway:
+ dest_info = ' '.join([dest, gateway, '-', '-']) + dest_info = ' '.join([dest, gateway, '-', '-'])

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Nov 10 11:39:09 UTC 2020 - Robert Schweikert <rjschwei@suse.com>
- Update cloud-init-write-routes.patch (bsc#1177526)
+ Fix missing default route when dual stack network setup is used. Once
a default route was configured for Ipv6 or IPv4 the default route
configuration for the othre protocol was skipped.
------------------------------------------------------------------- -------------------------------------------------------------------
Sat Oct 17 10:25:30 UTC 2020 - Robert Schweikert <rjschwei@suse.com> Sat Oct 17 10:25:30 UTC 2020 - Robert Schweikert <rjschwei@suse.com>