From c48c8b8701b9f05dc67633d3a4e2335e0d17c2a4 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 3 Mar 2022 18:01:26 +0100 Subject: [PATCH] DEV: udp: add an optional argument to set the prng seed This will help reproduce certain sequences that were observed. --- dev/udp/udp-perturb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dev/udp/udp-perturb.c b/dev/udp/udp-perturb.c index b6432575b..824628d36 100644 --- a/dev/udp/udp-perturb.c +++ b/dev/udp/udp-perturb.c @@ -420,7 +420,7 @@ int main(int argc, char **argv) err.msg = malloc(err.size); if (argc < 3) - die(1, "Usage: %s [:] [:] [rand_rate%%]\n", argv[0]); + die(1, "Usage: %s [:] [:] [rand_rate%% [seed]]\n", argv[0]); if (addr_to_ss(argv[1], &frt_addr, &err) < 0) die(1, "parsing listen address: %s\n", err.msg); @@ -431,6 +431,9 @@ int main(int argc, char **argv) if (argc > 3) rand_rate = atoi(argv[3]); + if (argc > 4) + prng_state = atol(argv[4]); + pfd = calloc(sizeof(struct pollfd), MAXCONN + 1); if (!pfd) die(1, "out of memory\n");