From b040563874190eda2bac198df673ba9edd16dcef Mon Sep 17 00:00:00 2001 From: Max Lv Date: Wed, 14 Oct 2026 21:18:48 +0800 Subject: [PATCH] Add the two casts ss-redir needs as C++ ss-redir only builds on Linux, so the macOS conversion checks never compiled it: getsockname() wants a struct sockaddr *, and memcpy's void * result needs a cast. --- src/redir.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/redir.cpp b/src/redir.cpp index 60892412..d6920cac 100644 --- a/src/redir.cpp +++ b/src/redir.cpp @@ -118,7 +118,7 @@ getdestaddr(int fd, struct sockaddr_storage *destaddr) int error = 0; if (tcp_tproxy) { - error = getsockname(fd, (void *)destaddr, &socklen); + error = getsockname(fd, (struct sockaddr *)destaddr, &socklen); } else { error = getsockopt(fd, SOL_IPV6, IP6T_SO_ORIGINAL_DST, destaddr, &socklen); if (error) { // Didn't find a proper way to detect IP version. @@ -1576,7 +1576,7 @@ Same behavior as `-T`; see that option for details. Short alias: `-T`. // Handle additionals TOS/DSCP listening ports if (dscp_num > 0) { listen_ctx_current = (listen_ctx_t *)ss_malloc(sizeof(listen_ctx_t)); - listen_ctx_current = memcpy(listen_ctx_current, &listen_ctx, sizeof(listen_ctx_t)); + listen_ctx_current = (listen_ctx_t *)memcpy(listen_ctx_current, &listen_ctx, sizeof(listen_ctx_t)); local_port = dscp[dscp_num - 1].port; listen_ctx_current->tos = dscp[dscp_num - 1].dscp << 2; }