-
Notifications
You must be signed in to change notification settings - Fork 450
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: sometimes allocate IPv6 address failed but there is available IP in V6FreeIPList #2132
Conversation
pkg/ipam/ip.go
Outdated
@@ -15,7 +16,7 @@ type IPRange struct { | |||
} | |||
|
|||
func (a IP) Equal(b IP) bool { | |||
return a == b | |||
return net.ParseIP(string(a)).Equal(net.ParseIP(string(b))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return net.ParseIP(string(a)).Equal(net.ParseIP(string(b))) | |
return a == b || net.ParseIP(string(a)).Equal(net.ParseIP(string(b))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is Equal()
used? Is there any chance that net.ParseIP(string(a))
may return nil?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in splitIPRangeList, the equal function will return false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for example, ipr.End = "fd00::e9:ed1" and ip ="fd00::00e9:0ed1"
…ress return NoAvailableAddress when use ipam.GetStaticAddress with param ipv6 address without clean Zero such as "fd00::00e9:0ed1", and exactly subnet.V6FreeIPList has a range with start fd00::e9:ed1 and end with any v6 address,or start with an any v6 address and end with fd00::e9:ed1, it will cause ipr.Start.Equal(ip) or ipr.End.Equal(ip) failed, and no v6 address allocated
09dbd4f
to
7f3a9ea
Compare
sometimes ipam.GetStaticAddress return NoAvailableAddress but there is available IP in V6FreeIPList
when use ipam.GetStaticAddress with param ipv6 address without clean Zero such as "fd00::00e9:0ed1", and exactly subnet.V6FreeIPList has a range with start fd00::e9:ed1 and end with any v6 address, or start with an any v6 address and end with fd00::e9:ed1, it will cause ipr.Start.Equal(ip) or ipr.End.Equal(ip) failed, Because equal only check the string match .
What type of this PR
Examples of user facing changes:
Which issue(s) this PR fixes:
Fixes #(issue-number)