Skip to content

Commit 36b5740

Browse files
lukacanPavel Siska
authored andcommitted
QUIC: comments/rfc links
1 parent 14e8321 commit 36b5740

File tree

2 files changed

+16
-21
lines changed

2 files changed

+16
-21
lines changed

process/quic.cpp

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ MVFST
9393
#include "quic.hpp"
9494

9595

96-
int counter = 0;
9796

9897
namespace ipxp {
9998

@@ -151,7 +150,7 @@ QUICPlugin::QUICPlugin()
151150
quic_ptr = nullptr;
152151

153152

154-
ietf_quic = false;
153+
can_parse = false;
155154
}
156155

157156
QUICPlugin::~QUICPlugin()
@@ -554,8 +553,8 @@ uint8_t QUICPlugin::quic_draft_version(uint32_t version)
554553
case (0x0a0a0a0a & 0x0F0F0F0F):
555554
return 29;
556555
// version 2 draft 00
557-
// newest
558556
case 0xff020000:
557+
// newest
559558
case 0x709a50c4:
560559
return 100;
561560
default:
@@ -646,28 +645,28 @@ bool QUICPlugin::quic_create_initial_secrets(CommSide side,RecordExtQUIC * rec)
646645
return false;
647646
} else if (version == 0x00000001){
648647
salt = handshake_salt_v1;
649-
ietf_quic = true;
648+
can_parse = true;
650649
} else if (quic_check_version(version, 9)) {
651650
salt = handshake_salt_draft_7;
652-
ietf_quic = true;
651+
can_parse = true;
653652
} else if (quic_check_version(version, 16)) {
654653
salt = handshake_salt_draft_10;
655-
ietf_quic = true;
654+
can_parse = true;
656655
} else if (quic_check_version(version, 20)) {
657656
salt = handshake_salt_draft_17;
658-
ietf_quic = true;
657+
can_parse = true;
659658
} else if (quic_check_version(version, 22)) {
660659
salt = handshake_salt_draft_21;
661-
ietf_quic = true;
660+
can_parse = true;
662661
} else if (quic_check_version(version, 28)) {
663662
salt = handshake_salt_draft_23;
664-
ietf_quic = true;
663+
can_parse = true;
665664
} else if (quic_check_version(version, 32)) {
666665
salt = handshake_salt_draft_29;
667-
ietf_quic = true;
666+
can_parse = true;
668667
} else if (quic_check_version(version, 100)) {
669668
salt = handshake_salt_v2;
670-
ietf_quic = true;
669+
can_parse = true;
671670
} else {
672671
DEBUG_MSG("Error, version not supported\n");
673672
return false;
@@ -1064,6 +1063,7 @@ bool QUICPlugin::quic_assemble()
10641063

10651064
} else if (*(decrypted_payload + offset) == CONNECTION_CLOSE1)
10661065
{
1066+
// https://www.rfc-editor.org/rfc/rfc9000.html#name-connection_close-frames
10671067
//skip type
10681068
offset++;
10691069

@@ -1074,6 +1074,7 @@ bool QUICPlugin::quic_assemble()
10741074

10751075
} else if (*(decrypted_payload + offset) == CONNECTION_CLOSE2)
10761076
{
1077+
// https://www.rfc-editor.org/rfc/rfc9000.html#name-connection_close-frames
10771078
//skip type
10781079
offset++;
10791080
uint64_t error_code = quic_get_variable_length(decrypted_payload,offset);
@@ -1217,12 +1218,6 @@ bool QUICPlugin::quic_check_initial(uint8_t packet0)
12171218
bool QUICPlugin::process_quic(RecordExtQUIC *quic_data, const Packet &pkt)
12181219
{
12191220

1220-
1221-
DEBUG_MSG("COUNTER %d\n",counter++);
1222-
DEBUG_MSG("FIRST %02x\n",pkt.payload[0] & 0xB0);
1223-
DEBUG_MSG("FIRSTTT %02x\n",pkt.payload[0]);
1224-
1225-
12261221
memset(decrypted_payload,0,1500);
12271222
memset(assembled_payload,0,1500);
12281223

@@ -1252,12 +1247,12 @@ bool QUICPlugin::process_quic(RecordExtQUIC *quic_data, const Packet &pkt)
12521247
DEBUG_MSG("Error, payload decryption failed (client side)\n");
12531248
return false;
12541249
}
1255-
if (ietf_quic && !quic_assemble())
1250+
if (can_parse && !quic_assemble())
12561251
{
12571252
DEBUG_MSG("Error, reassembling of crypto frames failed (client side)\n");
12581253
return false;
12591254
}
1260-
if (ietf_quic && !parse_tls(quic_data))
1255+
if (can_parse && !parse_tls(quic_data))
12611256
{
12621257
DEBUG_MSG("SNI and User Agent Extraction failed\n");
12631258
return false;
@@ -1332,7 +1327,7 @@ void QUICPlugin::add_quic(Flow &rec, const Packet &pkt)
13321327
}
13331328

13341329
if (process_quic(quic_ptr, pkt)) {
1335-
std::cout << quic_ptr->sni << std::endl;
1330+
//std::cout << quic_ptr->sni << std::endl;
13361331
rec.add_extension(quic_ptr);
13371332
quic_ptr = nullptr;
13381333
}

process/quic.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ class QUICPlugin : public ProcessPlugin
308308
Initial_Secrets initial_secrets;
309309

310310

311-
bool ietf_quic;
311+
bool can_parse;
312312
};
313313

314314
}

0 commit comments

Comments
 (0)