ossfuzz: Add parse_tcp_flags() to flow_extract_target.
This patch invokes parse_tcp_flags() in flow_extract_target.c after doing a
basic sanitization check (that packet contains at least an ETH header).
A cursory evaluation shows that the patch improves line coverage of
lib/flow.c from 37% to 39%.
@@ -18,6 +18,12 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
struct flowmap fmap;
flow_wc_map(&flow, &fmap);
+ /* Parse TCP flags. */
+ if (dp_packet_size(&packet) >= ETH_HEADER_LEN) {
+ uint16_t tcp_flags = parse_tcp_flags(&packet);
+ ignore(tcp_flags);
+ }
+
/* Extract metadata. */
struct match flow_metadata;
flow_get_metadata(&flow, &flow_metadata);
