rule: fix 32-bit platforms don't support adding rules with a mark 0xF0000000#983
rule: fix 32-bit platforms don't support adding rules with a mark 0xF0000000#983aboch merged 1 commit intovishvananda:mainfrom qxoqx:main
Conversation
|
May be related to #528 |
|
@antoninbas please check |
antoninbas
left a comment
There was a problem hiding this comment.
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
inttype on a 32-bit platform is 0x7FFFFFFF. Since 0xF0000000 exceeds this limit, we need to useuintinstead ofintto handle these values.I also tried to use unit tests under x86 architecture and failed
netlink/route_test.go
Line 2336 in 4d4ba14