add ct_stat bit and kernal source comment

This commit is contained in:
lyonsdpy 2021-05-14 17:12:33 +08:00
parent c7f280ac5c
commit 65dfe1ac13
2 changed files with 7 additions and 6 deletions

View File

@ -48,11 +48,12 @@ const (
CtKeyZONE CtKey = unix.NFT_CT_ZONE CtKeyZONE CtKey = unix.NFT_CT_ZONE
CtKeyEVENTMASK CtKey = unix.NFT_CT_EVENTMASK CtKeyEVENTMASK CtKey = unix.NFT_CT_EVENTMASK
CtStatINVALID uint32 = 1 // https://sources.debian.org/src//nftables/0.9.8-3/src/ct.c/?hl=39#L39
CtStatESTABLISHED uint32 = 2 CtStatBitINVALID uint32 = 1
CtStatRELATED uint32 = 4 CtStatBitESTABLISHED uint32 = 2
CtStatNEW uint32 = 8 CtStatBitRELATED uint32 = 4
CtStatUNTRACKED uint32 = 64 CtStatBitNEW uint32 = 8
CtStatBitUNTRACKED uint32 = 64
) )
// Ct defines type for NFT connection tracking // Ct defines type for NFT connection tracking

View File

@ -1083,7 +1083,7 @@ func TestCtStat(t *testing.T) {
SourceRegister: 1, SourceRegister: 1,
DestRegister: 1, DestRegister: 1,
Len: 4, Len: 4,
Mask: binaryutil.NativeEndian.PutUint32(expr.CtStatESTABLISHED | expr.CtStatRELATED), Mask: binaryutil.NativeEndian.PutUint32(expr.CtStatBitESTABLISHED | expr.CtStatBitRELATED),
Xor: binaryutil.NativeEndian.PutUint32(0), Xor: binaryutil.NativeEndian.PutUint32(0),
}, },
&expr.Cmp{Op: expr.CmpOpNeq, Register: 1, Data: []byte{0, 0, 0, 0}}, &expr.Cmp{Op: expr.CmpOpNeq, Register: 1, Data: []byte{0, 0, 0, 0}},