Skip to content

Commit

Permalink
Fix incorrect size check in NFGenMsg (#287)
Browse files Browse the repository at this point in the history
Fix incorrect size check in NFGenMsg, resolving TableFamily issue for rules in monitor
  • Loading branch information
patryk4815 authored Dec 13, 2024
1 parent c96bb63 commit eb34035
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ func TestMonitor(t *testing.T) {
*gotChain.Hooknum != *postrouting.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) {
t.Fatal("no want rule")
}
Expand Down
2 changes: 1 addition & 1 deletion util.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type NFGenMsg struct {
}

func (genmsg *NFGenMsg) Decode(b []byte) {
if len(b) < 16 {
if len(b) < 4 {
return
}
genmsg.NFGenFamily = b[0]
Expand Down

0 comments on commit eb34035

Please sign in to comment.