diff --git a/docs/manual.md b/docs/manual.md index df7f6ca..55b710e 100644 --- a/docs/manual.md +++ b/docs/manual.md @@ -1220,7 +1220,7 @@ track.pos содержит еще одно поле - `dt`. Время полу | tcp.seq0 | начальный sequence соединения | | | tcp.seq | sequence текущего пакета | | | tcp.rseq | relative sequence текущего пакета | вычисляется как seq-seq0 | -| tcp.seq_over_2G | был переход за границу 2 GB | s и p позиции больше нельзя учитывать | +| tcp.rseq_over_2G | был переход rseq за границу 2 GB | s и p позиции больше нельзя учитывать | | tcp.pos | relative sequence верхней границы текущего пакета | вычисляется как rseq+payload_size | | tcp.uppos | максимальный pos в соединении | | | tcp.uppos_prev | uppos в предыдущем пакете с данными | полезно для определения ретрансмиссий | diff --git a/lua/zapret-lib.lua b/lua/zapret-lib.lua index 33f3d1f..14fa788 100644 --- a/lua/zapret-lib.lua +++ b/lua/zapret-lib.lua @@ -238,7 +238,7 @@ end function pos_counter_overflow(desync, mode, reverse) if not desync.track or not desync.track.tcp or (mode~='s' and mode~='p') then return false end local track_pos = reverse and desync.track.pos.reverse or desync.track.pos.direct - return track_pos.tcp.seq_over_2G + return track_pos.tcp.rseq_over_2G end -- these functions duplicate range check logic from C code -- mode must be n,d,b,s,x,a diff --git a/nfq2/conntrack.c b/nfq2/conntrack.c index 879672b..5558479 100644 --- a/nfq2/conntrack.c +++ b/nfq2/conntrack.c @@ -156,10 +156,10 @@ static void ConntrackApplyPos(const struct tcphdr *tcp, t_ctrack *t, bool bRever if (mss && !direct->mss) direct->mss = mss; if (scale != SCALE_NONE) direct->scale = scale; - if (!direct->seq_over_2G && ((direct->seq_last - direct->seq0) & 0x80000000)) - direct->seq_over_2G = true; - if (!reverse->seq_over_2G && ((reverse->seq_last - reverse->seq0) & 0x80000000)) - reverse->seq_over_2G = true; + if (!direct->rseq_over_2G && ((direct->seq_last - direct->seq0) & 0x80000000)) + direct->rseq_over_2G = true; + if (!reverse->rseq_over_2G && ((reverse->seq_last - reverse->seq0) & 0x80000000)) + reverse->rseq_over_2G = true; } // non-tcp packets are passed with tcphdr=NULL but len_payload filled diff --git a/nfq2/conntrack_base.h b/nfq2/conntrack_base.h index 9c93cd9..c9824c5 100644 --- a/nfq2/conntrack_base.h +++ b/nfq2/conntrack_base.h @@ -28,7 +28,7 @@ typedef struct uint16_t mss; uint32_t winsize_calc; // calculated window size uint8_t scale; // last seen window scale factor. SCALE_NONE if none - bool seq_over_2G; + bool rseq_over_2G; } t_ctrack_position; typedef struct diff --git a/nfq2/desync.c b/nfq2/desync.c index 22b5808..10bb691 100644 --- a/nfq2/desync.c +++ b/nfq2/desync.c @@ -507,7 +507,7 @@ static uint8_t ct_new_postnat_fix(const t_ctrack *ctrack, const struct dissect * static bool pos_overflow(const t_ctrack_position *pos, char mode) { - return (mode=='s' || mode=='p') && pos && pos->seq_over_2G; + return (mode=='s' || mode=='p') && pos && pos->rseq_over_2G; } static uint64_t pos_get(const t_ctrack_position *pos, char mode) { diff --git a/nfq2/lua.c b/nfq2/lua.c index a43c5b0..3b90d86 100644 --- a/nfq2/lua.c +++ b/nfq2/lua.c @@ -1286,6 +1286,7 @@ void lua_pushf_ctrack_pos(const t_ctrack *ctrack, const t_ctrack_position *pos) lua_pushf_lint("seq0", pos->seq0); lua_pushf_lint("seq", pos->seq_last); lua_pushf_lint("rseq", pos->seq_last - pos->seq0); + lua_pushf_bool("rseq_over_2G", pos->rseq_over_2G); lua_pushf_int("pos", pos->pos - pos->seq0); lua_pushf_int("uppos", pos->uppos - pos->seq0); lua_pushf_int("uppos_prev", pos->uppos_prev - pos->seq0); @@ -1293,7 +1294,6 @@ void lua_pushf_ctrack_pos(const t_ctrack *ctrack, const t_ctrack_position *pos) lua_pushf_int("winsize_calc", pos->winsize_calc); lua_pushf_int("scale", pos->scale); lua_pushf_int("mss", pos->mss); - lua_pushf_bool("seq_over_2G", pos->seq_over_2G); lua_rawset(params.L,-3); }