summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabrice Bellet <fabrice@bellet.info>2016-06-17 00:31:48 +0200
committerOlivier Crête <olivier.crete@collabora.com>2016-06-20 18:05:37 -0400
commit328d081db0370c6e8dc72a57d899d26d08c46f88 (patch)
treeafe5cf211079df75d1c0c14f45be1ec8de47c842
parent6b106b7a4a5451ecae953add1f29636d4ec03e50 (diff)
downloadlibnice-328d081db0370c6e8dc72a57d899d26d08c46f88.tar.gz
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.
-rw-r--r--tests/test-pseudotcp-fuzzy.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/test-pseudotcp-fuzzy.c b/tests/test-pseudotcp-fuzzy.c
index 4211248..4a714e6 100644
--- a/tests/test-pseudotcp-fuzzy.c
+++ b/tests/test-pseudotcp-fuzzy.c
@@ -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);
}