16 Commits

Author SHA1 Message Date
lijia
d4d46ea31b fix gitlab-ci.yml 2024-11-15 11:45:38 +08:00
lijia
8d7b85f98c support aarch64 2024-11-15 11:32:26 +08:00
lijia
513b9b52d9 backport to master, from TSG-21660:fix support QUIC CHLO fragment 2024-10-21 17:30:48 +08:00
杨威
e770ce2c84 Resolve OMPUB-1493 "Fix " 2024-10-16 03:44:26 +00:00
liuxueli
1ab2559887 TSG-19817: Bugfix memory leak 2024-03-07 14:05:28 +08:00
yangwei
33a2bc5b39 🐎 ci(travis): remove sentry-cli 2024-01-11 16:58:54 +08:00
yangwei
aebc66e015 🎈 perf(QUIC_MAX_UDP_PAYLOAD_SIZE): from 65527 to 1460
reduce mem alloc
2024-01-11 15:46:09 +08:00
liuxueli
a7d76dda73 TSG-16626: 收到UDP Close状态,若未调用过业务层则不需要通知业务层close状态 2023-08-25 18:30:30 +08:00
yangwei
4d731800bf 🐞 fix(parse_quic_uncryption_payload): 增加长度判断,修复长度异常时造成的内存非法读
附test/pcap/quic_len-2.pcapng为解析长度异常的包
2023-07-28 23:24:57 +08:00
yangwei
1b678406e7 🔧 build(cmake version): 更新最低版本要求至3.10,修复changelog脚本生成可能报错的问题 2023-07-28 23:22:51 +08:00
yangwei
479fd1a771 🐞 fix(quic version len): 增加包长判断,避免读越界 2023-07-26 19:21:14 +08:00
liuxueli
bfeae04470 Debug版本链接ASAN,用于定位问题 2023-07-26 11:19:32 +08:00
liuxueli
513732e4f1 第一个数据包仅解析一次,节省cpu 2023-06-27 13:34:19 +08:00
liuxueli
96f9ce34ca 收到上层业务返回drop pkt状态时,不关闭对流的处理 2023-02-16 10:20:46 +08:00
liuxueli
ffb443ed7e OMPUB-527: 从解密后的client hello负载中解析user agent参数时,未对参数长度负值进行判断导致parse_quic_transport_parameter函数死循环触发sapp的watchdog timeout 2022-06-16 15:39:13 +08:00
liuxueli
98c567cf88 TSG-9724: 适配Rocky Linux8.5 2022-03-11 13:19:05 +08:00
25 changed files with 654 additions and 215 deletions

4
.gitignore vendored
View File

@@ -6,7 +6,9 @@ Debug
.project
.settings/
SI
build/
build*/
src/inc
src/lib64
cmake-build-*/
.cache/
.vscode/

View File

