You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type Rule struct {
// ...
Mark int
Mask int
// ...
}
The default value for Mark and Mask is -1 when creating an instance of Rule with NewRule, and this translates in the corresponding attributes being omitted from the generated netlink message:
if rule.Mark >= 0 {
b := make([]byte, 4)
native.PutUint32(b, uint32(rule.Mark))
req.AddData(nl.NewRtAttr(nl.FRA_FWMARK, b))
}
if rule.Mask >= 0 {
b := make([]byte, 4)
native.PutUint32(b, uint32(rule.Mask))
req.AddData(nl.NewRtAttr(nl.FRA_FWMASK, b))
}
I have a package that uses github.com/vishvananda/netlink as follows:
ipRule := netlink.NewRule()
ipRule.Mark = 1 << 31
ipRule.Mask = 0xffffffff # same as using the default (-1), but writing this makes sense to be explicit
...
When I try to build this code for a 32-bit architecture (in my case arm/v7), I get errors like this:
constant 2147483648 overflows int
constant 4294967295 overflows int
Would it be possible to change the type of Mark and Mask in order to have better support for 32-bit architectures? I would suggest making these fields *int32 values.
(I have limited knowledge of ip rule but I am assuming that 1 << 31 is a legit fwmark value).
The text was updated successfully, but these errors were encountered:
Rule
is defined as follows in rule.go:The default value for
Mark
andMask
is -1 when creating an instance ofRule
withNewRule
, and this translates in the corresponding attributes being omitted from the generated netlink message:I have a package that uses
github.com/vishvananda/netlink
as follows:When I try to build this code for a 32-bit architecture (in my case
arm/v7
), I get errors like this:Would it be possible to change the type of
Mark
andMask
in order to have better support for 32-bit architectures? I would suggest making these fields*int32
values.(I have limited knowledge of
ip rule
but I am assuming that1 << 31
is a legit fwmark value).The text was updated successfully, but these errors were encountered: