Skip to content
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 includes/ziti/ziti.h
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ extern int ziti_conn_bridge_idle_timeout(ziti_connection conn, unsigned long mil
* @return
*/
ZITI_FUNC
extern int ziti_conn_bridge_fds(ziti_connection conn, uv_os_fd_t input, uv_os_fd_t output, void (*close_cb)(void *ctx), void *ctx);
extern int ziti_conn_bridge_fds(ziti_connection conn, uv_os_sock_t input, uv_os_sock_t output, void (*close_cb)(void *ctx), void *ctx);

/**
* @brief Callback called after ziti_mfa_enroll()
Expand Down
12 changes: 6 additions & 6 deletions library/conn_bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
br ? br->conn->ziti_ctx->id : -1, br ? br->conn->conn_id : -1, ##__VA_ARGS__)

struct fd_bridge_s {
uv_os_fd_t in;
uv_os_fd_t out;
uv_os_sock_t in;
uv_os_sock_t out;

void (*close_cb)(void *ctx);

Expand Down Expand Up @@ -132,7 +132,7 @@ static void on_pipes_close(uv_handle_t *h) {
}
}

extern int ziti_conn_bridge_fds(ziti_connection conn, uv_os_fd_t input, uv_os_fd_t output, void (*close_cb)(void *ctx), void *ctx) {
extern int ziti_conn_bridge_fds(ziti_connection conn, uv_os_sock_t input, uv_os_sock_t output, void (*close_cb)(void *ctx), void *ctx) {
if (conn == NULL) return UV_EINVAL;

uv_loop_t *l = ziti_conn_context(conn)->loop;
Expand All @@ -144,7 +144,7 @@ extern int ziti_conn_bridge_fds(ziti_connection conn, uv_os_fd_t input, uv_os_fd
fdbr->ctx = ctx;

if (input == output) {
uv_os_sock_t input_sock = (uv_os_sock_t) input;
uv_os_sock_t input_sock = input;
uv_handle_t *sock = NULL;
int type;
socklen_t len = sizeof(type);
Expand Down Expand Up @@ -177,8 +177,8 @@ extern int ziti_conn_bridge_fds(ziti_connection conn, uv_os_fd_t input, uv_os_fd

uv_pipe_init(l, (uv_pipe_t *) br->input, 0);
uv_pipe_init(l, (uv_pipe_t *) br->output, 0);
uv_file input_file = uv_open_osfhandle(input);
uv_file output_file = uv_open_osfhandle(output);
uv_file input_file = uv_open_osfhandle((uv_os_fd_t)input);
uv_file output_file = uv_open_osfhandle((uv_os_fd_t)output);
uv_pipe_open((uv_pipe_t *) br->input, input_file);
uv_pipe_open((uv_pipe_t *) br->output, output_file);
br->input->data = br;
Expand Down
6 changes: 3 additions & 3 deletions library/zitilib/zitilib.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@

ziti_socket_t fd, ziti_fd;
fd = socket(AF_INET, SOCK_STREAM, 0);
int rc = connect_socket(fd, &ziti_fd);
int rc = connect_socket(AF_INET, fd, &ziti_fd);
if (rc != 0) {
ZITI_LOG(WARN, "failed to connect client socket[%d]: %d", fd, rc);
fail_future(pending->accept_f, rc);
Expand All @@ -510,12 +510,12 @@
zs->ziti_fd = ziti_fd;
ziti_conn_set_data(client, zs);
model_map_set_key(&ziti_sockets, &zs->fd, sizeof(zs->fd), zs);
ziti_conn_bridge_fds(client, (uv_os_fd_t) zs->ziti_fd, (uv_os_fd_t) zs->ziti_fd, on_bridge_close, zs);
ziti_conn_bridge_fds(client, zs->ziti_fd, zs->ziti_fd, on_bridge_close, zs);
NEWP(si, struct sock_info_s);
si->fd = zs->fd;
si->peer = pending->caller_id;

ZITI_LOG(DEBUG, "completing accept future[%p] with fd[%d]", pending->accept_f, fd);

Check warning on line 518 in library/zitilib/zitilib.c

View workflow job for this annotation

GitHub Actions / Linux ARM

format '%p' expects argument of type 'void *', but argument 7 has type 'future_t *' ***aka 'struct future_s *'*** [-Wformat=]

Check warning on line 518 in library/zitilib/zitilib.c

View workflow job for this annotation

GitHub Actions / Linux x86_64

format '%p' expects argument of type 'void *', but argument 7 has type 'future_t *' ***aka 'struct future_s *'*** [-Wformat=]

Check warning on line 518 in library/zitilib/zitilib.c

View workflow job for this annotation

GitHub Actions / Linux ARM64

format '%p' expects argument of type 'void *', but argument 7 has type 'future_t *' ***aka 'struct future_s *'*** [-Wformat=]
complete_future(pending->accept_f, si, 0);
free(pending);
}
Expand Down Expand Up @@ -577,7 +577,7 @@
cstr_drop(&zs->service);
free(zs);
} else {
connect_socket(zs->fd, &zs->ziti_fd);
connect_socket(AF_INET, zs->fd, &zs->ziti_fd);
model_map_set_key(&ziti_sockets, &zs->fd, sizeof(zs->fd), zs);

ZITI_LOG(DEBUG, "successfully bound fd[%d] to service[%s]", zs->fd, cstr_str(&zs->service));
Expand Down Expand Up @@ -718,7 +718,7 @@

ziti_socket_t Ziti_accept(ziti_socket_t server, char *caller, int caller_len) {
future_t *f = schedule_on_loop(do_ziti_accept, (void *) (uintptr_t) server, true);
ZITI_LOG(DEBUG, "fd[%d] waiting for future[%p]", server, f);

Check warning on line 721 in library/zitilib/zitilib.c

View workflow job for this annotation

GitHub Actions / Linux ARM

format '%p' expects argument of type 'void *', but argument 8 has type 'future_t *' ***aka 'struct future_s *'*** [-Wformat=]

Check warning on line 721 in library/zitilib/zitilib.c

View workflow job for this annotation

GitHub Actions / Linux x86_64

format '%p' expects argument of type 'void *', but argument 8 has type 'future_t *' ***aka 'struct future_s *'*** [-Wformat=]

Check warning on line 721 in library/zitilib/zitilib.c

View workflow job for this annotation

GitHub Actions / Linux ARM64

format '%p' expects argument of type 'void *', but argument 8 has type 'future_t *' ***aka 'struct future_s *'*** [-Wformat=]
ziti_socket_t clt = -1;
struct sock_info_s *si;
int err = await_future(f, (void **) &si);
Expand Down
4 changes: 3 additions & 1 deletion library/zitilib/zl.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,14 @@ ztx_wrap_t *zl_find_wrap(ziti_handle_t handle);

/**
* create bridge socket and connect client socket to it
* @param af address family
* @param clt_sock client socket
* @param ziti_sock[out] bridge socket
* @return
*/
int connect_socket(ziti_socket_t clt_sock, ziti_socket_t *ziti_sock);
int connect_socket(int af, ziti_socket_t clt_sock, ziti_socket_t *ziti_sock);
bool zl_is_blocking(ziti_socket_t s);
int zl_socket_af(ziti_socket_t s);
void zl_set_error(int err);

ZITI_FUNC
Expand Down
Loading
Loading