You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OCPBUGS-79354: Canonicalize all IP Address comparisons
1. pkg/operator/ceohelpers/common.go
- Added CanonicalizeIP() function (lines 37-46): Converts IP addresses to canonical form using net.ParseIP().String()
- Normalizes IPv6 addresses (e.g., 2001:0db8::1 → 2001:db8::1)
- Auto-converts IPv4-mapped IPv6 to IPv4 (e.g., ::ffff:192.0.2.1 → 192.0.2.1)
- Returns original string if invalid IP
- Updated 4 functions to use canonicalization:
- MemberToNodeInternalIP() - canonicalizes IP extracted from etcd member
- IndexMachinesByNodeInternalIP() - canonicalizes map keys
- FindMachineByNodeInternalIP() - canonicalizes both sides of comparison
- VotingMemberIPListSet() - canonicalizes IPs before inserting into set
- MemberIPSetFromConfigMap() - canonicalizes IPs from configmap
2. pkg/operator/clustermemberremovalcontroller/clustermemberremovalcontroller.go
- Updated hasInternalIP() function (line 528): Canonicalizes both machine and member IPs before comparison
3. pkg/operator/machinedeletionhooks/machinedeletionhooks.go
- Updated line 149: Canonicalizes machine address before set lookup
4. pkg/operator/ceohelpers/common_test.go
- Added comprehensive TestCanonicalizeIP() with 12 test cases covering:
- IPv4 addresses
- IPv6 compressed and full forms
- IPv6 with leading zeros and mixed case
- IPv4-mapped IPv6 conversion
- Loopback addresses
- Invalid IP handling
Impact
This fixes potential bugs where IPv6 addresses in different representations (e.g., 2001:db8::1 vs 2001:0db8:0000:0000:0000:0000:0000:0001) would fail to match, causing:
- Machine lookups to fail
- Member removal decisions to be incorrect
- Deletion hooks to be misapplied
Note: This PR is opened with claude based on findings by the openshift-installer team. Review of claude's work and instructions given by @barbacbd.
0 commit comments