@@ -1,41 +1,100 @@
image: "git.mesalab.cn:7443/mesa_platform/build-env:master"
variables:
GIT_STRATEGY: "clone"
BUILD_IMAGE_CENTOS8: "git.mesalab.cn:7443/mesa_platform/build-env:rocky8-for-sapp"
BUILD_IMAGE_AARCH64_ROCKY9: "git.mesalab.cn:7443/mesa_platform/build-env:rocky9-aarch64"
BUILD_PADDING_PREFIX: /tmp/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX_PREFIX_PREFIX_PREFIX_PREFIX_PREFIX/
INSTALL_PREFIX: "/opt/MESA/lib/"
INSTALL_DEPENDENCY_LIBRARY: libMESA_handle_logger-devel libcjson-devel libMESA_field_stat2-devel sapp-devel framework_env libMESA_prof_load-devel sapp-devel glib2-devel libasan libbreakpad_mini-devel libMESA_htable-devel systemd-devel
INSTALL_DEPENDENCY_PLATFORM: sapp-devel libasan systemd-devel libnsl glib2-devel libmnl-devel libnfnetlink-devel
INSTALL_DEPENDENCY_FRAMEWORK: libMESA_handle_logger-devel libcjson-devel libMESA_field_stat2-devel framework_env libMESA_prof_load-devel libbreakpad_mini-devel libMESA_htable-devel libfieldstat3 libfieldstat4
INSTALL_PREFIX: "/opt/tsg/sapp/"
stages:
- cppcheck
- build
- test
- package
###############################################################################
# cppcheck
###############################################################################
.cppcheck_script:
variables:
BUILD_TYPE: Debug
stage: cppcheck
script:
- mkdir -p build; cd build; cmake3 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
- >
cppcheck --project=compile_commands.json
--enable=all
--error-exitcode=1
--suppress=unusedFunction
--suppress=missingInclude
--suppress=uselessAssignmentPtrArg
--suppress=unmatchedSuppression
--suppress=variableScope
--suppress=unreadVariable
--suppress=cstyleCast
--suppress=memleakOnRealloc
--suppress=constParameter
--suppress=uselessAssignmentArg
--suppress=uninitvar
--suppress=unusedStructMember
--suppress=preprocessorErrorDirective
--suppress=syntaxError
--suppress=alidscanf
--suppress=knownConditionTrueFalse
--suppress=invalidscanf
--suppress=nullPointerRedundantCheck
--suppress=shiftNegativeLHS
--suppress=unsignedLessThanZero
--suppress=arithOperationsOnVoidPointer
--suppress=invalidPrintfArgType_sint
.build_by_travis:
run_cppcheck_for_x86_64_rocky8:
extends: .cppcheck_script
image: $BUILD_IMAGE_CENTOS8
tags:
- tsg-os-builder-el8
run_cppcheck_for_aarch64_rocky9:
extends: .cppcheck_script
image: $BUILD_IMAGE_AARCH64_ROCKY9
tags:
- tsg-os-builder-aarch64
###############################################################################
# build for rocky8
###############################################################################
.build_before_script:
before_script:
- mkdir -p $BUILD_PADDING_PREFIX/$CI_PROJECT_NAMESPACE/
- ln -s $CI_PROJECT_DIR $BUILD_PADDING_PREFIX/$CI_PROJECT_PATH
- cd $BUILD_PADDING_PREFIX/$CI_PROJECT_PATH
- chmod +x ./ci/travis.sh
script:
- yum makecache
- ./ci/travis.sh
- cd build
tags:
- share
- yum install -y elfutils-libelf-devel
run_test:
.build_by_travis_for_centos8:
stage: build
image: $BUILD_IMAGE_CENTOS8
extends: .build_before_script
script:
- ./ci/travis.sh
tags:
- share
run_test_for_centos8:
stage: test
extends: .build_by_travis
extends: .build_by_travis_for_centos8
script:
- yum makecache
- ./ci/travis.sh
- cd build
- ctest --verbose
- ctest3 --verbose
branch_build_debug:
branch_build_debug_for_centos8:
stage: build
extends: .build_by_travis
extends: .build_by_travis_for_centos8
variables:
BUILD_TYPE: Debug
except:
@@ -43,27 +102,27 @@ branch_build_debug:
- /^master.*$/i
- tags
branch_build_release:
branch_build_release_for_centos8:
stage: build
variables:
BUILD_TYPE: RelWithDebInfo
extends: .build_by_travis
extends: .build_by_travis_for_centos8
except:
- /^develop.*$/i
- /^master.*$/i
- tags
develop_build_debug:
stage: package
extends: .build_by_travis
develop_build_debug_for_centos8:
stage: build
extends: .build_by_travis_for_centos8
variables:
BUILD_TYPE: Debug
PACKAGE: 1
UPLOAD_RPM: 1
ASAN_OPTION: ADDRESS
TESTING_VERSION_BUILD: 1
PULP3_REPO_NAME: protocol-testing-x86_64.el7
PULP3_DIST_NAME: protocol-testing-x86_64.el7
PULP3_REPO_NAME: protocol-testing-x86_64.el8
PULP3_DIST_NAME: protocol-testing-x86_64.el8
artifacts:
name: "quic-$CI_COMMIT_REF_NAME-debug"
paths:
@@ -72,16 +131,16 @@ develop_build_debug:
- /^develop.*$/i
- /^master.*$/i
develop_build_release:
stage: package
extends: .build_by_travis
develop_build_release_for_centos8:
stage: build
extends: .build_by_travis_for_centos8
variables:
BUILD_TYPE: RelWithDebInfo
PACKAGE: 1
UPLOAD_RPM: 1
TESTING_VERSION_BUILD: 1
PULP3_REPO_NAME: protocol-testing-x86_64.el7
PULP3_DIST_NAME: protocol-testing-x86_64.el7
PULP3_REPO_NAME: protocol-testing-x86_64.el8
PULP3_DIST_NAME: protocol-testing-x86_64.el8
artifacts:
name: "quic-$CI_COMMIT_REF_NAME-release"
paths:
@@ -90,15 +149,16 @@ develop_build_release:
- /^develop.*$/i
- /^master.*$/i
release_build_debug:
release_build_debug_for_centos8:
stage: package
variables:
BUILD_TYPE: Debug
PACKAGE: 1
UPLOAD_RPM: 1
PULP3_REPO_NAME: protocol-stable-x86_64.el7
PULP3_DIST_NAME: protocol-stable-x86_64.el7
extends: .build_by_travis
ASAN_OPTION: ADDRESS
PULP3_REPO_NAME: protocol-stable-x86_64.el8
PULP3_DIST_NAME: protocol-stable-x86_64.el8
extends: .build_by_travis_for_centos8
artifacts:
name: "quic-$CI_COMMIT_REF_NAME-debug"
paths:
@@ -106,7 +166,7 @@ release_build_debug:
only:
- tags
release_build_release:
release_build_release_for_centos8:
stage: package
variables:
BUILD_TYPE: RelWithDebInfo
@@ -114,12 +174,159 @@ release_build_release:
UPLOAD_RPM: 1
UPLOAD_SYMBOL_FILES: 1
SYMBOL_TARGET: quic
PULP3_REPO_NAME: protocol-stable-x86_64.el7
PULP3_DIST_NAME: protocol-stable-x86_64.el7
extends: .build_by_travis
PULP3_REPO_NAME: protocol-stable-x86_64.el8
PULP3_DIST_NAME: protocol-stable-x86_64.el8
extends: .build_by_travis_for_centos8
artifacts:
name: "quic-$CI_COMMIT_REF_NAME-release"
paths:
- build/*.rpm
only:
- tags
###############################################################################
# build for rocky9
###############################################################################
.build_by_travis_for_rocky9:
stage: build
image: $BUILD_IMAGE_AARCH64_ROCKY9
extends: .build_before_script
script:
- yum install -y perl-FindBin
- ./ci/travis.sh
tags:
- tsg-os-builder-aarch64
branch_build_debug_for_rocky9:
stage: build
extends: .build_by_travis_for_rocky9
variables:
BUILD_TYPE: Debug
except:
- /^develop.*$/i
- /^master.*$/i
- tags
branch_build_release_for_rocky9:
stage: build
variables:
BUILD_TYPE: RelWithDebInfo
extends: .build_by_travis_for_rocky9
except:
- /^develop.*$/i
- /^master.*$/i
- tags
develop_build_debug_for_rocky9:
stage: build
extends: .build_by_travis_for_rocky9
variables:
BUILD_TYPE: Debug
PACKAGE: 1
UPLOAD_RPM: 1
ASAN_OPTION: ADDRESS
TESTING_VERSION_BUILD: 1
PULP3_REPO_NAME: protocol-testing-aarch64.el9
PULP3_DIST_NAME: protocol-testing-aarch64.el9
artifacts:
name: "quic-$CI_COMMIT_REF_NAME-debug"
paths:
- build/*.rpm
only:
- /^develop.*$/i
- /^master.*$/i
develop_build_release_for_rocky9:
stage: build
extends: .build_by_travis_for_rocky9
variables:
BUILD_TYPE: RelWithDebInfo
PACKAGE: 1
UPLOAD_RPM: 1
TESTING_VERSION_BUILD: 1
PULP3_REPO_NAME: protocol-testing-aarch64.el9
PULP3_DIST_NAME: protocol-testing-aarch64.el9
artifacts:
name: "quic-$CI_COMMIT_REF_NAME-release"
paths:
- build/*.rpm
only:
- /^develop.*$/i
- /^master.*$/i
release_build_debug_for_rocky9:
stage: package
variables:
BUILD_TYPE: Debug
PACKAGE: 1
UPLOAD_RPM: 1
ASAN_OPTION: ADDRESS
PULP3_REPO_NAME: protocol-stable-aarch64.el9
PULP3_DIST_NAME: protocol-stable-aarch64.el9
extends: .build_by_travis_for_rocky9
artifacts:
name: "quic-$CI_COMMIT_REF_NAME-debug"
paths:
- build/*.rpm
only:
- tags
release_build_release_for_rocky9:
stage: package
variables:
BUILD_TYPE: RelWithDebInfo
PACKAGE: 1
UPLOAD_RPM: 1
UPLOAD_SYMBOL_FILES: 0
SYMBOL_TARGET: quic
PULP3_REPO_NAME: protocol-stable-aarch64.el9
PULP3_DIST_NAME: protocol-stable-aarch64.el9
extends: .build_by_travis_for_rocky9
artifacts:
name: "quic-$CI_COMMIT_REF_NAME-release"
paths:
- build/*.rpm
only:
- tags
###############################################################################
# test
###############################################################################
.download_rpm_package: &download_rpm_package
- yumdownloader sapp-4.3.69.6dd815e
- yumdownloader sapp-devel-4.3.69.6dd815e
- mv sapp-4.3.69.6dd815e*.rpm /tmp/sapp.rpm
- mv sapp-devel-4.3.69.6dd815e*.rpm /tmp/sapp-devel.rpm
.install_rpm_package: &install_rpm_package
- rpm -e sapp || true
- rpm -e sapp-devel || true
- rpm -ivh /tmp/sapp.rpm --prefix=${INSTALL_PREFIX} --force --nodeps
- rpm -ivh /tmp/sapp-devel.rpm --prefix=${INSTALL_PREFIX} --force --nodeps
- rpm -qa | grep sapp
- ls -l ${INSTALL_PREFIX}
- ldd ${INSTALL_PREFIX}/sapp
run_test_for_centos8:
stage: test
extends: .build_by_travis_for_centos8
script:
- yum makecache
- ./ci/travis.sh
- cd build
- *download_rpm_package
- *install_rpm_package
- ctest3 --verbose
run_test_for_rocky9:
stage: test
extends: .build_by_travis_for_rocky9
script:
- yum makecache
- yum install -y perl-FindBin
- ./ci/travis.sh
- cd build
- *download_rpm_package
- *install_rpm_package
- ctest3 --verbose

View File

@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 2.8...3.10)
set(lib_name quic)
@@ -28,7 +28,10 @@ elseif(ASAN_OPTION MATCHES "THREAD")
endif()
# end of for ASAN
set(CMAKE_INSTALL_PREFIX /home/mesasoft/sapp_run)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/opt/tsg/sapp" CACHE PATH "default install path" FORCE)
message(STATUS "CMAKE_INSTALL_PREFIX='${CMAKE_INSTALL_PREFIX}'")
endif()
include_directories(include)
include_directories(/opt/MESA/include/MESA/)

View File

@@ -33,12 +33,16 @@ env | sort
: "${COMPILER_IS_GNUCXX:=OFF}"
# Install dependency from YUM
if [ -n "${INSTALL_DEPENDENCY_LIBRARY}" ]; then
yum install -y $INSTALL_DEPENDENCY_LIBRARY
if [ -n "${INSTALL_DEPENDENCY_FRAMEWORK}" ]; then
yum install -y $INSTALL_DEPENDENCY_FRAMEWORK
source /etc/profile.d/framework.sh
fi
if [ $ASAN_OPTION ];then
if [ -n "${INSTALL_DEPENDENCY_PLATFORM}" ]; then
yum install -y $INSTALL_DEPENDENCY_PLATFORM
fi
if [ $ASAN_OPTION ] && [ -f "/opt/rh/devtoolset-7/enable" ] ;then
source /opt/rh/devtoolset-7/enable
fi
@@ -63,9 +67,3 @@ if [ -n "${UPLOAD_RPM}" ]; then
python3 rpm_upload_tools.py ${PULP3_REPO_NAME} ${PULP3_DIST_NAME} *.rpm
fi
if [ -n "${UPLOAD_SYMBOL_FILES}" ]; then
rpm -i $SYMBOL_TARGET*debuginfo*.rpm
_symbol_file=`find /usr/lib/debug/ -name "$SYMBOL_TARGET*.so*.debug"`
cp $_symbol_file ${_symbol_file}info.${CI_COMMIT_SHORT_SHA}
sentry-cli upload-dif -t elf ${_symbol_file}info.${CI_COMMIT_SHORT_SHA}
fi

View File

@@ -12,18 +12,18 @@ set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}.${VERSION_BUILD}")
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
set(CPACK_PACKAGE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_BUILD}")
execute_process(COMMAND bash -c "echo -ne \"`uname -r | awk -F'.' '{print $5\".\"$6\".\"$7}'`\"" OUTPUT_VARIABLE SYSTEM_VERSION)
execute_process(COMMAND sh changelog.sh ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/cmake)
SET(CPACK_RPM_CHANGELOG_FILE ${CMAKE_BINARY_DIR}/changelog.txt)
# RPM Build
set(CPACK_GENERATOR "RPM")
set(CPACK_RPM_AUTO_GENERATED_FILE_NAME ON)
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
set(CPACK_RPM_PACKAGE_VENDOR "MESA")
set(CPACK_RPM_PACKAGE_AUTOREQPROV "yes")
set(CPACK_RPM_PACKAGE_RELEASE_LIBRARY "on")
set(CPACK_RPM_PACKAGE_RELEASE_DIST "on")
set(CPACK_RPM_DEBUGINFO_PACKAGE "on")
set(CPACK_RPM_PACKAGE_DEBUG 1)
set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
@@ -32,17 +32,12 @@ set(CPACK_COMPONENT_HEADER_DISPLAY_NAME "develop")
set(CPACK_COMPONENT_LIBRARIES_REQUIRED TRUE)
set(CPACK_RPM_LIBRARIES_PACKAGE_NAME ${MY_RPM_NAME_PREFIX})
set(CPACK_RPM_LIBRARIES_FILE_NAME "${CPACK_RPM_LIBRARIES_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${SYSTEM_VERSION}.rpm")
set(CPACK_RPM_LIBRARIES_DEBUGINFO_FILE_NAME "${CPACK_RPM_LIBRARIES_PACKAGE_NAME}-debuginfo-${CPACK_PACKAGE_VERSION}-${SYSTEM_VERSION}.rpm")
set(CPACK_COMPONENT_LIBRARIES_GROUP "libraries")
set(CPACK_COMPONENT_PROFILE_GROUP "libraries")
set(CPACK_COMPONENT_LIBRARIES_GROUP "LIBRARIES")
set(CPACK_COMPONENT_PROFILE_GROUP "LIBRARIES")
set(CPACK_COMPONENT_HEADER_REQUIRED TRUE)
set(CPACK_RPM_HEADER_PACKAGE_NAME "${MY_RPM_NAME_PREFIX}-devel")
set(CPACK_RPM_HEADER_FILE_NAME "${CPACK_RPM_HEADER_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${SYSTEM_VERSION}.rpm")
set(CPACK_RPM_HEADER_DEBUGINFO_FILE_NAME "${CPACK_RPM_HEADER_PACKAGE_NAME}-debuginfo-${CPACK_PACKAGE_VERSION}-${SYSTEM_VERSION}.rpm")
set(CPACK_COMPONENT_HEADER_GROUP "header")
set(CPACK_COMPONENT_HEADER_GROUP "HEADER")
set(CPACK_RPM_HEADER_PACKAGE_REQUIRES_PRE ${CPACK_RPM_LIBRARIES_PACKAGE_NAME})
set(CPACK_RPM_HEADER_PACKAGE_CONFLICTS ${CPACK_RPM_HEADER_PACKAGE_NAME})

View File

@@ -1,4 +1,4 @@
#!/bin/sh
work_path=$1
branch=`git status | grep branch | awk '{print $NF}'`
branch=`git status | grep 'On branch' | awk '{print $NF}'`
git log --branches=$branch --no-merges --date=local --show-signature --pretty="* %ad %an %ae %nhash: %H%ncommit:%n%B" | awk -F"-" '{print "- "$0}' | sed 's/- \*/\*/g' | sed 's/- $//g' | sed 's/-/ -/g' | sed 's/[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}//g' > $work_path/changelog.txt

