Skip to content

Commit

Permalink
Fix: NFT_DYNSET_F_EXPR not supported for kernels < 5.11-rc3 (#276)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Ignatella authored Sep 13, 2024
1 parent 5cbea79 commit 583cd2b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion expr/dynset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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)
Expand Down

0 comments on commit 583cd2b

Please sign in to comment.