From ce1513bfb9a6bba8642a64c495d0f63437b72c12 Mon Sep 17 00:00:00 2001 From: Shawn Carey Date: Wed, 29 May 2024 10:37:51 -0400 Subject: [PATCH 1/6] add proxy fields to host.vN config types --- includes/ziti/ziti_model.h | 7 +++++++ library/internal_model.c | 2 ++ 2 files changed, 9 insertions(+) diff --git a/includes/ziti/ziti_model.h b/includes/ziti/ziti_model.h index fcf10df4..958d03b2 100644 --- a/includes/ziti/ziti_model.h +++ b/includes/ziti/ziti_model.h @@ -128,6 +128,10 @@ XX(protocol, string, none, protocol, __VA_ARGS__) \ XX(hostname, string, none, hostname, __VA_ARGS__) \ XX(port, int, none, port, __VA_ARGS__) +#define ZITI_PROXY_SERVER_MODEL(XX, ...) \ +XX(address, string, none, address, __VA_ARGS__) \ +XX(type, string, none, type, __VA_ARGS__) + #define ZITI_HOST_CFG_V1_MODEL(XX, ...) \ XX(protocol, string, none, protocol, __VA_ARGS__) \ XX(forward_protocol, bool, none, forwardProtocol, __VA_ARGS__) \ @@ -139,6 +143,7 @@ XX(port, int, none, port, __VA_ARGS__) \ XX(forward_port, bool, none, forwardPort, __VA_ARGS__) \ XX(allowed_port_ranges, ziti_port_range, array, allowedPortRanges, __VA_ARGS__) \ XX(allowed_source_addresses, ziti_address, array, allowedSourceAddresses, __VA_ARGS__) \ +XX(proxy, ziti_proxy_server, none, proxy, __VA_ARGS__) \ XX(listen_options, ziti_listen_options, ptr, listenOptions, __VA_ARGS__) #define ZITI_HOST_CFG_V2_MODEL(XX, ...) \ @@ -243,6 +248,8 @@ DECLARE_MODEL(ziti_listen_options, ZITI_LISTEN_OPTS_MODEL) DECLARE_MODEL(ziti_server_cfg_v1, ZITI_SERVER_CFG_V1_MODEL) +DECLARE_MODEL(ziti_proxy_server, ZITI_PROXY_SERVER_MODEL) + DECLARE_MODEL(ziti_host_cfg_v1, ZITI_HOST_CFG_V1_MODEL) DECLARE_MODEL(ziti_host_cfg_v2, ZITI_HOST_CFG_V2_MODEL) diff --git a/library/internal_model.c b/library/internal_model.c index 1e269c6b..e5b7a429 100644 --- a/library/internal_model.c +++ b/library/internal_model.c @@ -63,6 +63,8 @@ IMPL_MODEL(ziti_listen_options, ZITI_LISTEN_OPTS_MODEL) IMPL_MODEL(ziti_server_cfg_v1, ZITI_SERVER_CFG_V1_MODEL) +IMPL_MODEL(ziti_proxy_server, ZITI_PROXY_SERVER_MODEL) + IMPL_MODEL(ziti_host_cfg_v1, ZITI_HOST_CFG_V1_MODEL) IMPL_MODEL(ziti_host_cfg_v2, ZITI_HOST_CFG_V2_MODEL) From 71717f19538a626c22a897e302a5951f020abbcf Mon Sep 17 00:00:00 2001 From: Shawn Carey Date: Fri, 31 May 2024 15:16:49 -0400 Subject: [PATCH 2/6] declare proxy type enum --- includes/ziti/ziti_model.h | 7 ++++++- library/internal_model.c | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/includes/ziti/ziti_model.h b/includes/ziti/ziti_model.h index 958d03b2..e6e34bf7 100644 --- a/includes/ziti/ziti_model.h +++ b/includes/ziti/ziti_model.h @@ -128,9 +128,12 @@ XX(protocol, string, none, protocol, __VA_ARGS__) \ XX(hostname, string, none, hostname, __VA_ARGS__) \ XX(port, int, none, port, __VA_ARGS__) +#define ZITI_PROXY_SERVER_TYPE_ENUM(XX, ...) \ +XX(http, __VA_ARGS__) + #define ZITI_PROXY_SERVER_MODEL(XX, ...) \ XX(address, string, none, address, __VA_ARGS__) \ -XX(type, string, none, type, __VA_ARGS__) +XX(type, ziti_proxy_server_type, none, type, __VA_ARGS__) #define ZITI_HOST_CFG_V1_MODEL(XX, ...) \ XX(protocol, string, none, protocol, __VA_ARGS__) \ @@ -248,6 +251,8 @@ DECLARE_MODEL(ziti_listen_options, ZITI_LISTEN_OPTS_MODEL) DECLARE_MODEL(ziti_server_cfg_v1, ZITI_SERVER_CFG_V1_MODEL) +DECLARE_ENUM(ziti_proxy_server_type, ZITI_PROXY_SERVER_TYPE_ENUM) + DECLARE_MODEL(ziti_proxy_server, ZITI_PROXY_SERVER_MODEL) DECLARE_MODEL(ziti_host_cfg_v1, ZITI_HOST_CFG_V1_MODEL) diff --git a/library/internal_model.c b/library/internal_model.c index e5b7a429..37b4d4c5 100644 --- a/library/internal_model.c +++ b/library/internal_model.c @@ -63,6 +63,8 @@ IMPL_MODEL(ziti_listen_options, ZITI_LISTEN_OPTS_MODEL) IMPL_MODEL(ziti_server_cfg_v1, ZITI_SERVER_CFG_V1_MODEL) +IMPL_ENUM(ziti_proxy_server_type, ZITI_PROXY_SERVER_TYPE_ENUM) + IMPL_MODEL(ziti_proxy_server, ZITI_PROXY_SERVER_MODEL) IMPL_MODEL(ziti_host_cfg_v1, ZITI_HOST_CFG_V1_MODEL) From 1f74f241fb75dd5bb5dc6f74e52b9414395d16bb Mon Sep 17 00:00:00 2001 From: ekoby <7406535+ekoby@users.noreply.github.com> Date: Wed, 5 Jun 2024 11:15:39 -0400 Subject: [PATCH 3/6] update tlsuv@v0.29.4 --- deps/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 7590d6ad..615dc896 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -8,7 +8,7 @@ else () FetchContent_Declare(tlsuv GIT_REPOSITORY https://github.com/openziti/tlsuv.git - GIT_TAG v0.29.3 + GIT_TAG v0.29.4 ) FetchContent_MakeAvailable(tlsuv) From 0e8f46f5141610c66b714553d56459aec47533c0 Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 6 Jun 2024 14:37:58 -0400 Subject: [PATCH 4/6] do not request services if controller is down --- library/ziti.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/library/ziti.c b/library/ziti.c index 75b8295e..b5364ab7 100644 --- a/library/ziti.c +++ b/library/ziti.c @@ -1254,30 +1254,26 @@ static void set_service_posture_policy_map(ziti_service *service) { static void check_service_update(ziti_service_update *update, const ziti_error *err, void *ctx) { ziti_context ztx = ctx; - bool need_update = true; - if (err) { // API not supported - do refresh + if (err) { ZTX_LOG(WARN, "failed to poll service updates: code[%d] err[%d/%s]", err->http_code, err->err, err->message); - if (err->err == ZITI_DISABLED) { - need_update = false; + // if controller is unavailable just reschedule for later time + if (err->err != ZITI_DISABLED) { + ziti_services_refresh(ztx, false); } } else if (ztx->last_update == NULL || strcmp(ztx->last_update, update->last_change) != 0) { ZTX_LOG(VERBOSE, "ztx last_update = %s", update->last_change); FREE(ztx->last_update); ztx->last_update = update->last_change; + ziti_ctrl_get_services(ztx_get_controller(ztx), update_services, ztx); + } else { ZTX_LOG(VERBOSE, "not updating: last_update is same previous (%s == %s)", update->last_change, ztx->last_update); free_ziti_service_update(update); - need_update = false; - ziti_services_refresh(ztx, false); } - - if (need_update) { - ziti_ctrl_get_services(ztx_get_controller(ztx), update_services, ztx); - } FREE(update); } @@ -1368,9 +1364,9 @@ static void edge_routers_cb(ziti_edge_router_array ers, const ziti_error *err, v it = model_map_it_remove(it); ers_changed = true; } - - // if the list of ERs changed, we want to opportunistically - // refresh sessions to clear out references to old ERs, + + // if the list of ERs changed, we want to opportunistically + // refresh sessions to clear out references to old ERs, // and pull new ERs (which could be better for dialing) // we don't want to evict/refresh session right away From 20dac07685d3fc8d5220d484d8d6aa35bee67aba Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 6 Jun 2024 14:50:19 -0400 Subject: [PATCH 5/6] run CI build on release-* PRs --- .github/workflows/cmake.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2ef0dfd2..7dc7e874 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -3,7 +3,9 @@ name: C/C++ CI on: workflow_dispatch: pull_request: - branches: [ main ] + branches: + - main + - release-* jobs: build: From 1ef8211d5949a0cbf69f46beb943a3c06cb7e42d Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 6 Jun 2024 14:53:05 -0400 Subject: [PATCH 6/6] update tlsuv@v0.29.5 --- deps/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 615dc896..269fd836 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -8,7 +8,7 @@ else () FetchContent_Declare(tlsuv GIT_REPOSITORY https://github.com/openziti/tlsuv.git - GIT_TAG v0.29.4 + GIT_TAG v0.29.5 ) FetchContent_MakeAvailable(tlsuv)