View File

@@ -0,0 +1,70 @@
//https://jira.geedge.net/browse/OMPUB-527
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
static int msb2_varint_decode(const unsigned char *buf, long *out)
{
unsigned long val = buf[0] & 0x3f;
unsigned int nfollow = 1<<(buf[0]>>6);
switch (nfollow-1)
{
case 7: val = (val << 8) | buf[nfollow - 7]; /*fail through*/
case 6: val = (val << 8) | buf[nfollow - 6]; /*fail through*/
case 5: val = (val << 8) | buf[nfollow - 5]; /*fail through*/
case 4: val = (val << 8) | buf[nfollow - 4]; /*fail through*/
case 3: val = (val << 8) | buf[nfollow - 3]; /*fail through*/
case 2: val = (val << 8) | buf[nfollow - 2]; /*fail through*/
case 1: val = (val << 8) | buf[nfollow-1];
case 0: break;
}
*out=val;
return nfollow;
}
int parse_quic_transport_parameter(const char *quic_para, int quic_para_len, int thread_seq)
{
int one_para_length=0;
int para_offset=0;
long one_para_type=0;
while(quic_para_len > para_offset)
{
para_offset+=msb2_varint_decode((const unsigned char *)(quic_para+para_offset), &one_para_type);
switch(one_para_type)
{
//case EXT_QUIC_PARAM_USER_AGENT: // 2021-10-20 deprecated
case 0x3129:
one_para_length=quic_para[para_offset++]; // length=1
if(one_para_length+para_offset>quic_para_len)
{
return 0;
}
//para_offset+=copy_extension_tag(quic_para+para_offset, one_para_length, &client_hello->user_agent, thread_seq);
return 1;
default:
one_para_length=(int)(quic_para[para_offset++]); // length=1
if(one_para_length<0 || one_para_length>quic_para_len)
{
break;
}
para_offset+=one_para_length;
break;
}
}
return 0;
}
int main(int argc, char *argv[])
{
char buff1[106]={0x80, 0x0, 0x47, 0x52, 0x4, 0x0, 0x0, 0x0, 0x1, 0x20, 0x4, 0x80, 0x1, 0x0, 0x0, 0xf, 0x0, 0x4, 0x4, 0x80, 0xf0, 0x0, 0x0, 0x8, 0x2, 0x40, 0x64, 0x7, 0x4, 0x80, 0x60, 0x0, 0x0, 0x9, 0x2, 0x40, 0x67, 0x6, 0x4, 0x80, 0x60, 0x0, 0x0, 0x80, 0xff, 0x73, 0xdb, 0xc, 0x0, 0x0, 0x0, 0x1, 0x3a, 0x6a, 0x9b, 0xaa, 0x4f, 0x2f, 0xbd, 0xc, 0xd5, 0xe2, 0xae, 0x32, 0x45, 0x6, 0x2e, 0xf, 0xc5, 0x82, 0x94, 0x3d, 0x5d, 0xb2, 0x69, 0x2c, 0x25, 0xbd, 0xd5, 0x85, 0x99, 0x72, 0xeb, 0x3, 0x2, 0x45, 0xc0, 0x1, 0x4, 0x80, 0x0, 0x75, 0x30, 0x71, 0x28, 0x4, 0x52, 0x56, 0x43, 0x4d, 0x5, 0x4, 0x80, 0x60, 0x0, 0x0};
char buff2[99]={0x71, 0x27, 0x4, 0x80, 0x2, 0xa5, 0xb2, 0xe4, 0xcf, 0x74, 0x5b, 0xf5, 0x6, 0x41, 0x20, 0x0, 0x8, 0x2, 0x40, 0x64, 0x4, 0x4, 0x80, 0xd4, 0x9f, 0xb7, 0x6f, 0xdf, 0xed, 0x48, 0x94, 0x18, 0xd7, 0x53, 0xf7, 0x92, 0x6, 0x94, 0xa0, 0x0, 0x0, 0x1, 0x4, 0x80, 0x0, 0x75, 0x30, 0xf, 0x0, 0x80, 0xff, 0x73, 0xdb, 0xc, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x8a, 0x7a, 0x8a, 0x3a, 0x9, 0x2, 0x40, 0x67, 0x3, 0x2, 0x45, 0xc0, 0x5, 0x4, 0x80, 0x60, 0x0, 0x0, 0x71, 0x28, 0x4, 0x52, 0x56, 0x43, 0x4d, 0x20, 0x4, 0x80, 0x1, 0x0, 0x0, 0x7, 0x4, 0x80, 0x60, 0x0, 0x0};
parse_quic_transport_parameter(buff1, 106, 0);
parse_quic_transport_parameter(buff2, 99, 0);
return 0;
}

