diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-04-18 14:37:48 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-04-18 14:37:48 +0200 |
| commit | 6fe0f49646813924a072d786e080ab7bf4f9ab65 (patch) | |
| tree | 0e84ece1b654da43d9ae849af33a1ee86da59318 /pkg/csource/generated.go | |
| parent | 9b9500887837d53da9b19f949bdbc05a2a1df354 (diff) | |
executor: remove more code if ENABLE_NAPI_FRAGS is not set
In some configurations tun_frags_enabled ends up being unused
with a compiler warning and failed build.
Remove mode code if ENABLE_NAPI_FRAGS is not enabled.
Diffstat (limited to 'pkg/csource/generated.go')
| -rw-r--r-- | pkg/csource/generated.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go index b3cfd2b62..f6115530e 100644 --- a/pkg/csource/generated.go +++ b/pkg/csource/generated.go @@ -1493,25 +1493,24 @@ static void netlink_add_neigh(struct nlmsg* nlmsg, int sock, const char* name, #include <linux/tcp.h> static int tunfd = -1; -static int tun_frags_enabled; #define TUN_IFACE "syz_tun" - #define LOCAL_MAC 0xaaaaaaaaaaaa #define REMOTE_MAC 0xaaaaaaaaaabb - #define LOCAL_IPV4 "172.20.20.170" #define REMOTE_IPV4 "172.20.20.187" - #define LOCAL_IPV6 "fe80::aa" #define REMOTE_IPV6 "fe80::bb" #ifndef IFF_NAPI #define IFF_NAPI 0x0010 #endif +#if ENABLE_NAPI_FRAGS +static int tun_frags_enabled; #ifndef IFF_NAPI_FRAGS #define IFF_NAPI_FRAGS 0x0020 #endif +#endif static void initialize_tun(void) { @@ -2259,9 +2258,7 @@ static int read_tun(char* data, int size) int rv = read(tunfd, data, size); if (rv < 0) { - if (errno == EAGAIN) - return -1; - if (errno == EBADFD) + if (errno == EAGAIN || errno == EBADFD) return -1; fail("tun: read failed with %d", rv); } @@ -2273,12 +2270,14 @@ static int read_tun(char* data, int size) #include <stdbool.h> #include <sys/uio.h> +#if ENABLE_NAPI_FRAGS #define MAX_FRAGS 4 struct vnet_fragmentation { uint32 full; uint32 count; uint32 frags[MAX_FRAGS]; }; +#endif static long syz_emit_ethernet(volatile long a0, volatile long a1, volatile long a2) { @@ -2289,6 +2288,7 @@ static long syz_emit_ethernet(volatile long a0, volatile long a1, volatile long char* data = (char*)a1; debug_dump_data(data, length); +#if ENABLE_NAPI_FRAGS struct vnet_fragmentation* frags = (struct vnet_fragmentation*)a2; struct iovec vecs[MAX_FRAGS + 1]; uint32 nfrags = 0; @@ -2321,6 +2321,9 @@ static long syz_emit_ethernet(volatile long a0, volatile long a1, volatile long } } return writev(tunfd, vecs, nfrags); +#else + return write(tunfd, data, length); +#endif } #endif |
