Skip to content

Commit

Permalink
ipcache: Remove superfluous if condition
Browse files Browse the repository at this point in the history
See #21667 (comment)
for an in-depth discussion about this change. For local identities, this
condition never evaluated to false, since identities are different for
each prefix and thus no other prefix could have added a map entry for
the previously allocated identity.

A subsequent commit will cause InjectLabels to also allocate global
identities. In that case, the condition is actively harmful, since it
could cause an identity leak.

Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
  • Loading branch information
gandro authored and aanm committed Jan 27, 2023
1 parent b387be7 commit c96b9d8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/ipcache/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,8 @@ func (ipc *IPCache) InjectLabels(ctx context.Context, modifiedPrefixes []netip.P
// iteration of the loop, then we must balance the
// allocation from the prior InjectLabels() call by
// releasing the previous reference.
if _, ok := idsToAdd[oldID.ID]; !ok {
previouslyAllocatedIdentities[prefix] = oldID
}
previouslyAllocatedIdentities[prefix] = oldID

// If all associated metadata for this prefix has been removed,
// and the existing IPCache entry was never touched by any other
// subsystem using the old Upsert API, then we can safely remove
Expand Down

0 comments on commit c96b9d8

Please sign in to comment.