Skip to content

Commit

Permalink
openvpn patch to help with clients which can't use tunnelblick patch (#…
Browse files Browse the repository at this point in the history
…64)

* added dpi patch

* added openvpn patch to overcome DPI w/o patching the client

added openvpn patch to overcome DPI w/o patching the client
  • Loading branch information
hondaspb authored Sep 15, 2024
1 parent 220717a commit 9003099
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,41 @@ RUN <<-"EOT" bash -ex
wget "https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-$OPENVPN_VER/patches/$patch"
git apply "$patch"
done
# 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)\
{\
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++)\
{\
#ifdef _WIN32\
stuffing_sent =+ link_socket_write_win32(sock, &stuffing_buf, to);\
#else\
stuffing_sent =+ link_socket_write_udp_posix(sock, &stuffing_buf, to);\
#endif\
}\
free_buf(&stuffing_buf);\
}\
#ifdef _WIN32\
stuffing_sent =+ link_socket_write_win32(sock, buf, to);\
#else\
stuffing_sent =+ link_socket_write_udp_posix(sock, buf, to);\
#endif\
return stuffing_sent;\
}\
\
\/\* write a TCP or UDP packet to link \*\/' "/opt/openvpn_install/openvpn-$OPENVPN_VER/src/openvpn/socket.h"
# Patch to overcome DPI end

./configure --enable-static=yes --enable-shared --enable-systemd=yes --disable-lzo --disable-debug --disable-plugin-auth-pam --disable-dependency-tracking
make -j$(nproc)
Expand Down

0 comments on commit 9003099

Please sign in to comment.