fix: correct .0 octet truncation in PaddedStringToIPV4 - #182
Open
a11ensu wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description: Fixes a regression where IPv4 addresses containing a .0 octet are truncated when read back from the SQLite store, producing invalid values in the IPAM CR status.
PaddedStringToIPV4() (pkg/utils/utils.go) un-pads stored addresses using strings.TrimLeft(octet, "0"). For an all-zero octet, "000" is stripped to "" instead of "0", so any address ending in (or containing) a 0 octet is corrupted on the read/write-back path — e.g. 10.65.82.0 (stored as 010.065.082.000) is reconstructed as 10.65.82., and 0.0.0.0 becomes .... This surfaces as IPStatus[N].ip: Invalid value: "10.65.82." on network-boundary addresses. The regression was introduced in d06b176 (#176) and shipped in v0.1.13.
Changes Proposed in PR:
Fixes
NA
General Checklist
CRD Checklist
NA (no CR schema change)