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

host-local: remove redundant startRange in RangeIterator to avoid mismatching with startIP #583

Merged
merged 1 commit into from
Mar 10, 2021

Conversation

mars1024
Copy link
Member

@mars1024 mars1024 commented Feb 9, 2021

Ref to #579 , just try another way to fix the same issue. Here is the details #579 (comment).

Signed-off-by: Bruce Ma [email protected]

Fixes #594

@mars1024 mars1024 requested a review from squeed February 9, 2021 06:27
@mars1024
Copy link
Member Author

mars1024 commented Feb 9, 2021

/assign @squeed

@@ -215,6 +215,7 @@ func (i *RangeIter) Next() (*net.IPNet, net.IP) {

if i.startIP == nil {
i.startIP = i.cur
i.startRange = i.rangeIdx
} else if i.rangeIdx == i.startRange && i.cur.Equal(i.startIP) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I look at this, do we even need startRange? Since we validate that ranges can't overlap, that should be sufficient, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha, good self-question :) , maybe I should walk all lines to figure this out

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mars1024 any thoughts on whether we can remove startRange?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I think startRange is redundant and I'll remove it

@mars1024 mars1024 changed the title host-local: keep startIP and startRange matching in RangeIterator host-local: remove redundant startRange in RangeIterator to avoid mismatching with startIP Mar 4, 2021
@mars1024
Copy link
Member Author

mars1024 commented Mar 4, 2021

Through the advice from @squeed , I've removed the redundant startRange to resolve this mismatching issue, which seems more brief and clean.
/cc @dcbw @bboreham

Copy link
Contributor

@bboreham bboreham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!

@squeed
Copy link
Member

squeed commented Mar 10, 2021

This looks awesome, thanks!

@squeed squeed merged commit 2989aba into master Mar 10, 2021
@jellonek jellonek deleted the bugfix/wrong_startrange branch April 14, 2022 14:40
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.

host-local hang because of mismatched startRange and startIP
4 participants