Add oss-fuzz support (not yet enabled) #748
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This builds on the work done by @catenacyber in #700. I started an independent effort to add oss-fuzz support, then discovered #700, and this is the combination of both efforts.
My version calls into printers directly - I've implemented the plumbing for ether, ip, ip6 and bgp. This allows targeted testing: "I wrote some code for a new bgp printer, let's fuzz it". It creates the corpus (example good packets for the fuzzing infrastructure to learn from) by parsing test/*.pcap using Scapy.
The other version uses pcap files, so can end up in any part of the system. It's good for "what can happen in the universe" but is harder to target.
Adding this plumbing to the tcpdump package is one half of what's needed; the other half is to enable clusterfuzz by submitting to the oss-fuzz repository. Merging this pull request can be done independently, so that fuzzing on the clusterfuzz infrastructure can be enabled when desirable.
I've tried to document some of how it works at https://github.com/fenner/tcpdump/blob/fuzz/fuzz/README.md .
Closes #700.