mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-26 12:10:53 +03:00
nfqws: rewrite default split pos logic
This commit is contained in:
parent
14e9fc4d43
commit
611292281c
@ -1129,17 +1129,10 @@ static uint8_t dpi_desync_tcp_packet_play(bool replay, size_t reasm_offset, uint
|
||||
fake_size = dp->fake_unknown_size;
|
||||
break;
|
||||
}
|
||||
const struct proto_pos defpos={marker:PM_ABS,pos:2};
|
||||
if (dp->desync_mode==DESYNC_MULTISPLIT || dp->desync_mode==DESYNC_MULTIDISORDER || dp->desync_mode2==DESYNC_MULTISPLIT || dp->desync_mode2==DESYNC_MULTIDISORDER)
|
||||
{
|
||||
split_pos=0;
|
||||
ResolveMultiPos(rdata_payload, rlen_payload, l7proto, dp->splits, dp->split_count, multisplit_pos, &multisplit_count);
|
||||
if (!multisplit_count)
|
||||
{
|
||||
multisplit_pos[multisplit_count] = ResolvePos(rdata_payload, rlen_payload, l7proto, &defpos);
|
||||
if (!multisplit_pos[multisplit_count]) multisplit_pos[multisplit_count] = 1;
|
||||
multisplit_count++;
|
||||
}
|
||||
if (params.debug)
|
||||
{
|
||||
if (multisplit_count)
|
||||
@ -1185,7 +1178,6 @@ static uint8_t dpi_desync_tcp_packet_play(bool replay, size_t reasm_offset, uint
|
||||
for(i=0,split_pos=0;i<dp->split_count && !split_pos;i++)
|
||||
if (dp->splits[i].marker==PM_ABS)
|
||||
split_pos = ResolvePos(rdata_payload, rlen_payload, l7proto, dp->splits+i);
|
||||
if (!split_pos) split_pos = ResolvePos(rdata_payload, rlen_payload, l7proto, &defpos);
|
||||
if (!split_pos) split_pos = 1;
|
||||
DLOG("regular split pos: %zu\n",split_pos);
|
||||
if (!split_pos || split_pos>rlen_payload) split_pos=1;
|
||||
|
11
nfq/nfqws.c
11
nfq/nfqws.c
@ -836,6 +836,16 @@ static bool parse_split_pos_list(char *opt, struct proto_pos *splits, int splits
|
||||
if (p) return false; // too much splits
|
||||
return true;
|
||||
}
|
||||
static void split_compat(struct desync_profile *dp)
|
||||
{
|
||||
if (!dp->split_count)
|
||||
{
|
||||
dp->splits[dp->split_count].marker = PM_ABS;
|
||||
dp->splits[dp->split_count].pos = 2;
|
||||
dp->split_count++;
|
||||
}
|
||||
}
|
||||
|
||||
static void SplitDebug(void)
|
||||
{
|
||||
struct desync_profile_list *dpl;
|
||||
@ -2032,6 +2042,7 @@ int main(int argc, char **argv)
|
||||
DLOG("[profile %d] autottl ipv4 %u:%u-%u\n",dp->n,dp->desync_autottl.delta,dp->desync_autottl.min,dp->desync_autottl.max);
|
||||
if (AUTOTTL_ENABLED(dp->desync_autottl6))
|
||||
DLOG("[profile %d] autottl ipv6 %u:%u-%u\n",dp->n,dp->desync_autottl6.delta,dp->desync_autottl6.min,dp->desync_autottl6.max);
|
||||
split_compat(dp);
|
||||
}
|
||||
|
||||
if (!LoadAllHostLists())
|
||||
|
Loading…
Reference in New Issue
Block a user