The code for doing IPAM never gave up if IPAM was un-configured later.

Found by inspection.

Signed-off-by: Ben Pfaff <b...@ovn.org>
---
 ovn/northd/ovn-northd.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index 344b595ad3c1..8755fa1f40c0 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -544,9 +544,17 @@ init_ipam_info_for_datapath(struct ovn_datapath *od)
         }
         od->ipam_info->ipv6_prefix_set = ipv6_parse(
             ipv6_prefix, &od->ipam_info->ipv6_prefix);
+    } else {
+        if (od->ipam_info) {
+            od->ipam_info->ipv6_prefix_set = false;
+        }
     }
 
     if (!subnet_str) {
+        if (od->ipam_info) {
+            bitmap_free(od->ipam_info->allocated_ipv4s);
+            od->ipam_info->allocated_ipv4s = NULL;
+        }
         return;
     }
 
@@ -557,6 +565,12 @@ init_ipam_info_for_datapath(struct ovn_datapath *od)
             = VLOG_RATE_LIMIT_INIT(5, 1);
         VLOG_WARN_RL(&rl, "bad 'subnet' %s", subnet_str);
         free(error);
+
+        if (od->ipam_info) {
+            bitmap_free(od->ipam_info->allocated_ipv4s);
+            od->ipam_info->allocated_ipv4s = NULL;
+        }
+
         return;
     }
 
-- 
2.16.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to