summaryrefslogtreecommitdiff
path: root/cloudinit/net
diff options
context:
space:
mode:
authorRaphael Glon <raphael.glon@ovh.net>2019-03-21 13:38:53 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2019-03-21 13:38:53 +0000
commit22e332933e78bc1c819c4f876d48620605ae813b (patch)
treee890656c48c869d1fbfb424790d16a658fe7f690 /cloudinit/net
parent5e5894d68d21bf33649aca36973a0ef2fe72f01d (diff)
downloadvyos-cloud-init-22e332933e78bc1c819c4f876d48620605ae813b.tar.gz
vyos-cloud-init-22e332933e78bc1c819c4f876d48620605ae813b.zip
net: Fix ipv6 static routes when using eni renderer
When rendering ipv6 static routes in eni format the post-up/pre down commands were not correct for ipv6. LP: #1818669
Diffstat (limited to 'cloudinit/net')
-rw-r--r--cloudinit/net/eni.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/cloudinit/net/eni.py b/cloudinit/net/eni.py
index 64236320..b129bb62 100644
--- a/cloudinit/net/eni.py
+++ b/cloudinit/net/eni.py
@@ -366,8 +366,6 @@ class Renderer(renderer.Renderer):
down = indent + "pre-down route del"
or_true = " || true"
mapping = {
- 'network': '-net',
- 'netmask': 'netmask',
'gateway': 'gw',
'metric': 'metric',
}
@@ -379,13 +377,21 @@ class Renderer(renderer.Renderer):
default_gw = ' -A inet6 default'
route_line = ''
- for k in ['network', 'netmask', 'gateway', 'metric']:
- if default_gw and k in ['network', 'netmask']:
+ for k in ['network', 'gateway', 'metric']:
+ if default_gw and k == 'network':
continue
if k == 'gateway':
route_line += '%s %s %s' % (default_gw, mapping[k], route[k])
elif k in route:
- route_line += ' %s %s' % (mapping[k], route[k])
+ if k == 'network':
+ if ':' in route[k]:
+ route_line += ' -A inet6'
+ else:
+ route_line += ' -net'
+ if 'prefix' in route:
+ route_line += ' %s/%s' % (route[k], route['prefix'])
+ else:
+ route_line += ' %s %s' % (mapping[k], route[k])
content.append(up + route_line + or_true)
content.append(down + route_line + or_true)
return content