From 5fa67772392a6acba60dfcf9c8093cac39ff9ebe Mon Sep 17 00:00:00 2001 From: Skyxim Date: Wed, 4 Jan 2023 21:18:07 +0800 Subject: [PATCH] fix: Process rule is not work in classical rule-set --- rules/provider/classical_strategy.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/rules/provider/classical_strategy.go b/rules/provider/classical_strategy.go index 12623271..73426e85 100644 --- a/rules/provider/classical_strategy.go +++ b/rules/provider/classical_strategy.go @@ -8,10 +8,11 @@ import ( ) type classicalStrategy struct { - rules []C.Rule - count int - shouldResolveIP bool - parse func(tp, payload, target string, params []string) (parsed C.Rule, parseErr error) + rules []C.Rule + count int + shouldResolveIP bool + shouldFindProcess bool + parse func(tp, payload, target string, params []string) (parsed C.Rule, parseErr error) } func (c *classicalStrategy) Match(metadata *C.Metadata) bool { @@ -32,6 +33,10 @@ func (c *classicalStrategy) ShouldResolveIP() bool { return c.shouldResolveIP } +func (c *classicalStrategy) ShouldFindProcess() bool { + return c.shouldFindProcess +} + func (c *classicalStrategy) OnUpdate(rules []string) { var classicalRules []C.Rule shouldResolveIP := false @@ -45,6 +50,10 @@ func (c *classicalStrategy) OnUpdate(rules []string) { shouldResolveIP = r.ShouldResolveIP() } + if !c.shouldFindProcess { + c.shouldFindProcess = r.ShouldFindProcess() + } + classicalRules = append(classicalRules, r) } }