Add test case: inject IPv4 based TCP payload packet after recv C2S first payload

This commit is contained in:
luwenpeng
2024-05-21 17:39:16 +08:00
parent 3701fc7361
commit e8c61a1752
24 changed files with 580 additions and 410 deletions

View File

@@ -1,3 +1,4 @@
#include <time.h>
#include <errno.h>
#include <assert.h>
@@ -209,7 +210,10 @@ static inline void calc_tcp_fingerprint(struct tcp_fingerprint *finger)
{
#define RANGE(rand, start, end) (start + rand % (end - start + 1)) // [start, end]
uint64_t random = 0x013579ABCDEF ^ stellar_get_monotonic_time_msec();
struct timespec time;
clock_gettime(CLOCK_MONOTONIC, &time);
uint64_t random = 0x013579ABCDEF ^ time.tv_nsec;
finger->ipid = (uint16_t)(RANGE(random, 32767, 65535));
finger->ttl = (uint8_t)(RANGE(random, 48, 120));
finger->win = (uint16_t)(RANGE(random, 1000, 1460));