From 738d58ade0f41fb8ab33066dc0dd486d86383ef5 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 17 May 2018 19:57:54 +0200 Subject: pkg/csource: minimize netdevices and net reset Add separate options to minimize netdevices setup and net namespace reset. Fixes #581 --- pkg/csource/options.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'pkg/csource/options.go') diff --git a/pkg/csource/options.go b/pkg/csource/options.go index 7b9ed7050..fd89abcb6 100644 --- a/pkg/csource/options.go +++ b/pkg/csource/options.go @@ -27,6 +27,8 @@ type Options struct { EnableTun bool `json:"tun,omitempty"` UseTmpDir bool `json:"tmpdir,omitempty"` EnableCgroups bool `json:"cgroups,omitempty"` + EnableNetdev bool `json:"netdev,omitempty"` + ResetNet bool `json:"resetnet,omitempty"` HandleSegv bool `json:"segv,omitempty"` WaitRepeat bool `json:"waitrepeat,omitempty"` Debug bool `json:"debug,omitempty"` @@ -66,6 +68,18 @@ func (opts Options) Check() error { if opts.EnableCgroups && !opts.UseTmpDir { return errors.New("EnableCgroups without UseTmpDir") } + if opts.EnableCgroups && !opts.WaitRepeat { + return errors.New("EnableCgroups without WaitRepeat") + } + if opts.EnableNetdev && opts.Sandbox == "" { + return errors.New("EnableNetdev without sandbox") + } + if opts.ResetNet && opts.Sandbox == "" { + return errors.New("ResetNet without sandbox") + } + if opts.ResetNet && !opts.WaitRepeat { + return errors.New("ResetNet without WaitRepeat") + } return nil } -- cgit mrf-deployment