View File

@@ -49,7 +49,7 @@ struct quic_info
//buff_len minimun 32bytes
int quic_version_int2string(unsigned int version, char *buff, int buff_len);
//ret: 0: not quic, >0: quic version
unsigned int quic_protocol_identify(struct streaminfo *a_stream, void *a_packet, char *out_sni, int *out_sni_len, char *out_ua, int *out_ua_len);
//ret: NULL: not quic, quic_info: quic version
struct quic_info *quic_protocol_identify(const struct streaminfo *a_stream);
#endif /* SRC__QUIC_H__ */

View File

@@ -44,7 +44,7 @@ extern "C"
#endif
#define QUIC_MAX_UDP_PAYLOAD_SIZE 65527
#define QUIC_MAX_UDP_PAYLOAD_SIZE 1460
#define quic_string(str) \
{ \

View File

@@ -6,9 +6,11 @@
*/
#include <stdio.h>
#include <MESA/stream_inc/stream_base.h>
#include <MESA/MESA_handle_logger.h>
#include <MESA/stream.h>
#include <MESA/MESA_prof_load.h>
#include <MESA/MESA_handle_logger.h>
#include "quic.h"
#include "quic_entry.h"
#include "quic_process.h"
@@ -141,47 +143,51 @@ void quic_free_client_hello(struct quic_client_hello *client_hello, int thread_s
return ;
}
void quic_free_context(void** pme, int thread_seq)
void quic_free_context(const struct streaminfo *a_stream, int bridge_id, void *data)
{
if(NULL==*pme)
if(NULL!=data)
{
return ;
struct quic_context *context = (struct quic_context *)data;
quic_free_client_hello(context->quic_info.client_hello, a_stream->threadnum);
if(context->quic_buf.buffer)
{
dictator_free(a_stream->threadnum, context->quic_buf.buffer);
}
dictator_free(a_stream->threadnum, data);
}
struct quic_context *context = (struct quic_context *)*pme;
quic_free_client_hello(context->quic_info.client_hello, thread_seq);
dictator_free(thread_seq, *pme);
*pme=NULL;
return;
}
extern "C" unsigned char QUIC_ENTRY(struct streaminfo *pstream, void**pme, int thread_seq, void *a_packet)
extern "C" unsigned char QUIC_ENTRY(const struct streaminfo *pstream, void**pme, int thread_seq, const void *a_packet)
{
unsigned char state=0;
struct quic_context *context=(struct quic_context *)*pme;
if((g_quic_param.quic_interested_region_flag<QUIC_KEY) || (!is_quic_port(pstream)))
{
return APP_STATE_DROPME;
}
if(*pme==NULL)
if(pstream->opstate==OP_STATE_PENDING)
{
quic_init_context(pme, thread_seq);
context=(struct quic_context *)*pme;
*pme=stream_bridge_async_data_get(pstream, g_quic_param.context_bridge_id);
if(*pme==NULL)
{
*pme=dictator_malloc(thread_seq, sizeof(struct quic_context));
memset(*pme, 0, sizeof(struct quic_context));
}
}
unsigned char state=0;
struct quic_context *context=(struct quic_context *)*pme;
state=quic_analyze_entry(pstream, context, thread_seq, a_packet);
if(pstream->opstate==OP_STATE_CLOSE)
{
state=quic_call_business_plug(pstream, context, NULL, 0, QUIC_INTEREST_KEY_MASK, a_packet);
}
if(state&APP_STATE_DROPME || state&APP_STATE_DROPPKT || pstream->opstate==OP_STATE_CLOSE)
if(state&APP_STATE_DROPME || pstream->opstate==OP_STATE_CLOSE)
{
quic_free_context(pme, thread_seq);
if(context->link_state==1)
{
quic_call_business_plug(pstream, context, NULL, 0, QUIC_INTEREST_KEY_MASK, a_packet);
}
quic_free_context(pstream, g_quic_param.context_bridge_id, *pme);
stream_bridge_async_data_put(pstream, g_quic_param.context_bridge_id, NULL);
*pme=NULL;
return state;
}
@@ -205,7 +211,7 @@ extern "C" int QUIC_INIT(void)
MESA_load_profile_int_def(g_quic_proto_conffile, "QUIC", "DECRYPTED_SWITCH", &g_quic_param.decrypted_switch, 2);
MESA_load_profile_int_def(g_quic_proto_conffile, "QUIC", "MAX_PARSE_PKT_NUM", &g_quic_param.max_parse_pkt_num, 3);
MESA_load_profile_string_def(g_quic_proto_conffile, "QUIC", "QUIC_PORT_LIST", buff, sizeof(buff), "443;8443;");
MESA_load_profile_string_def(g_quic_proto_conffile, "QUIC", "QUIC_PORT_LIST", buff, sizeof(buff), "");
g_quic_param.quic_port_num=parse_quic_port(buff, g_quic_param.quic_port_list, SUPPORT_QUIC_PORT_NUM);
g_quic_param.logger=MESA_create_runtime_log_handle(g_quic_param.log_path, g_quic_param.level);
@@ -226,14 +232,14 @@ extern "C" int QUIC_INIT(void)
MESA_handle_runtime_log(g_quic_param.logger, RLOG_LV_FATAL, "QUIC_READCONF", "Read error, Please check %s, region_line: %s", g_quic_regionname_conffile, buff);
return -1;
}
if(region_id>MAX_REGION_NUM)
if(region_id>=MAX_REGION_NUM)
{
fclose(fp);
MESA_handle_runtime_log(g_quic_param.logger, RLOG_LV_FATAL, "QUIC_READCONF", "Read error, Please check %s, bigger than MAX_REGION_NUM, region_line: %s", g_quic_regionname_conffile, buff);
return -1;
}
strncpy(g_quic_param.quic_conf_regionname[region_id], region_name, strlen(region_name));
memcpy(g_quic_param.quic_conf_regionname[region_id], region_name, MIN(sizeof(g_quic_param.quic_conf_regionname[region_id])-1, strlen(region_name)));
g_quic_param.quic_region_cnt++;
memset(region_name, 0, sizeof(region_name));
}
@@ -246,6 +252,9 @@ extern "C" int QUIC_INIT(void)
return -1;
}
g_quic_param.context_bridge_id=stream_bridge_build("QUIC_CONTEXT", "w");
stream_bridge_register_data_free_cb(g_quic_param.context_bridge_id, quic_free_context);
return 0;
}
@@ -319,6 +328,8 @@ extern "C" long long QUIC_FLAG_CHANGE(char* flag_str)
extern "C" void QUIC_DESTROY(void)
{
MESA_destroy_runtime_log_handle(g_quic_param.logger);
g_quic_param.logger = NULL;
return ;
}

