Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuzz testing app #172

Merged
merged 14 commits into from
May 23, 2014
Merged

Fuzz testing app #172

merged 14 commits into from
May 23, 2014

Conversation

ghost
Copy link

@ghost ghost commented May 19, 2014

This pull request adds a Fuzz testing app.

The application generates a number of packets on it's output link. When a packet is received it tries to find a match from the send ones.

The generation is done in 2 phases:

  • payload generation - stacking Raw data, Ethernet, IPv4, IPv6, TCP and UDP protocol layers
  • scatter the data to predefined iovec layouts

Each packet is marked at its payload end with a unique number. Upon receiving this number is used to find the originating match. Their parsed headers are then compared and verified.

This implies that the the packets are received assembled if any fragmentation was used. So GSO should be enabled on both TX/RX.

The first set of patches fixes some found issues with the existing code (datagram and packet). Then we add 2 utility functions in lib (random_data and deepcopy), packet (scatter) and header (eq).
For a complete packet payload generation we need more supported protocols in the protocol layer. So we add IPv4, TCP and UDP to the existing Ethernet, IPv6 and ICMP.

This patch may be affected by the "VPN performance" pull request, as it touches the same layer "protocol".

Nikolay Nikolaev added 14 commits May 12, 2014 09:34
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
When creating empty datagram add a single iovec with an empty buffer.
Also ensure the _parse stack is initialised.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
A new function for generating a random binary string with a specified length.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
deepcopy implementation from http://lua-users.org/wiki/CopyTable, with added
naive ctype support. C pointers are not properly copied.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Add a packet function that does the opposite of the coalescse.
It take a packet and returnes a 'scattered' clone of it.
The second argument is a scatter pattern list. It has the form
{ {len, offset}, {len, offset} ... }

An example invocation:

scattered = packet.scatter(p, {{10}, {100, 20}}

This will create a new packet with the following iovec layout:
 - 10 bytes at offset 0
 - 100 bytes starting at offset 20
 - the rest starting at offset 0

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Add a method for raw bit-to-bit comapring of header data. This can be overriden
in the ancestors, for more fine comparing (specific flags etc.)

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
dscp and ecn are subfields of the traffic class, should be able to set/get
separetely.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Add IPv4 support in the protocol library.
This version does not support IPv4 header options (rarely used)

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
The optional URG pointer and TCP options are nto supported.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
The generation is done in 2 phases:
 - payload generation - stacking Raw data, Ethernet, IPv4, IPv6,
   TCP and UDP protocol layers
 - scatter the data to predefined iovec layouts

Each packet is marked at its payload end with a unique number. Upon
receiving this number is used to find the originating match. Their
parsed headers are then compared and verified.

NOTE: This implies that the the packets are received assembled if
any fragmentation was used. So GSO should be enabled on both TX/RX.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
@lukego
Copy link
Member

lukego commented May 20, 2014

Great!

@alexandergall how does this look for you? (building on your framework.)

@javierguerragiraldez does this look like something you can use to help with intel10g testing / bug-finding?

@alexandergall
Copy link
Contributor

Looks good. I hope that my framework turns out to be useful. It would be easy to adapt this to the changes of my own pull request.

@javierguerragiraldez
Copy link
Contributor

seems very nice (and extensive!). definitely will try to pass that through the drivers.

nitpicking: there are a couple of places where it applies the "Shlemiel the painter's algorithm", building a string by consecutive concatenation. AFACIT it's only in the generation phase, so it's not important, but it stands out while reading the code.

@lukego
Copy link
Member

lukego commented May 21, 2014

@alexandergall Is it okay for you if I merge this first and you rebase your commits onto this if there is a conflict? (Or what would you suggest?)

@alexandergall
Copy link
Contributor

Yes, that's ok. I guess we'll have to sort out the issue with the inclusion of libpcap into the build environment before my request can be merged.

lukego added a commit that referenced this pull request May 23, 2014
@lukego lukego merged commit af8be4f into snabbco:master May 23, 2014
mwiget pushed a commit to mwiget/snabb that referenced this pull request Dec 29, 2015
Support for running the AFTR in “development mode”
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants