diff options
| author | Andrey Konovalov <andreyknvl@google.com> | 2017-05-18 16:08:43 +0200 |
|---|---|---|
| committer | Andrey Konovalov <andreyknvl@google.com> | 2017-06-12 19:48:23 +0200 |
| commit | 4d1df73af9a6d40d3111e3f2a7dfb9f138fbde4b (patch) | |
| tree | 48e66cf8d6f91fa3bcabc60ee94ca070befef0af /csource/csource.go | |
| parent | 10c9064bfc4890e5895057021280a0558131e3eb (diff) | |
csource: force enable tun flag when required
Diffstat (limited to 'csource/csource.go')
| -rw-r--r-- | csource/csource.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/csource/csource.go b/csource/csource.go index ccc235f7e..0a5bcddd7 100644 --- a/csource/csource.go +++ b/csource/csource.go @@ -42,6 +42,18 @@ type Options struct { Repro bool } +func RequiresTun(p *prog.Prog) bool { + for _, c := range p.Calls { + switch c.Meta.CallName { + case "syz_emit_ethernet": + return true + case "syz_extract_tcp_seq": + return true + } + } + return false +} + func Write(p *prog.Prog, opts Options) ([]byte, error) { exec := make([]byte, prog.ExecBufferSize) if err := p.SerializeForExec(exec, 0); err != nil { @@ -49,6 +61,10 @@ func Write(p *prog.Prog, opts Options) ([]byte, error) { } w := new(bytes.Buffer) + if RequiresTun(p) { + opts.EnableTun = true + } + fmt.Fprint(w, "// autogenerated by syzkaller (http://github.com/google/syzkaller)\n\n") handled := make(map[string]int) |
