Template
1
0
mirror of https://github.com/bol-van/zapret2.git synced 2026-03-14 06:13:09 +00:00

6 Commits

Author SHA1 Message Date
bol-van
a80aed5ccc update builder-linux 2026-02-18 17:28:03 +03:00
bol-van
2b35dc8ecd update builder-linux 2026-02-18 16:31:01 +03:00
bol-van
75fadab371 update builder-linux 2026-02-18 16:16:58 +03:00
bol-van
e70f4a000a update builder-linux 2026-02-18 16:08:19 +03:00
bol-van
755c792797 github: luajit for ppc 2026-02-18 15:37:08 +03:00
bol-van
b17894eec1 nfqws2: goto lua desync if reasm is cancelled 2026-02-18 15:28:30 +03:00
6 changed files with 32 additions and 28 deletions

View File

@@ -104,7 +104,7 @@ jobs:
fi
MINSIZE="$OPTIMIZE $MINSIZE"
if [[ "$ARCH" == lexra ]] || [[ "$ARCH" == ppc ]] || [[ "$ARCH" == riscv64 ]] || [[ "$ARCH" == x86 ]] ; then
if [[ "$ARCH" == lexra ]] || [[ "$ARCH" == riscv64 ]] || [[ "$ARCH" == x86 ]] ; then
# use classic lua
wget -qO- https://www.lua.org/ftp/lua-${LUA_RELEASE}.tar.gz | tar -xz
(

View File

@@ -31,7 +31,7 @@ build_netlink()
(
cd $i-*
[ -f "Makefile" ] && make clean
CFLAGS="$MINSIZE $CFLAGS" \
CFLAGS="$OPTIMIZE $MINSIZE $CFLAGS" \
LDFLAGS="$LDMINSIZE $LDFLAGS" \
./configure --prefix= --host=$TARGET CC=$CC LD=$LD --enable-static --disable-shared --disable-dependency-tracking
make install -j$nproc DESTDIR=$STAGING_DIR
@@ -44,7 +44,7 @@ build_zlib()
(
cd zlib-*
[ -f "Makefile" ] && make clean
CFLAGS="$MINSIZE $CFLAGS" \
CFLAGS="$OPTIMIZE $MINSIZE $CFLAGS" \
LDFLAGS="$LDMINSIZE $LDFLAGS" \
./configure --prefix= --static
make install -j$nproc DESTDIR=$STAGING_DIR
@@ -55,7 +55,7 @@ build_lua()
(
cd lua-${LUA_RELEASE}
make clean
make CC="$CC" AR="$AR rc" CFLAGS="$MINSIZE $CFLAGS" LDFLAGS="$LDMINSIZE $LDFLAGS" linux -j$nproc
make CC="$CC" AR="$AR rc" CFLAGS="$OPTIMIZE $MINSIZE $CFLAGS" LDFLAGS="$LDMINSIZE $LDFLAGS" linux -j$nproc
make install INSTALL_TOP="$STAGING_DIR" INSTALL_BIN="$STAGING_DIR/bin" INSTALL_INC="$STAGING_DIR/include/lua${LUA_VER}" INSTALL_LIB="$STAGING_DIR/lib"
)
}
@@ -64,7 +64,7 @@ build_luajit()
(
cd luajit2-*
make clean
make BUILDMODE=static XCFLAGS=-DLUAJIT_DISABLE_FFI HOST_CC="$HOST_CC" CROSS= CC="$CC" TARGET_AR="$AR rcus" TARGET_STRIP=$STRIP TARGET_CFLAGS="$MINSIZE $CFLAGS" TARGET_LDFLAGS="$LDMINSIZE $LDFLAGS"
make BUILDMODE=static XCFLAGS=-DLUAJIT_DISABLE_FFI HOST_CC="$HOST_CC" CROSS= CC="$CC" TARGET_AR="$AR rcus" TARGET_STRIP=$STRIP TARGET_CFLAGS="$OPTIMIZE $MINSIZE $CFLAGS" TARGET_LDFLAGS="$LDMINSIZE $LDFLAGS"
make install PREFIX= DESTDIR="$STAGING_DIR"
)
}

View File

@@ -46,7 +46,8 @@ for t in $TGT; do
pushd $ZBASE/$ZDIR
OPTIMIZE=-Oz \
make clean
OPTIMIZE=$OPTIMIZE \
CFLAGS="-static-libgcc -static -I$STAGING_DIR/include $MINSIZE $CFLAGS" \
LDFLAGS="-L$STAGING_DIR/lib $LDMINSIZE $LDFLAGS" \
make

View File

@@ -52,10 +52,13 @@ for t in $TGT; do
target_has_luajit $t && {
LUA_JIT=1
LCFLAGS="-I${STAGING_DIR}/include/luajit-${LUAJIT_VER}"
LLIB="-L${STAGING_DIR}/lib -lluajit-${LUAJIT_LUAVER}"
LLIB="-L${STAGING_DIR}/lib -lluajit-${LUAJIT_LUA_VER}"
}
OPTIMIZE=-Oz \
make clean
LUA_JIT=$LUA_JIT LUA_VER=$LUA_VER LUAJIT_LUA_VER=$LUAJIT_LUA_VER \
OPTIMIZE=$OPTIMIZE \
MINSIZE=$MINSIZE \
CFLAGS="-static-libgcc -static -I$STAGING_DIR/include $CFLAGS" \
LDFLAGS="-L$STAGING_DIR/lib $LDFLAGS" \
make LUA_JIT=$LJIT LUA_CFLAGS="$LCFLAGS" LUA_LIB="$LLIB"

View File

@@ -4,16 +4,17 @@ EXEDIR="$(cd "$EXEDIR"; pwd)"
TOOLCHAINS="$EXEDIR/toolchain"
DEPS="$EXEDIR/deps"
STAGE="$EXEDIR/staging"
MINSIZE="-Oz -flto=auto -ffunction-sections -fdata-sections"
LDMINSIZE="-Wl,--gc-sections -flto=auto"
CFLAGS=""
LDFLAGS="-lgcc_eh"
HOSTCC=cc
LUA_VER="5.5"
LUA_RELEASE="5.5.0"
LUAJIT_VER="2.1"
LUAJIT_RELEASE="2.1-20250826"
LUAJIT_LUAVER="5.1"
OPTIMIZE=${OPTIMIZE:--Oz}
MINSIZE="${MINSIZE:--flto=auto -ffunction-sections -fdata-sections}"
LDMINSIZE="${LDMINSIZE:--Wl,--gc-sections -flto=auto}"
#CFLAGS=""
LDFLAGS="-lgcc_eh $LDFLAGS"
HOSTCC=${HOSTCC:-cc}
LUA_VER=${LUA_VER:-5.5}
LUA_RELEASE=${LUA_RELEASE:-5.5.0}
LUAJIT_VER=${LUAJIT_VER:-2.1}
LUAJIT_RELEASE=${LUAJIT_RELEASE:-2.1-20250826}
LUAJIT_LUA_VER=${LUAJIT_LUA_VER:-5.1}
nproc=$(nproc)
TARGETS="\

View File

@@ -1588,7 +1588,7 @@ static uint8_t dpi_desync_tcp_packet_play(
else
{
DLOG_ERR("rawpacket_queue failed !\n");
goto pass_reasm_cancel;
goto rediscover;
}
if (ReasmIsFull(&ps.ctrack->reasm_client))
{
@@ -1602,6 +1602,7 @@ static uint8_t dpi_desync_tcp_packet_play(
}
}
// UNSOLVED: if reasm is cancelled all packets except the last are passed as is without lua desync
rediscover:
if (!dp_rediscovery(&ps))
goto pass_reasm_cancel;
@@ -1781,7 +1782,7 @@ static uint8_t dpi_desync_udp_packet_play(
else
{
DLOG("QUIC reasm is too long. cancelling.\n");
goto pass_reasm_cancel;
goto rediscover_cancel;
}
}
size_t hello_offset, hello_len, defrag_len = sizeof(defrag);
@@ -1805,7 +1806,7 @@ static uint8_t dpi_desync_udp_packet_play(
{
// preallocate max buffer to avoid reallocs that cause memory copy
if (!reasm_client_start(ps.ctrack, IPPROTO_UDP, UDP_MAX_REASM, UDP_MAX_REASM, clean, clean_len))
goto pass_reasm_cancel;
goto rediscover_cancel;
}
if (!ReasmIsEmpty(&ps.ctrack->reasm_client))
{
@@ -1816,7 +1817,7 @@ static uint8_t dpi_desync_udp_packet_play(
else
{
DLOG_ERR("rawpacket_queue failed !\n");
goto pass_reasm_cancel;
goto rediscover_cancel;
}
if (bReqFull)
{
@@ -1847,7 +1848,7 @@ static uint8_t dpi_desync_udp_packet_play(
{
// preallocate max buffer to avoid reallocs that cause memory copy
if (!reasm_client_start(ps.ctrack, IPPROTO_UDP, UDP_MAX_REASM, UDP_MAX_REASM, clean, clean_len))
goto pass_reasm_cancel;
goto rediscover_cancel;
}
if (rawpacket_queue(&ps.ctrack->delayed, &ps.dst, fwmark, desync_fwmark, ifin, ifout, dis->data_pkt, dis->len_pkt, dis->len_payload, &ps.ctrack->pos))
{
@@ -1856,7 +1857,7 @@ static uint8_t dpi_desync_udp_packet_play(
else
{
DLOG_ERR("rawpacket_queue failed !\n");
goto pass_reasm_cancel;
goto rediscover_cancel;
}
return ct_new_postnat_fix(ps.ctrack, dis, mod_pkt, len_mod_pkt);
}
@@ -1881,18 +1882,16 @@ static uint8_t dpi_desync_udp_packet_play(
feed_dns_response(dis->data_payload, dis->len_payload);
} // len_payload
// UNSOLVED: if reasm is cancelled all packets except the last are passed as is without lua desync
rediscover_cancel:
reasm_client_cancel(ps.ctrack);
if (!dp_rediscovery(&ps))
goto pass;
ps.verdict = desync(ps.dp, fwmark, ifin, ifout, ps.bReverseFixed, ps.ctrack_replay, tpos, ps.l7payload, ps.l7proto, dis, ps.sdip4, ps.sdip6, ps.sdport, mod_pkt, len_mod_pkt, replay_piece, replay_piece_count, reasm_offset, NULL, 0, data_decrypt, len_decrypt);
pass:
return (!ps.bReverse && (ps.verdict & VERDICT_MASK) == VERDICT_DROP) ? ct_new_postnat_fix(ps.ctrack, dis, mod_pkt, len_mod_pkt) : ps.verdict;
pass_reasm_cancel:
reasm_client_cancel(ps.ctrack);
goto pass;
}
// conntrack is supported only for RELATED icmp