Fix: NFT_DYNSET_F_EXPR not supported for kernels < 5.11-rc3 (#276)

Note that this will fix support for single expressions on older kernels but multiple expressions on older kernels will remain unsupported as NFT_DYNSET_F_EXPR flag should not be omitted for dynsets with multiple expressions.
This commit is contained in:
_|+ 2024-09-13 08:54:50 +02:00 committed by GitHub
parent 5cbea79940
commit 583cd2bdea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -77,7 +77,6 @@ func (e *Dynset) marshalData(fam byte) ([]byte, error) {
// Per https://git.netfilter.org/libnftnl/tree/src/expr/dynset.c?id=84d12cfacf8ddd857a09435f3d982ab6250d250c#n170
if len(e.Exprs) > 0 {
flags |= NFT_DYNSET_F_EXPR
switch len(e.Exprs) {
case 1:
exprData, err := Marshal(fam, e.Exprs[0])
@ -86,6 +85,7 @@ func (e *Dynset) marshalData(fam byte) ([]byte, error) {
}
opAttrs = append(opAttrs, netlink.Attribute{Type: unix.NFTA_DYNSET_EXPR, Data: exprData})
default:
flags |= NFT_DYNSET_F_EXPR
var elemAttrs []netlink.Attribute
for _, ex := range e.Exprs {
exprData, err := Marshal(fam, ex)