From 6b7507deb5cb2b6e83298edfc60111778ef2951d Mon Sep 17 00:00:00 2001 From: bol-van Date: Thu, 15 Jan 2026 20:51:57 +0300 Subject: [PATCH] nfqws2: set desync.tcp_mss to minimum of both ends or default if at least one is unknown --- docs/changes.txt | 1 + nfq2/desync.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index c6abf49..d9127d4 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -185,3 +185,4 @@ v0.8.1 * nfqws2: do not require / in the beginning of URI in http * zapret-lib: rawsend_dissect_segmented support URG * zapret-antidpi: oob +* nfqws2: set desync.tcp_mss to minimum of both ends or default if at least one is unknown diff --git a/nfq2/desync.c b/nfq2/desync.c index f65ae09..738b119 100644 --- a/nfq2/desync.c +++ b/nfq2/desync.c @@ -859,9 +859,11 @@ static uint8_t desync( if (dis->tcp) { // recommended mss value for generated packets - if (rpos && rpos->mss) - lua_pushf_int(params.L, "tcp_mss", rpos->mss); + if (pos && pos->mss && rpos && rpos->mss) + // use minimum MSS of two ends or can fail with "message too long" + lua_pushf_int(params.L, "tcp_mss", rpos->mss > pos->mss ? pos->mss : rpos->mss); else + // this value should always work lua_pushf_global(params.L, "tcp_mss", "DEFAULT_MSS"); } ref_arg = luaL_ref(params.L, LUA_REGISTRYINDEX);