set: Parse bytes length on sets
Parse the bytes length for key and data types when reading the sets. Signed-off-by: Rafael Campos <methril@gmail.com>
This commit is contained in:
parent
98de8c8ac9
commit
8f2d395e10
4
set.go
4
set.go
|
@ -719,6 +719,8 @@ func setsFromMsg(msg netlink.Message) (*Set, error) {
|
||||||
return nil, fmt.Errorf("could not determine data type: %w", err)
|
return nil, fmt.Errorf("could not determine data type: %w", err)
|
||||||
}
|
}
|
||||||
set.KeyType = dt
|
set.KeyType = dt
|
||||||
|
case unix.NFTA_SET_KEY_LEN:
|
||||||
|
set.KeyType.Bytes = binary.BigEndian.Uint32(ad.Bytes())
|
||||||
case unix.NFTA_SET_DATA_TYPE:
|
case unix.NFTA_SET_DATA_TYPE:
|
||||||
nftMagic := ad.Uint32()
|
nftMagic := ad.Uint32()
|
||||||
// Special case for the data type verdict, in the message it is stored as 0xffffff00 but it is defined as 1
|
// Special case for the data type verdict, in the message it is stored as 0xffffff00 but it is defined as 1
|
||||||
|
@ -731,6 +733,8 @@ func setsFromMsg(msg netlink.Message) (*Set, error) {
|
||||||
return nil, fmt.Errorf("could not determine data type: %w", err)
|
return nil, fmt.Errorf("could not determine data type: %w", err)
|
||||||
}
|
}
|
||||||
set.DataType = dt
|
set.DataType = dt
|
||||||
|
case unix.NFTA_SET_DATA_LEN:
|
||||||
|
set.DataType.Bytes = binary.BigEndian.Uint32(ad.Bytes())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &set, nil
|
return &set, nil
|
||||||
|
|
Loading…
Reference in New Issue