Add files via upload
This commit is contained in:
parent
5777405bab
commit
943c1ef005
|
@ -7,7 +7,7 @@
|
|||
#include "windivert.h"
|
||||
#include "goodbyedpi.h"
|
||||
|
||||
static const unsigned char fake_http_request[] = "GET / HTTP/1.1\r\nHost: www.w3.org\r\n"
|
||||
static const unsigned char fake_http_request[] = "GET / HTTP/3.0\r\nHost: www.yandex.ru\r\n"
|
||||
"User-Agent: curl/8.2.1\r\nAccept: */*\r\n"
|
||||
"Accept-Encoding: deflate, gzip, br\r\n\r\n";
|
||||
static const unsigned char fake_https_request[] = {
|
||||
|
|
|
@ -1466,4 +1466,4 @@ int main(int argc, char *argv[]) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -38,6 +38,8 @@ typedef struct tcp_connrecord {
|
|||
|
||||
static time_t last_cleanup = 0;
|
||||
static tcp_connrecord_t *conntrack = NULL;
|
||||
static tcp_connrecord_t connrecord_pool[CONNRECORD_POOL_SIZE];
|
||||
static int connrecord_pool_index = 0;
|
||||
|
||||
inline static void fill_key_data(char *key, const uint8_t is_ipv6, const uint32_t srcip[4],
|
||||
const uint32_t dstip[4], const uint16_t srcport, const uint16_t dstport)
|
||||
|
@ -145,7 +147,7 @@ static int add_tcp_conntrack(const uint32_t srcip[4], const uint32_t dstip[4],
|
|||
if (!(srcip && srcport && dstip && dstport))
|
||||
return FALSE;
|
||||
|
||||
tcp_connrecord_t *tmp_connrecord = malloc(sizeof(tcp_connrecord_t));
|
||||
tcp_connrecord_t *tmp_connrecord = &connrecord_pool[connrecord_pool_index++];
|
||||
construct_key(srcip, dstip, srcport, dstport, tmp_connrecord->key, is_ipv6);
|
||||
|
||||
if (!check_get_tcp_conntrack_key(tmp_connrecord->key, NULL)) {
|
||||
|
@ -156,7 +158,6 @@ static int add_tcp_conntrack(const uint32_t srcip[4], const uint32_t dstip[4],
|
|||
return TRUE;
|
||||
}
|
||||
debug("Not added TCP conntrack %u:%hu - %u:%hu\n", srcip[0], ntohs(srcport), dstip[0], ntohs(dstport));
|
||||
free(tmp_connrecord);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -173,8 +174,7 @@ static void tcp_cleanup() {
|
|||
|
||||
HASH_ITER(hh, conntrack, tmp_connrecord, tmp_connrecord2) {
|
||||
if (difftime(last_cleanup, tmp_connrecord->time) >= TCP_CLEANUP_INTERVAL_SEC) {
|
||||
HASH_DEL(conntrack, tmp_connrecord);
|
||||
free(tmp_connrecord);
|
||||
HASH_DELETE(hh, conntrack, tmp_connrecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -209,8 +209,7 @@ int tcp_handle_outgoing(uint32_t srcip[4], uint32_t dstip[4],
|
|||
if (check_get_tcp_conntrack_key(key, &tmp_connrecord) && tmp_connrecord) {
|
||||
/* Connection exists in conntrack, moving on */
|
||||
deconstruct_key(key, tmp_connrecord, conn_info);
|
||||
HASH_DEL(conntrack, tmp_connrecord);
|
||||
free(tmp_connrecord);
|
||||
HASH_DELETE(hh, conntrack, tmp_connrecord);
|
||||
debug("____tcp_handle_outgoing TRUE: srcport = %hu\n", ntohs(srcport));
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -249,4 +248,4 @@ int tcp_get_auto_ttl(const uint8_t ttl, const uint8_t autottl1,
|
|||
}
|
||||
|
||||
return ttl_of_fake_packet;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2003-2021, Troy D. Hanson http://troydhanson.github.io/uthash/
|
||||
Copyright (c) 2003-2022, Troy D. Hanson https://troydhanson.github.io/uthash/
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
@ -51,6 +51,8 @@ typedef unsigned char uint8_t;
|
|||
#else /* VS2008 or older (or VS2010 in C mode) */
|
||||
#define NO_DECLTYPE
|
||||
#endif
|
||||
#elif defined(__MCST__) /* Elbrus C Compiler */
|
||||
#define DECLTYPE(x) (__typeof(x))
|
||||
#elif defined(__BORLANDC__) || defined(__ICCARM__) || defined(__LCC__) || defined(__WATCOMC__)
|
||||
#define NO_DECLTYPE
|
||||
#else /* GNU, Sun and other compilers */
|
||||
|
@ -450,7 +452,7 @@ do {
|
|||
|
||||
#define HASH_DELETE_HH(hh,head,delptrhh) \
|
||||
do { \
|
||||
struct UT_hash_handle *_hd_hh_del = (delptrhh); \
|
||||
const struct UT_hash_handle *_hd_hh_del = (delptrhh); \
|
||||
if ((_hd_hh_del->prev == NULL) && (_hd_hh_del->next == NULL)) { \
|
||||
HASH_BLOOM_FREE((head)->hh.tbl); \
|
||||
uthash_free((head)->hh.tbl->buckets, \
|
||||
|
@ -593,7 +595,9 @@ do {
|
|||
|
||||
|
||||
/* SAX/FNV/OAT/JEN hash functions are macro variants of those listed at
|
||||
* http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx */
|
||||
* http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx
|
||||
* (archive link: https://archive.is/Ivcan )
|
||||
*/
|
||||
#define HASH_SAX(key,keylen,hashv) \
|
||||
do { \
|
||||
unsigned _sx_i; \
|
||||
|
@ -1133,4 +1137,4 @@ typedef struct UT_hash_handle {
|
|||
unsigned hashv; /* result of hash-fcn(key) */
|
||||
} UT_hash_handle;
|
||||
|
||||
#endif /* UTHASH_H */
|
||||
#endif /* UTHASH_H */
|
Loading…
Reference in New Issue