Compare commits

..

2 Commits

Author SHA1 Message Date
Paul Greenberg 4c8ce809eb
Merge dae73eaa9c into eb34035740 2024-12-15 19:57:55 +00:00
patryk4815 eb34035740
Fix incorrect size check in NFGenMsg (#287)
Fix incorrect size check in NFGenMsg, resolving TableFamily issue for rules in monitor
2024-12-13 07:30:25 +01:00
2 changed files with 4 additions and 1 deletions

View File

@ -156,6 +156,9 @@ func TestMonitor(t *testing.T) {
*gotChain.Hooknum != *postrouting.Hooknum { *gotChain.Hooknum != *postrouting.Hooknum {
t.Fatal("no want chain", gotChain.Type, gotChain.Name, gotChain.Hooknum) t.Fatal("no want chain", gotChain.Type, gotChain.Name, gotChain.Hooknum)
} }
if gotRule.Table.Family != nat.Family {
t.Fatal("rule wrong family", gotRule.Table.Family, gotRule.Table.Name)
}
if len(gotRule.Exprs) != len(rule.Exprs) { if len(gotRule.Exprs) != len(rule.Exprs) {
t.Fatal("no want rule") t.Fatal("no want rule")
} }

View File

@ -38,7 +38,7 @@ type NFGenMsg struct {
} }
func (genmsg *NFGenMsg) Decode(b []byte) { func (genmsg *NFGenMsg) Decode(b []byte) {
if len(b) < 16 { if len(b) < 4 {
return return
} }
genmsg.NFGenFamily = b[0] genmsg.NFGenFamily = b[0]