This is the right mailing list for now. The convention is to write [PATCH ovn] in subject headings (but I figured it out ;-)
On Fri, Oct 18, 2019 at 04:48:40PM +0200, Bhargava Shastry wrote: > Just want to add that the patch is to be applied to ovn source code, I > couldn't find the ovn mailing list so sent it here. Apologies. > > On Fri, Oct 18, 2019 at 11:13 AM <[email protected]> wrote: > > > From: Bhargava Shastry <[email protected]> > > > > It appears that ossfuzz specific test harnesses and configuration files > > were carried over to the ovn repo from the ovs repo without > > justification. This patch removes them until there is a need to > > continuously fuzz ovn code as the ovs code is currently fuzzed. > > > > Signed-off-by: Bhargava Shastry <[email protected]> > > --- > > tests/automake.mk | 2 - > > tests/oss-fuzz/automake.mk | 66 --- > > tests/oss-fuzz/config/expr.dict | 120 ----- > > .../oss-fuzz/config/expr_parse_target.options | 3 - > > .../config/flow_extract_target.options | 3 - > > .../config/json_parser_target.options | 2 - > > tests/oss-fuzz/config/miniflow_target.options | 3 - > > tests/oss-fuzz/config/odp.dict | 170 ------- > > tests/oss-fuzz/config/odp_target.options | 3 - > > .../config/ofctl_parse_target.options | 3 - > > tests/oss-fuzz/config/ofp-flow.dict | 45 -- > > .../oss-fuzz/config/ofp_print_target.options | 3 - > > tests/oss-fuzz/config/ovs.dict | 293 ----------- > > tests/oss-fuzz/expr_parse_target.c | 464 ------------------ > > tests/oss-fuzz/flow_extract_target.c | 100 ---- > > tests/oss-fuzz/fuzzer.h | 9 - > > tests/oss-fuzz/json_parser_target.c | 42 -- > > tests/oss-fuzz/miniflow_target.c | 365 -------------- > > tests/oss-fuzz/odp_target.c | 149 ------ > > tests/oss-fuzz/ofctl_parse_target.c | 113 ----- > > tests/oss-fuzz/ofp_print_target.c | 47 -- > > 21 files changed, 2005 deletions(-) > > delete mode 100644 tests/oss-fuzz/automake.mk > > delete mode 100644 tests/oss-fuzz/config/expr.dict > > delete mode 100644 tests/oss-fuzz/config/expr_parse_target.options > > delete mode 100644 tests/oss-fuzz/config/flow_extract_target.options > > delete mode 100644 tests/oss-fuzz/config/json_parser_target.options > > delete mode 100644 tests/oss-fuzz/config/miniflow_target.options > > delete mode 100644 tests/oss-fuzz/config/odp.dict > > delete mode 100644 tests/oss-fuzz/config/odp_target.options > > delete mode 100644 tests/oss-fuzz/config/ofctl_parse_target.options > > delete mode 100644 tests/oss-fuzz/config/ofp-flow.dict > > delete mode 100644 tests/oss-fuzz/config/ofp_print_target.options > > delete mode 100644 tests/oss-fuzz/config/ovs.dict > > delete mode 100644 tests/oss-fuzz/expr_parse_target.c > > delete mode 100644 tests/oss-fuzz/flow_extract_target.c > > delete mode 100644 tests/oss-fuzz/fuzzer.h > > delete mode 100644 tests/oss-fuzz/json_parser_target.c > > delete mode 100644 tests/oss-fuzz/miniflow_target.c > > delete mode 100644 tests/oss-fuzz/odp_target.c > > delete mode 100644 tests/oss-fuzz/ofctl_parse_target.c > > delete mode 100644 tests/oss-fuzz/ofp_print_target.c > > > > diff --git a/tests/automake.mk b/tests/automake.mk > > index 013e59280..e86a5273e 100644 > > --- a/tests/automake.mk > > +++ b/tests/automake.mk > > @@ -246,5 +246,3 @@ clean-pki: > > rm -f tests/pki/stamp > > rm -rf tests/pki > > endif > > - > > -include tests/oss-fuzz/automake.mk > > diff --git a/tests/oss-fuzz/automake.mk b/tests/oss-fuzz/automake.mk > > deleted file mode 100644 > > index 5bf7d0d7c..000000000 > > --- a/tests/oss-fuzz/automake.mk > > +++ /dev/null > > @@ -1,66 +0,0 @@ > > -OSS_FUZZ_TARGETS = \ > > - tests/oss-fuzz/flow_extract_target \ > > - tests/oss-fuzz/json_parser_target \ > > - tests/oss-fuzz/ofp_print_target \ > > - tests/oss-fuzz/expr_parse_target \ > > - tests/oss-fuzz/odp_target \ > > - tests/oss-fuzz/miniflow_target \ > > - tests/oss-fuzz/ofctl_parse_target > > -EXTRA_PROGRAMS += $(OSS_FUZZ_TARGETS) > > -oss-fuzz-targets: $(OSS_FUZZ_TARGETS) > > - > > -tests_oss_fuzz_flow_extract_target_SOURCES = \ > > - tests/oss-fuzz/flow_extract_target.c \ > > - tests/oss-fuzz/fuzzer.h > > -tests_oss_fuzz_flow_extract_target_LDADD = lib/libopenvswitch.la > > -tests_oss_fuzz_flow_extract_target_LDFLAGS = $(LIB_FUZZING_ENGINE) -lc++ > > - > > -tests_oss_fuzz_json_parser_target_SOURCES = \ > > - tests/oss-fuzz/json_parser_target.c \ > > - tests/oss-fuzz/fuzzer.h > > -tests_oss_fuzz_json_parser_target_LDADD = lib/libopenvswitch.la > > -tests_oss_fuzz_json_parser_target_LDFLAGS = $(LIB_FUZZING_ENGINE) -lc++ > > - > > -tests_oss_fuzz_ofp_print_target_SOURCES = \ > > - tests/oss-fuzz/ofp_print_target.c \ > > - tests/oss-fuzz/fuzzer.h > > -tests_oss_fuzz_ofp_print_target_LDADD = lib/libopenvswitch.la > > -tests_oss_fuzz_ofp_print_target_LDFLAGS = $(LIB_FUZZING_ENGINE) -lc++ > > - > > -tests_oss_fuzz_expr_parse_target_SOURCES = \ > > - tests/oss-fuzz/expr_parse_target.c \ > > - tests/oss-fuzz/fuzzer.h > > -tests_oss_fuzz_expr_parse_target_LDADD = lib/libopenvswitch.la \ > > - ovn/lib/libovn.la > > -tests_oss_fuzz_expr_parse_target_LDFLAGS = $(LIB_FUZZING_ENGINE) -lc++ > > - > > -tests_oss_fuzz_odp_target_SOURCES = \ > > - tests/oss-fuzz/odp_target.c \ > > - tests/oss-fuzz/fuzzer.h > > -tests_oss_fuzz_odp_target_LDADD = lib/libopenvswitch.la > > -tests_oss_fuzz_odp_target_LDFLAGS = $(LIB_FUZZING_ENGINE) -lc++ > > - > > -tests_oss_fuzz_miniflow_target_SOURCES = \ > > - tests/oss-fuzz/miniflow_target.c \ > > - tests/oss-fuzz/fuzzer.h > > -tests_oss_fuzz_miniflow_target_LDADD = lib/libopenvswitch.la > > -tests_oss_fuzz_miniflow_target_LDFLAGS = $(LIB_FUZZING_ENGINE) -lc++ > > - > > -tests_oss_fuzz_ofctl_parse_target_SOURCES = \ > > - tests/oss-fuzz/ofctl_parse_target.c \ > > - tests/oss-fuzz/fuzzer.h > > -tests_oss_fuzz_ofctl_parse_target_LDADD = lib/libopenvswitch.la > > -tests_oss_fuzz_ofctl_parse_target_LDFLAGS = $(LIB_FUZZING_ENGINE) -lc++ > > - > > -EXTRA_DIST += \ > > - tests/oss-fuzz/config/flow_extract_target.options \ > > - tests/oss-fuzz/config/json_parser_target.options \ > > - tests/oss-fuzz/config/ofp_print_target.options \ > > - tests/oss-fuzz/config/expr_parse_target.options \ > > - tests/oss-fuzz/config/odp_target.options \ > > - tests/oss-fuzz/config/miniflow_target.options \ > > - tests/oss-fuzz/config/ofctl_parse_target.options \ > > - tests/oss-fuzz/config/ovs.dict \ > > - tests/oss-fuzz/config/expr.dict \ > > - tests/oss-fuzz/config/odp.dict \ > > - tests/oss-fuzz/config/ofp-flow.dict > > diff --git a/tests/oss-fuzz/config/expr.dict > > b/tests/oss-fuzz/config/expr.dict > > deleted file mode 100644 > > index 03741ad7d..000000000 > > --- a/tests/oss-fuzz/config/expr.dict > > +++ /dev/null > > @@ -1,120 +0,0 @@ > > -" = " > > -" = (" > > -" = dns_lookup();" > > -" { " > > -" };" > > -"!" > > -"!=" > > -"$" > > -"&&" > > -"(" > > -"()" > > -")" > > -"),commit,table=,zone=NXM_NX_REG)" > > -");" > > -", " > > -", meter=\"\"" > > -"," > > -",bucket=bucket_id=,weight:100,actions=ct(nat(dst=" > > -"--" > > -".." > > -"/" > > -"/%" > > -"0" > > -":" > > -"<" > > -"<->" > > -"<=" > > -"=" > > -"==" > > -"=r" > > -">" > > -">=" > > -"[" > > -"\x00" > > -"\x28" > > -"]" > > -"]:" > > -"allow" > > -"arp" > > -"bool" > > -"bswap " > > -"bswap %0" > > -"cc" > > -"clone" > > -"ct_clear" > > -"ct_clear;" > > -"ct_commit" > > -"ct_commit(" > > -"ct_dnat" > > -"ct_label" > > -"ct_label=" > > -"ct_lb" > > -"ct_mark" > > -"ct_mark=" > > -"ct_mark=%#x" > > -"ct_next" > > -"ct_next;" > > -"ct_snat" > > -"decimal" > > -"dhcpv6_stateful" > > -"dhcpv6_stateless" > > -"dns_lookup" > > -"drop" > > -"drop;" > > -"egress" > > -"error(" > > -"get_arp" > > -"get_nd" > > -"hexadecimal" > > -"icmp4" > > -"icmp6" > > -"ingress" > > -"ip.ttl" > > -"ip.ttl--;" > > -"ipv4" > > -"ipv6" > > -"log" > > -"log(" > > -"mac" > > -"meter" > > -"name" > > -"name=\"\", " > > -"nd_na" > > -"nd_na_router" > > -"nd_ns" > > -"next" > > -"next();" > > -"next(pipeline=, table=);" > > -"next;" > > -"output" > > -"output;" > > -"pipeline" > > -"put_arp" > > -"put_dhcp_opts" > > -"put_dhcpv6_opts" > > -"put_nd" > > -"put_nd_ra_opts" > > -"reject" > > -"set_meter" > > -"set_meter();" > > -"set_meter(, );" > > -"set_meter(,);" > > -"set_queue" > > -"set_queue();" > > -"severity" > > -"severity=" > > -"slaac" > > -"static_routes" > > -"str" > > -"table" > > -"tcp_reset" > > -"type=select,selection_method=dp_hash" > > -"uint16" > > -"uint32" > > -"uint8" > > -"verdict" > > -"verdict=, " > > -"{" > > -"||" > > -"}" > > diff --git a/tests/oss-fuzz/config/expr_parse_target.options > > b/tests/oss-fuzz/config/expr_parse_target.options > > deleted file mode 100644 > > index fc254e84f..000000000 > > --- a/tests/oss-fuzz/config/expr_parse_target.options > > +++ /dev/null > > @@ -1,3 +0,0 @@ > > -[libfuzzer] > > -dict = expr.dict > > -close_fd_mask = 3 > > diff --git a/tests/oss-fuzz/config/flow_extract_target.options > > b/tests/oss-fuzz/config/flow_extract_target.options > > deleted file mode 100644 > > index 81ad7f18c..000000000 > > --- a/tests/oss-fuzz/config/flow_extract_target.options > > +++ /dev/null > > @@ -1,3 +0,0 @@ > > -[libfuzzer] > > -dict = ovs.dict > > -close_fd_mask = 3 > > diff --git a/tests/oss-fuzz/config/json_parser_target.options > > b/tests/oss-fuzz/config/json_parser_target.options > > deleted file mode 100644 > > index 8d3739a53..000000000 > > --- a/tests/oss-fuzz/config/json_parser_target.options > > +++ /dev/null > > @@ -1,2 +0,0 @@ > > -[libfuzzer] > > -dict = json.dict > > diff --git a/tests/oss-fuzz/config/miniflow_target.options > > b/tests/oss-fuzz/config/miniflow_target.options > > deleted file mode 100644 > > index 4849f282d..000000000 > > --- a/tests/oss-fuzz/config/miniflow_target.options > > +++ /dev/null > > @@ -1,3 +0,0 @@ > > -[libfuzzer] > > -dict = ovs.dict > > -close_fd_mask = 3 > > \ No newline at end of file > > diff --git a/tests/oss-fuzz/config/odp.dict > > b/tests/oss-fuzz/config/odp.dict > > deleted file mode 100644 > > index a9bdd3e99..000000000 > > --- a/tests/oss-fuzz/config/odp.dict > > +++ /dev/null > > @@ -1,170 +0,0 @@ > > -"(" > > -")" > > -"," > > -"/0x" > > -"0x" > > -": " > > -"=" > > -"=r" > > -"action" > > -"arp" > > -"bfd" > > -"bos" > > -"c1" > > -"c2" > > -"c3" > > -"c4" > > -"cc" > > -"cfi" > > -"cfm" > > -"class" > > -"clone" > > -"code" > > -"commit," > > -"crit," > > -"csum" > > -"ct" > > -"ct(error)" > > -"ct_clear" > > -"ct_label" > > -"ct_mark" > > -"ct_state" > > -"ct_tuple4" > > -"ct_tuple6" > > -"ct_zone" > > -"dir" > > -"dl_type" > > -"dnat" > > -"dp_hash" > > -"drop" > > -"dst" > > -"dst_port" > > -"egress" > > -"encap" > > -"error" > > -"erspan" > > -"erspan(ver=1,sid=0x,dir=,idx=0x)" > > -"est" > > -"eth" > > -"eth_type" > > -"eth_type(0/)" > > -"first" > > -"flags" > > -"force_commit," > > -"frag" > > -"gbp(" > > -"geneve" > > -"gre((flags=0x,proto=0x)" > > -"hash," > > -"helper" > > -"hlimit" > > -"hwid" > > -"icmp" > > -"icmpv6" > > -"id" > > -"idx=" > > -"in_port" > > -"ingress" > > -"inv" > > -"ip6erspan" > > -"ipfix(output_port=" > > -"ipv4" > > -"ipv6" > > -"ipv6_dst" > > -"ipv6_src" > > -"l4()" > > -"label" > > -"lacp" > > -"later" > > -"len" > > -"lldp" > > -"mark=/," > > -"match" > > -"md2" > > -"mdtype" > > -"meter()" > > -"mpls" > > -"nat" > > -"nd" > > -"new" > > -"no" > > -"np" > > -"ns" > > -"nsh" > > -"oam," > > -"op" > > -"options(" > > -"out_port(" > > -"packet_type" > > -"pcp=" > > -"persistent," > > -"pop_eth" > > -"pop_mpls(eth_type=0x)" > > -"pop_nsh()" > > -"pop_vlan" > > -"proto" > > -"push_eth(src=:::::,dst=:::::,type=)" > > -"push_mpls(" > > -"push_nsh(" > > -"push_vlan(" > > -"push_vlan(tpid=,vid=,pcp=,cfi=)" > > -"random," > > -"recirc()" > > -"recirc_id" > > -"rel" > > -"rpl" > > -"sFlow(vid=,pcp=,output=)" > > -"sample" > > -"sctp" > > -"seq=0x" > > -"set(" > > -"set(nsh(" > > -"sha" > > -"si" > > -"sip" > > -"skb_mark" > > -"skb_priority" > > -"sll" > > -"slow_path" > > -"snat" > > -"spi" > > -"src" > > -"src_port" > > -"stp" > > -"sym_l4()" > > -"target" > > -"tc=" > > -"tclass" > > -"tcp" > > -"tcp_flags" > > -"tha" > > -"tip" > > -"tll" > > -"tnl_pop(" > > -"tnl_push(tnl_port(" > > -"too_little" > > -"too_much" > > -"tos" > > -"tp_dst" > > -"tp_src" > > -"tpid=0x" > > -"trk" > > -"trunc()" > > -"ttl" > > -"tun_id" > > -"tunnel" > > -"tunnel_out_port" > > -"type" > > -"udp" > > -"unspec" > > -"userdata" > > -"userspace(" > > -"userspace(error)" > > -"userspace(pid" > > -"ver" > > -"vid" > > -"vlan" > > -"vxlan" > > -"vxlan(flags=0x,vni=0x)" > > -"vxlan(gbp(" > > -"zone" > > diff --git a/tests/oss-fuzz/config/odp_target.options > > b/tests/oss-fuzz/config/odp_target.options > > deleted file mode 100644 > > index 41821b8c1..000000000 > > --- a/tests/oss-fuzz/config/odp_target.options > > +++ /dev/null > > @@ -1,3 +0,0 @@ > > -[libfuzzer] > > -close_fd_mask = 3 > > -dict = odp.dict > > diff --git a/tests/oss-fuzz/config/ofctl_parse_target.options > > b/tests/oss-fuzz/config/ofctl_parse_target.options > > deleted file mode 100644 > > index 6d67dd6ad..000000000 > > --- a/tests/oss-fuzz/config/ofctl_parse_target.options > > +++ /dev/null > > @@ -1,3 +0,0 @@ > > -[libfuzzer] > > -close_fd_mask = 3 > > -dict = ofp-flow.dict > > diff --git a/tests/oss-fuzz/config/ofp-flow.dict > > b/tests/oss-fuzz/config/ofp-flow.dict > > deleted file mode 100644 > > index 01175e5eb..000000000 > > --- a/tests/oss-fuzz/config/ofp-flow.dict > > +++ /dev/null > > @@ -1,45 +0,0 @@ > > -")" > > -"(" > > -"[" > > -"]" > > -"," > > -"-" > > -"0" > > -":" > > -"=" > > -"ADD" > > -"DEL" > > -"DEL_STRICT" > > -"MOD" > > -"MOD_STRICT" > > -"\x00" > > -"\x20" > > -"\x3F" > > -"actions" > > -"add" > > -"allow_hidden_fields" > > -"cc" > > -"check_overlap" > > -"cookie" > > -"delete" > > -"delete_strict" > > -"duration" > > -"eth" > > -"hard_age" > > -"hard_timeout" > > -"idle_age" > > -"idle_timeout" > > -"importance" > > -"modify" > > -"modify_strict" > > -"n_bytes" > > -"n_packets" > > -"no_byte_counts" > > -"no_packet_counts" > > -"no_readonly_table" > > -"out_group" > > -"out_port" > > -"priority" > > -"reset_counts" > > -"send_flow_rem" > > -"table" > > diff --git a/tests/oss-fuzz/config/ofp_print_target.options > > b/tests/oss-fuzz/config/ofp_print_target.options > > deleted file mode 100644 > > index 7f117292e..000000000 > > --- a/tests/oss-fuzz/config/ofp_print_target.options > > +++ /dev/null > > @@ -1,3 +0,0 @@ > > -[libfuzzer] > > -close_fd_mask = 3 > > -dict = ovs.dict > > diff --git a/tests/oss-fuzz/config/ovs.dict > > b/tests/oss-fuzz/config/ovs.dict > > deleted file mode 100644 > > index 243b243ab..000000000 > > --- a/tests/oss-fuzz/config/ovs.dict > > +++ /dev/null > > @@ -1,293 +0,0 @@ > > -"0.2" > > -"ADD_SUBSCRIBE" > > -"-cbc" > > -"CLEARSUB" > > -"CLIENT" > > -"GIMME" > > -"GIMMEDEFS" > > -"GIMMESTATS" > > -"HM" > > -"-hmac96" > > -"HM_CTL" > > -"HM_STAT" > > -"HMST_CLIENT" > > -"LOGIN" > > -"\\MAILSLOT\\BROWSE" > > -"NET-ANNOUNCED" > > -"NET-VISIBLE" > > -"-nodefs" > > -"NONE" > > -"OPSTAFF" > > -"\\PIPE\\LANMAN" > > -"public" > > -"REALM" > > -"REALM-ANNOUNCED" > > -"REALM-VISIBLE" > > -"REQ_SUBSCRIBE" > > -"RLM_SUBSCRIBE" > > -"RLM_UNSUBSCRIBE" > > -"SENT" > > -" %ssub%s" > > -"SUBSCRIBE" > > -"SUBSCRIBE_NODEFS" > > -"un" > > -"UNSUBSCRIBE" > > -"USER_FLUSH" > > -"USER_HIDE" > > -"USER_LOCATE" > > -"USER_UNHIDE" > > -"WG_CTL" > > -"\x01\x00" > > -"\x01\x00\x00" > > -"\x01\x00\x01" > > -"\x01\x00\x02" > > -"\x01\x00\x03" > > -"\x01\x00\x05" > > -"\x01\x01" > > -"\x01\x02" > > -"\x01\x03" > > -"\x01\x04" > > -"\x01\x05" > > -"\x01\x07" > > -"\x01\x0B" > > -"\x01\x0C" > > -"\x01\x10" > > -"\x01\x11" > > -"\x01\x12" > > -"\x01\x13" > > -"\x01\x14" > > -"\x01\x15" > > -"\x01\x16" > > -"\x01\xE8\x48" > > -"\x01\xF4" > > -"\x01\xF5" > > -"\x01\xF6" > > -"\x01\xF7" > > -"\x01\xF8" > > -"\x01\xF9" > > -"\x01\xFA" > > -"\x01\xFB" > > -"\x01\xFC" > > -"\x01\xFD" > > -"\x01\xFE" > > -"\x01\xFF" > > -"\x02\x00" > > -"\x02\x00\x00" > > -"\x02\x01" > > -"\x02\x02" > > -"\x02\x03" > > -"\x02\x04" > > -"\x02\x05" > > -"\x02\x06" > > -"\x02\x07" > > -"\x02\x08" > > -"\x02\x09" > > -"\x02\x0C" > > -"\x02\x0E" > > -"\x02\x0F" > > -"\x02\x11" > > -"\x02\x12" > > -"\x02\x58" > > -"\x02\x81" > > -"\x02\x83" > > -"\x03\x00" > > -"\x03\x01" > > -"\x03\x02" > > -"\x03\x03" > > -"\x03\x06" > > -"\x03\xE8" > > -"\x03\xE9" > > -"\x03\xEA" > > -"\x03\xEB" > > -"\x03\xEC" > > -"\x03\xED" > > -"\x03\xEE" > > -"\x03\xEF" > > -"\x03\xF0" > > -"\x03\xF1" > > -"\x03\xF2" > > -"\x03\xF3" > > -"\x03\xF4" > > -"\x03\xFF\xFF\xFF" > > -"\x04\x00" > > -"\x04\x00\x00" > > -"\x04\x01" > > -"\x04\x02" > > -"\x04\x03" > > -"\x04\x04" > > -"\x04\x51" > > -"\x04\x52" > > -"\x04\x53" > > -"\x04\x55" > > -"\x04\x56" > > -"\x05\x00" > > -"\x05\x01" > > -"\x05\x02" > > -"\x05\x03" > > -"\x05\x53" > > -"\x05\xCC" > > -"\x05\xDC" > > -"\x06\x00" > > -"\x06\x01" > > -"\x06\xCF" > > -"\x07\x07" > > -"\x07\xC1" > > -"\x07\xFF" > > -"\x08\x00" > > -"\x08\x00\x00\x00" > > -"\x08\x00\x07" > > -"\x08\x01" > > -"\x08\x06" > > -"\x08\x38\x00\x00" > > -"\x0A\x00\xB1" > > -"\x0C\x01" > > -"\x0C\x02" > > -"\x0C\x03" > > -"\x0C\x04" > > -"\x0C\x05" > > -"\x0C\x06" > > -"\x0C\x08" > > -"\x0D\x80" > > -"\x0E\x00" > > -"\x0E\x10" > > -"\x0E\xC8" > > -"\x0E\xC9" > > -"\x0F\x42\x40" > > -"\x0F\xFF" > > -"\x10\x00" > > -"\x11\x11" > > -"\x11\xD7" > > -"\x12\x0F" > > -"\x12\xBB" > > -"\x1A\x30" > > -"\x1A\x31" > > -"\x1A\x32" > > -"\x1B\x21" > > -"\x1B\x58" > > -"\x1B\x59" > > -"\x1B\x5A" > > -"\x1B\x5B" > > -"\x1B\x5C" > > -"\x1B\x5D" > > -"\x1B\x5F" > > -"\x1B\x61" > > -"\x1F\x00" > > -"\x1F\x40" > > -"\x1F\xFF" > > -"\x1F\xFF\xFF" > > -"\x20\x00" > > -"\x20\x03" > > -"\x20\x04" > > -"\x27\x10" > > -"\x27\x13" > > -"\x2F\xBF" > > -"\x35\x00\x00" > > -"\x3C\x13" > > -"\x40\x00" > > -"\x40\x04" > > -"\x40\x80" > > -"\x47\x00\x06\x01" > > -"\x4E\x20" > > -"\x4E\x21" > > -"\x4E\x22" > > -"\x4E\x23" > > -"\x4E\x24" > > -"\x4E\x25" > > -"\x4E\x26" > > -"\x4E\x27" > > -"\x4E\x28" > > -"\x4E\x29" > > -"\x4E\x2A" > > -"\x4E\x2C" > > -"\x60\x00" > > -"\x60\x01" > > -"\x60\x02" > > -"\x60\x03" > > -"\x60\x04" > > -"\x60\x07" > > -"\x7F\xFF" > > -"\x7F\xFF\xFF" > > -"\x80\x00" > > -"\x80\x00\x00\x00" > > -"\x80\x01" > > -"\x80\x05" > > -"\x80\x0A" > > -"\x80\x21" > > -"\x80\x21\x10\x01" > > -"\x80\x21\x10\x02" > > -"\x80\x23" > > -"\x80\x35" > > -"\x80\x57" > > -"\x80\x9B" > > -"\x80\xC2" > > -"\x80\xF3" > > -"\x80\xFD" > > -"\x81\x00" > > -"\x81\x37" > > -"\x82\x81" > > -"\x83\xAA\x7E\x80" > > -"\x85\xBE" > > -"\x86\xDD" > > -"\x88\x08" > > -"\x88\x09" > > -"\x88\x0B" > > -"\x88\x47" > > -"\x88\x48" > > -"\x88\x63" > > -"\x88\x64" > > -"\x88\x6F" > > -"\x88\x70" > > -"\x88\x8E" > > -"\x88\x99" > > -"\x88\xA2" > > -"\x88\xA8" > > -"\x88\xCA" > > -"\x88\xCC" > > -"\x89\x02" > > -"\x89\x3A" > > -"\x89\x47" > > -"\x90\x00" > > -"\x91\x00" > > -"\xA0\x00" > > -"\xAB\xCD" > > -"\xB0\x00" > > -"\xC0\x00\x00\x00" > > -"\xC0\x21" > > -"\xC0\x23" > > -"\xC0\x25" > > -"\xC0\x27" > > -"\xC0\x2B" > > -"\xC0\x2D" > > -"\xC1\x23" > > -"\xC2\x23" > > -"\xC2\x27" > > -"\xDA\xDA" > > -"\xE0\x00" > > -"\xE0\x00\x00\x00" > > -"\xF0\x00\x00\x00" > > -"\xF1\x0A" > > -"\xF9\x89" > > -"\xFC\x00" > > -"\xFD\xE9" > > -"\xFE\xFE" > > -"\xFF\x00" > > -"\xFF\x00\x00" > > -"\xFF\x00\x00\x00" > > -"\xFF\xF0" > > -"\xFF\xF8" > > -"\xFF\xFD" > > -"\xFF\xFE" > > -"\xFF\xFF" > > -"\xFF\xFF\x00\x00" > > -"\xFF\xFF\xF0\x00" > > -"\xFF\xFF\xFF\x00" > > -"\xFF\xFF\xFF\x01" > > -"\xFF\xFF\xFF\x02" > > -"\xFF\xFF\xFF\x03" > > -"\xFF\xFF\xFF\xEF" > > -"\xFF\xFF\xFF\xFD" > > -"\xFF\xFF\xFF\xFE" > > -"\xFF\xFF\xFF\xFF" > > -"ZEPH" > > -"ZEPHYR_ADMIN" > > -"ZEPHYR_CTL" > > diff --git a/tests/oss-fuzz/expr_parse_target.c > > b/tests/oss-fuzz/expr_parse_target.c > > deleted file mode 100644 > > index 1a3893858..000000000 > > --- a/tests/oss-fuzz/expr_parse_target.c > > +++ /dev/null > > @@ -1,464 +0,0 @@ > > -#include <config.h> > > -#include "fuzzer.h" > > -#include <errno.h> > > -#include <getopt.h> > > -#include <sys/wait.h> > > - > > -#include "command-line.h" > > -#include "dp-packet.h" > > -#include "fatal-signal.h" > > -#include "flow.h" > > -#include "openvswitch/dynamic-string.h" > > -#include "openvswitch/match.h" > > -#include "openvswitch/ofp-actions.h" > > -#include "openvswitch/ofpbuf.h" > > -#include "openvswitch/vlog.h" > > -#include "ovn/actions.h" > > -#include "ovn/expr.h" > > -#include "ovn/lex.h" > > -#include "ovn/lib/logical-fields.h" > > -#include "ovn/lib/ovn-l7.h" > > -#include "ovn/lib/extend-table.h" > > -#include "openvswitch/shash.h" > > -#include "simap.h" > > -#include "util.h" > > - > > -static void > > -compare_token(const struct lex_token *a, const struct lex_token *b) > > -{ > > - if (a->type != b->type) { > > - fprintf(stderr, "type differs: %d -> %d\n", a->type, b->type); > > - return; > > - } > > - > > - if (!((a->s && b->s && !strcmp(a->s, b->s)) > > - || (!a->s && !b->s))) { > > - fprintf(stderr, "string differs: %s -> %s\n", > > - a->s ? a->s : "(null)", > > - b->s ? b->s : "(null)"); > > - return; > > - } > > - > > - if (a->type == LEX_T_INTEGER || a->type == LEX_T_MASKED_INTEGER) { > > - if (memcmp(&a->value, &b->value, sizeof a->value)) { > > - fprintf(stderr, "value differs\n"); > > - return; > > - } > > - > > - if (a->type == LEX_T_MASKED_INTEGER > > - && memcmp(&a->mask, &b->mask, sizeof a->mask)) { > > - fprintf(stderr, "mask differs\n"); > > - return; > > - } > > - > > - if (a->format != b->format > > - && !(a->format == LEX_F_HEXADECIMAL > > - && b->format == LEX_F_DECIMAL > > - && a->value.integer == 0)) { > > - fprintf(stderr, "format differs: %d -> %d\n", > > - a->format, b->format); > > - } > > - } > > -} > > - > > -static void > > -test_lex(const char *input) > > -{ > > - struct ds output; > > - > > - ds_init(&output); > > - struct lexer lexer; > > - > > - lexer_init(&lexer, input); > > - ds_clear(&output); > > - while (lexer_get(&lexer) != LEX_T_END) { > > - size_t len = output.length; > > - lex_token_format(&lexer.token, &output); > > - > > - /* Check that the formatted version can really be parsed back > > - * losslessly. */ > > - if (lexer.token.type != LEX_T_ERROR) { > > - const char *s = ds_cstr(&output) + len; > > - struct lexer l2; > > - > > - lexer_init(&l2, s); > > - lexer_get(&l2); > > - compare_token(&lexer.token, &l2.token); > > - lexer_destroy(&l2); > > - } > > - ds_put_char(&output, ' '); > > - } > > - lexer_destroy(&lexer); > > - > > - ds_chomp(&output, ' '); > > - puts(ds_cstr(&output)); > > - ds_destroy(&output); > > -} > > - > > -static void > > -create_symtab(struct shash *symtab) > > -{ > > - ovn_init_symtab(symtab); > > - > > - /* For negative testing. */ > > - expr_symtab_add_field(symtab, "bad_prereq", MFF_XREG0, "xyzzy", > > false); > > - expr_symtab_add_field(symtab, "self_recurse", MFF_XREG0, > > - "self_recurse != 0", false); > > - expr_symtab_add_field(symtab, "mutual_recurse_1", MFF_XREG0, > > - "mutual_recurse_2 != 0", false); > > - expr_symtab_add_field(symtab, "mutual_recurse_2", MFF_XREG0, > > - "mutual_recurse_1 != 0", false); > > - expr_symtab_add_string(symtab, "big_string", MFF_XREG0, NULL); > > -} > > - > > -static void > > -create_gen_opts(struct hmap *dhcp_opts, struct hmap *dhcpv6_opts, > > - struct hmap *nd_ra_opts) > > -{ > > - hmap_init(dhcp_opts); > > - dhcp_opt_add(dhcp_opts, "offerip", 0, "ipv4"); > > - dhcp_opt_add(dhcp_opts, "netmask", 1, "ipv4"); > > - dhcp_opt_add(dhcp_opts, "router", 3, "ipv4"); > > - dhcp_opt_add(dhcp_opts, "dns_server", 6, "ipv4"); > > - dhcp_opt_add(dhcp_opts, "log_server", 7, "ipv4"); > > - dhcp_opt_add(dhcp_opts, "lpr_server", 9, "ipv4"); > > - dhcp_opt_add(dhcp_opts, "domain", 15, "str"); > > - dhcp_opt_add(dhcp_opts, "swap_server", 16, "ipv4"); > > - dhcp_opt_add(dhcp_opts, "policy_filter", 21, "ipv4"); > > - dhcp_opt_add(dhcp_opts, "router_solicitation", 32, "ipv4"); > > - dhcp_opt_add(dhcp_opts, "nis_server", 41, "ipv4"); > > - dhcp_opt_add(dhcp_opts, "ntp_server", 42, "ipv4"); > > - dhcp_opt_add(dhcp_opts, "server_id", 54, "ipv4"); > > - dhcp_opt_add(dhcp_opts, "tftp_server", 66, "ipv4"); > > - dhcp_opt_add(dhcp_opts, "classless_static_route", 121, > > "static_routes"); > > - dhcp_opt_add(dhcp_opts, "ip_forward_enable", 19, "bool"); > > - dhcp_opt_add(dhcp_opts, "router_discovery", 31, "bool"); > > - dhcp_opt_add(dhcp_opts, "ethernet_encap", 36, "bool"); > > - dhcp_opt_add(dhcp_opts, "default_ttl", 23, "uint8"); > > - dhcp_opt_add(dhcp_opts, "tcp_ttl", 37, "uint8"); > > - dhcp_opt_add(dhcp_opts, "mtu", 26, "uint16"); > > - dhcp_opt_add(dhcp_opts, "lease_time", 51, "uint32"); > > - dhcp_opt_add(dhcp_opts, "wpad", 252, "str"); > > - > > - /* DHCPv6 options. */ > > - hmap_init(dhcpv6_opts); > > - dhcp_opt_add(dhcpv6_opts, "server_id", 2, "mac"); > > - dhcp_opt_add(dhcpv6_opts, "ia_addr", 5, "ipv6"); > > - dhcp_opt_add(dhcpv6_opts, "dns_server", 23, "ipv6"); > > - dhcp_opt_add(dhcpv6_opts, "domain_search", 24, "str"); > > - > > - /* IPv6 ND RA options. */ > > - hmap_init(nd_ra_opts); > > - nd_ra_opts_init(nd_ra_opts); > > -} > > - > > -static void > > -create_addr_sets(struct shash *addr_sets) > > -{ > > - shash_init(addr_sets); > > - > > - static const char *const addrs1[] = { > > - "10.0.0.1", "10.0.0.2", "10.0.0.3", > > - }; > > - static const char *const addrs2[] = { > > - "::1", "::2", "::3", > > - }; > > - static const char *const addrs3[] = { > > - "00:00:00:00:00:01", "00:00:00:00:00:02", "00:00:00:00:00:03", > > - }; > > - static const char *const addrs4[] = { NULL }; > > - > > - expr_const_sets_add(addr_sets, "set1", addrs1, 3, true); > > - expr_const_sets_add(addr_sets, "set2", addrs2, 3, true); > > - expr_const_sets_add(addr_sets, "set3", addrs3, 3, true); > > - expr_const_sets_add(addr_sets, "set4", addrs4, 0, true); > > -} > > - > > -static void > > -create_port_groups(struct shash *port_groups) > > -{ > > - shash_init(port_groups); > > - > > - static const char *const pg1[] = { > > - "lsp1", "lsp2", "lsp3", > > - }; > > - static const char *const pg2[] = { NULL }; > > - > > - expr_const_sets_add(port_groups, "pg1", pg1, 3, false); > > - expr_const_sets_add(port_groups, "pg_empty", pg2, 0, false); > > -} > > - > > -static bool > > -lookup_port_cb(const void *ports_, const char *port_name, unsigned int > > *portp) > > -{ > > - const struct simap *ports = ports_; > > - const struct simap_node *node = simap_find(ports, port_name); > > - if (!node) { > > - return false; > > - } > > - *portp = node->data; > > - return true; > > -} > > - > > -static bool > > -is_chassis_resident_cb(const void *ports_, const char *port_name) > > -{ > > - const struct simap *ports = ports_; > > - const struct simap_node *node = simap_find(ports, port_name); > > - if (node) { > > - return true; > > - } > > - return false; > > -} > > - > > -static void > > -test_parse_actions(const char *input) > > -{ > > - struct shash symtab; > > - struct hmap dhcp_opts; > > - struct hmap dhcpv6_opts; > > - struct hmap nd_ra_opts; > > - struct simap ports; > > - > > - create_symtab(&symtab); > > - create_gen_opts(&dhcp_opts, &dhcpv6_opts, &nd_ra_opts); > > - > > - /* Initialize group ids. */ > > - struct ovn_extend_table group_table; > > - ovn_extend_table_init(&group_table); > > - > > - /* Initialize meter ids for QoS. */ > > - struct ovn_extend_table meter_table; > > - ovn_extend_table_init(&meter_table); > > - > > - simap_init(&ports); > > - simap_put(&ports, "eth0", 5); > > - simap_put(&ports, "eth1", 6); > > - simap_put(&ports, "LOCAL", ofp_to_u16(OFPP_LOCAL)); > > - > > - struct ofpbuf ovnacts; > > - struct expr *prereqs; > > - char *error; > > - > > - puts(input); > > - > > - ofpbuf_init(&ovnacts, 0); > > - > > - const struct ovnact_parse_params pp = { > > - .symtab = &symtab, > > - .dhcp_opts = &dhcp_opts, > > - .dhcpv6_opts = &dhcpv6_opts, > > - .nd_ra_opts = &nd_ra_opts, > > - .n_tables = 24, > > - .cur_ltable = 10, > > - }; > > - error = ovnacts_parse_string(input, &pp, &ovnacts, &prereqs); > > - if (!error) { > > - /* Convert the parsed representation back to a string and print > > it, > > - * if it's different from the input. */ > > - struct ds ovnacts_s = DS_EMPTY_INITIALIZER; > > - ovnacts_format(ovnacts.data, ovnacts.size, &ovnacts_s); > > - if (strcmp(input, ds_cstr(&ovnacts_s))) { > > - printf(" formats as %s\n", ds_cstr(&ovnacts_s)); > > - } > > - > > - /* Encode the actions into OpenFlow and print. */ > > - const struct ovnact_encode_params ep = { > > - .lookup_port = lookup_port_cb, > > - .aux = &ports, > > - .is_switch = true, > > - .group_table = &group_table, > > - .meter_table = &meter_table, > > - > > - .pipeline = OVNACT_P_INGRESS, > > - .ingress_ptable = 8, > > - .egress_ptable = 40, > > - .output_ptable = 64, > > - .mac_bind_ptable = 65, > > - }; > > - struct ofpbuf ofpacts; > > - ofpbuf_init(&ofpacts, 0); > > - ovnacts_encode(ovnacts.data, ovnacts.size, &ep, &ofpacts); > > - struct ds ofpacts_s = DS_EMPTY_INITIALIZER; > > - struct ofpact_format_params fp = { .s = &ofpacts_s }; > > - ofpacts_format(ofpacts.data, ofpacts.size, &fp); > > - printf(" encodes as %s\n", ds_cstr(&ofpacts_s)); > > - ds_destroy(&ofpacts_s); > > - ofpbuf_uninit(&ofpacts); > > - > > - /* Print prerequisites if any. */ > > - if (prereqs) { > > - struct ds prereqs_s = DS_EMPTY_INITIALIZER; > > - expr_format(prereqs, &prereqs_s); > > - printf(" has prereqs %s\n", ds_cstr(&prereqs_s)); > > - ds_destroy(&prereqs_s); > > - } > > - > > - /* Now re-parse and re-format the string to verify that it's > > - * round-trippable. */ > > - struct ofpbuf ovnacts2; > > - struct expr *prereqs2; > > - ofpbuf_init(&ovnacts2, 0); > > - error = ovnacts_parse_string(ds_cstr(&ovnacts_s), &pp, &ovnacts2, > > - &prereqs2); > > - if (!error) { > > - struct ds ovnacts2_s = DS_EMPTY_INITIALIZER; > > - ovnacts_format(ovnacts2.data, ovnacts2.size, &ovnacts2_s); > > - if (strcmp(ds_cstr(&ovnacts_s), ds_cstr(&ovnacts2_s))) { > > - printf(" bad reformat: %s\n", ds_cstr(&ovnacts2_s)); > > - } > > - ds_destroy(&ovnacts2_s); > > - } else { > > - printf(" reparse error: %s\n", error); > > - free(error); > > - } > > - expr_destroy(prereqs2); > > - > > - ovnacts_free(ovnacts2.data, ovnacts2.size); > > - ofpbuf_uninit(&ovnacts2); > > - ds_destroy(&ovnacts_s); > > - } else { > > - printf(" %s\n", error); > > - free(error); > > - } > > - > > - expr_destroy(prereqs); > > - ovnacts_free(ovnacts.data, ovnacts.size); > > - ofpbuf_uninit(&ovnacts); > > - > > - simap_destroy(&ports); > > - expr_symtab_destroy(&symtab); > > - shash_destroy(&symtab); > > - dhcp_opts_destroy(&dhcp_opts); > > - dhcp_opts_destroy(&dhcpv6_opts); > > - nd_ra_opts_destroy(&nd_ra_opts); > > - ovn_extend_table_destroy(&group_table); > > - ovn_extend_table_destroy(&meter_table); > > -} > > - > > -static void > > -test_parse_expr(const char *input) > > -{ > > - struct shash symtab; > > - struct shash addr_sets; > > - struct shash port_groups; > > - struct simap ports; > > - struct expr *expr; > > - char *error; > > - > > - create_symtab(&symtab); > > - create_addr_sets(&addr_sets); > > - create_port_groups(&port_groups); > > - > > - simap_init(&ports); > > - simap_put(&ports, "eth0", 5); > > - simap_put(&ports, "eth1", 6); > > - simap_put(&ports, "LOCAL", ofp_to_u16(OFPP_LOCAL)); > > - simap_put(&ports, "lsp1", 0x11); > > - simap_put(&ports, "lsp2", 0x12); > > - simap_put(&ports, "lsp3", 0x13); > > - > > - expr = expr_parse_string(input, &symtab, &addr_sets, > > - &port_groups, &error); > > - if (!error) { > > - expr = expr_annotate(expr, &symtab, &error); > > - } > > - if (!error) { > > - expr = expr_simplify(expr, is_chassis_resident_cb, &ports); > > - expr = expr_normalize(expr); > > - ovs_assert(expr_is_normalized(expr)); > > - } > > - if (!error) { > > - struct hmap matches; > > - > > - expr_to_matches(expr, lookup_port_cb, &ports, &matches); > > - expr_matches_print(&matches, stdout); > > - expr_matches_destroy(&matches); > > - } else { > > - puts(error); > > - free(error); > > - } > > - expr_destroy(expr); > > - simap_destroy(&ports); > > - expr_symtab_destroy(&symtab); > > - shash_destroy(&symtab); > > - expr_const_sets_destroy(&addr_sets); > > - shash_destroy(&addr_sets); > > - expr_const_sets_destroy(&port_groups); > > - shash_destroy(&port_groups); > > -} > > - > > -static bool > > -lookup_atoi_cb(const void *aux OVS_UNUSED, const char *port_name, > > - unsigned int *portp) > > -{ > > - *portp = atoi(port_name); > > - return true; > > -} > > - > > -static void > > -test_expr_to_packets(const char *input) > > -{ > > - struct shash symtab; > > - create_symtab(&symtab); > > - > > - struct flow uflow; > > - char *error = expr_parse_microflow(input, &symtab, NULL, NULL, > > - lookup_atoi_cb, NULL, &uflow); > > - if (error) { > > - puts(error); > > - free(error); > > - expr_symtab_destroy(&symtab); > > - shash_destroy(&symtab); > > - return; > > - } > > - > > - uint64_t packet_stub[128 / 8]; > > - struct dp_packet packet; > > - dp_packet_use_stub(&packet, packet_stub, sizeof packet_stub); > > - flow_compose(&packet, &uflow, NULL, 64); > > - > > - struct ds output = DS_EMPTY_INITIALIZER; > > - const uint8_t *buf = dp_packet_data(&packet); > > - for (int i = 0; i < dp_packet_size(&packet); i++) { > > - uint8_t val = buf[i]; > > - ds_put_format(&output, "%02"PRIx8, val); > > - } > > - puts(ds_cstr(&output)); > > - ds_destroy(&output); > > - dp_packet_uninit(&packet); > > - expr_symtab_destroy(&symtab); > > - shash_destroy(&symtab); > > -} > > - > > -int > > -LLVMFuzzerTestOneInput(const uint8_t *input_, size_t size) > > -{ > > - /* Bail out if we cannot construct at least a 1 char string. */ > > - const char *input = (const char *) input_; > > - if (size < 2 || input[size - 1] != '\0' || strchr(input, '\n') || > > - strlen(input) != size - 1) { > > - return 0; > > - } > > - > > - /* Disable logging to avoid write to disk. */ > > - static bool isInit = false; > > - if (!isInit) { > > - vlog_set_verbosity("off"); > > - isInit = true; > > - } > > - > > - /* Parse, annotate, simplify, normalize expr and convert to flows. */ > > - test_parse_expr(input); > > - > > - /* Parse actions. */ > > - test_parse_actions(input); > > - > > - /* Test OVN lexer. */ > > - test_lex(input); > > - > > - /* Expr to packets. */ > > - test_expr_to_packets(input); > > - > > - return 0; > > -} > > diff --git a/tests/oss-fuzz/flow_extract_target.c > > b/tests/oss-fuzz/flow_extract_target.c > > deleted file mode 100644 > > index 4a7451411..000000000 > > --- a/tests/oss-fuzz/flow_extract_target.c > > +++ /dev/null > > @@ -1,100 +0,0 @@ > > -#include <config.h> > > -#include "classifier.h" > > -#include <assert.h> > > -#include "fuzzer.h" > > -#include "dp-packet.h" > > -#include "flow.h" > > -#include "openvswitch/ofp-match.h" > > -#include "openvswitch/ofp-print.h" > > -#include "openvswitch/match.h" > > -#include "classifier-private.h" > > - > > -static void > > -test_flow_hash(const struct flow *flow) > > -{ > > - uint32_t hash = flow_hash_5tuple(flow, 0); > > - hash = flow_hash_symmetric_l4(flow, 0); > > - hash = flow_hash_symmetric_l2(flow, 0); > > - hash = flow_hash_symmetric_l3l4(flow, 0, NULL); > > - hash = flow_hash_symmetric_l3(flow, 0); > > - hash = flow_hash_fields(flow, NX_HASH_FIELDS_ETH_SRC, hash); > > - hash = flow_hash_fields(flow, NX_HASH_FIELDS_SYMMETRIC_L4, hash); > > - hash = flow_hash_fields(flow, NX_HASH_FIELDS_SYMMETRIC_L3L4, hash); > > - hash = flow_hash_fields(flow, NX_HASH_FIELDS_SYMMETRIC_L3L4_UDP, > > hash); > > - hash = flow_hash_fields(flow, NX_HASH_FIELDS_NW_SRC, hash); > > - hash = flow_hash_fields(flow, NX_HASH_FIELDS_NW_DST, hash); > > - hash = flow_hash_fields(flow, NX_HASH_FIELDS_SYMMETRIC_L3, hash); > > - ignore(hash); > > -} > > - > > -static void > > -test_flow_mask(const struct flow *flow) > > -{ > > - struct flow_wildcards catchall; > > - > > - flow_wildcards_init_catchall(&catchall); > > - flow_mask_hash_fields(flow, &catchall, NX_HASH_FIELDS_ETH_SRC); > > - flow_mask_hash_fields(flow, &catchall, NX_HASH_FIELDS_SYMMETRIC_L4); > > - flow_mask_hash_fields(flow, &catchall, NX_HASH_FIELDS_SYMMETRIC_L3L4); > > - flow_mask_hash_fields(flow, &catchall, > > NX_HASH_FIELDS_SYMMETRIC_L3L4_UDP); > > - flow_mask_hash_fields(flow, &catchall, NX_HASH_FIELDS_NW_SRC); > > - flow_mask_hash_fields(flow, &catchall, NX_HASH_FIELDS_NW_DST); > > - flow_mask_hash_fields(flow, &catchall, NX_HASH_FIELDS_SYMMETRIC_L3); > > -} > > - > > -int > > -LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) > > -{ > > - struct dp_packet packet; > > - struct flow flow; > > - dp_packet_use_const(&packet, data, size); > > - flow_extract(&packet, &flow); > > - > > - /* Extract flowmap. */ > > - 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); > > - } > > - > > - /* Parse TCP flags. */ > > - if (dp_packet_size(&packet) >= ETH_HEADER_LEN) { > > - uint16_t tcp_flags = parse_tcp_flags(&packet); > > - ignore(tcp_flags); > > - } > > - > > - /* Count headers. */ > > - int count = flow_count_vlan_headers(&flow); > > - ignore(count); > > - > > - /* Extract metadata. */ > > - struct match flow_metadata; > > - flow_get_metadata(&flow, &flow_metadata); > > - > > - /* Hashing functions. */ > > - test_flow_hash(&flow); > > - > > - /* Masking functions. */ > > - test_flow_mask(&flow); > > - > > - /* Convert flow to match. */ > > - struct match match; > > - match_wc_init(&match, &flow); > > - > > - struct ofp10_match ext_match; > > - ofputil_match_to_ofp10_match(&match, &ext_match); > > - > > - /* Print match and packet. */ > > - ofp_print_packet(stdout, dp_packet_data(&packet), > > dp_packet_size(&packet), > > - htonl(PT_ETH)); > > - ovs_hex_dump(stdout, dp_packet_data(&packet), > > dp_packet_size(&packet), 0, > > - true); > > - match_print(&match, NULL); > > - > > - ovs_hex_dump(stdout, &ext_match, sizeof ext_match, 0, false); > > - > > - return 0; > > -} > > diff --git a/tests/oss-fuzz/fuzzer.h b/tests/oss-fuzz/fuzzer.h > > deleted file mode 100644 > > index f87ae59e9..000000000 > > --- a/tests/oss-fuzz/fuzzer.h > > +++ /dev/null > > @@ -1,9 +0,0 @@ > > -#ifndef FUZZER_H > > -#define FUZZER_H 1 > > - > > -#include <stdint.h> > > -#include <stddef.h> > > - > > -int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); > > - > > -#endif /* fuzzer.h */ > > diff --git a/tests/oss-fuzz/json_parser_target.c > > b/tests/oss-fuzz/json_parser_target.c > > deleted file mode 100644 > > index e39e04a0d..000000000 > > --- a/tests/oss-fuzz/json_parser_target.c > > +++ /dev/null > > @@ -1,42 +0,0 @@ > > -#include <config.h> > > -#include "fuzzer.h" > > -#include "jsonrpc.h" > > -#include "openvswitch/json.h" > > -#include "ovsdb-error.h" > > -#include "ovsdb/table.h" > > -#include <assert.h> > > -#include <string.h> > > - > > -int > > -LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) > > -{ > > - if (!size || data[size - 1]) { > > - return 0; > > - } > > - > > - struct json *j1 = json_from_string((const char *)data); > > - if (j1->type == JSON_STRING) { > > - json_destroy(j1); > > - return 0; > > - } > > - > > - free(json_to_string(j1, JSSF_SORT | JSSF_PRETTY)); > > - > > - struct jsonrpc_msg *msg; > > - char *error = jsonrpc_msg_from_json(j1, &msg); /* Frees 'j1'. */ > > - if (error) { > > - free(error); > > - return 0; > > - } > > - > > - struct json *j2 = jsonrpc_msg_to_json(msg); /* Frees 'msg'. */ > > - if (j2->type == JSON_STRING) { > > - json_destroy(j2); > > - return 0; > > - } > > - > > - free(json_to_string(j2, JSSF_SORT | JSSF_PRETTY)); > > - json_destroy(j2); > > - > > - return 0; > > -} > > diff --git a/tests/oss-fuzz/miniflow_target.c > > b/tests/oss-fuzz/miniflow_target.c > > deleted file mode 100644 > > index 800375d63..000000000 > > --- a/tests/oss-fuzz/miniflow_target.c > > +++ /dev/null > > @@ -1,365 +0,0 @@ > > -#include <config.h> > > -#include "classifier.h" > > -#include "fuzzer.h" > > -#include "dp-packet.h" > > -#include "flow.h" > > -#include "openvswitch/ofp-match.h" > > -#include "openvswitch/ofp-print.h" > > -#include "openvswitch/match.h" > > -#include "classifier-private.h" > > -#include "util.h" > > - > > -static void > > -shuffle_u32s(uint32_t *p, size_t n) > > -{ > > - for (; n > 1; n--, p++) { > > - uint32_t *q = &p[random_range(n)]; > > - uint32_t tmp = *p; > > - *p = *q; > > - *q = tmp; > > - } > > -} > > - > > -/* Returns a copy of 'src'. The caller must eventually free the returned > > - * miniflow with free(). */ > > -static struct miniflow * > > -miniflow_clone__(const struct miniflow *src) > > -{ > > - struct miniflow *dst; > > - size_t data_size; > > - > > - data_size = miniflow_alloc(&dst, 1, src); > > - miniflow_clone(dst, src, data_size / sizeof(uint64_t)); > > - return dst; > > -} > > - > > -/* Returns a hash value for 'flow', given 'basis'. */ > > -static inline uint32_t > > -miniflow_hash__(const struct miniflow *flow, uint32_t basis) > > -{ > > - const uint64_t *p = miniflow_get_values(flow); > > - size_t n_values = miniflow_n_values(flow); > > - struct flowmap hash_map = FLOWMAP_EMPTY_INITIALIZER; > > - uint32_t hash = basis; > > - size_t idx; > > - > > - FLOWMAP_FOR_EACH_INDEX (idx, flow->map) { > > - uint64_t value = *p++; > > - > > - if (value) { > > - hash = hash_add64(hash, value); > > - flowmap_set(&hash_map, idx, 1); > > - } > > - } > > - map_t map; > > - FLOWMAP_FOR_EACH_MAP (map, hash_map) { > > - hash = hash_add64(hash, map); > > - } > > - > > - return hash_finish(hash, n_values); > > -} > > - > > -static uint32_t > > -random_value(void) > > -{ > > - static const uint32_t values_[] = > > - { 0xffffffff, 0xaaaaaaaa, 0x55555555, 0x80000000, > > - 0x00000001, 0xface0000, 0x00d00d1e, 0xdeadbeef }; > > - > > - return values_[random_range(ARRAY_SIZE(values_))]; > > -} > > - > > -static bool > > -choose(unsigned int n, unsigned int *idxp) > > -{ > > - if (*idxp < n) { > > - return true; > > - } else { > > - *idxp -= n; > > - return false; > > - } > > -} > > - > > -#define FLOW_U32S (FLOW_U64S * 2) > > - > > -static bool > > -init_consecutive_values(int n_consecutive, struct flow *flow, > > - unsigned int *idxp) > > -{ > > - uint32_t *flow_u32 = (uint32_t *) flow; > > - > > - if (choose(FLOW_U32S - n_consecutive + 1, idxp)) { > > - int i; > > - > > - for (i = 0; i < n_consecutive; i++) { > > - flow_u32[i + *idxp] = random_value(); > > - } > > - return true; > > - } else { > > - return false; > > - } > > -} > > - > > -static bool > > -next_random_flow(struct flow *flow, unsigned int idx) > > -{ > > - uint32_t *flow_u32 = (uint32_t *) flow; > > - > > - memset(flow, 0, sizeof *flow); > > - > > - /* Empty flow. */ > > - if (choose(1, &idx)) { > > - return true; > > - } > > - > > - /* All flows with a small number of consecutive nonzero values. */ > > - for (int i = 1; i <= 4; i++) { > > - if (init_consecutive_values(i, flow, &idx)) { > > - return true; > > - } > > - } > > - > > - /* All flows with a large number of consecutive nonzero values. */ > > - for (int i = FLOW_U32S - 4; i <= FLOW_U32S; i++) { > > - if (init_consecutive_values(i, flow, &idx)) { > > - return true; > > - } > > - } > > - > > - /* All flows with exactly two nonconsecutive nonzero values. */ > > - if (choose((FLOW_U32S - 1) * (FLOW_U32S - 2) / 2, &idx)) { > > - int ofs1; > > - > > - for (ofs1 = 0; ofs1 < FLOW_U32S - 2; ofs1++) { > > - int ofs2; > > - > > - for (ofs2 = ofs1 + 2; ofs2 < FLOW_U32S; ofs2++) { > > - if (choose(1, &idx)) { > > - flow_u32[ofs1] = random_value(); > > - flow_u32[ofs2] = random_value(); > > - return true; > > - } > > - } > > - } > > - OVS_NOT_REACHED(); > > - } > > - > > - /* 16 randomly chosen flows with N >= 3 nonzero values. */ > > - if (choose(16 * (FLOW_U32S - 4), &idx)) { > > - int n = idx / 16 + 3; > > - > > - for (int i = 0; i < n; i++) { > > - flow_u32[i] = random_value(); > > - } > > - shuffle_u32s(flow_u32, FLOW_U32S); > > - > > - return true; > > - } > > - > > - return false; > > -} > > - > > -static void > > -any_random_flow(struct flow *flow) > > -{ > > - static unsigned int max; > > - if (!max) { > > - while (next_random_flow(flow, max)) { > > - max++; > > - } > > - } > > - > > - next_random_flow(flow, random_range(max)); > > -} > > - > > -static void > > -toggle_masked_flow_bits(struct flow *flow, const struct flow_wildcards > > *mask) > > -{ > > - const uint32_t *mask_u32 = (const uint32_t *) &mask->masks; > > - uint32_t *flow_u32 = (uint32_t *) flow; > > - int i; > > - > > - for (i = 0; i < FLOW_U32S; i++) { > > - if (mask_u32[i] != 0) { > > - uint32_t bit; > > - > > - do { > > - bit = 1u << random_range(32); > > - } while (!(bit & mask_u32[i])); > > - flow_u32[i] ^= bit; > > - } > > - } > > -} > > - > > -static void > > -wildcard_extra_bits(struct flow_wildcards *mask) > > -{ > > - uint32_t *mask_u32 = (uint32_t *) &mask->masks; > > - int i; > > - > > - for (i = 0; i < FLOW_U32S; i++) { > > - if (mask_u32[i] != 0) { > > - uint32_t bit; > > - > > - do { > > - bit = 1u << random_range(32); > > - } while (!(bit & mask_u32[i])); > > - mask_u32[i] &= ~bit; > > - } > > - } > > -} > > - > > -static void > > -test_miniflow(struct flow *flow) > > -{ > > - struct miniflow *miniflow, *miniflow2, *miniflow3; > > - struct flow flow2, flow3; > > - struct flow_wildcards mask; > > - struct minimask *minimask; > > - int i; > > - > > - const uint64_t *flow_u64 = (const uint64_t *) flow; > > - > > - /* Convert flow to miniflow. */ > > - miniflow = miniflow_create(flow); > > - > > - /* Obtain miniflow hash. */ > > - uint32_t hash = miniflow_hash_5tuple(miniflow, 0); > > - ignore(hash); > > - > > - /* Check that the flow equals its miniflow. */ > > - for (i = 0; i < FLOW_MAX_VLAN_HEADERS; i++) { > > - ovs_assert(miniflow_get_vid(miniflow, i) == > > - vlan_tci_to_vid(flow->vlans[i].tci)); > > - } > > - for (i = 0; i < FLOW_U64S; i++) { > > - ovs_assert(miniflow_get(miniflow, i) == flow_u64[i]); > > - } > > - > > - /* Check that the miniflow equals itself. */ > > - ovs_assert(miniflow_equal(miniflow, miniflow)); > > - > > - /* Convert miniflow back to flow and verify that it's the same. */ > > - miniflow_expand(miniflow, &flow2); > > - ovs_assert(flow_equal(flow, &flow2)); > > - /* Check that copying a miniflow works properly. */ > > - miniflow2 = miniflow_clone__(miniflow); > > - ovs_assert(miniflow_equal(miniflow, miniflow2)); > > - ovs_assert(miniflow_hash__(miniflow, 0) == miniflow_hash__(miniflow2, > > 0)); > > - miniflow_expand(miniflow2, &flow3); > > - ovs_assert(flow_equal(flow, &flow3)); > > - > > - /* Check that masked matches work as expected for identical flows and > > - * miniflows. */ > > - do { > > - next_random_flow(&mask.masks, 1); > > - } while (flow_wildcards_is_catchall(&mask)); > > - minimask = minimask_create(&mask); > > - ovs_assert(minimask_is_catchall(minimask) > > - == flow_wildcards_is_catchall(&mask)); > > - ovs_assert(miniflow_equal_in_minimask(miniflow, miniflow2, minimask)); > > - ovs_assert(miniflow_equal_flow_in_minimask(miniflow, &flow2, > > minimask)); > > - ovs_assert(miniflow_hash_in_minimask(miniflow, minimask, 0x12345678) > > == > > - flow_hash_in_minimask(flow, minimask, 0x12345678)); > > - ovs_assert(minimask_hash(minimask, 0) == > > - miniflow_hash__(&minimask->masks, 0)); > > - > > - /* Check that masked matches work as expected for differing flows and > > - * miniflows. */ > > - toggle_masked_flow_bits(&flow2, &mask); > > - ovs_assert(!miniflow_equal_flow_in_minimask(miniflow, &flow2, > > minimask)); > > - miniflow3 = miniflow_create(&flow2); > > - ovs_assert(!miniflow_equal_in_minimask(miniflow, miniflow3, > > minimask)); > > - > > - free(miniflow); > > - free(miniflow2); > > - free(miniflow3); > > - free(minimask); > > -} > > - > > -static void > > -test_minimask_has_extra(struct flow *flow) > > -{ > > - struct flow_wildcards catchall; > > - struct minimask *minicatchall; > > - > > - flow_wildcards_init_catchall(&catchall); > > - minicatchall = minimask_create(&catchall); > > - ovs_assert(minimask_is_catchall(minicatchall)); > > - > > - struct flow_wildcards mask; > > - struct minimask *minimask; > > - > > - mask.masks = *flow; > > - minimask = minimask_create(&mask); > > - ovs_assert(!minimask_has_extra(minimask, minimask)); > > - ovs_assert(minimask_has_extra(minicatchall, minimask) > > - == !minimask_is_catchall(minimask)); > > - if (!minimask_is_catchall(minimask)) { > > - struct minimask *minimask2; > > - > > - wildcard_extra_bits(&mask); > > - minimask2 = minimask_create(&mask); > > - ovs_assert(minimask_has_extra(minimask2, minimask)); > > - ovs_assert(!minimask_has_extra(minimask, minimask2)); > > - free(minimask2); > > - } > > - > > - free(minimask); > > - free(minicatchall); > > -} > > - > > -static void > > -test_minimask_combine(struct flow *flow) > > -{ > > - struct flow_wildcards catchall; > > - struct minimask *minicatchall; > > - > > - flow_wildcards_init_catchall(&catchall); > > - minicatchall = minimask_create(&catchall); > > - ovs_assert(minimask_is_catchall(minicatchall)); > > - > > - struct minimask *minimask, *minimask2; > > - struct flow_wildcards mask, mask2, combined, combined2; > > - struct { > > - struct minimask minicombined; > > - uint64_t storage[FLOW_U64S]; > > - } m; > > - struct flow flow2; > > - > > - mask.masks = *flow; > > - minimask = minimask_create(&mask); > > - > > - minimask_combine(&m.minicombined, minimask, minicatchall, m.storage); > > - ovs_assert(minimask_is_catchall(&m.minicombined)); > > - > > - any_random_flow(&flow2); > > - mask2.masks = flow2; > > - minimask2 = minimask_create(&mask2); > > - > > - minimask_combine(&m.minicombined, minimask, minimask2, m.storage); > > - flow_wildcards_and(&combined, &mask, &mask2); > > - minimask_expand(&m.minicombined, &combined2); > > - ovs_assert(flow_wildcards_equal(&combined, &combined2)); > > - > > - free(minimask); > > - free(minimask2); > > - > > - free(minicatchall); > > -} > > - > > -int > > -LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) > > -{ > > - struct dp_packet packet; > > - struct flow flow; > > - dp_packet_use_const(&packet, data, size); > > - flow_extract(&packet, &flow); > > - > > - /* Do miniflow tests. */ > > - test_miniflow(&flow); > > - test_minimask_has_extra(&flow); > > - test_minimask_combine(&flow); > > - > > - return 0; > > -} > > diff --git a/tests/oss-fuzz/odp_target.c b/tests/oss-fuzz/odp_target.c > > deleted file mode 100644 > > index ae61cdca3..000000000 > > --- a/tests/oss-fuzz/odp_target.c > > +++ /dev/null > > @@ -1,149 +0,0 @@ > > -#include <config.h> > > -#include "fuzzer.h" > > -#undef NDEBUG > > -#include "odp-util.h" > > -#include <stdio.h> > > -#include "openvswitch/dynamic-string.h" > > -#include "flow.h" > > -#include "openvswitch/match.h" > > -#include "openvswitch/ofpbuf.h" > > -#include "util.h" > > -#include "openvswitch/ofp-flow.h" > > -#include "openvswitch/vlog.h" > > - > > -static int > > -parse_keys(bool wc_keys, const char *in) > > -{ > > - int exit_code = 0; > > - > > - enum odp_key_fitness fitness; > > - struct ofpbuf odp_key; > > - struct ofpbuf odp_mask; > > - struct flow flow; > > - struct ds out; > > - int error; > > - > > - /* Convert string to OVS DP key. */ > > - ofpbuf_init(&odp_key, 0); > > - ofpbuf_init(&odp_mask, 0); > > - error = odp_flow_from_string(in, NULL, > > - &odp_key, &odp_mask, NULL); > > - if (error) { > > - printf("odp_flow_from_string: error\n"); > > - goto next; > > - } > > - > > - if (!wc_keys) { > > - struct odp_flow_key_parms odp_parms = { > > - .flow = &flow, > > - .support = { > > - .recirc = true, > > - .ct_state = true, > > - .ct_zone = true, > > - .ct_mark = true, > > - .ct_label = true, > > - .max_vlan_headers = SIZE_MAX, > > - }, > > - }; > > - > > - /* Convert odp_key to flow. */ > > - fitness = odp_flow_key_to_flow(odp_key.data, odp_key.size, > > - &flow, NULL); > > - switch (fitness) { > > - case ODP_FIT_PERFECT: > > - break; > > - > > - case ODP_FIT_TOO_LITTLE: > > - printf("ODP_FIT_TOO_LITTLE: "); > > - break; > > - > > - case ODP_FIT_TOO_MUCH: > > - printf("ODP_FIT_TOO_MUCH: "); > > - break; > > - > > - case ODP_FIT_ERROR: > > - printf("odp_flow_key_to_flow: error\n"); > > - goto next; > > - } > > - /* Convert cls_rule back to odp_key. */ > > - ofpbuf_uninit(&odp_key); > > - ofpbuf_init(&odp_key, 0); > > - odp_flow_key_from_flow(&odp_parms, &odp_key); > > - > > - if (odp_key.size > ODPUTIL_FLOW_KEY_BYTES) { > > - printf ("too long: %"PRIu32" > %d\n", > > - odp_key.size, ODPUTIL_FLOW_KEY_BYTES); > > - exit_code = 1; > > - } > > - } > > - > > - /* Convert odp_key to string. */ > > - ds_init(&out); > > - if (wc_keys) { > > - odp_flow_format(odp_key.data, odp_key.size, > > - odp_mask.data, odp_mask.size, NULL, &out, false); > > - } else { > > - odp_flow_key_format(odp_key.data, odp_key.size, &out); > > - } > > - puts(ds_cstr(&out)); > > - ds_destroy(&out); > > - > > -next: > > - ofpbuf_uninit(&odp_key); > > - ofpbuf_uninit(&odp_mask); > > - > > - return exit_code; > > -} > > - > > -static int > > -parse_actions(const char *in) > > -{ > > - struct ofpbuf odp_actions; > > - struct ds out; > > - int error; > > - > > - /* Convert string to OVS DP actions. */ > > - ofpbuf_init(&odp_actions, 0); > > - error = odp_actions_from_string(in, NULL, &odp_actions); > > - if (error) { > > - printf("odp_actions_from_string: error\n"); > > - goto next; > > - } > > - > > - /* Convert odp_actions back to string. */ > > - ds_init(&out); > > - format_odp_actions(&out, odp_actions.data, odp_actions.size, NULL); > > - puts(ds_cstr(&out)); > > - ds_destroy(&out); > > - > > -next: > > - ofpbuf_uninit(&odp_actions); > > - return 0; > > -} > > - > > -int > > -LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) > > -{ > > - /* Bail out if we cannot construct at least a 1 char string. */ > > - const char *input = (const char *) data; > > - if (size < 2 || input[size - 1] != '\0' || strchr(input, '\n') || > > - strlen(input) != size - 1) { > > - return 0; > > - } > > - > > - /* Disable logging to avoid write to disk. */ > > - static bool isInit = false; > > - if (!isInit) { > > - vlog_set_verbosity("off"); > > - isInit = true; > > - } > > - > > - /* Parse keys and wc keys. */ > > - parse_keys(false, input); > > - parse_keys(true, input); > > - > > - /* Parse actions. */ > > - parse_actions(input); > > - > > - return 0; > > -} > > diff --git a/tests/oss-fuzz/ofctl_parse_target.c > > b/tests/oss-fuzz/ofctl_parse_target.c > > deleted file mode 100644 > > index b4db52f7e..000000000 > > --- a/tests/oss-fuzz/ofctl_parse_target.c > > +++ /dev/null > > @@ -1,113 +0,0 @@ > > -#include <config.h> > > -#include "fuzzer.h" > > -#include "openvswitch/ofp-flow.h" > > -#include "ofp-version-opt.h" > > -#include "ofproto/ofproto.h" > > -#include "openflow/openflow.h" > > -#include "openvswitch/ofpbuf.h" > > -#include "openvswitch/vlog.h" > > -#include "util.h" > > - > > -static void > > -ofctl_parse_flows__(struct ofputil_flow_mod *fms, size_t n_fms, > > - enum ofputil_protocol usable_protocols) > > -{ > > - enum ofputil_protocol protocol = 0; > > - char *usable_s; > > - size_t i; > > - > > - usable_s = ofputil_protocols_to_string(usable_protocols); > > - printf("usable protocols: %s\n", usable_s); > > - free(usable_s); > > - > > - if (!(usable_protocols & OFPUTIL_P_ANY)) { > > - printf("no usable protocol\n"); > > - goto free; > > - } > > - for (i = 0; i < sizeof(enum ofputil_protocol) * CHAR_BIT; i++) { > > - protocol = 1u << i; > > - if (protocol & usable_protocols & OFPUTIL_P_ANY) { > > - break; > > - } > > - } > > - ovs_assert(is_pow2(protocol)); > > - > > - printf("chosen protocol: %s\n", ofputil_protocol_to_string(protocol)); > > - > > - for (i = 0; i < n_fms; i++) { > > - struct ofputil_flow_mod *fm = &fms[i]; > > - struct ofpbuf *msg; > > - > > - msg = ofputil_encode_flow_mod(fm, protocol); > > - ofpbuf_delete(msg); > > - } > > - > > -free: > > - for (i = 0; i < n_fms; i++) { > > - struct ofputil_flow_mod *fm = &fms[i]; > > - free(CONST_CAST(struct ofpact *, fm->ofpacts)); > > - minimatch_destroy(&fm->match); > > - } > > -} > > - > > -/* "parse-flow FLOW": parses the argument as a flow (like add-flow) and > > prints > > - * it back to stdout. */ > > -static void > > -ofctl_parse_flow(const char *input, int command) > > -{ > > - enum ofputil_protocol usable_protocols; > > - struct ofputil_flow_mod fm; > > - char *error; > > - > > - error = parse_ofp_flow_mod_str(&fm, input, NULL, NULL, > > - command, &usable_protocols); > > - if (error) { > > - printf("Error encountered: %s\n", error); > > - free(error); > > - } else { > > - ofctl_parse_flows__(&fm, 1, usable_protocols); > > - } > > -} > > - > > -int > > -LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) > > -{ > > - /* Bail out if we cannot construct at least a 1 char string. > > - * Reserve 1 byte to decide flow mod command. > > - * > > - * Here's the structure of data we expect > > - * |--Byte 1--|--Byte 2--|...|--Byte (size-1)--| > > - * > > - * where, > > - * > > - * Byte 1: Used to decide which ofp flow mod command to test > > - * Bytes 2--(size-1): The C string that is actually passed to > > - * ofctl_parse_flow() test API. > > - * > > - * This means that the fuzzed input is actually a C string of > > - * length = (size -2) with the terminal byte being the NUL > > - * character. Moreover, this string is expected to not contain > > - * a new-line character. > > - */ > > - const char *stream = (const char *) data; > > - if (size < 3 || stream[size - 1] != '\0' || strchr(&stream[1], '\n') > > || > > - strlen(&stream[1]) != size - 2) { > > - return 0; > > - } > > - > > - /* Disable logging to avoid write to disk. */ > > - static bool isInit = false; > > - if (!isInit) { > > - vlog_set_verbosity("off"); > > - isInit = true; > > - } > > - > > - /* Decide test parameters using first byte of fuzzed input. */ > > - int command = (stream[0] % OFPFC_DELETE_STRICT) + 1; > > - > > - /* Fuzz extended match parsing. */ > > - const char *input = &stream[1]; > > - ofctl_parse_flow(input, command); > > - > > - return 0; > > -} > > diff --git a/tests/oss-fuzz/ofp_print_target.c > > b/tests/oss-fuzz/ofp_print_target.c > > deleted file mode 100644 > > index 126f2623f..000000000 > > --- a/tests/oss-fuzz/ofp_print_target.c > > +++ /dev/null > > @@ -1,47 +0,0 @@ > > -#include <config.h> > > -#include "fuzzer.h" > > -#include "dp-packet.h" > > -#include "openvswitch/ofp-print.h" > > -#include "openvswitch/ofpbuf.h" > > -#include "openvswitch/vlog.h" > > - > > -int > > -LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) > > -{ > > - if (size < sizeof(struct ofp_header)) { > > - return 0; > > - } > > - > > - static bool isInit = false; > > - if (!isInit) { > > - vlog_set_verbosity("off"); > > - isInit = true; > > - } > > - > > - struct ofpbuf b; > > - ofpbuf_use_const(&b, data, size); > > - for (;;) { > > - /* Check if ofpbuf contains ofp header. */ > > - struct ofp_header *oh = ofpbuf_at(&b, 0, sizeof *oh); > > - if (!oh) { > > - break; > > - } > > - > > - /* Check if length is geq than lower bound. */ > > - size_t length = ntohs(oh->length); > > - if (length < sizeof *oh) { > > - break; > > - } > > - > > - /* Check if ofpbuf contains payload. */ > > - size_t tail_len = length - sizeof *oh; > > - void *tail = ofpbuf_at(&b, sizeof *oh, tail_len); > > - if (!tail) { > > - break; > > - } > > - > > - ofp_print(stdout, ofpbuf_pull(&b, length), length, NULL, NULL, 2); > > - } > > - ofpbuf_uninit(&b); > > - return 0; > > -} > > -- > > 2.17.1 > > > > > > -- > Bhargava Shastry > _______________________________________________ > dev mailing list > [email protected] > https://mail.openvswitch.org/mailman/listinfo/ovs-dev _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
