-
Notifications
You must be signed in to change notification settings - Fork 748
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
rule: fix 32-bit platforms don't support adding rules with a mark 0xF0000000 #983
Conversation
May be related to #528 |
@antoninbas please 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.
The API changes look good to me, but I am not a maintainer for this repo.
Hopefully users don't find it confusing that Rule{Mark: 0}
means "match all marks" but Rule{Mark:1}
means "match mark 1 exclusively". To match mark 0 exclusively, one needs to use Rule{Mark: 0, Mask: &mask}
with mask := uint32(0xffffffff)
.
If other believe that this is confusing, the only solution is to make Mark
a pointer as well, which also impacts usability to some extent.
I used the |
…alue of 0x80000000/0xF0000000 ~ 0xF0000000/0xF0000000 The maximum value for an `int` type on a 32-bit platform is 0x7FFFFFFF. Since 0xF0000000 exceeds this limit, we need to use `uint` instead of `int` to handle these values.
@qxoqx I was unaware that there was a similar behavior with |
Thanks @antoninbas LGTM |
Thank you all for review the PR! |
rule: fix 32-bit platforms don't support adding rules with a mark value of 0x80000000/0xF0000000 ~ 0xF0000000/0xF0000000
netlink/rule.go
Line 14 in 4d4ba14
The maximum value for an
int
type on a 32-bit platform is 0x7FFFFFFF. Since 0xF0000000 exceeds this limit, we need to useuint
instead ofint
to handle these values.I also tried to use unit tests under x86 architecture and failed
netlink/route_test.go
Line 2336 in 4d4ba14