From 40b3b1536061a420d551bc183db6b8f356a636b6 Mon Sep 17 00:00:00 2001 From: liuxueli Date: Wed, 3 Jun 2020 15:56:03 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8DQUIC=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E6=8F=90=E4=BE=9B=E7=9A=84=E5=8D=8F=E8=AE=AE=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E5=87=BD=E6=95=B0quic=5Fprotocol=5Fidentify?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tsg_entry.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/tsg_entry.cpp b/src/tsg_entry.cpp index ffc6e22..078acd3 100644 --- a/src/tsg_entry.cpp +++ b/src/tsg_entry.cpp @@ -42,7 +42,7 @@ static __attribute__((__used__)) const char * GIT_VERSION_UNKNOWN = NULL; #endif -char TSG_MASTER_VERSION_20200601=0; +char TSG_MASTER_VERSION_20200603=0; const char *tsg_conffile="tsgconf/main.conf"; g_tsg_para_t g_tsg_para; @@ -618,22 +618,14 @@ static int identify_application_protocol(struct streaminfo *a_stream, struct _id } //quic - struct _quic_context *_context=NULL; - quic_init_stream((void **)&_context, a_stream->threadnum); - ret=quic_process(a_stream, _context, a_stream->threadnum, a_packet); - if(ret!=PROT_STATE_DROPME) + ret=quic_protocol_identify(a_stream, a_packet, identify_info->domain, sizeof(identify_info->domain)); + if(ret>0) { identify_info->proto=PROTO_QUIC; - if(_context->quic_info.client_hello!=NULL) - { - char *sni=(char *)(_context->quic_info.client_hello->ext_tags[_context->quic_info.client_hello->sni_idx].value); - identify_info->domain_len=MIN(strlen(sni), sizeof(identify_info->domain)-1); - strncpy(identify_info->domain, sni, identify_info->domain_len); - } + identify_info->domain_len=ret; + return 1; } - quic_release_stream(a_stream, (void **)&_context, a_stream->threadnum); - return ret; } @@ -910,7 +902,7 @@ extern "C" char TSG_MASTER_UDP_ENTRY(struct streaminfo *a_udp, void **pme, int t FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_HIT_SHARE], 0, FS_OP_ADD, 1); MESA_handle_runtime_log(g_tsg_para.logger, RLOG_LV_DEBUG, - "SCAN_FQDN", + "SCAN_QUIC_SNI", "Hit %s: %s policy_id: %d service: %d action: %d addr: %s", "QUIC SNI", identify_info.domain, @@ -926,10 +918,10 @@ extern "C" char TSG_MASTER_UDP_ENTRY(struct streaminfo *a_udp, void **pme, int t { MESA_handle_runtime_log(g_tsg_para.logger, RLOG_LV_DEBUG, - "SCAN_FQDN", + "SCAN_QUIC_SNI", "Not hit %s: %s stream_dir: %d addr: %s", - (ret==-1) ? "NULL" : "QUIC SNI", - (ret==-1) ? "NULL" : identify_info.domain, + "QUIC SNI", + identify_info.domain, a_udp->dir, printaddr(&a_udp->addr, thread_seq) );