-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 prefix length comparison bug in AutoApprovers route evaluation #862
Fix prefix length comparison bug in AutoApprovers route evaluation #862
Conversation
6e2b6f8
to
ef5fe7f
Compare
@@ -125,7 +125,7 @@ func (autoApprovers *AutoApprovers) GetRouteApprovers( | |||
return nil, err | |||
} | |||
|
|||
if autoApprovedPrefix.Bits() >= prefix.Bits() && | |||
if prefix.Bits() >= autoApprovedPrefix.Bits() && |
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.
Is this check even necessary, given the Contains
check below?
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.
Never mind I see, Contains
operates on a single IP, hence the need for this check.
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.
ah yeah that makes sense, I'd forgotten entirely and it's pretty late here 😅
+1, I've been soaking this change in my personal tailnet for a week now, LGTM 👍 |
ty! my mistakes are undone 😂 |
Fixes a bug raised by @samcday in #763 where a subprefix (
10.0.1.0/24
) of an autoApproved route (10.0.0.0/8
) wasn't being approved due to an incorrect comparison of their prefix lengths. The corresponding unit test has been modified to capture this regression.