mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-29 21:40:52 +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;
|
fake_size = dp->fake_unknown_size;
|
||||||
break;
|
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)
|
if (dp->desync_mode==DESYNC_MULTISPLIT || dp->desync_mode==DESYNC_MULTIDISORDER || dp->desync_mode2==DESYNC_MULTISPLIT || dp->desync_mode2==DESYNC_MULTIDISORDER)
|
||||||
{
|
{
|
||||||
split_pos=0;
|
split_pos=0;
|
||||||
ResolveMultiPos(rdata_payload, rlen_payload, l7proto, dp->splits, dp->split_count, multisplit_pos, &multisplit_count);
|
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 (params.debug)
|
||||||
{
|
{
|
||||||
if (multisplit_count)
|
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++)
|
for(i=0,split_pos=0;i<dp->split_count && !split_pos;i++)
|
||||||
if (dp->splits[i].marker==PM_ABS)
|
if (dp->splits[i].marker==PM_ABS)
|
||||||
split_pos = ResolvePos(rdata_payload, rlen_payload, l7proto, dp->splits+i);
|
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;
|
if (!split_pos) split_pos = 1;
|
||||||
DLOG("regular split pos: %zu\n",split_pos);
|
DLOG("regular split pos: %zu\n",split_pos);
|
||||||
if (!split_pos || split_pos>rlen_payload) split_pos=1;
|
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
|
if (p) return false; // too much splits
|
||||||
return true;
|
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)
|
static void SplitDebug(void)
|
||||||
{
|
{
|
||||||
struct desync_profile_list *dpl;
|
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);
|
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))
|
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);
|
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())
|
if (!LoadAllHostLists())
|
||||||
|
Loading…
Reference in New Issue
Block a user