Add support for inverted set lookups. (#10)
This commit is contained in:
parent
51ca8da884
commit
ca263a814b
|
@ -29,6 +29,7 @@ type Lookup struct {
|
||||||
|
|
||||||
SetID uint32
|
SetID uint32
|
||||||
SetName string
|
SetName string
|
||||||
|
Invert bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *Lookup) marshal() ([]byte, error) {
|
func (e *Lookup) marshal() ([]byte, error) {
|
||||||
|
@ -40,6 +41,9 @@ func (e *Lookup) marshal() ([]byte, error) {
|
||||||
if e.DestRegister != 0 {
|
if e.DestRegister != 0 {
|
||||||
opAttrs = append(opAttrs, netlink.Attribute{Type: unix.NFTA_LOOKUP_DREG, Data: binaryutil.BigEndian.PutUint32(e.DestRegister)})
|
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,
|
opAttrs = append(opAttrs,
|
||||||
netlink.Attribute{Type: unix.NFTA_LOOKUP_SET, Data: []byte(e.SetName + "\x00")},
|
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)},
|
netlink.Attribute{Type: unix.NFTA_LOOKUP_SET_ID, Data: binaryutil.BigEndian.PutUint32(e.SetID)},
|
||||||
|
|
Loading…
Reference in New Issue