This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new bf7c217925 background_fetch: add Unix domain support. (#12504)
bf7c217925 is described below
commit bf7c2179253105ce9943a0bb31b87a47478d52b4
Author: vuori <[email protected]>
AuthorDate: Wed Sep 17 16:38:11 2025 +0300
background_fetch: add Unix domain support. (#12504)
* background_fetch: add Unix domain socket support.
AF_UNIX client socket sockaddr structure is now handled correctly.
Additionally a missing return in the error branch was added.
* cache_fill: add Unix domain socket support.
Ported fixes from background_fetch plugin.
---
plugins/background_fetch/background_fetch.cc | 4 ++++
plugins/experimental/cache_fill/background_fetch.cc | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/plugins/background_fetch/background_fetch.cc
b/plugins/background_fetch/background_fetch.cc
index 38c10b6775..aef4acb565 100644
--- a/plugins/background_fetch/background_fetch.cc
+++ b/plugins/background_fetch/background_fetch.cc
@@ -31,6 +31,7 @@
#include <cinttypes>
#include <string_view>
#include <array>
+#include <sys/un.h>
#include "ts/ts.h"
#include "ts/remap.h"
@@ -238,8 +239,11 @@ BgFetchData::initialize(TSMBuffer request, TSMLoc req_hdr,
TSHttpTxn txnp)
memcpy(&client_ip, ip, sizeof(sockaddr_in));
} else if (ip->sa_family == AF_INET6) {
memcpy(&client_ip, ip, sizeof(sockaddr_in6));
+ } else if (ip->sa_family == AF_UNIX) {
+ memcpy(&client_ip, ip, sizeof(sockaddr_un));
} else {
TSError("[%s] Unknown address family %d", PLUGIN_NAME, ip->sa_family);
+ return false;
}
} else {
TSError("[%s] Failed to get client host info", PLUGIN_NAME);
diff --git a/plugins/experimental/cache_fill/background_fetch.cc
b/plugins/experimental/cache_fill/background_fetch.cc
index 621d9844d1..2cced083d5 100644
--- a/plugins/experimental/cache_fill/background_fetch.cc
+++ b/plugins/experimental/cache_fill/background_fetch.cc
@@ -34,6 +34,7 @@
#include <array>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <sys/un.h>
#include "ts/ts.h"
#include "ts/remap.h"
@@ -157,8 +158,11 @@ BgFetchData::initialize(TSMBuffer request, TSMLoc req_hdr,
TSHttpTxn txnp)
memcpy(&client_ip, ip, sizeof(sockaddr_in));
} else if (ip->sa_family == AF_INET6) {
memcpy(&client_ip, ip, sizeof(sockaddr_in6));
+ } else if (ip->sa_family == AF_UNIX) {
+ memcpy(&client_ip, ip, sizeof(sockaddr_un));
} else {
TSError("[%s] Unknown address family %d", PLUGIN_NAME, ip->sa_family);
+ return false;
}
} else {
TSError("[%s] Failed to get client host info", PLUGIN_NAME);