Skip to content

Commit

Permalink
network_manager: Assign routes to ip section by ip version
Browse files Browse the repository at this point in the history
  • Loading branch information
holmanb committed Oct 19, 2023
1 parent 9a401b4 commit 5ee7253
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cloudinit/net/network_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,14 @@ def _add_route(self, family, route):
Adds a ipv[46].route<n> property.
"""

# family of the gateway must match the family of the route
gateway_family = "ipv6" if is_ipv6_address(route.get("gateway")) else "ipv4"
if gateway_family != family:
return
value = route["network"] + "/" + str(route["prefix"])
if "gateway" in route:
value = value + "," + route["gateway"]

self._add_numbered(family, "route", value)

def _add_nameserver(self, dns):
Expand Down

0 comments on commit 5ee7253

Please sign in to comment.