Compare commits

..

2 Commits

Author SHA1 Message Date
turekt 6c996cbd5f
Merge 590565fb36 into 38e481bfc4 2024-08-14 19:27:51 +00:00
turekt 590565fb36 Implement cthelper object expr 2024-08-14 21:27:41 +02:00
1 changed files with 8 additions and 2 deletions

View File

@ -1401,6 +1401,7 @@ func TestCtHelper(t *testing.T) {
Obj: &expr.CtHelper{
Name: "ftp",
L4Proto: unix.IPPROTO_TCP,
L3Proto: unix.NFPROTO_IPV4,
},
})
@ -1431,8 +1432,13 @@ func TestCtHelper(t *testing.T) {
t.Errorf("c.GetObject(cthelp1) failed: %v failed", err)
}
if help := obj1.(*nftables.NamedObj).Obj.(*expr.CtHelper); help.L4Proto != unix.IPPROTO_TCP {
t.Errorf("unexpected proto number: got %d, want %d", help.L4Proto, unix.IPPROTO_TCP)
help := obj1.(*nftables.NamedObj).Obj.(*expr.CtHelper)
if got, want := help.L4Proto, uint8(unix.IPPROTO_TCP); got != want {
t.Errorf("unexpected l4proto number: got %d, want %d", got, want)
}
if got, want := help.L3Proto, uint16(unix.NFPROTO_IPV4); got != want {
t.Errorf("unexpected l3proto number: got %d, want %d", got, want)
}
}