DEV: udp: add an optional argument to set the prng seed

This will help reproduce certain sequences that were observed.
This commit is contained in:
Willy Tarreau 2022-03-03 18:01:26 +01:00
parent e7a7fb4390
commit c48c8b8701

View File

@ -420,7 +420,7 @@ int main(int argc, char **argv)
err.msg = malloc(err.size);
if (argc < 3)
die(1, "Usage: %s [<laddr>:]<lport> [<saddr>:]<sport> [rand_rate%%]\n", argv[0]);
die(1, "Usage: %s [<laddr>:]<lport> [<saddr>:]<sport> [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");