# rule: fix 32-bit platforms don't support adding rules with a mark value 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.
This commit is contained in:
qianxiao
2024-07-29 17:12:06 +08:00
committed by Alessandro Boch
parent d13535d71e
commit 8f96fd8b2f
5 changed files with 295 additions and 33 deletions

View File

@@ -1521,7 +1521,7 @@ type RouteGetOptions struct {
VrfName string
SrcAddr net.IP
UID *uint32
Mark int
Mark uint32
FIBMatch bool
}
@@ -1630,7 +1630,7 @@ func (h *Handle) RouteGetWithOptions(destination net.IP, options *RouteGetOption
if options.Mark > 0 {
b := make([]byte, 4)
native.PutUint32(b, uint32(options.Mark))
native.PutUint32(b, options.Mark)
req.AddData(nl.NewRtAttr(unix.RTA_MARK, b))
}