Addressing comments

Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
This commit is contained in:
Serguei Bezverkhi 2020-02-09 08:48:53 -05:00
parent 8093f4aecc
commit 1bcf0471bb
2 changed files with 3 additions and 3 deletions

View File

@ -81,7 +81,7 @@ func (e *Dynset) unmarshal(data []byte) error {
case unix.NFTA_DYNSET_OP:
e.Operation = ad.Uint32()
case unix.NFTA_DYNSET_TIMEOUT:
e.Timeout = time.Duration(ad.Uint64() * 1000)
e.Timeout = time.Duration(time.Millisecond * time.Duration(ad.Uint64()))
case unix.NFTA_DYNSET_FLAGS:
e.Invert = (ad.Uint32() & unix.NFT_DYNSET_F_INV) != 0
}

4
set.go
View File

@ -173,7 +173,7 @@ func (s *SetElement) decode() func(b []byte) error {
flags := ad.Uint32()
s.IntervalEnd = (flags & unix.NFT_SET_ELEM_INTERVAL_END) != 0
case unix.NFTA_SET_ELEM_TIMEOUT:
s.Timeout = time.Duration(ad.Uint64() * 1000)
s.Timeout = time.Duration(time.Millisecond * time.Duration(ad.Uint64()))
}
}
return ad.Err()
@ -490,7 +490,7 @@ func setsFromMsg(msg netlink.Message) (*Set, error) {
case unix.NFTA_SET_ID:
set.ID = binary.BigEndian.Uint32(ad.Bytes())
case unix.NFTA_SET_TIMEOUT:
set.Timeout = time.Duration(binary.BigEndian.Uint64(ad.Bytes()) * 1000)
set.Timeout = time.Duration(time.Millisecond * time.Duration(binary.BigEndian.Uint64(ad.Bytes())))
set.HasTimeout = true
case unix.NFTA_SET_FLAGS:
flags := ad.Uint32()