aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2017-05-17 18:05:28 +0200
committerAndrey Konovalov <andreyknvl@google.com>2017-06-12 19:48:23 +0200
commit1ab96df8855796901f133c1afab0f7384fc92eea (patch)
tree733527f49344852acbc2a106ce51d5654559a3ae /executor
parent7b43c5f9f723c6d593cb03065ea3371b86c350c7 (diff)
executor: call flush_tun for repeat repros
Diffstat (limited to 'executor')
-rw-r--r--executor/common.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/executor/common.h b/executor/common.h
index 46356c6a9..55ed7a73a 100644
--- a/executor/common.h
+++ b/executor/common.h
@@ -399,13 +399,6 @@ int read_tun(char* data, int size)
return rv;
}
-void flush_tun()
-{
- char data[SYZ_TUN_MAX_PACKET_SIZE];
- while (read_tun(&data[0], sizeof(data)) != -1)
- ;
-}
-
static uintptr_t syz_extract_tcp_res(uintptr_t a0, uintptr_t a1, uintptr_t a2)
{
// syz_extract_tcp_res(res ptr[out, tcp_resources], seq_inc int32, ack_inc int32)
@@ -458,6 +451,15 @@ static uintptr_t syz_extract_tcp_res(uintptr_t a0, uintptr_t a1, uintptr_t a2)
}
#endif
+#if defined(SYZ_TUN_ENABLE) && (defined(SYZ_EXECUTOR) || defined(SYZ_REPEAT))
+void flush_tun()
+{
+ char data[SYZ_TUN_MAX_PACKET_SIZE];
+ while (read_tun(&data[0], sizeof(data)) != -1)
+ ;
+}
+#endif
+
#ifdef __NR_syz_open_dev
static uintptr_t syz_open_dev(uintptr_t a0, uintptr_t a1, uintptr_t a2)
{
@@ -939,6 +941,9 @@ void loop()
setpgrp();
if (chdir(cwdbuf))
fail("failed to chdir");
+#if defined(SYZ_TUN_ENABLE)
+ flush_tun();
+#endif
test();
doexit(0);
}