Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openvpn patch to help with clients which can't use tunnelblick patch #64

Merged
merged 2 commits into from
Sep 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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