fix: Process rule is not work in classical rule-set

This commit is contained in:
gVisor bot 2023-01-04 21:18:07 +08:00
parent ae5e4559dc
commit 290a425c42

View file

@ -8,10 +8,11 @@ import (
) )
type classicalStrategy struct { type classicalStrategy struct {
rules []C.Rule rules []C.Rule
count int count int
shouldResolveIP bool shouldResolveIP bool
parse func(tp, payload, target string, params []string) (parsed C.Rule, parseErr error) shouldFindProcess bool
parse func(tp, payload, target string, params []string) (parsed C.Rule, parseErr error)
} }
func (c *classicalStrategy) Match(metadata *C.Metadata) bool { func (c *classicalStrategy) Match(metadata *C.Metadata) bool {
@ -32,6 +33,10 @@ func (c *classicalStrategy) ShouldResolveIP() bool {
return c.shouldResolveIP return c.shouldResolveIP
} }
func (c *classicalStrategy) ShouldFindProcess() bool {
return c.shouldFindProcess
}
func (c *classicalStrategy) OnUpdate(rules []string) { func (c *classicalStrategy) OnUpdate(rules []string) {
var classicalRules []C.Rule var classicalRules []C.Rule
shouldResolveIP := false shouldResolveIP := false
@ -45,6 +50,10 @@ func (c *classicalStrategy) OnUpdate(rules []string) {
shouldResolveIP = r.ShouldResolveIP() shouldResolveIP = r.ShouldResolveIP()
} }
if !c.shouldFindProcess {
c.shouldFindProcess = r.ShouldFindProcess()
}
classicalRules = append(classicalRules, r) classicalRules = append(classicalRules, r)
} }
} }