Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with mask length of gateway addresses #2305

Merged

Conversation

katiewasnothere
Copy link
Contributor

In more recent golang versions, net library's implementation of ParseIP was changed to always return a byte array of length 16 whether or not the parsed IP is IPv4 or IPv6 (see here). However, the GCS was relying on the length of ParseIP to match the IP type when calculating a mask length before adding the gateway address.

Without this change, a mask length of 128 is always created in cases where we add a gateway address that is outside the interface's subnet. If the gateway IP is IPv4 and the mask length is 128, then the call to netlink.AddrAdd will return invalid argument and we will fail to create a pod.

@katiewasnothere katiewasnothere requested a review from a team as a code owner November 1, 2024 18:37
interface's subnet
* See documentation at https://pkg.go.dev/net#ParseIP

Signed-off-by: Kathryn Baldauf <[email protected]>
@katiewasnothere katiewasnothere merged commit c65b789 into microsoft:main Nov 4, 2024
19 checks passed
@katiewasnothere katiewasnothere deleted the user/kabaldau/fix_parse_ip branch November 4, 2024 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants