Skip to content

Commit

Permalink
Updated patch for dpi
Browse files Browse the repository at this point in the history
  • Loading branch information
hondaspb authored and xtrime-ru committed Sep 24, 2024
1 parent 87cf813 commit 4b07e88
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,34 +76,38 @@ RUN <<-"EOT" bash -ex
# Patch to overcome DPI start (works only for UDP connections, taken from https://github.com/GubernievS/AntiZapret-VPN/blob/main/setup/root/patch-openvpn.sh
sed -i '/link_socket_write_udp(struct link_socket \*sock/,/\/\* write a TCP or UDP packet to link \*\//c\
link_socket_write_udp(struct link_socket *sock,\
struct buffer *buf,\
struct link_socket_actual *to)\
struct buffer *buf,\
struct link_socket_actual *to)\
{\
uint16_t stuffing_sent = 0;\
uint8_t opcode = *BPTR(buf) >> 3;\
uint16_t stuffing_sent = 0;\
uint8_t opcode = *BPTR(buf) >> 3;\
if (opcode == 7 || opcode == 8 || opcode == 10)\
{\
uint8_t stuffing_data[] = {0x01, 0x00, 0x00, 0x00, 0x01};\
size_t stuffing_len = sizeof(stuffing_data);\
struct buffer stuffing_buf = clone_buf(buf);\
buf_clear(&stuffing_buf);\
buf_write(&stuffing_buf, stuffing_data, stuffing_len);\
for (int i=0; i<100; i++)\
{\
srand(time(NULL));\
for (int i=0; i<2; i++) {\
int stuffing_len = rand() % 91 + 10;\
uint8_t stuffing_data[100];\
for (int j=0; j<stuffing_len; j++) {\
stuffing_data[j] = rand() % 256;\
}\
struct buffer stuffing_buf = alloc_buf(100);\
buf_write(&stuffing_buf, stuffing_data, stuffing_len);\
for (int j=0; j<100; j++) {\
#ifdef _WIN32\
stuffing_sent =+ link_socket_write_win32(sock, &stuffing_buf, to);\
stuffing_sent =+ link_socket_write_win32(sock, &stuffing_buf, to);\
#else\
stuffing_sent =+ link_socket_write_udp_posix(sock, &stuffing_buf, to);\
stuffing_sent =+ link_socket_write_udp_posix(sock, &stuffing_buf, to);\
#endif\
}\
free_buf(&stuffing_buf);\
}\
free_buf(&stuffing_buf);\
}\
}\
#ifdef _WIN32\
stuffing_sent =+ link_socket_write_win32(sock, buf, to);\
stuffing_sent =+ link_socket_write_win32(sock, buf, to);\
#else\
stuffing_sent =+ link_socket_write_udp_posix(sock, buf, to);\
stuffing_sent =+ link_socket_write_udp_posix(sock, buf, to);\
#endif\
return stuffing_sent;\
return stuffing_sent;\
}\
\
\/\* write a TCP or UDP packet to link \*\/' "/opt/openvpn_install/openvpn-$OPENVPN_VER/src/openvpn/socket.h"
Expand Down

0 comments on commit 4b07e88

Please sign in to comment.