From 7d57fcff6d32fd706dd745315c0f8f72d94385eb Mon Sep 17 00:00:00 2001
From: James Falcon <james.falcon@canonical.com>
Date: Tue, 24 Jan 2023 08:54:05 -0600
Subject: [PATCH] Fix default route rendering on v2 ipv6 (#1973)

Reference:https://github.com/canonical/cloud-init/commit/7d57fcff6d32fd706dd745315c0f8f72d94385eb
Conflict:NA

::/0 would get rendered as ::/64 rather than ::/0 across all renderers
using ipv6 in a v2 config.

LP: #2003562
---
 cloudinit/net/network_state.py | 2 +-
 tests/unittests/test_net.py    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py
index 0d81291..857942a 100644
--- a/cloudinit/net/network_state.py
+++ b/cloudinit/net/network_state.py
@@ -857,7 +857,7 @@ def _normalize_net_keys(network, address_keys=()):
 
     @returns: A dict containing normalized prefix and matching addr_key.
     """
-    net = dict((k, v) for k, v in network.items() if v)
+    net = {k: v for k, v in network.items() if v or v == 0}
     addr_key = None
     for key in address_keys:
         if net.get(key):
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index a698c65..2d2cff0 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -3962,7 +3962,7 @@ USERCTL=no
                 # Created by cloud-init on instance boot automatically, do not edit.
                 #
                 2a00:1730:fff9:100::1/128 via ::0  dev eth0
-                ::0/64 via 2a00:1730:fff9:100::1  dev eth0
+                ::0/0 via 2a00:1730:fff9:100::1  dev eth0
                 """  # noqa: E501
             ),
         }
-- 
2.33.0


