Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[!] fix http3 deadloop and segmentation fault, fix stream compose error #338

Merged
merged 4 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
SSL_LIB_PATH_STR="${PWD}/third_party/boringssl/build/ssl/libssl.a;${PWD}/third_party/boringssl/build/crypto/libcrypto.a"
mkdir -p build
cd build
cmake -DGCOV=on -DCMAKE_BUILD_TYPE=Debug -DXQC_ENABLE_TESTING=1 -DXQC_SUPPORT_SENDMMSG_BUILD=1 -DXQC_ENABLE_EVENT_LOG=1 -DXQC_ENABLE_BBR2=1 -DXQC_DISABLE_RENO=0 -DSSL_TYPE=${SSL_TYPE_STR} -DSSL_PATH=${SSL_PATH_STR} -DSSL_INC_PATH=${SSL_INC_PATH_STR} -DSSL_LIB_PATH=${SSL_LIB_PATH_STR} ..
cmake -DGCOV=on -DCMAKE_BUILD_TYPE=Debug -DXQC_ENABLE_TESTING=1 -DXQC_SUPPORT_SENDMMSG_BUILD=1 -DXQC_ENABLE_EVENT_LOG=1 -DXQC_ENABLE_BBR2=1 -DXQC_ENABLE_RENO=1 -DSSL_TYPE=${SSL_TYPE_STR} -DSSL_PATH=${SSL_PATH_STR} -DSSL_INC_PATH=${SSL_INC_PATH_STR} -DSSL_LIB_PATH=${SSL_LIB_PATH_STR} ..
make -j

- name: Test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
SSL_LIB_PATH_STR="${PWD}/third_party/boringssl/build/ssl/libssl.a;${PWD}/third_party/boringssl/build/crypto/libcrypto.a"
mkdir -p build
cd build
cmake -DGCOV=on -DCMAKE_BUILD_TYPE=Debug -DXQC_ENABLE_TESTING=1 -DXQC_SUPPORT_SENDMMSG_BUILD=1 -DXQC_ENABLE_EVENT_LOG=1 -DXQC_ENABLE_BBR2=1 -DXQC_DISABLE_RENO=0 -DSSL_TYPE=${SSL_TYPE_STR} -DSSL_PATH=${SSL_PATH_STR} -DSSL_INC_PATH=${SSL_INC_PATH_STR} -DSSL_LIB_PATH=${SSL_LIB_PATH_STR} ..
cmake -DGCOV=on -DCMAKE_BUILD_TYPE=Debug -DXQC_ENABLE_TESTING=1 -DXQC_SUPPORT_SENDMMSG_BUILD=1 -DXQC_ENABLE_EVENT_LOG=1 -DXQC_ENABLE_BBR2=1 -DXQC_ENABLE_RENO=1 -DSSL_TYPE=${SSL_TYPE_STR} -DSSL_PATH=${SSL_PATH_STR} -DSSL_INC_PATH=${SSL_INC_PATH_STR} -DSSL_LIB_PATH=${SSL_LIB_PATH_STR} ..
make -j

- name: Perform CodeQL Analysis
Expand Down
62 changes: 43 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ set (xquic_VERSION_MAJOR 0)
set (xquic_VERSION_MINOR 1)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

