Add default routes for IPv4 and IPv6 only to ifcfg-* files and not to route-* or route6-* files in sysconfig
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Medium
|
Andreas Karis |
Bug Description
Since f38fa4131760290
(i) First of all, let me explain why only the IPv6 route was added to route6-* and not the IPv4 route to route-*
sysconfig.py
(...)
for route in subnet.
if _is_default_
(...)
The above will obviously overwrite GATEWAY0, NETMASK0, ADDRESS0 when there is an IPv4 default route and an IPv6 default route.
(ii) Now, interestingly, we don't want to add these routes to the route-* and route6-* files, because this would only result in duplicate default route declaration (we only need it in the ifcfg-* files, not in the route-* or route6-*).
Which means that this can be fixed by changing indentation for the following lines (moving all lines marked with "+" exactly 4 characters to the right). This moves the route_cfg part into the "else" condition:
~~~
cd /usr/lib/
[root@rhel-test net]# diff -u sysconfig.py.back sysconfig.py
--- sysconfig.py.back 2017-06-06 12:39:25.857595506 -0400
+++ sysconfig.py 2017-06-06 12:40:19.059595506 -0400
@@ -372,11 +372,11 @@
- for (old_key, new_key) in [('gateway', gw_key),
- ('netmask', nm_key),
- ('network', addr_key)]:
- if old_key in route:
- route_cfg[new_key] = route[old_key]
+ for (old_key, new_key) in [('gateway', gw_key),
+ ('netmask', nm_key),
+ ('network', addr_key)]:
+ if old_key in route:
+ route_cfg[new_key] = route[old_key]
@classmethod
def _render_
~~~
The above means that a route will only be added to the route_cfg array if it is not a default route.
Related branches
- Server Team CI bot: Approve (continuous-integration)
- cloud-init Commiters: Pending requested
-
Diff: 42 lines (+7/-13)2 files modifiedcloudinit/net/sysconfig.py (+7/-5)
tests/unittests/test_net.py (+0/-8)
- Server Team CI bot: Approve (continuous-integration)
- cloud-init Commiters: Pending requested
-
Diff: 42 lines (+7/-13)2 files modifiedcloudinit/net/sysconfig.py (+7/-5)
tests/unittests/test_net.py (+0/-8)
Changed in cloud-init: | |
assignee: | nobody → Andreas Karis (akaris) |
Changed in cloud-init: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Changed in cloud-init: | |
status: | Confirmed → Fix Committed |
This bug is believed to be fixed in cloud-init in 17.1. If this is still a problem for you, please make a comment and set the state back to New
Thank you.