mirror of
https://github.com/bol-van/zapret2.git
synced 2026-03-13 22:03:09 +00:00
zapret-lib,antidpi: optimizations
This commit is contained in:
@@ -1080,7 +1080,7 @@ function oob(ctx, desync)
|
||||
local data = desync.reasm_data or desync.dis.payload
|
||||
if not desync.arg.drop_ack and #data==0 then
|
||||
DLOG("oob: sending empty ACK")
|
||||
if not rawsend_dissect(desync.dis) then return end
|
||||
if not rawsend_dissect(desync.dis,rawsend_opts_base(desync)) then return end
|
||||
end
|
||||
if #data>0 then
|
||||
local oob = desync.arg.char or (desync.arg.byte and bu8(desync.arg.byte) or nil) or "\x00"
|
||||
@@ -1107,7 +1107,7 @@ function oob(ctx, desync)
|
||||
dis_oob.payload = string.sub(data, 1, urp-1) .. oob .. string.sub(data, urp)
|
||||
dis_oob.tcp.th_flags = bitor(dis_oob.tcp.th_flags, TH_URG)
|
||||
DLOG("oob: sending OOB")
|
||||
if not rawsend_dissect_segmented(desync, dis_oob, desync.tcp_mss, desync_opts(desync)) then
|
||||
if not rawsend_dissect_segmented(desync, dis_oob) then
|
||||
instance_cutoff_shim(ctx, desync)
|
||||
return
|
||||
end
|
||||
|
||||
@@ -1069,10 +1069,13 @@ end
|
||||
|
||||
-- send dissect with tcp segmentation based on mss value. appply specified rawsend options.
|
||||
function rawsend_dissect_segmented(desync, dis, mss, options)
|
||||
dis = dis or desync.dis
|
||||
local discopy = deepcopy(dis)
|
||||
options = options or desync_opts(desync)
|
||||
apply_fooling(desync, discopy, options and options.fooling)
|
||||
|
||||
if dis.tcp then
|
||||
mss = mss or desync.tcp_mss
|
||||
local extra_len = l3l4_extra_len(discopy)
|
||||
if extra_len >= mss then return false end
|
||||
local max_data = mss - extra_len
|
||||
@@ -1114,13 +1117,13 @@ end
|
||||
|
||||
-- send specified payload based on existing L3/L4 headers in the dissect. add seq to tcp.th_seq.
|
||||
function rawsend_payload_segmented(desync, payload, seq, options)
|
||||
options = options or desync_opts(desync)
|
||||
local dis = deepcopy(desync.dis)
|
||||
-- save some cpu and ram
|
||||
local dis = (payload or seq and seq~=0) and deepcopy(desync.dis) or desync.dis
|
||||
if payload then dis.payload = payload end
|
||||
if dis.tcp and seq then
|
||||
dis.tcp.th_seq = dis.tcp.th_seq + seq
|
||||
end
|
||||
return rawsend_dissect_segmented(desync, dis, desync.tcp_mss, options)
|
||||
return rawsend_dissect_segmented(desync, dis, nil, options)
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user