Commit 328d081d authored by Fabrice Bellet's avatar Fabrice Bellet Committed by Olivier Crête

pseudotcp-fuzzy: fix this test

The header size should be 24 bytes only, if we don't want to fuzz the
payload too.  Moreover, the default lambda parameter is decreased to
one, to not fuzz the header too heavily, and consequently increase too
much the time for the test to complete, due to exponential
retransmission timeout when packets are corrupted.
parent 6b106b7a
......@@ -98,7 +98,7 @@ guint32 right_stream_pos = 0;
/* Configuration options. */
gint64 seed = 0;
guint32 fuzz_start_pos = 1; /* bytes into stream payload; after the SYN-ACKs */
guint n_changes_lambda = 2; /* lambda parameter for a Poisson distribution
guint n_changes_lambda = 1; /* lambda parameter for a Poisson distribution
* controlling the number of mutations made to each
* packet */
......@@ -270,7 +270,7 @@ fuzz_packet (guint8 *buf, guint32 len, guint32 stream_pos)
{
guint32 i;
guint n_changes;
#define TCP_HEADER_LENGTH 32 /* bytes; or thereabouts (include some options) */
#define HEADER_LENGTH 24 /* bytes; or thereabouts (include some options) */
/* Do we want to fuzz this packet? */
if (stream_pos < fuzz_start_pos) {
......@@ -285,7 +285,7 @@ fuzz_packet (guint8 *buf, guint32 len, guint32 stream_pos)
n_changes, stream_pos);
for (i = 0; i < n_changes; i++) {
guint32 pos = g_rand_int_range (prng, 0, MIN (len, TCP_HEADER_LENGTH));
guint32 pos = g_rand_int_range (prng, 0, MIN (len, HEADER_LENGTH));
g_debug (" • Changing byte %u.", stream_pos + pos);
buf[pos] = g_rand_int_range (prng, 0, G_MAXUINT8 + 1);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment