From 1ab96df8855796901f133c1afab0f7384fc92eea Mon Sep 17 00:00:00 2001 From: Andrey Konovalov Date: Wed, 17 May 2017 18:05:28 +0200 Subject: executor: call flush_tun for repeat repros --- csource/common.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'csource') diff --git a/csource/common.go b/csource/common.go index e1c1863ec..09eeac8a4 100644 --- a/csource/common.go +++ b/csource/common.go @@ -368,13 +368,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) { @@ -425,6 +418,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) { @@ -1825,6 +1827,9 @@ void loop() setpgrp(); if (chdir(cwdbuf)) fail("failed to chdir"); +#if defined(SYZ_TUN_ENABLE) + flush_tun(); +#endif test(); doexit(0); } -- cgit mrf-deployment