lookup dest reg check fix (#57)

Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
This commit is contained in:
Serguei Bezverkhi 2019-08-31 03:36:20 -04:00 committed by Michael Stapelberg
parent 2d823533fe
commit 4b2264477a
1 changed files with 2 additions and 1 deletions

View File

@ -26,6 +26,7 @@ import (
type Lookup struct { type Lookup struct {
SourceRegister uint32 SourceRegister uint32
DestRegister uint32 DestRegister uint32
IsDestRegSet bool
SetID uint32 SetID uint32
SetName string SetName string
@ -38,7 +39,7 @@ func (e *Lookup) marshal() ([]byte, error) {
if e.SourceRegister != 0 { if e.SourceRegister != 0 {
opAttrs = append(opAttrs, netlink.Attribute{Type: unix.NFTA_LOOKUP_SREG, Data: binaryutil.BigEndian.PutUint32(e.SourceRegister)}) opAttrs = append(opAttrs, netlink.Attribute{Type: unix.NFTA_LOOKUP_SREG, Data: binaryutil.BigEndian.PutUint32(e.SourceRegister)})
} }
if e.DestRegister != 0 { if e.IsDestRegSet {
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 { if e.Invert {