@@ -840,7 +840,7 @@ static uint8_t dpi_desync_tcp_packet_play(bool replay, size_t reasm_offset, uint
840
840
uint8_t * p , * phost = NULL ;
841
841
const uint8_t * rdata_payload = dis -> data_payload ;
842
842
size_t rlen_payload = dis -> len_payload ;
843
- size_t split_pos ;
843
+ size_t split_pos , seqovl_pos ;
844
844
size_t multisplit_pos [MAX_SPLITS ];
845
845
int multisplit_count ;
846
846
int i ;
@@ -1165,6 +1165,7 @@ static uint8_t dpi_desync_tcp_packet_play(bool replay, size_t reasm_offset, uint
1165
1165
DLOG ("all multisplit pos are outside of this packet\n" );
1166
1166
}
1167
1167
}
1168
+ seqovl_pos = ResolvePos (rdata_payload , rlen_payload , l7proto , & dp -> seqovl );
1168
1169
}
1169
1170
else if (dp -> desync_mode == DESYNC_FAKEDSPLIT || dp -> desync_mode == DESYNC_FAKEDDISORDER || dp -> desync_mode2 == DESYNC_FAKEDSPLIT || dp -> desync_mode2 == DESYNC_FAKEDDISORDER )
1170
1171
{
@@ -1186,12 +1187,15 @@ static uint8_t dpi_desync_tcp_packet_play(bool replay, size_t reasm_offset, uint
1186
1187
DLOG ("normalized regular split pos : %zu\n" ,split_pos );
1187
1188
else
1188
1189
DLOG ("regular split pos is outside of this packet\n" );
1190
+ seqovl_pos = ResolvePos (rdata_payload , rlen_payload , l7proto , & dp -> seqovl );
1189
1191
}
1190
1192
else
1191
1193
{
1192
1194
multisplit_count = 0 ;
1193
- split_pos = 0 ;
1195
+ split_pos = seqovl_pos = 0 ;
1194
1196
}
1197
+ seqovl_pos = pos_normalize (seqovl_pos ,reasm_offset ,dis -> len_payload );
1198
+ if (seqovl_pos ) DLOG ("normalized seqovl pos : %zu\n" ,seqovl_pos );
1195
1199
1196
1200
// we do not need reasm buffer anymore
1197
1201
reasm_orig_cancel (ctrack );
@@ -1283,7 +1287,7 @@ static uint8_t dpi_desync_tcp_packet_play(bool replay, size_t reasm_offset, uint
1283
1287
// do seqovl only to the first packet
1284
1288
// otherwise it's prone to race condition on server side
1285
1289
// what happens first : server pushes socket buffer to process or another packet with seqovl arrives
1286
- seqovl = i == 0 ? dp -> desync_seqovl : 0 ;
1290
+ seqovl = i == 0 ? seqovl_pos : 0 ;
1287
1291
#ifdef __linux__
1288
1292
// only linux return error if MTU is exceeded
1289
1293
for (;;seqovl = 0 )
@@ -1356,11 +1360,11 @@ static uint8_t dpi_desync_tcp_packet_play(bool replay, size_t reasm_offset, uint
1356
1360
// real observations revealed that server can receive overlap junk instead of real data
1357
1361
if (i == 0 )
1358
1362
{
1359
- if (dp -> desync_seqovl >=from )
1363
+ if (seqovl_pos >=from )
1360
1364
DLOG ("seqovl>=split_pos (%u>=%zu). cancelling seqovl for part %d.\n" ,seqovl ,from ,i + 2 );
1361
1365
else
1362
1366
{
1363
- seqovl = dp -> desync_seqovl ;
1367
+ seqovl = seqovl_pos ;
1364
1368
seg_len = to - from + seqovl ;
1365
1369
if (seg_len > sizeof (ovlseg ))
1366
1370
{
@@ -1397,13 +1401,13 @@ static uint8_t dpi_desync_tcp_packet_play(bool replay, size_t reasm_offset, uint
1397
1401
size_t seg_len ;
1398
1402
unsigned int seqovl ;
1399
1403
1400
- if (dp -> desync_seqovl >=split_pos )
1404
+ if (seqovl_pos >=split_pos )
1401
1405
{
1402
- DLOG ("seqovl>=split_pos (%u>=%zu). cancelling seqovl.\n" ,dp -> desync_seqovl ,split_pos );
1406
+ DLOG ("seqovl>=split_pos (%u>=%zu). cancelling seqovl.\n" ,seqovl_pos ,split_pos );
1403
1407
seqovl = 0 ;
1404
1408
}
1405
1409
else
1406
- seqovl = dp -> desync_seqovl ;
1410
+ seqovl = seqovl_pos ;
1407
1411
1408
1412
if (split_pos < dis -> len_payload )
1409
1413
{
@@ -1484,7 +1488,7 @@ static uint8_t dpi_desync_tcp_packet_play(bool replay, size_t reasm_offset, uint
1484
1488
if (!rawsend_rep (dp -> desync_repeats ,(struct sockaddr * )& dst , desync_fwmark , ifout , fakeseg , fakeseg_len ))
1485
1489
return verdict ;
1486
1490
1487
- unsigned int seqovl = dp -> desync_seqovl ;
1491
+ unsigned int seqovl = seqovl_pos ;
1488
1492
#ifdef __linux__
1489
1493
// only linux return error if MTU is exceeded
1490
1494
for (;;seqovl = 0 )
0 commit comments