# build type
option (XQC_ENABLE_BBR2 "enable bbr2" ON)
option (XQC_ENABLE_COPA "enable copa" ON)
option (XQC_ENABLE_RENO "enable reno" ON)
option (XQC_ENABLE_UNLIMITED "enable unlimited cc" ON)
option (XQC_ENABLE_MP_INTEROP "enable MPQUIC interop" ON)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
Expand Down Expand Up @@ -74,6 +79,9 @@ if(XQC_COMPAT_DUPLICATE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXQC_COMPAT_DUPLICATE")
endif()

if(XQC_COMPAT_GENERATE_SR_PKT)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXQC_COMPAT_GENERATE_SR_PKT")
endif()

# print only error log
if(XQC_ONLY_ERROR_LOG)
Expand Down Expand Up @@ -116,8 +124,8 @@ endif()

# configure file
configure_file (
xqc_configure.h.in
xqc_configure.h
"${CMAKE_CURRENT_SOURCE_DIR}/xqc_configure.h.in"
"${CMAKE_CURRENT_SOURCE_DIR}/include/xquic/xqc_configure.h"
)

include_directories(
Expand All @@ -127,8 +135,6 @@ include_directories(
"${CMAKE_CURRENT_BINARY_DIR}/include"
)



# http3/qpack source
set(
HTTP3_SOURCES
Expand Down Expand Up @@ -185,9 +191,16 @@ set(
"src/transport/scheduler/xqc_scheduler_common.c"
"src/transport/scheduler/xqc_scheduler_backup.c"
"src/transport/scheduler/xqc_scheduler_rap.c"
"src/transport/scheduler/xqc_scheduler_interop.c"
)

if(XQC_ENABLE_MP_INTEROP)
set(
TRANSPORT_SOURCES
${TRANSPORT_SOURCES}
"src/transport/scheduler/xqc_scheduler_interop.c"
)
endif()

# TLS source
set (
TLS_SOURCE
Expand Down Expand Up @@ -240,15 +253,11 @@ set(
CONGESTION_CONTROL_SOURCES
"src/congestion_control/xqc_cubic.c"
"src/congestion_control/xqc_bbr.c"
"src/congestion_control/xqc_unlimited_cc.c"
"src/congestion_control/xqc_copa.c"
"src/congestion_control/xqc_window_filter.c"
"src/congestion_control/xqc_sample.c"
)

if(XQC_DISABLE_RENO)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXQC_DISABLE_RENO ")
else()
if(XQC_ENABLE_RENO)
set(
CONGESTION_CONTROL_SOURCES
${CONGESTION_CONTROL_SOURCES}
Expand All @@ -257,15 +266,30 @@ else()
endif()

if(XQC_ENABLE_BBR2)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXQC_ENABLE_BBR2 ")
set(
CONGESTION_CONTROL_SOURCES

${CONGESTION_CONTROL_SOURCES}
"src/congestion_control/xqc_bbr2.c"
)
endif()

if(XQC_ENABLE_COPA)
set(
CONGESTION_CONTROL_SOURCES
${CONGESTION_CONTROL_SOURCES}
"src/congestion_control/xqc_copa.c"
)
endif()

if(XQC_ENABLE_UNLIMITED)
set(
CONGESTION_CONTROL_SOURCES
${CONGESTION_CONTROL_SOURCES}
"src/congestion_control/xqc_unlimited_cc.c"
)
endif()


# xquic source
set (
XQC_SOURCE
Expand Down Expand Up @@ -392,13 +416,13 @@ if (XQC_ENABLE_TESTING)
endif()

if(PLATFORM STREQUAL "mac32")
target_link_libraries(test_server xquic -lm ${CMAKE_CURRENT_SOURCE_DIR}/../libevent32/lib/libevent.dylib)
target_link_libraries(test_client xquic -lm ${CMAKE_CURRENT_SOURCE_DIR}/../libevent32/lib/libevent.dylib)
target_link_libraries(test_server xquic-static ${SSL_LIB_PATH} -ldl -lpthread -lm ${CMAKE_CURRENT_SOURCE_DIR}/../libevent32/lib/libevent.dylib)
target_link_libraries(test_client xquic-static ${SSL_LIB_PATH} -ldl -lpthread -lm ${CMAKE_CURRENT_SOURCE_DIR}/../libevent32/lib/libevent.dylib)
target_link_libraries(demo_server xquic -lm ${CMAKE_CURRENT_SOURCE_DIR}/../libevent32/lib/libevent.dylib)
target_link_libraries(demo_client xquic -lm ${CMAKE_CURRENT_SOURCE_DIR}/../libevent32/lib/libevent.dylib)
elseif(PLATFORM STREQUAL "mac")
target_link_libraries(test_server xquic -lm -L/usr/local/lib -levent)
target_link_libraries(test_client xquic -lm -L/usr/local/lib -levent)
target_link_libraries(test_server xquic-static ${SSL_LIB_PATH} -ldl -lpthread -lm -L/usr/local/lib -levent)
target_link_libraries(test_client xquic-static ${SSL_LIB_PATH} -ldl -lpthread -lm -L/usr/local/lib -levent)
target_link_libraries(demo_server xquic -lm -L/usr/local/lib -levent)
target_link_libraries(demo_client xquic -lm -L/usr/local/lib -levent)
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
Expand All @@ -407,8 +431,8 @@ if (XQC_ENABLE_TESTING)
target_link_libraries(demo_server xquic ${EVENT_LIB_PATH} -lm)
target_link_libraries(demo_client xquic ${EVENT_LIB_PATH} -lm)
else()
target_link_libraries(test_server xquic -levent -lm)
target_link_libraries(test_client xquic -levent -lm)
target_link_libraries(test_server xquic-static ${SSL_LIB_PATH} -ldl -lpthread -levent -lm)
target_link_libraries(test_client xquic-static ${SSL_LIB_PATH} -ldl -lpthread -levent -lm)
target_link_libraries(demo_server xquic -levent -lm)
target_link_libraries(demo_client xquic -levent -lm)
endif()
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,7 @@ In no particular order, thanks to these excellent individuals who contributed co
* @yunwei37
* @keengo99
* @ruanshanshan
* @alagoutte
* @MPK1

This list will be continuously updated. Contributions are welcome!
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ cd ../..
# build XQUIC with BoringSSL
git submodule update --init --recursive
mkdir -p build; cd build
cmake -DGCOV=on -DCMAKE_BUILD_TYPE=Debug -DXQC_ENABLE_TESTING=1 -DXQC_SUPPORT_SENDMMSG_BUILD=1 -DXQC_ENABLE_EVENT_LOG=1 -DXQC_ENABLE_BBR2=1 -DXQC_DISABLE_RENO=0 -DSSL_TYPE=${SSL_TYPE_STR} -DSSL_PATH=${SSL_PATH_STR} -DSSL_INC_PATH=${SSL_INC_PATH_STR} -DSSL_LIB_PATH=${SSL_LIB_PATH_STR} ..
cmake -DGCOV=on -DCMAKE_BUILD_TYPE=Debug -DXQC_ENABLE_TESTING=1 -DXQC_SUPPORT_SENDMMSG_BUILD=1 -DXQC_ENABLE_EVENT_LOG=1 -DXQC_ENABLE_BBR2=1 -DXQC_ENABLE_RENO=1 -DSSL_TYPE=${SSL_TYPE_STR} -DSSL_PATH=${SSL_PATH_STR} -DSSL_INC_PATH=${SSL_INC_PATH_STR} -DSSL_LIB_PATH=${SSL_LIB_PATH_STR} ..
make -j
```

Expand All @@ -114,7 +114,7 @@ cd -
# build XQUIC with BabaSSL
git submodule update --init --recursive
mkdir -p build; cd build
cmake -DGCOV=on -DCMAKE_BUILD_TYPE=Debug -DXQC_ENABLE_TESTING=1 -DXQC_SUPPORT_SENDMMSG_BUILD=1 -DXQC_ENABLE_EVENT_LOG=1 -DXQC_ENABLE_BBR2=1 -DXQC_DISABLE_RENO=0 -DSSL_TYPE=${SSL_TYPE_STR} -DSSL_PATH=${SSL_PATH_STR} -DSSL_INC_PATH=${SSL_INC_PATH_STR} -DSSL_LIB_PATH=${SSL_LIB_PATH_STR} ..
cmake -DGCOV=on -DCMAKE_BUILD_TYPE=Debug -DXQC_ENABLE_TESTING=1 -DXQC_SUPPORT_SENDMMSG_BUILD=1 -DXQC_ENABLE_EVENT_LOG=1 -DXQC_ENABLE_BBR2=1 -DXQC_ENABLE_RENO=1 -DSSL_TYPE=${SSL_TYPE_STR} -DSSL_PATH=${SSL_PATH_STR} -DSSL_INC_PATH=${SSL_INC_PATH_STR} -DSSL_LIB_PATH=${SSL_LIB_PATH_STR} ..
make -j
```

Expand Down
63 changes: 49 additions & 14 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ if (XQC_DISABLE_LOG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXQC_DISABLE_LOG")
endif()

if(XQC_COMPAT_GENERATE_SR_PKT)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXQC_COMPAT_GENERATE_SR_PKT")
endif()

if (XQC_ONLY_ERROR_LOG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXQC_ONLY_ERROR_LOG")
endif()
Expand All @@ -71,11 +75,6 @@ if (XQC_ENABLE_EVENT_LOG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXQC_ENABLE_EVENT_LOG ")
endif()

if(XQC_COMPAT_GENERATE_SR_PKT)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXQC_COMPAT_GENERATE_SR_PKT")
endif()


if(ANDROID)
set(DYMAMIC_LINK_OPTION
${DYMAMIC_LINK_OPTION}
Expand Down Expand Up @@ -126,7 +125,11 @@ else()
endif()


configure_file (xqc_configure.h.in include/xquic/xqc_configure.h @ONLY)
configure_file (
"${CMAKE_CURRENT_SOURCE_DIR}/xqc_configure.h.in"
"${CMAKE_CURRENT_SOURCE_DIR}/include/xquic/xqc_configure.h"
@ONLY
)

include_directories(
include/
Expand Down Expand Up @@ -191,9 +194,16 @@ set(
"src/transport/scheduler/xqc_scheduler_common.c"
"src/transport/scheduler/xqc_scheduler_backup.c"
"src/transport/scheduler/xqc_scheduler_rap.c"
"src/transport/scheduler/xqc_scheduler_interop.c"
)

if(XQC_ENABLE_MP_INTEROP)
set(
TRANSPORT_SOURCES
${TRANSPORT_SOURCES}
"src/transport/scheduler/xqc_scheduler_interop.c"
)
endif()

# TLS source
set (
TLS_SOURCE
Expand Down Expand Up @@ -246,31 +256,55 @@ set(
CONGESTION_CONTROL_SOURCES
"src/congestion_control/xqc_cubic.c"
"src/congestion_control/xqc_bbr.c"
"src/congestion_control/xqc_unlimited_cc.c"
"src/congestion_control/xqc_copa.c"
"src/congestion_control/xqc_window_filter.c"
"src/congestion_control/xqc_sample.c"
)

if (XQC_DISABLE_RENO)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXQC_DISABLE_RENO")
else()
if(XQC_ENABLE_RENO)
set(
CONGESTION_CONTROL_SOURCES
${CONGESTION_CONTROL_SOURCES}
"src/congestion_control/xqc_new_reno.c"
)
endif()

if (XQC_ENABLE_BBR2)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXQC_ENABLE_BBR2")
if(XQC_ENABLE_BBR2)
set(
CONGESTION_CONTROL_SOURCES
${CONGESTION_CONTROL_SOURCES}
"src/congestion_control/xqc_bbr2.c"
)
endif()

if(XQC_ENABLE_COPA)
set(
CONGESTION_CONTROL_SOURCES
${CONGESTION_CONTROL_SOURCES}
"src/congestion_control/xqc_copa.c"
)
endif()

if(XQC_ENABLE_UNLIMITED)
set(
CONGESTION_CONTROL_SOURCES
${CONGESTION_CONTROL_SOURCES}
"src/congestion_control/xqc_unlimited_cc.c"
)
endif()


if(XQC_ENABLE_TH3)
set(XQC_ENABLE_TUNNEL 1)
set(
TH3_SOURCES
"tunnel/tunnel_h3/th3_ctx.c"
"tunnel/tunnel_h3/th3_vconn.c"
)
endif()

)
endif()

if (XQC_NO_SHARED)
set(XQC_BINARY_TYPE STATIC)
endif()
Expand Down Expand Up @@ -312,3 +346,4 @@ if (XQC_BUILD_SAMPLE)
target_link_libraries(test_client xquic event)
target_link_libraries(test_server xquic event)
endif()

6 changes: 3 additions & 3 deletions demo/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
#define CIPHER_SUIT_LEN 256
#define TLS_GROUPS_LEN 64

#define PATH_LEN 512
#define RESOURCE_LEN 256
#define PATH_LEN 1024
#define RESOURCE_LEN 1024
#define AUTHORITY_LEN 128
#define URL_LEN 512
#define URL_LEN 1024

/* the congestion control types */
typedef enum cc_type_s {
Expand Down
Loading