File tree 2 files changed +12
-9
lines changed
2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 2
2
3
3
#include <csum.h>
4
4
5
+ #ifdef VERY_RANDOM
6
+ #include <sys/random.h>
7
+ #endif
8
+
5
9
pthread_t threads [MAX_THREADS ];
6
10
int thread_cnt = 0 ;
7
11
@@ -429,15 +433,12 @@ void *thread_hdl(void *temp)
429
433
// Retrieve current time since boot.
430
434
clock_gettime (CLOCK_BOOTTIME , & ts );
431
435
432
- // Generate seed (we use nanoseconds for better precision/randomness).
433
- seed = ts .tv_nsec ;
434
-
435
- // Add some more randomness if track is enabled.
436
- if (ti -> seq .track )
437
- {
438
- seed ^= total_pckts [ti -> seq_cnt ];
439
- }
440
-
436
+ // Generate seed.
437
+ #ifdef VERY_RANDOM
438
+ getrandom (& seed , sizeof (seed ), 0 );
439
+ #else
440
+ seed = ts .tv_nsec ;
441
+ #endif
441
442
// Check if we need to generate random IP TTL.
442
443
if (ti -> seq .ip .min_ttl != ti -> seq .ip .max_ttl )
443
444
{
Original file line number Diff line number Diff line change 33
33
#include "af_xdp.h"
34
34
#include "main.h"
35
35
36
+ //#define VERY_RANDOM
37
+
36
38
#define MAX_PCKT_LEN 0xFFFF
37
39
#define MAX_THREADS 4096
38
40
#define MAX_NAME_LEN 64
You can’t perform that action at this time.
0 commit comments