Skip to content

Commit

Permalink
Conntrack GC running in Retina default
Browse files Browse the repository at this point in the history
  • Loading branch information
manojks1999 committed Feb 6, 2025
1 parent ca2b7fb commit e56b583
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/plugin/common/common_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,16 @@ func NewPerfReader(l *log.ZapLogger, m *ebpf.Map, max, min int) (*perf.Reader, e
}
return nil, errors.New("failed to create perf reader")
}

// IsPluginEnabled checks if a given plugin is enabled in the config
func IsPluginEnabled(enabledPlugins []string, pluginName string) bool {
if enabledPlugins == nil {
return false
}
for _, plugin := range enabledPlugins {
if plugin == pluginName {
return true
}
}
return false
}
6 changes: 6 additions & 0 deletions pkg/plugin/conntrack/conntrack_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ func GenerateDynamic(ctx context.Context, dynamicHeaderPath string, conntrackMet

// Run starts the Conntrack garbage collection loop.
func (ct *Conntrack) Run(ctx context.Context) error {
// Check if packetparser plugin is enabled
if !plugincommon.IsPluginEnabled(ct.cfg.EnabledPlugins, "packetparser") {

Check failure on line 97 in pkg/plugin/conntrack/conntrack_linux.go

View workflow job for this annotation

GitHub Actions / Lint (linux, amd64)

ct.cfg undefined (type *Conntrack has no field or method cfg)) (typecheck)

Check failure on line 97 in pkg/plugin/conntrack/conntrack_linux.go

View workflow job for this annotation

GitHub Actions / Lint (linux, amd64)

ct.cfg undefined (type *Conntrack has no field or method cfg)) (typecheck)

Check failure on line 97 in pkg/plugin/conntrack/conntrack_linux.go

View workflow job for this annotation

GitHub Actions / Lint (linux, amd64)

ct.cfg undefined (type *Conntrack has no field or method cfg) (typecheck)

Check failure on line 97 in pkg/plugin/conntrack/conntrack_linux.go

View workflow job for this annotation

GitHub Actions / Lint (linux, amd64)

ct.cfg undefined (type *Conntrack has no field or method cfg)) (typecheck)

Check failure on line 97 in pkg/plugin/conntrack/conntrack_linux.go

View workflow job for this annotation

GitHub Actions / Lint (linux, arm64)

ct.cfg undefined (type *Conntrack has no field or method cfg)) (typecheck)

Check failure on line 97 in pkg/plugin/conntrack/conntrack_linux.go

View workflow job for this annotation

GitHub Actions / Lint (linux, arm64)

ct.cfg undefined (type *Conntrack has no field or method cfg)) (typecheck)

Check failure on line 97 in pkg/plugin/conntrack/conntrack_linux.go

View workflow job for this annotation

GitHub Actions / Lint (linux, arm64)

ct.cfg undefined (type *Conntrack has no field or method cfg) (typecheck)

Check failure on line 97 in pkg/plugin/conntrack/conntrack_linux.go

View workflow job for this annotation

GitHub Actions / Lint (linux, arm64)

ct.cfg undefined (type *Conntrack has no field or method cfg)) (typecheck)
ct.l.Info("Skipping Conntrack GC loop as packetparser plugin is not enabled")
return nil
}

ticker := time.NewTicker(ct.gcFrequency)
defer ticker.Stop()

Expand Down

0 comments on commit e56b583

Please sign in to comment.