aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource/options.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-05-17 19:57:54 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-05-17 19:57:54 +0200
commit738d58ade0f41fb8ab33066dc0dd486d86383ef5 (patch)
tree1a924306f9af60f1067aa0c9ca0859664d8f3319 /pkg/csource/options.go
parent3717901c109694be56bb24593db945e4367ecf14 (diff)
pkg/csource: minimize netdevices and net reset
Add separate options to minimize netdevices setup and net namespace reset. Fixes #581
Diffstat (limited to 'pkg/csource/options.go')
-rw-r--r--pkg/csource/options.go14
1 files changed, 14 insertions, 0 deletions
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
}