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

zapret-auto: reset parameter to standard_detector

This commit is contained in:
bol-van
2025-12-23 10:27:23 +03:00
parent 347c35e588
commit a6e11540ff
2 changed files with 37 additions and 0 deletions

View File

@@ -135,6 +135,7 @@ end
-- udp too much out with too few in
-- arg: maxseq=<rseq> - tcp: test retransmissions only within this relative sequence. default is 32K
-- arg: retrans=N - tcp: retrans count threshold. default is 3
-- arg: reset - send RST to retransmitter to break long wait
-- arg: inseq=<rseq> - tcp: maximum relative sequence number to treat incoming RST as DPI reset. default is 4K
-- arg: no_http_redirect - tcp: disable http_reply dpi redirect trigger
-- arg: no_rst - tcp: disable incoming RST trigger
@@ -151,6 +152,15 @@ function standard_failure_detector(desync, crec)
crec.retrans = crec.retrans and (crec.retrans+1) or 1
DLOG("standard_failure_detector: retransmission "..crec.retrans.."/"..arg.retrans)
trigger = crec.retrans>=arg.retrans
if trigger and desync.arg.reset then
local dis = deepcopy(desync.dis)
dis.payload = nil
dis_reverse(dis)
dis.tcp.th_flags = TH_RST
dis.tcp.th_win = desync.track and desync.track.pos.reverse.tcp.winsize or 64
DLOG("standard_failure_detector: sending RST to retransmitter")
rawsend_dissect(dis)
end
end
end
else

View File

@@ -762,6 +762,33 @@ function fix_ip6_next(ip6, last_proto)
end
end
-- reverses ip addresses, ports and seq/ack
function dis_reverse(dis)
local temp
if dis.ip then
temp = dis.ip.ip_src
dis.ip.ip_src = dis.ip.ip_dst
dis.ip.ip_dst = temp
end
if dis.ip6 then
temp = dis.ip6.ip6_src
dis.ip6.ip6_src = dis.ip6.ip6_dst
dis.ip6.ip6_dst = temp
end
if dis.tcp then
temp = dis.tcp.th_sport
dis.tcp.th_sport = dis.tcp.th_dport
dis.tcp.th_dport = temp
temp = dis.tcp.th_ack
dis.tcp.th_ack = dis.tcp.th_seq
dis.tcp.th_seq = temp
end
if dis.udp then
temp = dis.udp.uh_sport
dis.udp.uh_sport = dis.udp.uh_dport
dis.udp.uh_dport = temp
end
end
-- parse autottl : delta,min-max
function parse_autottl(s)