From f7d7f390d124f8f162aea6fd5421911c382db1cb Mon Sep 17 00:00:00 2001 From: Evan Baker Date: Thu, 5 May 2022 17:56:51 +0000 Subject: [PATCH] include 0th address when parsing overlay cidrs Signed-off-by: Evan Baker --- cns/singletenantcontroller/conversion.go | 3 +-- cns/singletenantcontroller/conversion_test.go | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cns/singletenantcontroller/conversion.go b/cns/singletenantcontroller/conversion.go index afab6c034d..413a2d667c 100644 --- a/cns/singletenantcontroller/conversion.go +++ b/cns/singletenantcontroller/conversion.go @@ -88,8 +88,7 @@ func CreateNCRequestFromStaticNC(nc v1alpha.NetworkContainer) (*cns.CreateNetwor // iterate through all IP addresses in the subnet described by primaryPrefix and // add them to the request as secondary IPConfigs. - zeroAddr := primaryPrefix.Masked().Addr() // the masked address is the 0th IP in the subnet - for addr := zeroAddr.Next(); primaryPrefix.Contains(addr); addr = addr.Next() { + for addr := primaryPrefix.Masked().Addr(); primaryPrefix.Contains(addr); addr = addr.Next() { secondaryIPConfigs[addr.String()] = cns.SecondaryIPConfig{ IPAddress: addr.String(), NCVersion: int(nc.Version), diff --git a/cns/singletenantcontroller/conversion_test.go b/cns/singletenantcontroller/conversion_test.go index 3df4e0fc98..e6ce30f722 100644 --- a/cns/singletenantcontroller/conversion_test.go +++ b/cns/singletenantcontroller/conversion_test.go @@ -94,6 +94,10 @@ var validOverlayRequest = &cns.CreateNetworkContainerRequest{ NetworkContainerid: ncID, NetworkContainerType: cns.Docker, SecondaryIPConfigs: map[string]cns.SecondaryIPConfig{ + "10.0.0.0": { + IPAddress: "10.0.0.0", + NCVersion: version, + }, "10.0.0.1": { IPAddress: "10.0.0.1", NCVersion: version,