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

Main merge 1.0.4 #666

Merged
merged 9 commits into from
Jun 7, 2024
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 deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.5
)
FetchContent_MakeAvailable(tlsuv)

Expand Down
12 changes: 12 additions & 0 deletions includes/ziti/ziti_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ 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, ziti_proxy_server_type, 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__) \
Expand All @@ -140,6 +147,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, ...) \
Expand Down Expand Up @@ -244,6 +252,10 @@ 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)

DECLARE_MODEL(ziti_host_cfg_v2, ZITI_HOST_CFG_V2_MODEL)
Expand Down
4 changes: 4 additions & 0 deletions library/internal_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ 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)

IMPL_MODEL(ziti_host_cfg_v2, ZITI_HOST_CFG_V2_MODEL)
Expand Down
16 changes: 6 additions & 10 deletions library/ziti.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,14 @@
ziti_context ctx = NULL;
PREPF(ziti, ziti_errorstr);

if (options->config == NULL) {

Check warning on line 215 in library/ziti.c

View workflow job for this annotation

GitHub Actions / Linux x86_64

'config' is deprecated: ignored, will be removed [-Wdeprecated-declarations]

Check warning on line 215 in library/ziti.c

View workflow job for this annotation

GitHub Actions / Linux ARM64

'config' is deprecated: ignored, will be removed [-Wdeprecated-declarations]
ZITI_LOG(ERROR, "config or controller/tls has to be set");
return ZITI_INVALID_CONFIG;
}
ctx = calloc(1, sizeof(*ctx));

if (options->config != NULL) {

Check warning on line 221 in library/ziti.c

View workflow job for this annotation

GitHub Actions / Linux x86_64

'config' is deprecated: ignored, will be removed [-Wdeprecated-declarations]

Check warning on line 221 in library/ziti.c

View workflow job for this annotation

GitHub Actions / Linux ARM64

'config' is deprecated: ignored, will be removed [-Wdeprecated-declarations]
TRY(ziti, ziti_load_config(&ctx->config, options->config));

Check warning on line 222 in library/ziti.c

View workflow job for this annotation

GitHub Actions / Linux x86_64

'config' is deprecated: ignored, will be removed [-Wdeprecated-declarations]

Check warning on line 222 in library/ziti.c

View workflow job for this annotation

GitHub Actions / Linux ARM64

'config' is deprecated: ignored, will be removed [-Wdeprecated-declarations]
}

if (ctx->config.id.ca && strncmp(ctx->config.id.ca, "file://", strlen("file://")) == 0) {
Expand Down Expand Up @@ -1222,30 +1222,26 @@

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);
}

Expand Down Expand Up @@ -1647,7 +1643,7 @@
}
const char *url;
if (model_list_size(&config->controllers) > 0) {
MODEL_LIST_FOREACH(url, (config->controllers)) {

Check warning on line 1646 in library/ziti.c

View workflow job for this annotation

GitHub Actions / MacOS arm64

passing 'const model_list *' (aka 'const struct model_list_s *') to parameter of type 'model_list *' (aka 'struct model_list_s *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]

Check warning on line 1646 in library/ziti.c

View workflow job for this annotation

GitHub Actions / MacOS x86_64

passing 'const model_list *' (aka 'const struct model_list_s *') to parameter of type 'model_list *' (aka 'struct model_list_s *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
model_list_append(&ctx->config.controllers, strdup(url));
}
} else {
Expand Down
Loading