From ca263a814b494f17fe674dbf6c24535fb2d63859 Mon Sep 17 00:00:00 2001 From: Tom D <40675700+twitchy-jsonp@users.noreply.github.com> Date: Wed, 13 Feb 2019 01:06:43 -0800 Subject: [PATCH] Add support for inverted set lookups. (#10) --- expr/lookup.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/expr/lookup.go b/expr/lookup.go index 50dd5fc..67ab165 100644 --- a/expr/lookup.go +++ b/expr/lookup.go @@ -29,6 +29,7 @@ type Lookup struct { SetID uint32 SetName string + Invert bool } func (e *Lookup) marshal() ([]byte, error) { @@ -40,6 +41,9 @@ func (e *Lookup) marshal() ([]byte, error) { if e.DestRegister != 0 { opAttrs = append(opAttrs, netlink.Attribute{Type: unix.NFTA_LOOKUP_DREG, Data: binaryutil.BigEndian.PutUint32(e.DestRegister)}) } + if e.Invert { + opAttrs = append(opAttrs, netlink.Attribute{Type: unix.NFTA_LOOKUP_FLAGS, Data: binaryutil.BigEndian.PutUint32(unix.NFT_LOOKUP_F_INV)}) + } opAttrs = append(opAttrs, netlink.Attribute{Type: unix.NFTA_LOOKUP_SET, Data: []byte(e.SetName + "\x00")}, netlink.Attribute{Type: unix.NFTA_LOOKUP_SET_ID, Data: binaryutil.BigEndian.PutUint32(e.SetID)},