View File

@@ -3,6 +3,10 @@
#include "quic.h"
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#define FALSE 0x00
#define TRUE 0x01
#define MAYBE 0x02
@@ -29,6 +33,7 @@ struct quic_param
int quic_port_num;
int decrypted_switch;
int max_parse_pkt_num;
int context_bridge_id;
unsigned short quic_port_list[SUPPORT_QUIC_PORT_NUM];
char quic_conf_regionname[MAX_REGION_NUM][REGION_NAME_LEN];
char log_path[128];
@@ -47,8 +52,7 @@ enum quic_mes_type{
};
extern struct quic_param g_quic_param;
int is_quic_port(struct streaminfo *pstream);
void quic_free_client_hello(struct quic_client_hello *client_hello, int thread_seq);
int is_quic_port(const struct streaminfo *pstream);
#endif /* SRC_QUIC_ANALYSIS_H_ */

View File

@@ -31,10 +31,6 @@ enum PARSE_RESULT
#define PRINTADDR(a, b) ((b)<RLOG_LV_FATAL ? printaddr(&(a->addr), a->threadnum) : "")
#endif
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
struct quic_client_hello_msg_hdr
{
uint8_t handshake_type;
@@ -57,10 +53,10 @@ int check_port(unsigned short port)
return 0;
}
int is_quic_port(struct streaminfo *pstream)
int is_quic_port(const struct streaminfo *pstream)
{
unsigned short source=0, dest=0;
if(g_quic_param.quic_port_num==0)return 1;
switch(pstream->addr.addrtype)
{
case ADDR_TYPE_IPV4:
@@ -104,6 +100,12 @@ static int copy_extension_tag(const char *tag_start_pos, int tag_len, char **out
{
if(tag_start_pos!=NULL && tag_len>0)
{
if(*out!=NULL)
{
dictator_free(thread_seq, *out);
*out=NULL;
}
(*out)=(char *)dictator_malloc(thread_seq, tag_len+1);
memcpy(*out, tag_start_pos, tag_len);
(*out)[tag_len]='\0';
@@ -152,7 +154,7 @@ int quic_call_business_state(struct quic_context *context)
return state;
}
unsigned char quic_call_business_plug(struct streaminfo *pstream, struct quic_context *context, void *buff, int buff_len, enum quic_interested_region region_mask, void *a_packet)
unsigned char quic_call_business_plug(const struct streaminfo *pstream, struct quic_context *context, void *buff, int buff_len, enum quic_interested_region region_mask, const void *a_packet)
{
char state=PROT_STATE_GIVEME;
char app_state=APP_STATE_GIVEME;
@@ -176,7 +178,7 @@ unsigned char quic_call_business_plug(struct streaminfo *pstream, struct quic_co
session_info.buf=buff;
session_info.buflen=buff_len;
}
state=PROT_PROCESS(&session_info, &(context->business_pme), pstream->threadnum, pstream, a_packet);
state=PROT_PROCESS(&session_info, &(context->business_pme), pstream->threadnum, (struct streaminfo *)pstream, a_packet);
if(state&PROT_STATE_DROPPKT)
{
@@ -314,8 +316,11 @@ int parse_special_frame_stream(struct quic_info* quic_info, const char *payload,
return PARSE_RESULT_VERSION;
}
quic_info->client_hello=(struct quic_client_hello *)dictator_malloc(thread_seq, sizeof(struct quic_client_hello));
memset(quic_info->client_hello, 0, sizeof(struct quic_client_hello));
if(quic_info->client_hello==NULL)
{
quic_info->client_hello=(struct quic_client_hello *)dictator_malloc(thread_seq, sizeof(struct quic_client_hello));
memset(quic_info->client_hello, 0, sizeof(struct quic_client_hello));
}
tag_value_start_offset=payload_offset+tag_num*4*2; // skip length of type and offset, type(offset)=szieof(int)
@@ -376,7 +381,11 @@ int parse_quic_transport_parameter(struct quic_client_hello *client_hello, const
para_offset+=copy_extension_tag(quic_para+para_offset, one_para_length, &client_hello->user_agent, thread_seq);
return 1;
default:
one_para_length=quic_para[para_offset++]; // length=1
one_para_length=(int)(quic_para[para_offset++]); // length=1
if(one_para_length<0 || one_para_length>quic_para_len)
{
break;
}
para_offset+=one_para_length;
break;
}
@@ -511,7 +520,7 @@ int parse_tls_client_hello(struct quic_client_hello **client_hello, const char *
int parse_quic_decrypted_payload(struct quic_info *quic_info, const char * payload, int payload_len, int thread_seq)
{
char join_payload[2048]={0};
char join_payload[MAX_CLIENT_HELLO_CHUNK_SIZE]={};
int join_payload_len=sizeof(join_payload);
unsigned int quic_version=quic_info->quic_version;
@@ -737,6 +746,11 @@ enum QUIC_VERSION is_quic_protocol(const char *payload, int payload_len, int *pa
enum QUIC_VERSION quic_version=QUIC_VERSION_UNKNOWN;
unsigned char frame_type=(unsigned char)(payload[0]);
if(payload_len<=4)
{
return QUIC_VERSION_UNKNOWN;
}
if(frame_type&QUIC_LONG_HEADER_MASK)
{
quic_version=identify_quic_version(payload, payload_len, payload_offset);
@@ -753,9 +767,109 @@ enum QUIC_VERSION is_quic_protocol(const char *payload, int payload_len, int *pa
return quic_version;
}
unsigned char parse_quic_all_version(struct quic_info *quic_info, const char *payload, int payload_len, int thread_seq)
static void quic_chlo_chunk_assemble(struct quic_buffer *qbuf, unsigned char *new_payload, int new_len, int thread_seq)
{
int ret=0, payload_offset=0;
if(NULL == new_payload || new_len <= 0){
return;
}
if(NULL == qbuf->buffer){
qbuf->buffer = (unsigned char *)dictator_malloc(thread_seq, MAX_CLIENT_HELLO_CHUNK_SIZE);
qbuf->max_size = MAX_CLIENT_HELLO_CHUNK_SIZE;
}
int max_copy_len = MIN((int)(qbuf->max_size - qbuf->datalen), new_len);
memcpy(qbuf->buffer + qbuf->datalen, new_payload, max_copy_len);
qbuf->datalen += max_copy_len;
}
static int get_chlo_total_length(const unsigned char *payload, int payload_len)
{
const struct quic_client_hello_msg_hdr *chlo_hdr=(const struct quic_client_hello_msg_hdr *)payload;
int chlo_len=0;
uint8_t *p = (uint8_t *)&chlo_len;
p[2] = chlo_hdr->client_hello_len[0];
p[1] = chlo_hdr->client_hello_len[1];
p[0] = chlo_hdr->client_hello_len[2];
return chlo_len;
}
/*
1: is chlo, and complete!
0: is chlo, but fragment;
-1: not support
*/
static int quic_chlo_is_complete(enum QUIC_VERSION quic_version, const unsigned char *payload, int payload_len)
{
if(!( (quic_version>=MVFST_VERSION_00 && quic_version<=MVFST_VERSION_0F) ||
(quic_version>=GQUIC_VERSION_T050 && quic_version<=GQUIC_VERSION_T059) ||
(quic_version>=IQUIC_VERSION_I022 && quic_version<=IQUIC_VERSION_I029) ||
(quic_version==IQUIC_VERSION_RFC9000)))
{
return -1;
}
if((payload[0] != 0x06) && (payload[0] != 0x08))
{
return -1;
}
int payload_offset = 0;
long frame_offset, frame_length;
payload_offset = 1; //skip frame type
payload_offset+=msb2_varint_decode(payload+payload_offset, &frame_offset);
payload_offset+=msb2_varint_decode(payload+payload_offset, &frame_length);
if(payload[payload_offset] != QUIC_HANDSHAKE_TYPE_CLIENTHELLO)
{
return -1;
}
int expect_len = get_chlo_total_length(payload + payload_offset, payload_len-payload_offset);
if(payload_len-payload_offset >= expect_len){
return 1;
}
return 0;
}
static enum PARSE_RESULT quic_decrypting_payload(struct quic_context *qcontext, unsigned char *udp_payload, int udp_payload_len, int thread_seq)
{
struct quic_buffer *qbuf = &qcontext->quic_buf;
unsigned char *quic_decrypted_payload;
int ret, quic_decrypted_payload_len;
quic_dpt_t *dpt = quic_deprotection_new();
enum PARSE_RESULT parse_result = PARSE_RESULT_UNKNOWN;
if(quic_deprotection(dpt, (const u_char *)udp_payload, udp_payload_len) < 0){
goto err_exit;
}
if(qbuf->datalen > 0){ //some fragment exist
quic_chlo_chunk_assemble(qbuf, dpt->payload.data, dpt->payload.len, thread_seq);
quic_decrypted_payload = qbuf->buffer;
quic_decrypted_payload_len = qbuf->datalen;
}else{
quic_decrypted_payload = dpt->payload.data;
quic_decrypted_payload_len = dpt->payload.len;
}
ret = quic_chlo_is_complete((enum QUIC_VERSION)qcontext->quic_info.quic_version, quic_decrypted_payload, quic_decrypted_payload_len);
if(0 == ret){
if(NULL == qbuf->buffer || 0 == qbuf->datalen){
quic_chlo_chunk_assemble(qbuf, dpt->payload.data, dpt->payload.len, thread_seq);
}
parse_result = PARSE_RESULT_VERSION;
goto fun_exit;
}
parse_result = (enum PARSE_RESULT)parse_quic_decrypted_payload(&qcontext->quic_info, (char *)quic_decrypted_payload, quic_decrypted_payload_len, thread_seq);
fun_exit:
quic_deprotection_free(dpt);
return parse_result;
err_exit:
quic_deprotection_free(dpt);
return PARSE_RESULT_VERSION;
}
unsigned char parse_quic_all_version(struct quic_context *qcontext, const char *payload, int payload_len, int thread_seq)
{
int payload_offset=0;
enum QUIC_VERSION quic_version=QUIC_VERSION_UNKNOWN;
if(payload==NULL || payload_len<=0)
@@ -769,21 +883,25 @@ unsigned char parse_quic_all_version(struct quic_info *quic_info, const char *pa
return PARSE_RESULT_UNKNOWN;
}
quic_info->quic_version=quic_version;
qcontext->quic_info.quic_version=quic_version;
if(quic_version>=GQUIC_VERSION_Q001 && quic_version<=GQUIC_VERSION_Q048)
{
return parse_quic_uncryption_payload(quic_info, payload+payload_offset, payload_len-payload_offset, thread_seq);
if(payload_len > payload_offset)
{
return parse_quic_uncryption_payload(&qcontext->quic_info, payload+payload_offset, payload_len-payload_offset, thread_seq);
}
return PARSE_RESULT_VERSION;
}
else if(((quic_version>=MVFST_VERSION_00 && quic_version<=MVFST_VERSION_0F) ||
(quic_version>=GQUIC_VERSION_Q049 && quic_version<=GQUIC_VERSION_Q059) ||
(quic_version>=GQUIC_VERSION_T050 && quic_version<=GQUIC_VERSION_T059) ||
(quic_version>=GQUIC_VERSION_T050 && quic_version<=GQUIC_VERSION_T059) ||
(quic_version>=IQUIC_VERSION_I022 && quic_version<=IQUIC_VERSION_I029) ||
(quic_version==IQUIC_VERSION_RFC9000))
&& g_quic_param.decrypted_switch>0
)
{
#if 0
quic_dpt_t *dpt = quic_deprotection_new();
if (quic_deprotection(dpt, (const u_char *)payload, payload_len) != 0)
{
@@ -798,6 +916,9 @@ unsigned char parse_quic_all_version(struct quic_info *quic_info, const char *pa
return ret;
}
quic_deprotection_free(dpt);
#else
return quic_decrypting_payload(qcontext, (unsigned char *)payload, payload_len, thread_seq);
#endif
}
else
{
@@ -808,12 +929,12 @@ unsigned char parse_quic_all_version(struct quic_info *quic_info, const char *pa
}
unsigned char quic_analyze_entry(struct streaminfo *pstream, struct quic_context* context, int thread_seq, void* a_packet)
unsigned char quic_analyze_entry(const struct streaminfo *pstream, struct quic_context* context, int thread_seq, const void* a_packet)
{
unsigned char parse_result=PARSE_RESULT_UNKNOWN;
char state=APP_STATE_GIVEME;
if(pstream==NULL || pstream->pudpdetail==NULL)
if(pstream==NULL || pstream->pudpdetail==NULL || context==NULL)
{
return APP_STATE_DROPME;
}
@@ -826,7 +947,7 @@ unsigned char quic_analyze_entry(struct streaminfo *pstream, struct quic_context
parse_result=PARSE_RESULT_PAYLOAD;
break;
case PARSE_RESULT_VERSION:
parse_result=parse_quic_all_version(&(context->quic_info), (const char *)udp_detail->pdata, udp_detail->datalen, thread_seq);
parse_result=parse_quic_all_version(context, (const char *)udp_detail->pdata, udp_detail->datalen, thread_seq);
if(parse_result==PARSE_RESULT_VERSION || parse_result==PARSE_RESULT_UNKNOWN)
{
parse_result=PARSE_RESULT_PAYLOAD;
@@ -835,12 +956,26 @@ unsigned char quic_analyze_entry(struct streaminfo *pstream, struct quic_context
case PARSE_RESULT_PAYLOAD:
case PARSE_RESULT_UNKNOWN:
default:
if(context->parse_first_pkt==1)
{
context->parse_first_pkt=0;
if(context->quic_info.client_hello==NULL)
{
parse_result=PARSE_RESULT_VERSION;
}
else
{
parse_result=PARSE_RESULT_CLIENT_HELLO;
}
break;
}
if((context->parse_pkt_cnt++)>=g_quic_param.max_parse_pkt_num)
{
parse_result=PARSE_RESULT_PAYLOAD;
break;
}
parse_result=parse_quic_all_version(&(context->quic_info), (const char *)udp_detail->pdata, udp_detail->datalen, thread_seq);
parse_result=parse_quic_all_version(context, (const char *)udp_detail->pdata, udp_detail->datalen, thread_seq);
break;
}
@@ -865,49 +1000,30 @@ unsigned char quic_analyze_entry(struct streaminfo *pstream, struct quic_context
return state;
}
static int copy_client_hello_extension(char *src, char *dest, int d_len)
struct quic_info *quic_protocol_identify(const struct streaminfo *a_stream)
{
if(src==NULL || dest==NULL || d_len<=0)
{
return 0;
}
int len=MIN((int)strlen(src), d_len-1);
memcpy(dest, src, len);
dest[len]='\0';
return len;
}
unsigned int quic_protocol_identify(struct streaminfo *a_stream, void *a_packet, char *out_sni, int *out_sni_len, char *out_ua, int *out_ua_len)
{
unsigned char parse_result=APP_STATE_GIVEME;
struct quic_info quic_info={0, NULL};
unsigned int quic_version=QUIC_VERSION_UNKNOWN;
if(!is_quic_port(a_stream) || a_stream==NULL || a_stream->pudpdetail==NULL)
{
return quic_version;
return NULL;
}
parse_result=parse_quic_all_version(&quic_info, (const char *)a_stream->pudpdetail->pdata, a_stream->pudpdetail->datalen, a_stream->threadnum);
struct quic_context tmp_qcontext = {};
unsigned char parse_result=APP_STATE_GIVEME;
parse_result=parse_quic_all_version(&tmp_qcontext, (const char *)a_stream->pudpdetail->pdata, a_stream->pudpdetail->datalen, a_stream->threadnum);
if(parse_result!=PARSE_RESULT_UNKNOWN)
{
if(quic_info.client_hello!=NULL)
{
*out_sni_len=copy_client_hello_extension(quic_info.client_hello->sni, out_sni, *out_sni_len);
*out_ua_len=copy_client_hello_extension(quic_info.client_hello->user_agent, out_ua, *out_ua_len);
quic_free_client_hello(quic_info.client_hello, a_stream->threadnum);
}
else
{
*out_sni_len=0;
*out_ua_len=0;
}
struct quic_context *context=(struct quic_context *)dictator_malloc(a_stream->threadnum, sizeof(struct quic_context));
memset(context, 0, sizeof(struct quic_context));
context->quic_info=tmp_qcontext.quic_info;
context->parse_first_pkt=1;
context->pre_parse_state=PARSE_RESULT_UNKNOWN;
quic_version=quic_info.quic_version;
stream_bridge_async_data_put(a_stream, g_quic_param.context_bridge_id, (void *)context);
return &(context->quic_info);
}
return quic_version;
return NULL;
}

View File

@@ -279,18 +279,28 @@ enum QUIC_VERSION
IQUIC_VERSION_I032=0xFF000020
};
#define MAX_CLIENT_HELLO_CHUNK_SIZE (4096)
struct quic_buffer
{
unsigned char *buffer;
size_t max_size;
size_t datalen;
};
struct quic_context
{
unsigned char link_state;
unsigned char parse_pkt_cnt;
unsigned char pre_parse_state;
unsigned char padding[5];
unsigned char parse_first_pkt;
unsigned char padding[4];
void *business_pme;
struct quic_info quic_info;
struct quic_buffer quic_buf; // for client hello fragment
};
unsigned char quic_analyze_entry(struct streaminfo *pstream, struct quic_context* context, int thread_seq, void* a_packet);
unsigned char quic_call_business_plug(struct streaminfo *pstream, struct quic_context *context, void *buff, int buff_len, enum quic_interested_region region_mask, void *a_packet);
unsigned char quic_analyze_entry(const struct streaminfo *pstream, struct quic_context* context, int thread_seq, const void* a_packet);
unsigned char quic_call_business_plug(const struct streaminfo *pstream, struct quic_context *context, void *buff, int buff_len, enum quic_interested_region region_mask, const void *a_packet);
#endif

View File

@@ -55,12 +55,6 @@ int quic_version_int2string(unsigned int version, char *buff, int buff_len)
return 1;
}
if(version>=QUIC_GO_VERSION_00 && version<=QUIC_GO_VERSION_FF)
{
snprintf(buff, buff_len, "quicly qicly0 %02d", (version&0x000000FF));
return 1;
}
if(version>=MSQUIC_VERSION_00 && version<=MSQUIC_VERSION_0F)
{
snprintf(buff, buff_len, "Microsoft MsQuic %02d", (version&0x0000000F));

View File

@@ -6,7 +6,7 @@ include(ExternalProject)
ExternalProject_Add(OpenSSL PREFIX openssl
URL ${CMAKE_CURRENT_SOURCE_DIR}/openssl-1.1.1l.tar.gz
URL_MD5 ac0d4387f3ba0ad741b0580dd45f6ff3
CONFIGURE_COMMAND ./Configure linux-x86_64 --prefix=<INSTALL_DIR> --openssldir=<INSTALL_DIR>/lib/ssl enable-ec_nistp_64_gcc_128 no-shared
CONFIGURE_COMMAND ./config --prefix=<INSTALL_DIR> --openssldir=<INSTALL_DIR>/lib/ssl enable-ec_nistp_64_gcc_128 no-shared
BUILD_COMMAND ${MAKE_COMMAND}
INSTALL_COMMAND make install_sw
BUILD_IN_SOURCE 1)

View File

@@ -1,61 +1,58 @@
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 2.8...3.10)
set(lib_name quic)
project(${lib_name}_test)
include(ExternalProject)
#### Protoco_test_run
ExternalProject_Add(ProtoTest PREFIX ProtoTest
URL ${CMAKE_CURRENT_SOURCE_DIR}/test_protocol_run.zip
URL_MD5 71d8284b59af0286b5f31f0a3160bc44
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
COMMAND ${CMAKE_COMMAND} -E make_directory <SOURCE_DIR>/conf/${lib_name}/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/bin/${lib_name}.conf <SOURCE_DIR>/conf/${lib_name}/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/conflist.inf <SOURCE_DIR>/plug/
COMMAND ${CMAKE_COMMAND} -E make_directory <SOURCE_DIR>/plug/protocol/${lib_name}/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/bin/${lib_name}.inf <SOURCE_DIR>/plug/protocol/${lib_name}/
COMMAND ${CMAKE_COMMAND} -E make_directory <SOURCE_DIR>/plug/business/${lib_name}_test_plug/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/test/${lib_name}_test_plug.inf <SOURCE_DIR>/plug/business/${lib_name}_test_plug/)
ExternalProject_Get_Property(ProtoTest INSTALL_DIR)
ExternalProject_Get_Property(ProtoTest SOURCE_DIR)
set(PROTO_TEST_RUN_DIR ${SOURCE_DIR})
add_executable(proto_test_main IMPORTED GLOBAL)
add_dependencies(proto_test_main ProtoTest)
set_property(TARGET proto_test_main PROPERTY IMPORTED_LOCATION ${SOURCE_DIR}/test_protocol_plug_main)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/opt/tsg/sapp" CACHE PATH "default install path" FORCE)
message(STATUS "CMAKE_INSTALL_PREFIX='${CMAKE_INSTALL_PREFIX}'")
endif()
add_library(${lib_name}_test_plug SHARED ${lib_name}_test_plug.cpp)
target_link_libraries(${lib_name}_test_plug MESA_prof_load cjson)
set_target_properties(${lib_name}_test_plug PROPERTIES PREFIX "")
add_test(NAME COPY_QUIC_SO COMMAND sh -c "cp ${CMAKE_BINARY_DIR}/${lib_name}.so ${PROTO_TEST_RUN_DIR}/plug/protocol/${lib_name}/${lib_name}.so")
add_test(NAME COPY_TEST_SO COMMAND sh -c "cp ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_test_plug.so ${PROTO_TEST_RUN_DIR}/plug/business/${lib_name}_test_plug/${lib_name}_test_plug.so")
add_test(NAME IQUIC_29_TEST COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/iquic/29//${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/iquic/29/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME GQUIC_23_TEST COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/23/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/23/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME GQUIC_25_TEST COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/25/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/25/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME GQUIC_33_TEST COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/33/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/33/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME GQUIC_34_TEST COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/34/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/34/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME GQUIC_35_TEST COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/35/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/35/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME GQUIC_37_TEST COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/37/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/37/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME GQUIC_39_TEST COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/39/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/39/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME GQUIC_41_TEST COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/41/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/41/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME GQUIC_43_TEST COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/43/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/43/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME GQUIC_44_TEST COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/44/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/44/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME GQUIC_46_TEST COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/46/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/46/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME GQUIC_50_TEST COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/50/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/50/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME MVFST_01_TEST COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/mvfst/01/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/mvfst/01/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME MVFST_02_TEST COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/mvfst/02/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/mvfst/02/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME TQUIC_TEST COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/tquic/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/tquic/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME IQUIC_PORT_8443_TEST COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/port-8443/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/port-8443/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME QUIC_RFC9000 COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/rfc9000/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/rfc9000/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME QUIC_RFC9000_FRAGMENT COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/rfc9000-fragment/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/rfc9000-fragment/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME QUIC_RFC9000_SPECIAL COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/rfc9000-special/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/rfc9000-special/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME QUIC_AIRPORT COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/airport/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/airport -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
add_test(NAME QUIC_SPECIAL COMMAND proto_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/special/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/special/ -name *.pcap|sort -V" WORKING_DIRECTORY ${PROTO_TEST_RUN_DIR})
set(TEST_RUN_DIR ${CMAKE_INSTALL_PREFIX})
set(PLUGIN_TEST_MAIN ${CMAKE_INSTALL_PREFIX}/plugin_test_main)
message(STATUS "TEST_RUN_DIR='${TEST_RUN_DIR}'")
# build test env
add_test(NAME MKDIR COMMAND sh -c "mkdir -p ${TEST_RUN_DIR}/plug/protocol/${lib_name} && mkdir -p ${TEST_RUN_DIR}/plug/business/${lib_name}_test_plug && mkdir -p ${TEST_RUN_DIR}/conf/${lib_name}")
add_test(NAME COPY_PLUGIN_TEST_MAIN COMMAND sh -c "cp ${TEST_RUN_DIR}/tools/plugin_test_main ${TEST_RUN_DIR}/plugin_test_main")
add_test(NAME COPY_CONFLIST COMMAND sh -c "mkdir -p ${TEST_RUN_DIR}/plug/ && cp ${CMAKE_CURRENT_SOURCE_DIR}/conflist.inf ${TEST_RUN_DIR}/plug/conflist.inf")
add_test(NAME COPY_QUIC_DECODER_CONF COMMAND sh -c "cp ${CMAKE_SOURCE_DIR}/bin/${lib_name}.conf ${TEST_RUN_DIR}/conf/${lib_name}/")
add_test(NAME ADD_QUIC_TO_ENTRY_LIST COMMAND sh -c "echo 'QUIC' >> ${TEST_RUN_DIR}/etc/entrylist.conf")
add_test(NAME COPY_QUIC_INF COMMAND sh -c "cp ${CMAKE_SOURCE_DIR}/bin/${lib_name}.inf ${TEST_RUN_DIR}/plug/protocol/${lib_name}/${lib_name}.inf")
add_test(NAME COPY_QUIC_SO COMMAND sh -c "cp ${CMAKE_BINARY_DIR}/${lib_name}.so ${TEST_RUN_DIR}/plug/protocol/${lib_name}/${lib_name}.so")
add_test(NAME COPY_TEST_INF COMMAND sh -c "cp ${CMAKE_CURRENT_SOURCE_DIR}/${lib_name}_test_plug.inf ${TEST_RUN_DIR}/plug/business/${lib_name}_test_plug/${lib_name}_test_plug.inf")
add_test(NAME COPY_TEST_SO COMMAND sh -c "cp ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_test_plug.so ${TEST_RUN_DIR}/plug/business/${lib_name}_test_plug/${lib_name}_test_plug.so")
# update sapp config files
add_test(NAME UPDATE_SAPP_LOG_LEVEL COMMAND bash -c "sed -i 's/sapp_log.fatal/sapp_log.info/' ${TEST_RUN_DIR}/etc/sapp_log.conf")
add_test(NAME ENABLE_SAPP_MONITOR COMMAND bash -c "sed -i 's/monitor_thread_enabled=0/monitor_thread_enabled=1/' ${TEST_RUN_DIR}/etc/sapp.toml")
add_test(NAME IQUIC_29_TEST COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/iquic/29/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/iquic/29/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME GQUIC_23_TEST COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/23/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/23/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME GQUIC_25_TEST COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/25/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/25/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME GQUIC_33_TEST COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/33/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/33/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME GQUIC_34_TEST COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/34/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/34/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME GQUIC_35_TEST COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/35/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/35/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME GQUIC_37_TEST COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/37/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/37/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME GQUIC_39_TEST COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/39/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/39/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME GQUIC_41_TEST COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/41/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/41/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME GQUIC_43_TEST COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/43/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/43/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME GQUIC_44_TEST COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/44/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/44/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME GQUIC_46_TEST COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/46/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/46/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME GQUIC_50_TEST COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/50/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/gquic/50/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME MVFST_01_TEST COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/mvfst/01/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/mvfst/01/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME MVFST_02_TEST COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/mvfst/02/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/mvfst/02/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME TQUIC_TEST COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/tquic/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/tquic/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME IQUIC_PORT_8443_TEST COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/port-8443/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/port-8443/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME QUIC_RFC9000 COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/rfc9000/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/rfc9000/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME QUIC_RFC9000_FRAGMENT COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/rfc9000-fragment/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/rfc9000-fragment/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME QUIC_RFC9000_SPECIAL COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/rfc9000-special/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/rfc9000-special/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME QUIC_AIRPORT COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/airport/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/airport -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME QUIC_SPECIAL COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/special/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/special/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
add_test(NAME QUIC_CHLO_FRAGMENT COMMAND ./plugin_test_main ${CMAKE_CURRENT_SOURCE_DIR}/pcap/rfc9000-chlo-fragment/${lib_name}_result.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/pcap/rfc9000-chlo-fragment/ -name *.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,32 @@
[
{
"Tuple4": "2607:5d00:2:2::38:2.53977>2404:6800:4005:807::2004.443",
"VERSION": "IETF QUIC RFC9000",
"SNI": "www.google.com",
"name": "QUIC_RESULT_1"
},
{
"Tuple4": "2607:5d00:2:2::38:2.50835>2404:6800:4005:80d::2003.443",
"VERSION": "IETF QUIC RFC9000",
"SNI": "www.google.com.hk",
"name": "QUIC_RESULT_2"
},
{
"Tuple4": "192.168.64.25.61166>157.240.245.35.443",
"VERSION": "IETF QUIC RFC9000",
"SNI": "www.facebook.com",
"name": "QUIC_RESULT_3"
},
{
"Tuple4": "2607:5d00:2:2::38:2.54817>2404:6800:4005:80c::200a.443",
"VERSION": "IETF QUIC RFC9000",
"SNI": "optimizationguide-pa.googleapis.com",
"name": "QUIC_RESULT_4"
},
{
"Tuple4": "192.168.54.157.60388>142.250.71.164.443",
"VERSION": "IETF QUIC RFC9000",
"SNI": "www.google.com",
"name": "QUIC_RESULT_5"
}
]

View File

@@ -19,7 +19,7 @@ extern "C" int commit_test_result_json(cJSON *node, const char *name);
static int g_result_count = 1;
extern "C" unsigned char QUIC_TEST_PLUG_ENTRY(stSessionInfo *session_info, void **pme,
int thread_seq, struct streaminfo *a_tcp, void *a_packet)
int thread_seq, struct streaminfo *a_udp, void *a_packet)
{
assert(NULL != session_info || pme != NULL);
@@ -34,7 +34,7 @@ extern "C" unsigned char QUIC_TEST_PLUG_ENTRY(stSessionInfo *session_info, void
{
ctx = cJSON_CreateObject();
*pme = (void *)ctx;
cJSON_AddStringToObject(ctx, "Tuple4", printaddr(&a_tcp->addr, a_tcp->threadnum));
cJSON_AddStringToObject(ctx, "Tuple4", printaddr(&a_udp->addr, a_udp->threadnum));
}
}

Binary file not shown.