You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by cm...@apache.org on 2025/03/14 15:55:52 UTC
(trafficserver) branch 10.1.x updated (0fc7e37d5a -> 42f2920bce)
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a change to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
from 0fc7e37d5a [cachekey] Cleanup debug log (#12084)
new 54f97f7319 Fix a few places where inet_ntop could fail (#12095)
new 42f2920bce Move defaulting install prefix before layout setup (#12085)
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
CMakeLists.txt | 16 ++++++++--------
plugins/experimental/wasm/ats_context.cc | 6 +++---
plugins/lua/ts_lua_client_request.cc | 12 ++++++------
plugins/lua/ts_lua_http.cc | 8 ++++----
plugins/lua/ts_lua_server_request.cc | 21 +++++++++++----------
5 files changed, 32 insertions(+), 31 deletions(-)
(trafficserver) 01/02: Fix a few places where inet_ntop could fail (#12095)
Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 54f97f7319dde4221079312ed58d330ee4ac5c9f
Author: Chris McFarlen <ch...@mcfarlen.us>
AuthorDate: Tue Mar 11 09:24:13 2025 -0500
Fix a few places where inet_ntop could fail (#12095)
Co-authored-by: Chris McFarlen <cm...@apple.com>
(cherry picked from commit 597cbb80882292fbefda24e7c14a278da6935c0f)
---
plugins/experimental/wasm/ats_context.cc | 6 +++---
plugins/lua/ts_lua_client_request.cc | 12 ++++++------
plugins/lua/ts_lua_http.cc | 8 ++++----
plugins/lua/ts_lua_server_request.cc | 21 +++++++++++----------
4 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/plugins/experimental/wasm/ats_context.cc b/plugins/experimental/wasm/ats_context.cc
index cb78b147c2..8e8bd2d7d7 100644
--- a/plugins/experimental/wasm/ats_context.cc
+++ b/plugins/experimental/wasm/ats_context.cc
@@ -116,13 +116,13 @@ static void
print_address(struct sockaddr const *ip, std::string *result)
{
if (ip != nullptr) {
- char cip[128];
- int64_t port = 0;
+ char cip[128] = "";
+ int64_t port = 0;
if (ip->sa_family == AF_INET) {
const auto *s_sockaddr_in = reinterpret_cast<const struct sockaddr_in *>(ip);
inet_ntop(AF_INET, &s_sockaddr_in->sin_addr, cip, sizeof(cip));
port = s_sockaddr_in->sin_port;
- } else {
+ } else if (ip->sa_family == AF_INET6) {
const auto *s_sockaddr_in6 = reinterpret_cast<const struct sockaddr_in6 *>(ip);
inet_ntop(AF_INET6, &s_sockaddr_in6->sin6_addr, cip, sizeof(cip));
port = s_sockaddr_in6->sin6_port;
diff --git a/plugins/lua/ts_lua_client_request.cc b/plugins/lua/ts_lua_client_request.cc
index 804a8c8e67..ac2671cf10 100644
--- a/plugins/lua/ts_lua_client_request.cc
+++ b/plugins/lua/ts_lua_client_request.cc
@@ -762,7 +762,7 @@ static int
ts_lua_client_request_client_addr_get_ip(lua_State *L)
{
struct sockaddr const *client_ip;
- char cip[128];
+ char cip[128] = "";
ts_lua_http_ctx *http_ctx;
GET_HTTP_CONTEXT(http_ctx, L);
@@ -775,7 +775,7 @@ ts_lua_client_request_client_addr_get_ip(lua_State *L)
} else {
if (client_ip->sa_family == AF_INET) {
inet_ntop(AF_INET, (const void *)&((struct sockaddr_in *)client_ip)->sin_addr, cip, sizeof(cip));
- } else {
+ } else if (client_ip->sa_family == AF_INET6) {
inet_ntop(AF_INET6, (const void *)&((struct sockaddr_in6 *)client_ip)->sin6_addr, cip, sizeof(cip));
}
@@ -844,9 +844,9 @@ ts_lua_client_request_client_addr_get_addr(lua_State *L)
{
struct sockaddr const *client_ip;
ts_lua_http_ctx *http_ctx;
- int port;
- int family;
- char cip[128];
+ int port = 0;
+ int family = AF_UNSPEC;
+ char cip[128] = "";
GET_HTTP_CONTEXT(http_ctx, L);
@@ -862,7 +862,7 @@ ts_lua_client_request_client_addr_get_addr(lua_State *L)
port = ntohs(((struct sockaddr_in *)client_ip)->sin_port);
inet_ntop(AF_INET, (const void *)&((struct sockaddr_in *)client_ip)->sin_addr, cip, sizeof(cip));
family = AF_INET;
- } else {
+ } else if (client_ip->sa_family == AF_INET6) {
port = ntohs(((struct sockaddr_in6 *)client_ip)->sin6_port);
inet_ntop(AF_INET6, (const void *)&((struct sockaddr_in6 *)client_ip)->sin6_addr, cip, sizeof(cip));
family = AF_INET6;
diff --git a/plugins/lua/ts_lua_http.cc b/plugins/lua/ts_lua_http.cc
index 92423198e9..4326224f78 100644
--- a/plugins/lua/ts_lua_http.cc
+++ b/plugins/lua/ts_lua_http.cc
@@ -1061,9 +1061,9 @@ ts_lua_http_get_ssn_remote_addr(lua_State *L)
{
struct sockaddr const *client_ip;
ts_lua_http_ctx *http_ctx;
- int port;
- int family;
- char cip[128];
+ int port = 0;
+ int family = AF_UNSPEC;
+ char cip[128] = "";
GET_HTTP_CONTEXT(http_ctx, L);
@@ -1081,7 +1081,7 @@ ts_lua_http_get_ssn_remote_addr(lua_State *L)
port = ntohs(((struct sockaddr_in *)client_ip)->sin_port);
inet_ntop(AF_INET, (const void *)&((struct sockaddr_in *)client_ip)->sin_addr, cip, sizeof(cip));
family = AF_INET;
- } else {
+ } else if (client_ip->sa_family == AF_INET6) {
port = ntohs(((struct sockaddr_in6 *)client_ip)->sin6_port);
inet_ntop(AF_INET6, (const void *)&((struct sockaddr_in6 *)client_ip)->sin6_addr, cip, sizeof(cip));
family = AF_INET6;
diff --git a/plugins/lua/ts_lua_server_request.cc b/plugins/lua/ts_lua_server_request.cc
index f787487ad4..26c2897436 100644
--- a/plugins/lua/ts_lua_server_request.cc
+++ b/plugins/lua/ts_lua_server_request.cc
@@ -18,6 +18,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <sys/socket.h>
#include "ts_lua_util.h"
#define TS_LUA_CHECK_SERVER_REQUEST_HDR(http_ctx) \
@@ -750,7 +751,7 @@ static int
ts_lua_server_request_server_addr_get_ip(lua_State *L)
{
struct sockaddr const *server_ip;
- char sip[128];
+ char sip[128] = "";
ts_lua_http_ctx *http_ctx;
GET_HTTP_CONTEXT(http_ctx, L);
@@ -763,7 +764,7 @@ ts_lua_server_request_server_addr_get_ip(lua_State *L)
} else {
if (server_ip->sa_family == AF_INET) {
inet_ntop(AF_INET, (const void *)&((struct sockaddr_in *)server_ip)->sin_addr, sip, sizeof(sip));
- } else {
+ } else if (server_ip->sa_family == AF_INET6) {
inet_ntop(AF_INET6, (const void *)&((struct sockaddr_in6 *)server_ip)->sin6_addr, sip, sizeof(sip));
}
@@ -832,9 +833,9 @@ ts_lua_server_request_server_addr_get_addr(lua_State *L)
{
struct sockaddr const *server_ip;
ts_lua_http_ctx *http_ctx;
- int port;
- int family;
- char sip[128];
+ int port = 0;
+ int family = AF_UNSPEC;
+ char sip[128] = "";
GET_HTTP_CONTEXT(http_ctx, L);
@@ -850,7 +851,7 @@ ts_lua_server_request_server_addr_get_addr(lua_State *L)
port = ntohs(((struct sockaddr_in *)server_ip)->sin_port);
inet_ntop(AF_INET, (const void *)&((struct sockaddr_in *)server_ip)->sin_addr, sip, sizeof(sip));
family = AF_INET;
- } else {
+ } else if (server_ip->sa_family == AF_INET6) {
port = ntohs(((struct sockaddr_in6 *)server_ip)->sin6_port);
inet_ntop(AF_INET6, (const void *)&((struct sockaddr_in6 *)server_ip)->sin6_addr, sip, sizeof(sip));
family = AF_INET6;
@@ -869,9 +870,9 @@ ts_lua_server_request_server_addr_get_nexthop_addr(lua_State *L)
{
struct sockaddr const *server_ip;
ts_lua_http_ctx *http_ctx;
- int port;
- int family;
- char sip[128];
+ int port = 0;
+ int family = AF_UNSPEC;
+ char sip[128] = "";
GET_HTTP_CONTEXT(http_ctx, L);
@@ -887,7 +888,7 @@ ts_lua_server_request_server_addr_get_nexthop_addr(lua_State *L)
port = ntohs(((struct sockaddr_in *)server_ip)->sin_port);
inet_ntop(AF_INET, (const void *)&((struct sockaddr_in *)server_ip)->sin_addr, sip, sizeof(sip));
family = AF_INET;
- } else {
+ } else if (server_ip->sa_family == AF_INET6) {
port = ntohs(((struct sockaddr_in6 *)server_ip)->sin6_port);
inet_ntop(AF_INET6, (const void *)&((struct sockaddr_in6 *)server_ip)->sin6_addr, sip, sizeof(sip));
family = AF_INET6;
(trafficserver) 02/02: Move defaulting install prefix before layout setup (#12085)
Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 42f2920bce6df86e0e21a8de85e33a1795e9eff5
Author: Chris McFarlen <ch...@mcfarlen.us>
AuthorDate: Tue Mar 11 11:51:42 2025 -0500
Move defaulting install prefix before layout setup (#12085)
Co-authored-by: Chris McFarlen <cm...@apple.com>
(cherry picked from commit 9a1ef119f3b7a017583c9aa5d088b2437101b92a)
---
CMakeLists.txt | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e691ab2c94..6b8d3856f0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -45,6 +45,14 @@ set(CMAKE_CXX_EXTENSIONS OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE -DATS_BUILD)
+# Setup default install directory
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ set(CMAKE_INSTALL_PREFIX
+ /usr/local/trafficserver
+ CACHE PATH "Default install path" FORCE
+ )
+endif()
+
include(layout)
include(ClangTidy)
@@ -161,14 +169,6 @@ else()
endif()
set(TS_PKGSYSUSER ${WITH_USER})
-# Setup default install directory
-if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
- set(CMAKE_INSTALL_PREFIX
- /usr/local/trafficserver
- CACHE PATH "Default install path" FORCE
- )
-endif()
-
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
set(DEFAULT_POSIX_CAP ON)
endif()