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 ec4a5d3b0d Cleanup mgmt (#10021)
ec4a5d3b0d is described below
commit ec4a5d3b0dff444c3f64f6a4599566a59ff23e5c
Author: Chris McFarlen <[email protected]>
AuthorDate: Fri Jul 14 20:31:50 2023 -0500
Cleanup mgmt (#10021)
* cleanup mgmt sub directory
* remove mgmt includes from cmake
---
CMakeLists.txt | 1 -
configure.ac | 1 -
{mgmt => include/tscore}/MgmtDefs.h | 18 +-
iocore/aio/Makefile.am | 2 -
iocore/cache/CMakeLists.txt | 2 -
iocore/cache/Makefile.am | 4 -
iocore/dns/CMakeLists.txt | 4 +-
iocore/dns/Makefile.am | 2 -
iocore/eventsystem/CMakeLists.txt | 2 +-
iocore/eventsystem/Makefile.am | 2 -
iocore/hostdb/CMakeLists.txt | 2 -
iocore/hostdb/HostDB.cc | 2 +-
iocore/hostdb/Makefile.am | 4 -
iocore/net/CMakeLists.txt | 4 +-
iocore/net/Makefile.am | 6 -
iocore/net/quic/Makefile.am | 2 -
iocore/utils/CMakeLists.txt | 2 -
mgmt/Makefile.am | 3 +-
mgmt/config/Makefile.am | 2 -
mgmt/rpc/CMakeLists.txt | 2 +-
mgmt/rpc/Makefile.am | 7 -
mgmt/rpc/server/IPCSocketServer.cc | 58 ++++-
mgmt/utils/CMakeLists.txt | 42 ----
mgmt/utils/ExpandingArray.cc | 79 -------
mgmt/utils/ExpandingArray.h | 62 ------
mgmt/utils/Makefile.am | 69 ------
mgmt/utils/MgmtSocket.cc | 367 --------------------------------
mgmt/utils/MgmtSocket.h | 100 ---------
mgmt/utils/MgmtUtils.cc | 351 ------------------------------
mgmt/utils/MgmtUtils.h | 56 -----
mgmt/utils/unit_tests/unit_test_main.cc | 25 ---
proxy/CMakeLists.txt | 2 -
proxy/Makefile.am | 2 -
proxy/http/CMakeLists.txt | 2 -
proxy/http/HttpConnectionCount.h | 2 +-
proxy/http/HttpTransact.h | 2 +-
proxy/http/Makefile.am | 2 -
proxy/http/remap/CMakeLists.txt | 2 -
proxy/http/remap/Makefile.am | 2 -
proxy/http/unit_tests/CMakeLists.txt | 1 -
proxy/http2/CMakeLists.txt | 4 +-
proxy/http2/Makefile.am | 2 -
proxy/http3/CMakeLists.txt | 2 +-
proxy/http3/Makefile.am | 2 -
proxy/logging/CMakeLists.txt | 4 +-
proxy/logging/Log.cc | 2 +-
proxy/logging/LogStandalone.cc | 3 -
proxy/logging/Makefile.am | 2 -
proxy/shared/CMakeLists.txt | 2 -
proxy/shared/Makefile.am | 2 -
src/records/CMakeLists.txt | 9 +-
src/tests/CMakeLists.txt | 4 -
src/traffic_crashlog/CMakeLists.txt | 2 +-
src/traffic_crashlog/Makefile.inc | 1 -
src/traffic_ctl/CMakeLists.txt | 1 -
src/traffic_layout/CMakeLists.txt | 2 +-
src/traffic_layout/Makefile.inc | 1 -
src/traffic_logcat/Makefile.inc | 4 +-
src/traffic_logstats/Makefile.inc | 6 +-
src/traffic_quic/Makefile.inc | 2 -
src/traffic_server/CMakeLists.txt | 4 +-
src/traffic_server/Makefile.inc | 2 -
src/traffic_server/traffic_server.cc | 5 +-
63 files changed, 82 insertions(+), 1286 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 120d6d2b00..53c025e9c2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -358,7 +358,6 @@ add_subdirectory(src/tscore)
add_subdirectory(src/records)
add_subdirectory(iocore)
add_subdirectory(proxy)
-add_subdirectory(mgmt/utils)
add_subdirectory(mgmt/config)
add_subdirectory(mgmt/rpc)
add_subdirectory(src/traffic_crashlog)
diff --git a/configure.ac b/configure.ac
index 14a497451c..3dc8c3d18d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2382,7 +2382,6 @@ AC_CONFIG_FILES([
lib/swoc/Makefile
lib/yamlcpp/Makefile
mgmt/Makefile
- mgmt/utils/Makefile
mgmt/rpc/Makefile
mgmt/config/Makefile
plugins/Makefile
diff --git a/mgmt/MgmtDefs.h b/include/tscore/MgmtDefs.h
similarity index 91%
rename from mgmt/MgmtDefs.h
rename to include/tscore/MgmtDefs.h
index de3489fa28..18b2b6b318 100644
--- a/mgmt/MgmtDefs.h
+++ b/include/tscore/MgmtDefs.h
@@ -26,23 +26,13 @@
/*
* Type definitions.
*/
-#include <functional>
#include <string_view>
#include "tscore/ink_defs.h"
-#include "swoc/MemSpan.h"
-#include "tscpp/util/TextView.h"
-
-using MgmtIntCounter = int64_t;
-using MgmtInt = int64_t;
-using MgmtByte = int8_t;
-using MgmtFloat = float;
-using MgmtString = char *;
-
-/// Management callback signature.
-/// The memory span is the message payload for the callback.
-/// This can be a lambda, which should be used if additional context
information is needed.
-using MgmtCallback = std::function<void(swoc::MemSpan<void>)>;
+
+using MgmtInt = int64_t;
+using MgmtByte = int8_t;
+using MgmtFloat = float;
//-------------------------------------------------------------------------
// API conversion functions.
diff --git a/iocore/aio/Makefile.am b/iocore/aio/Makefile.am
index 0c237a2b58..ae5da0cce6 100644
--- a/iocore/aio/Makefile.am
+++ b/iocore/aio/Makefile.am
@@ -49,8 +49,6 @@ test_AIO_CPPFLAGS = \
-I$(abs_top_srcdir)/proxy/hdrs \
-I$(abs_top_srcdir)/proxy/http \
-I$(abs_top_srcdir)/proxy/logging \
- -I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
@SWOC_INCLUDES@ @OPENSSL_INCLUDES@
test_AIO_LDADD = \
diff --git a/iocore/cache/CMakeLists.txt b/iocore/cache/CMakeLists.txt
index 20e907834e..fd47f624aa 100644
--- a/iocore/cache/CMakeLists.txt
+++ b/iocore/cache/CMakeLists.txt
@@ -50,7 +50,5 @@ target_include_directories(inkcache PRIVATE
${CMAKE_SOURCE_DIR}/proxy/http
${CMAKE_SOURCE_DIR}/proxy/http/remap
${CMAKE_SOURCE_DIR}/proxy/hdrs
- ${CMAKE_SOURCE_DIR}/mgmt
- ${CMAKE_SOURCE_DIR}/mgmt/utils
${CMAKE_SOURCE_DIR}/lib
)
diff --git a/iocore/cache/Makefile.am b/iocore/cache/Makefile.am
index ada3be6d52..07b6082d35 100644
--- a/iocore/cache/Makefile.am
+++ b/iocore/cache/Makefile.am
@@ -25,8 +25,6 @@ AM_CPPFLAGS += \
-I$(abs_top_srcdir)/proxy/http \
-I$(abs_top_srcdir)/proxy/shared \
-I$(abs_top_srcdir)/proxy/http/remap \
- -I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
@SWOC_INCLUDES@
$(TS_INCLUDES)
@@ -80,8 +78,6 @@ test_CPPFLAGS = \
-I$(abs_top_srcdir)/proxy/http/remap \
-I$(abs_top_srcdir)/proxy/hdrs \
-I$(abs_top_srcdir)/proxy/shared \
- -I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
-I$(abs_top_srcdir)/lib/catch2 \
@SWOC_INCLUDES@ \
$(TS_INCLUDES) \
diff --git a/iocore/dns/CMakeLists.txt b/iocore/dns/CMakeLists.txt
index beae3f1fba..44e3b6ec7a 100644
--- a/iocore/dns/CMakeLists.txt
+++ b/iocore/dns/CMakeLists.txt
@@ -33,6 +33,4 @@ target_include_directories(inkdns PRIVATE
${CMAKE_SOURCE_DIR}/proxy
${CMAKE_SOURCE_DIR}/proxy/http
${CMAKE_SOURCE_DIR}/proxy/hdrs
- ${CMAKE_SOURCE_DIR}/mgmt
- ${CMAKE_SOURCE_DIR}/mgmt/utils
-)
\ No newline at end of file
+)
diff --git a/iocore/dns/Makefile.am b/iocore/dns/Makefile.am
index 7df675225c..33ae418014 100644
--- a/iocore/dns/Makefile.am
+++ b/iocore/dns/Makefile.am
@@ -23,8 +23,6 @@ AM_CPPFLAGS += \
-I$(abs_top_srcdir)/proxy \
-I$(abs_top_srcdir)/proxy/http \
-I$(abs_top_srcdir)/proxy/hdrs \
- -I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
@SWOC_INCLUDES@ \
$(TS_INCLUDES)
diff --git a/iocore/eventsystem/CMakeLists.txt
b/iocore/eventsystem/CMakeLists.txt
index 7100794c32..b8341cbb48 100644
--- a/iocore/eventsystem/CMakeLists.txt
+++ b/iocore/eventsystem/CMakeLists.txt
@@ -41,7 +41,7 @@ target_include_directories(inkevent PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}")
target_link_libraries(inkevent
PUBLIC
- ts::records_p
+ ts::records
ts::tscore
PRIVATE
libswoc
diff --git a/iocore/eventsystem/Makefile.am b/iocore/eventsystem/Makefile.am
index 927473d606..8d1757307c 100644
--- a/iocore/eventsystem/Makefile.am
+++ b/iocore/eventsystem/Makefile.am
@@ -90,8 +90,6 @@ test_CPP_FLAGS = \
-I$(abs_top_srcdir)/proxy/hdrs \
-I$(abs_top_srcdir)/proxy/http \
-I$(abs_top_srcdir)/proxy/logging \
- -I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
-I$(abs_top_srcdir)/lib/catch2 \
@OPENSSL_INCLUDES@ @SWOC_INCLUDES@
diff --git a/iocore/hostdb/CMakeLists.txt b/iocore/hostdb/CMakeLists.txt
index 5158ca62ff..42378d68bd 100644
--- a/iocore/hostdb/CMakeLists.txt
+++ b/iocore/hostdb/CMakeLists.txt
@@ -34,6 +34,4 @@ target_include_directories(inkhostdb PRIVATE
${CMAKE_SOURCE_DIR}/proxy
${CMAKE_SOURCE_DIR}/proxy/http
${CMAKE_SOURCE_DIR}/proxy/hdrs
- ${CMAKE_SOURCE_DIR}/mgmt
- ${CMAKE_SOURCE_DIR}/mgmt/utils
)
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index e510c65562..4457c5f990 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -29,7 +29,7 @@
#include "Show.h"
#include "tscore/ink_apidefs.h"
#include "tscore/bwf_std_format.h"
-#include "MgmtDefs.h" // MgmtInt, MgmtFloat, etc
+#include "tscore/MgmtDefs.h" // MgmtInt, MgmtFloat, etc
#include "HostFile.h"
#include <utility>
diff --git a/iocore/hostdb/Makefile.am b/iocore/hostdb/Makefile.am
index 66f22ed740..284eff8475 100644
--- a/iocore/hostdb/Makefile.am
+++ b/iocore/hostdb/Makefile.am
@@ -23,8 +23,6 @@ AM_CPPFLAGS += \
-I$(abs_top_srcdir)/proxy \
-I$(abs_top_srcdir)/proxy/hdrs \
-I$(abs_top_srcdir)/proxy/http \
- -I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
@SWOC_INCLUDES@ \
$(TS_INCLUDES)
@@ -67,8 +65,6 @@ test_CPP_FLAGS = \
-I$(abs_top_srcdir)/proxy/hdrs \
-I$(abs_top_srcdir)/proxy/http \
-I$(abs_top_srcdir)/proxy/logging \
- -I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
@OPENSSL_INCLUDES@
test_LD_ADD = \
diff --git a/iocore/net/CMakeLists.txt b/iocore/net/CMakeLists.txt
index 663e47dbfe..a3fbb97168 100644
--- a/iocore/net/CMakeLists.txt
+++ b/iocore/net/CMakeLists.txt
@@ -97,7 +97,7 @@ if(BUILD_REGRESSION_TESTING)
target_sources(inknet PRIVATE NetVCTest.cc)
endif()
-target_link_libraries(inknet PUBLIC inkevent records_p)
+target_link_libraries(inknet PUBLIC inkevent records)
target_compile_options(inknet PUBLIC -Wno-deprecated-declarations)
target_include_directories(inknet PUBLIC
${CMAKE_SOURCE_DIR}/iocore/eventsystem
@@ -112,8 +112,6 @@ target_include_directories(inknet PUBLIC
${CMAKE_SOURCE_DIR}/proxy/shared
${CMAKE_SOURCE_DIR}/proxy/http
${CMAKE_SOURCE_DIR}/proxy/http/remap
- ${CMAKE_SOURCE_DIR}/mgmt
- ${CMAKE_SOURCE_DIR}/mgmt/utils
${CMAKE_SOURCE_DIR}/src/traffic_server
${OPENSSL_INCLUDE_DIRS}
${YAML_INCLUDE_DIRS}
diff --git a/iocore/net/Makefile.am b/iocore/net/Makefile.am
index 397f110452..cb2206e571 100644
--- a/iocore/net/Makefile.am
+++ b/iocore/net/Makefile.am
@@ -27,8 +27,6 @@ AM_CPPFLAGS += \
-I$(abs_top_srcdir)/proxy \
-I$(abs_top_srcdir)/proxy/hdrs \
-I$(abs_top_srcdir)/proxy/shared \
- -I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
-I$(abs_top_srcdir)/proxy/http \
-I$(abs_top_srcdir)/proxy/http/remap \
-I$(abs_top_srcdir)/src/traffic_server \
@@ -66,8 +64,6 @@ test_UDPNet_CPPFLAGS = \
-I$(abs_top_srcdir)/proxy \
-I$(abs_top_srcdir)/proxy/hdrs \
-I$(abs_top_srcdir)/proxy/http \
- -I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
@OPENSSL_INCLUDES@ \
@SWOC_INCLUDES@
@@ -109,8 +105,6 @@ test_libinknet_CPPFLAGS = \
-I$(abs_top_srcdir)/proxy \
-I$(abs_top_srcdir)/proxy/hdrs \
-I$(abs_top_srcdir)/proxy/http \
- -I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
-DLIBINKNET_UNIT_TEST_DIR="$(abs_top_srcdir)/iocore/net/unit_tests" \
@OPENSSL_INCLUDES@
diff --git a/iocore/net/quic/Makefile.am b/iocore/net/quic/Makefile.am
index c16d92d6a8..a6e965aef2 100644
--- a/iocore/net/quic/Makefile.am
+++ b/iocore/net/quic/Makefile.am
@@ -27,8 +27,6 @@ AM_CPPFLAGS += \
-I$(abs_top_srcdir)/proxy/logging \
-I$(abs_top_srcdir)/proxy/http \
-I$(abs_top_srcdir)/proxy/http3 \
- -I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
$(TS_INCLUDES) @SWOC_INCLUDES@ \
@OPENSSL_INCLUDES@ @YAMLCPP_INCLUDES@
diff --git a/iocore/utils/CMakeLists.txt b/iocore/utils/CMakeLists.txt
index 14c2bfe27f..87840d4ed9 100644
--- a/iocore/utils/CMakeLists.txt
+++ b/iocore/utils/CMakeLists.txt
@@ -30,6 +30,4 @@ target_include_directories(inkutils PRIVATE
${CMAKE_SOURCE_DIR}/proxy
${CMAKE_SOURCE_DIR}/proxy/http
${CMAKE_SOURCE_DIR}/proxy/hdrs
- ${CMAKE_SOURCE_DIR}/mgmt
- ${CMAKE_SOURCE_DIR}/mgmt/utils
)
diff --git a/mgmt/Makefile.am b/mgmt/Makefile.am
index cf331565da..0d0eab92f2 100644
--- a/mgmt/Makefile.am
+++ b/mgmt/Makefile.am
@@ -17,13 +17,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-SUBDIRS = utils config rpc
+SUBDIRS = config rpc
AM_CPPFLAGS += \
$(iocore_include_dirs) \
-I$(abs_top_srcdir)/include \
-I$(abs_top_srcdir)/lib \
- -I$(abs_top_srcdir)/mgmt/utils \
-I$(abs_top_srcdir)/proxy \
-I$(abs_top_srcdir)/proxy/http \
-I$(abs_top_srcdir)/proxy/hdrs \
diff --git a/mgmt/config/Makefile.am b/mgmt/config/Makefile.am
index 982ccb2334..758408dcb2 100644
--- a/mgmt/config/Makefile.am
+++ b/mgmt/config/Makefile.am
@@ -26,7 +26,6 @@ AM_CPPFLAGS += \
-I$(abs_top_srcdir)/lib/ \
-I$(abs_top_srcdir)/mgmt/rpc \
-I$(abs_top_srcdir)/mgmt/ \
- -I$(abs_top_srcdir)/mgmt/utils \
-I$(abs_top_srcdir)/proxy/ \
-I$(abs_top_srcdir)/proxy/http \
-I$(abs_top_srcdir)/proxy/hdrs \
@@ -59,4 +58,3 @@ include $(top_srcdir)/mk/tidy.mk
clang-tidy-local: $(DIST_SOURCES)
$(CXX_Clang_Tidy)
-
diff --git a/mgmt/rpc/CMakeLists.txt b/mgmt/rpc/CMakeLists.txt
index 1e162a3087..9e9aee25de 100644
--- a/mgmt/rpc/CMakeLists.txt
+++ b/mgmt/rpc/CMakeLists.txt
@@ -46,4 +46,4 @@ add_library(rpcpublichandlers STATIC
handlers/storage/Storage.cc
handlers/server/Server.cc
handlers/plugins/Plugins.cc
-)
\ No newline at end of file
+)
diff --git a/mgmt/rpc/Makefile.am b/mgmt/rpc/Makefile.am
index a2572e4550..cd96470db6 100644
--- a/mgmt/rpc/Makefile.am
+++ b/mgmt/rpc/Makefile.am
@@ -33,9 +33,6 @@ check_PROGRAMS = test_jsonrpc test_jsonrpcserver
TESTS = $(check_PROGRAMS)
-# TODO: handlers - mgmt/utils needed as ProcessManager.h is included in many
pleaces, we should be able to remove it once
-# we move away from TM
-
###########################################################################################
# Protocol library only, no transport.
@@ -70,7 +67,6 @@ test_jsonrpc_LDADD = \
$(top_builddir)/iocore/eventsystem/libinkevent.a \
$(top_builddir)/src/records/librecords_p.a \
$(top_builddir)/src/tscore/libtscore.la \
- $(top_builddir)/mgmt/utils/libutils_p.la \
@YAMLCPP_LIBS@ @HWLOC_LIBS@
@@ -112,7 +108,6 @@ test_jsonrpcserver_LDADD = \
$(top_builddir)/src/records/librecords_p.a \
$(top_builddir)/src/tscpp/util/libtscpputil.la \
$(top_builddir)/src/tscore/libtscore.la \
- $(top_builddir)/mgmt/utils/libutils_p.la \
@YAMLCPP_LIBS@ @HWLOC_LIBS@ @SWOC_LIBS@ @YAMLCPP_LIBS@
@@ -121,7 +116,6 @@ test_jsonrpcserver_LDADD = \
AM_CPPFLAGS += \
-I$(abs_top_srcdir)/mgmt/ \
- -I$(abs_top_srcdir)/mgmt/utils \
-I$(abs_top_srcdir)/proxy/http \
-I$(abs_top_srcdir)/proxy/hdrs \
-I$(abs_top_srcdir)/proxy/
@@ -179,4 +173,3 @@ include $(top_srcdir)/mk/tidy.mk
clang-tidy-local: $(DIST_SOURCES)
$(CXX_Clang_Tidy)
-
diff --git a/mgmt/rpc/server/IPCSocketServer.cc
b/mgmt/rpc/server/IPCSocketServer.cc
index 36ef75b5ea..e4cd540d25 100644
--- a/mgmt/rpc/server/IPCSocketServer.cc
+++ b/mgmt/rpc/server/IPCSocketServer.cc
@@ -38,7 +38,6 @@
#include "tscore/bwf_std_format.h"
#include "records/I_RecProcess.h"
#include "tscore/ink_sock.h"
-#include "utils/MgmtSocket.h"
#include <ts/ts.h>
@@ -71,6 +70,57 @@ poll_on_socket(Func &&check_poll_return,
std::chrono::milliseconds timeout, int
}
return true;
}
+
+static bool
+has_peereid()
+{
+#if HAVE_GETPEEREID
+ return true;
+#elif HAVE_GETPEERUCRED
+ return true;
+#elif TS_HAS_SO_PEERCRED
+ return true;
+#else
+ return false;
+#endif
+}
+
+static int
+get_peereid(int fd, uid_t *euid, gid_t *egid)
+{
+ *euid = -1;
+ *egid = -1;
+
+#if HAVE_GETPEEREID
+ return getpeereid(fd, euid, egid);
+#elif HAVE_GETPEERUCRED
+ ucred_t *ucred;
+
+ if (getpeerucred(fd, &ucred) == -1) {
+ return -1;
+ }
+
+ *euid = ucred_geteuid(ucred);
+ *egid = ucred_getegid(ucred);
+ ucred_free(ucred);
+ return 0;
+#elif TS_HAS_SO_PEERCRED
+ struct ucred cred;
+ socklen_t credsz = sizeof(cred);
+ if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cred, &credsz) == -1) {
+ return -1;
+ }
+
+ *euid = cred.uid;
+ *egid = cred.gid;
+ return 0;
+#else
+ (void)fd;
+ errno = ENOTSUP;
+ return -1;
+#endif
+}
+
} // namespace
namespace rpc::comm
@@ -270,7 +320,7 @@ IPCSocketServer::bind(std::error_code &ec)
// support. Otherwise, default to making it restricted.
bool restricted{true};
if (!_conf.restrictedAccessApi) {
- restricted = !mgmt_has_peereid();
+ restricted = !has_peereid();
}
mode_t mode = restricted ? 00700 : 00777;
@@ -400,10 +450,10 @@ IPCSocketServer::late_check_peer_credentials(int peedFd,
TSRPCHandlerOptions con
{
ts::LocalBufferWriter<256> w;
// For privileged calls, ensure we have caller credentials and that the
caller is privileged.
- if (mgmt_has_peereid() && options.auth.restricted) {
+ if (has_peereid() && options.auth.restricted) {
uid_t euid = -1;
gid_t egid = -1;
- if (mgmt_get_peereid(peedFd, &euid, &egid) == -1) {
+ if (get_peereid(peedFd, &euid, &egid) == -1) {
errata.push(1,
static_cast<int>(UnauthorizedErrorCode::PEER_CREDENTIALS_ERROR),
w.print("Error getting peer credentials: {}\0",
ts::bwf::Errno{}).data());
} else if (euid != 0 && euid != geteuid()) {
diff --git a/mgmt/utils/CMakeLists.txt b/mgmt/utils/CMakeLists.txt
deleted file mode 100644
index 122c202535..0000000000
--- a/mgmt/utils/CMakeLists.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-#######################
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
contributor license
-# agreements. See the NOTICE file distributed with this work for additional
information regarding
-# copyright ownership. The ASF licenses this file to you under the Apache
License, Version 2.0
-# (the "License"); you may not use this file except in compliance with the
License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
distributed under the License
-# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express
-# or implied. See the License for the specific language governing permissions
and limitations under
-# the License.
-#
-#######################
-
-
-add_library(utils_lm STATIC
- MgmtSocket.cc
- MgmtUtils.cc
- ExpandingArray.cc
-)
-add_library(utils_p STATIC
- MgmtSocket.cc
- MgmtUtils.cc
-)
-include_directories(
- ${IOCORE_INCLUDE_DIRS}
- ${PROXY_INCLUDE_DIRS}
- ${YAML_INCLUDE_DIR}
- ${CMAKE_SOURCE_DIR}/mgmt
- ${CMAKE_SOURCE_DIR}/proxy
- ${CMAKE_SOURCE_DIR}/proxy/http
- ${CMAKE_SOURCE_DIR}/proxy/http2
- ${CMAKE_SOURCE_DIR}/proxy/http3
- ${CMAKE_SOURCE_DIR}/proxy/logging
- ${CMAKE_SOURCE_DIR}/proxy/http/remap
- ${CMAKE_SOURCE_DIR}/proxy/hdrs
- ${CMAKE_CURRENT_SOURCE_DIR}
-)
-
diff --git a/mgmt/utils/ExpandingArray.cc b/mgmt/utils/ExpandingArray.cc
deleted file mode 100644
index 3f4a7f5bad..0000000000
--- a/mgmt/utils/ExpandingArray.cc
+++ /dev/null
@@ -1,79 +0,0 @@
-/** @file
-
- A brief file description
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-#include "tscore/ink_platform.h"
-#include "tscore/ink_memory.h"
-#include "ExpandingArray.h"
-
-ExpandingArray::ExpandingArray(int initialSize, bool freeContents)
-{
- if (initialSize < EA_MIN_SIZE) {
- initialSize = EA_MIN_SIZE;
- }
-
- internalArray = static_cast<void **>(ats_malloc(initialSize * sizeof(void
*)));
-
- freeContentsOnDestruct = freeContents;
- internalArraySize = initialSize;
- numValidValues = 0;
-}
-
-ExpandingArray::~ExpandingArray()
-{
- if (freeContentsOnDestruct == true) {
- for (int i = 0; i < numValidValues; i++) {
- ats_free(internalArray[i]);
- }
- }
- ats_free(internalArray);
-}
-
-void *
-ExpandingArray::operator[](int index)
-{
- if (index < numValidValues) {
- return internalArray[index];
- } else {
- return nullptr;
- }
-}
-
-int
-ExpandingArray::addEntry(void *entry)
-{
- if (numValidValues == internalArraySize) {
- // Time to increase the size of the array
- internalArray = static_cast<void **>(ats_realloc(internalArray, 2 *
sizeof(void *) * internalArraySize));
- internalArraySize *= 2;
- }
-
- internalArray[numValidValues] = entry;
-
- return numValidValues++;
-}
-
-void
-ExpandingArray::sortWithFunction(int(sortFunc)(const void *, const void *))
-{
- qsort(internalArray, numValidValues, sizeof(void *), sortFunc);
-}
diff --git a/mgmt/utils/ExpandingArray.h b/mgmt/utils/ExpandingArray.h
deleted file mode 100644
index 36c726802f..0000000000
--- a/mgmt/utils/ExpandingArray.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/** @file
-
- A brief file description
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-#pragma once
-
-/****************************************************************************
- *
- * ExpandingArray.h - interface for a simple expanding array class
- *
- * Thread-Safe: no
- *
- *
- ****************************************************************************/
-
-#define EA_MIN_SIZE 4
-
-class ExpandingArray
-{
-public:
- ExpandingArray(int initialSize, bool freeContents);
- ~ExpandingArray();
- void *operator[](int index);
- int addEntry(void *entry);
- void sortWithFunction(int(sortFunc)(const void *, const void *));
- int
- getNumEntries()
- {
- return numValidValues;
- };
- // INTERNAL DataStructure access, use with care
- void **
- getArray()
- {
- return internalArray;
- };
-
-private:
- int internalArraySize;
- void **internalArray;
- int numValidValues;
- bool freeContentsOnDestruct;
-};
diff --git a/mgmt/utils/Makefile.am b/mgmt/utils/Makefile.am
deleted file mode 100644
index 5f5d504af6..0000000000
--- a/mgmt/utils/Makefile.am
+++ /dev/null
@@ -1,69 +0,0 @@
-#
-# Makefile.am for the Enterprise Management module.
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-AM_CPPFLAGS += \
- -I$(abs_top_srcdir)/iocore/utils \
- -I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/proxy \
- -I$(abs_top_srcdir)/include \
- -I$(abs_top_srcdir)/lib \
- @SWOC_INCLUDES@ \
- $(TS_INCLUDES) \
- @OPENSSL_INCLUDES@
-
-# header files used by other libraries
-EXTRA_DIST = MgmtSocket.h
-
-noinst_LTLIBRARIES = libutils_lm.la libutils_p.la
-check_PROGRAMS = test_mgmt_utils
-
-TESTS = $(check_PROGRAMS)
-
-libutils_COMMON = \
- MgmtSocket.cc \
- MgmtSocket.h \
- MgmtUtils.cc \
- MgmtUtils.h
-
-libutils_lm_la_SOURCES = \
- $(libutils_COMMON) \
- ExpandingArray.cc \
- ExpandingArray.h
-
-libutils_p_la_SOURCES = \
- $(libutils_COMMON)
-
-test_mgmt_utils_CPPFLAGS = $(AM_CPPFLAGS) -I$(abs_top_srcdir)/lib/catch2
-
-test_mgmt_utils_LDFLAGS = \
- @AM_LDFLAGS@ \
- @SWOC_LDFLAGS@ @OPENSSL_LDFLAGS@
-
-test_mgmt_utils_SOURCES = \
- unit_tests/unit_test_main.cc
-
-test_mgmt_utils_LDADD = \
- libutils_p.la \
- $(top_builddir)/src/tscore/libtscore.la \
- @SWOC_LIBS@
-
-include $(top_srcdir)/mk/tidy.mk
-
-clang-tidy-local: $(DIST_SOURCES)
- $(CXX_Clang_Tidy)
diff --git a/mgmt/utils/MgmtSocket.cc b/mgmt/utils/MgmtSocket.cc
deleted file mode 100644
index 385a2e1870..0000000000
--- a/mgmt/utils/MgmtSocket.cc
+++ /dev/null
@@ -1,367 +0,0 @@
-/** @file
-
- A brief file description
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-#include "tscore/ink_platform.h"
-#include "tscore/ink_assert.h"
-#include "tscore/ink_cap.h"
-#include "MgmtSocket.h"
-
-#if HAVE_UCRED_H
-#include <ucred.h>
-#endif
-
-//-------------------------------------------------------------------------
-// defines
-//-------------------------------------------------------------------------
-
-#define MGMT_MAX_TRANSIENT_ERRORS 64
-
-//-------------------------------------------------------------------------
-// transient_error
-//-------------------------------------------------------------------------
-
-bool
-mgmt_transient_error()
-{
- switch (errno) {
- case EINTR:
- case EAGAIN:
-
-#ifdef ENOMEM
- case ENOMEM:
-#endif
-
-#ifdef ENOBUF
- case ENOBUF:
-#endif
-
-#if defined(EWOULDBLOCK) && (EWOULDBLOCK != EAGAIN)
- case EWOULDBLOCK:
-#endif
-
- return true;
-
- default:
- return false;
- }
-}
-
-//-------------------------------------------------------------------------
-// system calls (based on implementation from UnixSocketManager)
-//-------------------------------------------------------------------------
-
-//-------------------------------------------------------------------------
-// mgmt_accept
-//-------------------------------------------------------------------------
-
-int
-mgmt_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
-{
- int r, retries;
- ink_assert(*addrlen != 0);
- for (retries = 0; retries < MGMT_MAX_TRANSIENT_ERRORS; retries++) {
- r = ::accept(s, addr, addrlen);
- if (r >= 0) {
- return r;
- }
- if (!mgmt_transient_error()) {
- break;
- }
- }
- return r;
-}
-
-//-------------------------------------------------------------------------
-// mgmt_fopen
-//-------------------------------------------------------------------------
-
-FILE *
-mgmt_fopen(const char *filename, const char *mode)
-{
- FILE *f;
- int retries;
- for (retries = 0; retries < MGMT_MAX_TRANSIENT_ERRORS; retries++) {
- // no leak here as f will be returned if it is > 0
- // coverity[overwrite_var]
- f = ::fopen(filename, mode);
- if (f != nullptr) {
- return f;
- }
- if (!mgmt_transient_error()) {
- break;
- }
- }
- return f;
-}
-
-//-------------------------------------------------------------------------
-// mgmt_open
-//-------------------------------------------------------------------------
-
-int
-mgmt_open(const char *path, int oflag)
-{
- int r, retries;
- for (retries = 0; retries < MGMT_MAX_TRANSIENT_ERRORS; retries++) {
- r = ::open(path, oflag);
- if (r >= 0) {
- return r;
- }
- if (!mgmt_transient_error()) {
- break;
- }
- }
- return r;
-}
-
-//-------------------------------------------------------------------------
-// mgmt_open_mode
-//-------------------------------------------------------------------------
-
-int
-mgmt_open_mode(const char *path, int oflag, mode_t mode)
-{
- int r, retries;
- for (retries = 0; retries < MGMT_MAX_TRANSIENT_ERRORS; retries++) {
- r = ::open(path, oflag, mode);
- if (r >= 0) {
- return r;
- }
- if (!mgmt_transient_error()) {
- break;
- }
- }
- return r;
-}
-
-//-------------------------------------------------------------------------
-// mgmt_open_mode_elevate
-//-------------------------------------------------------------------------
-
-int
-mgmt_open_mode_elevate(const char *path, int oflag, mode_t mode, bool
elevate_p)
-{
- int r, retries;
- for (retries = 0; retries < MGMT_MAX_TRANSIENT_ERRORS; retries++) {
- r = elevate_p ? elevating_open(path, oflag, mode) : ::open(path, oflag,
mode);
- if (r >= 0) {
- return r;
- }
- if (!mgmt_transient_error()) {
- break;
- }
- }
- return r;
-}
-//-------------------------------------------------------------------------
-// mgmt_select
-//-------------------------------------------------------------------------
-
-int
-mgmt_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds,
struct timeval *timeout)
-{
-// Note: Linux select() has slight different semantics. From the
-// man page: "On Linux, timeout is modified to reflect the amount of
-// time not slept; most other implementations do not do this."
-// Linux select() can also return ENOMEM, so we especially need to
-// protect the call with the transient error retry loop.
-// Fortunately, because of the Linux timeout handling, our
-// mgmt_select call will still timeout correctly, rather than
-// possibly extending our timeout period by up to
-// MGMT_MAX_TRANSIENT_ERRORS times.
-#if defined(__linux__)
- int r, retries;
- for (retries = 0; retries < MGMT_MAX_TRANSIENT_ERRORS; retries++) {
- r = ::select(nfds, readfds, writefds, errorfds, timeout);
- if (r >= 0) {
- return r;
- }
- if (!mgmt_transient_error()) {
- break;
- }
- }
- return r;
-#else
- return ::select(nfds, readfds, writefds, errorfds, timeout);
-#endif
-}
-
-//-------------------------------------------------------------------------
-// mgmt_sendto
-//-------------------------------------------------------------------------
-
-int
-mgmt_sendto(int fd, void *buf, int len, int flags, struct sockaddr *to, int
tolen)
-{
- int r, retries;
- for (retries = 0; retries < MGMT_MAX_TRANSIENT_ERRORS; retries++) {
- r = ::sendto(fd, static_cast<char *>(buf), len, flags, to, tolen);
- if (r >= 0) {
- return r;
- }
- if (!mgmt_transient_error()) {
- break;
- }
- }
- return r;
-}
-
-//-------------------------------------------------------------------------
-// mgmt_socket
-//-------------------------------------------------------------------------
-
-int
-mgmt_socket(int domain, int type, int protocol)
-{
- int r, retries;
- for (retries = 0; retries < MGMT_MAX_TRANSIENT_ERRORS; retries++) {
- r = ::socket(domain, type, protocol);
- if (r >= 0) {
- return r;
- }
- if (!mgmt_transient_error()) {
- break;
- }
- }
- return r;
-}
-
-/***************************************************************************
- * mgmt_write_timeout
- *
- * purpose: checks if the specified socket is ready to be written too; only
- * checks for the specified time
- * input: fd - the socket to wait for
- * sec - time to wait in secs
- * usec - time to wait in usecs
- * output: return 0 if time expires and the fd is not ready to be written
- * return > 0 (actually 1) if fd is ready to be written
- * return < 0 if error
- ***************************************************************************/
-int
-mgmt_write_timeout(int fd, int sec, int usec)
-{
- struct timeval timeout;
- fd_set writeSet;
- timeout.tv_sec = sec;
- timeout.tv_usec = usec;
-
- if (fd < 0 || fd >= FD_SETSIZE) {
- errno = EBADF;
- return -1;
- }
-
- FD_ZERO(&writeSet);
- FD_SET(fd, &writeSet);
-
- if (sec < 0 && usec < 0) {
- // blocking select; only returns when fd is ready to write
- return (mgmt_select(fd + 1, nullptr, &writeSet, nullptr, nullptr));
- } else {
- return (mgmt_select(fd + 1, nullptr, &writeSet, nullptr, &timeout));
- }
-}
-
-/***************************************************************************
- * mgmt_read_timeout
- *
- * purpose: need timeout for socket after sending a request and waiting to
- * read reply check to see if anything to read;
- * but only wait for fixed time specified in timeout struct
- * input: fd - the socket to wait for
- * sec - time to wait in secs
- * usec - time to wait in usecs
- * output: returns 0 if time expires and the fd is not ready
- * return > 0 (actually 1) if fd is ready to read
- * reason: the client could send a reply, but if TM is down or has
- * problems sending a reply then the client could end up hanging,
- * waiting to read a replay from the local side
- ***************************************************************************/
-int
-mgmt_read_timeout(int fd, int sec, int usec)
-{
- struct timeval timeout;
- fd_set readSet;
- timeout.tv_sec = sec;
- timeout.tv_usec = usec;
-
- if (fd < 0 || fd >= FD_SETSIZE) {
- errno = EBADF;
- return -1;
- }
-
- FD_ZERO(&readSet);
- FD_SET(fd, &readSet);
-
- return mgmt_select(fd + 1, &readSet, nullptr, nullptr, &timeout);
-}
-
-bool
-mgmt_has_peereid()
-{
-#if HAVE_GETPEEREID
- return true;
-#elif HAVE_GETPEERUCRED
- return true;
-#elif TS_HAS_SO_PEERCRED
- return true;
-#else
- return false;
-#endif
-}
-
-int
-mgmt_get_peereid(int fd, uid_t *euid, gid_t *egid)
-{
- *euid = -1;
- *egid = -1;
-
-#if HAVE_GETPEEREID
- return getpeereid(fd, euid, egid);
-#elif HAVE_GETPEERUCRED
- ucred_t *ucred;
-
- if (getpeerucred(fd, &ucred) == -1) {
- return -1;
- }
-
- *euid = ucred_geteuid(ucred);
- *egid = ucred_getegid(ucred);
- ucred_free(ucred);
- return 0;
-#elif TS_HAS_SO_PEERCRED
- struct ucred cred;
- socklen_t credsz = sizeof(cred);
- if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cred, &credsz) == -1) {
- return -1;
- }
-
- *euid = cred.uid;
- *egid = cred.gid;
- return 0;
-#else
- (void)fd;
- errno = ENOTSUP;
- return -1;
-#endif
-}
diff --git a/mgmt/utils/MgmtSocket.h b/mgmt/utils/MgmtSocket.h
deleted file mode 100644
index 46eb242b54..0000000000
--- a/mgmt/utils/MgmtSocket.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/** @file
-
- A brief file description
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-#pragma once
-
-#include "tscore/ink_platform.h"
-
-//-------------------------------------------------------------------------
-// transient_error
-//-------------------------------------------------------------------------
-
-bool mgmt_transient_error();
-
-//-------------------------------------------------------------------------
-// system calls (based on implementation from UnixSocketManager);
-//-------------------------------------------------------------------------
-
-//-------------------------------------------------------------------------
-// mgmt_accept
-//-------------------------------------------------------------------------
-
-int mgmt_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
-
-//-------------------------------------------------------------------------
-// mgmt_fopen
-//-------------------------------------------------------------------------
-
-FILE *mgmt_fopen(const char *filename, const char *mode);
-
-//-------------------------------------------------------------------------
-// mgmt_open
-//-------------------------------------------------------------------------
-
-int mgmt_open(const char *path, int oflag);
-
-//-------------------------------------------------------------------------
-// mgmt_open_mode
-//-------------------------------------------------------------------------
-
-int mgmt_open_mode(const char *path, int oflag, mode_t mode);
-
-//-------------------------------------------------------------------------
-// mgmt_open_mode_elevate
-//-------------------------------------------------------------------------
-
-int mgmt_open_mode_elevate(const char *path, int oflag, mode_t mode, bool
elevate_p = false);
-
-//-------------------------------------------------------------------------
-// mgmt_select
-//-------------------------------------------------------------------------
-
-int mgmt_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds,
struct timeval *timeout);
-
-//-------------------------------------------------------------------------
-// mgmt_sendto
-//-------------------------------------------------------------------------
-
-int mgmt_sendto(int fd, void *buf, int len, int flags, struct sockaddr *to,
int tolen);
-
-//-------------------------------------------------------------------------
-// mgmt_socket
-//-------------------------------------------------------------------------
-
-int mgmt_socket(int domain, int type, int protocol);
-
-//-------------------------------------------------------------------------
-// mgmt_write_timeout
-//-------------------------------------------------------------------------
-int mgmt_write_timeout(int fd, int sec, int usec);
-
-//-------------------------------------------------------------------------
-// mgmt_read_timeout
-//-------------------------------------------------------------------------
-int mgmt_read_timeout(int fd, int sec, int usec);
-
-// Do we support passing Unix domain credentials on this platform?
-bool mgmt_has_peereid();
-
-// Get the Unix domain peer credentials.
-int mgmt_get_peereid(int fd, uid_t *euid, gid_t *egid);
diff --git a/mgmt/utils/MgmtUtils.cc b/mgmt/utils/MgmtUtils.cc
deleted file mode 100644
index 35947394c4..0000000000
--- a/mgmt/utils/MgmtUtils.cc
+++ /dev/null
@@ -1,351 +0,0 @@
-/** @file
-
- Some utility and support functions for the management module.
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-#include "tscore/ink_platform.h"
-#include "tscore/ink_sock.h"
-#include "MgmtUtils.h"
-#include "MgmtSocket.h"
-#include "tscore/Diags.h"
-
-static int use_syslog = 0;
-
-/* mgmt_use_syslog()
- *
- * Called to indicate that the syslog should be used and
- * the log has been opened
- */
-void
-mgmt_use_syslog()
-{
- use_syslog = 1;
-}
-
-/*
- * mgmt_readline(...)
- * Simple, inefficient, read line function. Takes a socket to read
- * from, a char * to write into, and a max len to read. The newline
- * is stripped.
- *
- * Returns: num bytes read
- * -1 error
- */
-int
-mgmt_readline(int soc, char *buf, int maxlen)
-{
- int n = 0;
- char c;
-
- for (; n < maxlen; n++) {
- int rc = read_socket(soc, &c, 1);
- if (rc == 1) {
- *buf++ = c;
- if (c == '\n') {
- --buf;
- *buf = '\0';
- if (*(buf - 1) == '\r') {
- --buf;
- *buf = '\0';
- }
- break;
- }
- } else if (rc == 0) {
- return n;
- } else { /* Error */
- if (errno == ECONNRESET || errno == EPIPE) {
- return n ? n : 0;
- }
-
- if (mgmt_transient_error()) {
- mgmt_sleep_msec(1);
- continue;
- }
-
- return -1;
- }
- }
-
- return n;
-} /* End mgmt_readline */
-
-/*
- * mgmt_writeline(...)
- * Simple, inefficient, write line function. Takes a soc to write to,
- * a char * containing the data, and the number of bytes to write.
- * It sends nbytes + 1 bytes worth of data, the + 1 being the newline
- * character.
- *
- * Returns: num bytes not written
- * -1 error
- */
-int
-mgmt_writeline(int soc, const char *data, int nbytes)
-{
- int nleft, n = 0;
- const char *tmp = data;
-
- nleft = nbytes;
- while (nleft > 0) {
- int nwritten = write_socket(soc, tmp, nleft);
- if (nwritten == 0) { // Nothing written
- mgmt_sleep_msec(1);
- continue;
- } else if (nwritten < 0) { // Error
- if (mgmt_transient_error()) {
- mgmt_sleep_msec(1);
- continue;
- }
-
- return nwritten;
- }
- nleft -= nwritten;
- tmp += nwritten;
- }
-
- while (n != 1) {
- n = write_socket(soc, "\n", 1); /* Terminating newline */
- if (n == 0) {
- mgmt_sleep_msec(1);
- continue;
- } else if (n < 0) { // Error
- if (mgmt_transient_error()) {
- mgmt_sleep_msec(1);
- continue;
- }
-
- return n;
- }
- }
-
- return (nleft); /* Paranoia */
-} /* End mgmt_writeline */
-
-/*
- * mgmt_read_pipe()
- * - Reads from a pipe
- *
- * Returns: bytes read
- * 0 on EOF
- * -errno on error
- */
-
-int
-mgmt_read_pipe(int fd, char *buf, int bytes_to_read)
-{
- char *p = buf;
- int bytes_read = 0;
-
- while (bytes_to_read > 0) {
- int err = read_socket(fd, p, bytes_to_read);
- if (err == 0) {
- // return 0 if partial read.
- return err;
- } else if (err < 0) {
- // Turn ECONNRESET into EOF.
- if (errno == ECONNRESET || errno == EPIPE) {
- return bytes_read ? bytes_read : 0;
- }
-
- if (mgmt_transient_error()) {
- mgmt_sleep_msec(1);
- continue;
- }
-
- return -errno;
- }
-
- bytes_to_read -= err;
- bytes_read += err;
- p += err;
- }
-
- return bytes_read;
-}
-
-/*
- * mgmt_write_pipe()
- * - Writes to a pipe
- *
- * Returns: bytes written
- * 0 on EOF
- * -errno on error
- */
-
-int
-mgmt_write_pipe(int fd, char *buf, int bytes_to_write)
-{
- char *p = buf;
- int bytes_written = 0;
-
- while (bytes_to_write > 0) {
- int err = write_socket(fd, p, bytes_to_write);
- if (err == 0) {
- // Where this volume of IEEE Std 1003.1-2001 requires -1 to be returned
and errno set to [EAGAIN],
- // most historical implementations return zero for write(2)
- mgmt_sleep_msec(1);
- continue;
- } else if (err < 0) {
- if (mgmt_transient_error()) {
- mgmt_sleep_msec(1);
- continue;
- }
-
- return -errno;
- }
-
- bytes_to_write -= err;
- bytes_written += err;
- p += err;
- }
-
- return bytes_written;
-}
-
-static inline int
-get_interface_mtu(int sock_fd, struct ifreq *ifr)
-{
- if (ioctl(sock_fd, SIOCGIFMTU, ifr) < 0) {
- Debug("mgmt_utils",
- "[getAddrForIntr] Unable to obtain MTU for "
- "interface '%s'",
- ifr->ifr_name);
- return 0;
- } else {
- return ifr->ifr_mtu;
- }
-}
-
-bool
-mgmt_getAddrForIntr(char *intrName, sockaddr *addr, int *mtu)
-{
- bool found = false;
-
- if (intrName == nullptr) {
- return false;
- }
-
- int fakeSocket; // a temporary socket to pass to ioctl
- struct ifconf ifc; // ifconf information
- char *ifbuf; // ifconf buffer
- struct ifreq *ifr, *ifend; // pointer to individual interface info
- int lastlen;
- int len;
-
- // Prevent UMRs
- memset(addr, 0, sizeof(struct in_addr));
-
- if ((fakeSocket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
- Fatal("[getAddrForIntr] Unable to create socket: %d\n", errno);
- }
- // INKqa06739
- // Fetch the list of network interfaces
- // . from Stevens, Unix Network Prog., pg 434-435
- ifbuf = nullptr;
- lastlen = 0;
- len = 128 * sizeof(struct ifreq); // initial buffer size guess
- for (;;) {
- ifbuf = static_cast<char *>(ats_malloc(len));
- memset(ifbuf, 0, len); // prevent UMRs
- ifc.ifc_len = len;
- ifc.ifc_buf = ifbuf;
- if (ioctl(fakeSocket, SIOCGIFCONF, &ifc) < 0) {
- if (errno != EINVAL || lastlen != 0) {
- Fatal("[getAddrForIntr] Unable to read network interface
configuration: %d\n", errno);
- }
- } else {
- if (ifc.ifc_len == lastlen) {
- break;
- }
- lastlen = ifc.ifc_len;
- }
- len *= 2;
- ats_free(ifbuf);
- }
-
- found = false;
- // Loop through the list of interfaces
- ifend = reinterpret_cast<struct ifreq *>(ifc.ifc_buf + ifc.ifc_len);
- for (ifr = ifc.ifc_req; ifr < ifend;) {
- if (ifr->ifr_addr.sa_family == AF_INET && strcmp(ifr->ifr_name, intrName)
== 0) {
- // Get the address of the interface
- if (ioctl(fakeSocket, SIOCGIFADDR, reinterpret_cast<char *>(ifr)) < 0) {
- Debug("mgmt_utils", "[getAddrForIntr] Unable obtain address for
network interface %s\n", intrName);
- } else {
- // Only look at the address if it an internet address
- if (ifr->ifr_ifru.ifru_addr.sa_family == AF_INET) {
- ats_ip_copy(addr, &ifr->ifr_ifru.ifru_addr);
- found = true;
-
- if (mtu) {
- *mtu = get_interface_mtu(fakeSocket, ifr);
- }
-
- break;
- } else {
- Debug("mgmt_utils", "[getAddrForIntr] Interface %s is not configured
for IP.\n", intrName);
- }
- }
- }
-#if defined(freebsd) || defined(darwin)
- ifr = (struct ifreq *)((char *)&ifr->ifr_addr + ifr->ifr_addr.sa_len);
-#else
- ifr = reinterpret_cast<struct ifreq *>((reinterpret_cast<char *>(ifr)) +
sizeof(*ifr));
-#endif
- }
- ats_free(ifbuf);
- close(fakeSocket);
-
- return found;
-} /* End mgmt_getAddrForIntr */
-
-/*
- * mgmt_sortipaddrs(...)
- * Routine to sort and pick smallest ip addr.
- */
-struct in_addr *
-mgmt_sortipaddrs(int num, struct in_addr **list)
-{
- int i = 0;
- unsigned long min;
- struct in_addr *entry, *tmp;
-
- min = (list[0])->s_addr;
- entry = list[0];
- while (i < num && (tmp = list[i]) != nullptr) {
- i++;
- if (min > tmp->s_addr) {
- min = tmp->s_addr;
- entry = tmp;
- }
- }
- return entry;
-} /* End mgmt_sortipaddrs */
-
-void
-mgmt_sleep_sec(int seconds)
-{
- sleep(seconds);
-}
-void
-mgmt_sleep_msec(int msec)
-{
- usleep(msec * 1000);
-}
diff --git a/mgmt/utils/MgmtUtils.h b/mgmt/utils/MgmtUtils.h
deleted file mode 100644
index 9c658b813e..0000000000
--- a/mgmt/utils/MgmtUtils.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/** @file
-
- A brief file description
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-/**************************************
- *
- * MgmtUtils.h
- * Some utility and support functions for the management module.
- *
- * $Date: 2007-10-05 16:56:46 $
- *
- *
- */
-
-#pragma once
-
-#include "tscore/ink_platform.h"
-#include "tscore/Diags.h"
-
-#include "records/P_RecCore.h"
-
-int mgmt_readline(int fd, char *buf, int maxlen);
-int mgmt_writeline(int fd, const char *data, int nbytes);
-
-int mgmt_read_pipe(int fd, char *buf, int bytes_to_read);
-int mgmt_write_pipe(int fd, char *buf, int bytes_to_write);
-
-void mgmt_use_syslog();
-void mgmt_cleanup();
-
-struct in_addr *mgmt_sortipaddrs(int num, struct in_addr **list);
-bool mgmt_getAddrForIntr(char *intrName, sockaddr *addr, int *mtu = nullptr);
-
-void mgmt_sleep_sec(int);
-void mgmt_sleep_msec(int);
-
-void load_config_file_callback(const char *parent_file, const char
*remap_file);
diff --git a/mgmt/utils/unit_tests/unit_test_main.cc
b/mgmt/utils/unit_tests/unit_test_main.cc
deleted file mode 100644
index 940d865fb4..0000000000
--- a/mgmt/utils/unit_tests/unit_test_main.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-/** @file
-
- This file used for catch based tests. It is the main() stub.
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-#define CATCH_CONFIG_MAIN
-#include <catch.hpp>
diff --git a/proxy/CMakeLists.txt b/proxy/CMakeLists.txt
index 43c2e1ad48..6406c4e31f 100644
--- a/proxy/CMakeLists.txt
+++ b/proxy/CMakeLists.txt
@@ -55,8 +55,6 @@ set(PROXY_INCLUDE_DIRS ${PROXY_INCLUDE_DIRS} PARENT_SCOPE)
target_include_directories(proxy PUBLIC
${IOCORE_INCLUDE_DIRS}
${PROXY_INCLUDE_DIRS}
- ${CMAKE_SOURCE_DIR}/mgmt
- ${CMAKE_SOURCE_DIR}/mgmt/utils
${CMAKE_SOURCE_DIR}/lib/yamlcpp/include
)
diff --git a/proxy/Makefile.am b/proxy/Makefile.am
index 449e176230..4e3a16a269 100644
--- a/proxy/Makefile.am
+++ b/proxy/Makefile.am
@@ -37,8 +37,6 @@ AM_CPPFLAGS += \
-I$(abs_srcdir)/logging \
-I$(abs_srcdir)/http/remap \
-I$(abs_srcdir)/hdrs \
- -I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
@SWOC_INCLUDES@ \
@YAMLCPP_INCLUDES@ \
$(TS_INCLUDES)
diff --git a/proxy/http/CMakeLists.txt b/proxy/http/CMakeLists.txt
index d90b525adf..5f919ceb23 100644
--- a/proxy/http/CMakeLists.txt
+++ b/proxy/http/CMakeLists.txt
@@ -53,8 +53,6 @@ target_include_directories(http
PRIVATE
${IOCORE_INCLUDE_DIRS}
${PROXY_INCLUDE_DIRS}
- ${CMAKE_SOURCE_DIR}/mgmt
- ${CMAKE_SOURCE_DIR}/mgmt/utils
${YAMLCPP_INCLUDE_DIR}
)
diff --git a/proxy/http/HttpConnectionCount.h b/proxy/http/HttpConnectionCount.h
index 8ba73c59ca..2fef0fb550 100644
--- a/proxy/http/HttpConnectionCount.h
+++ b/proxy/http/HttpConnectionCount.h
@@ -39,7 +39,7 @@
#include "tscore/CryptoHash.h"
#include "tscore/BufferWriterForward.h"
#include "tscpp/util/TextView.h"
-#include <MgmtDefs.h>
+#include <tscore/MgmtDefs.h>
#include "HttpProxyAPIEnums.h"
#include "Show.h"
diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h
index c8b7cf1bb2..ff32c2d027 100644
--- a/proxy/http/HttpTransact.h
+++ b/proxy/http/HttpTransact.h
@@ -43,7 +43,7 @@
#include "UrlMapping.h"
#include "records/I_RecHttp.h"
#include "ProxySession.h"
-#include "MgmtDefs.h"
+#include "tscore/MgmtDefs.h"
#define HTTP_OUR_VIA_MAX_LENGTH 1024 // 512-bytes for hostname+via string,
512-bytes for the debug info
diff --git a/proxy/http/Makefile.am b/proxy/http/Makefile.am
index 954d8ef5a3..3afb3d4ddc 100644
--- a/proxy/http/Makefile.am
+++ b/proxy/http/Makefile.am
@@ -25,8 +25,6 @@ AM_CPPFLAGS += \
-I$(abs_top_srcdir)/proxy \
-I$(abs_top_srcdir)/include \
-I$(abs_top_srcdir)/lib \
- -I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
-I$(abs_top_srcdir)/proxy/hdrs \
-I$(abs_top_srcdir)/proxy/shared \
-I$(abs_top_srcdir)/proxy/http/remap \
diff --git a/proxy/http/remap/CMakeLists.txt b/proxy/http/remap/CMakeLists.txt
index 8fe9e01d9a..15b357f7d4 100644
--- a/proxy/http/remap/CMakeLists.txt
+++ b/proxy/http/remap/CMakeLists.txt
@@ -37,8 +37,6 @@ add_library(http_remap STATIC
target_include_directories(http_remap PRIVATE
${IOCORE_INCLUDE_DIRS}
${PROXY_INCLUDE_DIRS}
- ${CMAKE_SOURCE_DIR}/mgmt
- ${CMAKE_SOURCE_DIR}/mgmt/utils
${CMAKE_SOURCE_DIR}/src/records
${YAML_INCLUDE_DIRS}
)
diff --git a/proxy/http/remap/Makefile.am b/proxy/http/remap/Makefile.am
index cae2797ab0..96a3d13f7c 100644
--- a/proxy/http/remap/Makefile.am
+++ b/proxy/http/remap/Makefile.am
@@ -24,8 +24,6 @@ AM_CPPFLAGS += \
-I$(abs_top_srcdir)/lib \
-I$(abs_top_srcdir)/src/records \
-I$(abs_top_srcdir)/proxy \
- -I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
-I$(abs_top_srcdir)/proxy/hdrs \
-I$(abs_top_srcdir)/proxy/shared \
-I$(abs_top_srcdir)/proxy/http \
diff --git a/proxy/http/unit_tests/CMakeLists.txt
b/proxy/http/unit_tests/CMakeLists.txt
index 6d0f0958cc..a1878a3854 100644
--- a/proxy/http/unit_tests/CMakeLists.txt
+++ b/proxy/http/unit_tests/CMakeLists.txt
@@ -29,7 +29,6 @@ add_executable(test_http
target_include_directories(test_http
PRIVATE
"${PROJECT_BINARY_DIR}/include/ts"
- "${PROJECT_SOURCE_DIR}/mgmt"
)
target_link_libraries(test_http
diff --git a/proxy/http2/CMakeLists.txt b/proxy/http2/CMakeLists.txt
index 6b3fc0033b..464d7a50b3 100644
--- a/proxy/http2/CMakeLists.txt
+++ b/proxy/http2/CMakeLists.txt
@@ -32,7 +32,5 @@ add_library(http2 STATIC
target_include_directories(http2 PRIVATE
${IOCORE_INCLUDE_DIRS}
${PROXY_INCLUDE_DIRS}
- ${CMAKE_SOURCE_DIR}/mgmt
- ${CMAKE_SOURCE_DIR}/mgmt/utils
${YAMLCPP_INCLUDE_DIR}
-)
\ No newline at end of file
+)
diff --git a/proxy/http2/Makefile.am b/proxy/http2/Makefile.am
index 879867ba39..1d0d7ddbfd 100644
--- a/proxy/http2/Makefile.am
+++ b/proxy/http2/Makefile.am
@@ -22,8 +22,6 @@ AM_CPPFLAGS += \
$(iocore_include_dirs) \
-I$(abs_top_srcdir)/include \
-I$(abs_top_srcdir)/lib \
- -I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
-I$(abs_top_srcdir)/proxy \
-I$(abs_top_srcdir)/proxy/http \
-I$(abs_top_srcdir)/proxy/hdrs \
diff --git a/proxy/http3/CMakeLists.txt b/proxy/http3/CMakeLists.txt
index 721f1997b1..d3408bd1ff 100644
--- a/proxy/http3/CMakeLists.txt
+++ b/proxy/http3/CMakeLists.txt
@@ -48,7 +48,7 @@ target_link_libraries(http3
ts::inkevent
ts::proxy
ts::quic
- ts::records_p
+ ts::records
ts::tscpputil
ts::tscore
)
diff --git a/proxy/http3/Makefile.am b/proxy/http3/Makefile.am
index 3c7b777a3b..45b2c2c40d 100644
--- a/proxy/http3/Makefile.am
+++ b/proxy/http3/Makefile.am
@@ -23,8 +23,6 @@ AM_CPPFLAGS += \
-I$(abs_top_srcdir)/proxy/api/ts \
-I$(abs_top_srcdir)/lib \
-I$(abs_top_srcdir)/src/records \
- -I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
-I$(abs_top_srcdir)/proxy \
-I$(abs_top_srcdir)/proxy/http \
-I$(abs_top_srcdir)/proxy/hdrs \
diff --git a/proxy/logging/CMakeLists.txt b/proxy/logging/CMakeLists.txt
index 06e9f1691d..cbe94e906f 100644
--- a/proxy/logging/CMakeLists.txt
+++ b/proxy/logging/CMakeLists.txt
@@ -35,8 +35,6 @@ add_library(logging STATIC
target_include_directories(logging PRIVATE
${IOCORE_INCLUDE_DIRS}
${PROXY_INCLUDE_DIRS}
- ${CMAKE_SOURCE_DIR}/mgmt
- ${CMAKE_SOURCE_DIR}/mgmt/utils
${YAML_INCLUDE_DIRS}
${SWOC_INCLUDE_DIR}
-)
\ No newline at end of file
+)
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index 1f0435d3b7..3f2608103a 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -53,7 +53,7 @@
#include "tscore/ink_apidefs.h"
-#include "MgmtDefs.h"
+#include "tscore/MgmtDefs.h"
#define PERIODIC_TASKS_INTERVAL_FALLBACK 5
diff --git a/proxy/logging/LogStandalone.cc b/proxy/logging/LogStandalone.cc
index cda1b57ef2..1cec2379a1 100644
--- a/proxy/logging/LogStandalone.cc
+++ b/proxy/logging/LogStandalone.cc
@@ -36,7 +36,6 @@
#include "P_EventSystem.h"
#include "records/P_RecProcess.h"
-#include "MgmtUtils.h"
// Needs LibRecordsConfigInit()
#include "records/I_RecordsConfig.h"
#include "I_Machine.h"
@@ -84,8 +83,6 @@ init_system(bool notify_syslog)
static void
initialize_process_manager()
{
- mgmt_use_syslog();
-
// diags should have been initialized by caller, e.g.: sac.cc
ink_assert(diags());
diff --git a/proxy/logging/Makefile.am b/proxy/logging/Makefile.am
index f8b5db7741..cf3252da41 100644
--- a/proxy/logging/Makefile.am
+++ b/proxy/logging/Makefile.am
@@ -27,8 +27,6 @@ AM_CPPFLAGS += \
-I$(abs_top_srcdir)/proxy/http/remap \
-I$(abs_top_srcdir)/proxy/hdrs \
-I$(abs_top_srcdir)/proxy/shared \
- -I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
$(TS_INCLUDES) @SWOC_INCLUDES@ @YAMLCPP_INCLUDES@
EXTRA_DIST = LogStandalone.cc
diff --git a/proxy/shared/CMakeLists.txt b/proxy/shared/CMakeLists.txt
index 7594b1dad6..5e93f01a3f 100644
--- a/proxy/shared/CMakeLists.txt
+++ b/proxy/shared/CMakeLists.txt
@@ -20,7 +20,5 @@ add_library(diagsconfig STATIC DiagsConfig.cc)
target_include_directories(diagsconfig PRIVATE
${IOCORE_INCLUDE_DIRS}
${PROXY_INCLUDE_DIRS}
- ${CMAKE_SOURCE_DIR}/mgmt
- ${CMAKE_SOURCE_DIR}/mgmt/utils
${YAMLCPP_INCLUDE_DIR}
)
diff --git a/proxy/shared/Makefile.am b/proxy/shared/Makefile.am
index f4d153f4af..b83e7db7f6 100644
--- a/proxy/shared/Makefile.am
+++ b/proxy/shared/Makefile.am
@@ -26,8 +26,6 @@ AM_CPPFLAGS += \
$(iocore_include_dirs) \
-I$(abs_top_srcdir)/include \
-I$(abs_top_srcdir)/lib \
- -I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
-I$(abs_top_srcdir)/proxy \
-I$(abs_top_srcdir)/proxy/http \
-I$(abs_top_srcdir)/proxy/hdrs \
diff --git a/src/records/CMakeLists.txt b/src/records/CMakeLists.txt
index 32e28af9bb..d64f3b4e7d 100644
--- a/src/records/CMakeLists.txt
+++ b/src/records/CMakeLists.txt
@@ -15,7 +15,7 @@
#
#######################
-add_library(records_p STATIC
+add_library(records STATIC
P_RecCore.cc
RecConfigParse.cc
RecCore.cc
@@ -30,16 +30,15 @@ add_library(records_p STATIC
RecordsConfigUtils.cc
RecRawStats.cc
)
-add_library(ts::records_p ALIAS records_p)
+add_library(ts::records ALIAS records)
-target_include_directories(records_p
+target_include_directories(records
PUBLIC
"${PROJECT_SOURCE_DIR}/include"
"${CMAKE_SOURCE_DIR}/iocore/eventsystem"
PRIVATE
"${CMAKE_SOURCE_DIR}/mgmt"
- "${CMAKE_SOURCE_DIR}/mgmt/utils"
"${CMAKE_SOURCE_DIR}/iocore/utils"
)
-target_link_libraries(records_p PUBLIC ts::tscore)
+target_link_libraries(records PUBLIC ts::tscore)
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index cb076ddb46..daeaa2ee30 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -20,7 +20,6 @@
include_directories(
${IOCORE_INCLUDE_DIRS}
${PROXY_INCLUDE_DIRS}
- ${CMAKE_SOURCE_DIR}/mgmt
${CATCH_INCLUDE_DIR}
)
@@ -30,9 +29,7 @@ link_libraries(
http2
logging
hdrs
- configmanager
diagsconfig
- utils_p
inkutils
inkdns
inkhostdb
@@ -53,7 +50,6 @@ link_libraries(
tscpputil
proxy
inknet
- records_p
inkevent
yaml-cpp
libswoc
diff --git a/src/traffic_crashlog/CMakeLists.txt
b/src/traffic_crashlog/CMakeLists.txt
index 8961cb558b..ce391a5168 100644
--- a/src/traffic_crashlog/CMakeLists.txt
+++ b/src/traffic_crashlog/CMakeLists.txt
@@ -20,7 +20,7 @@ add_executable(traffic_crashlog procinfo.cc
traffic_crashlog.cc)
target_link_libraries(traffic_crashlog
PRIVATE
ts::inkevent # transitive
- ts::records_p
+ ts::records
ts::tscore
)
diff --git a/src/traffic_crashlog/Makefile.inc
b/src/traffic_crashlog/Makefile.inc
index 6fbf0b5416..18e3b20159 100644
--- a/src/traffic_crashlog/Makefile.inc
+++ b/src/traffic_crashlog/Makefile.inc
@@ -23,7 +23,6 @@ traffic_crashlog_traffic_crashlog_CPPFLAGS = \
-I$(abs_top_srcdir)/include \
-I$(abs_top_srcdir)/lib \
-I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
@SWOC_INCLUDES@ \
$(TS_INCLUDES)
diff --git a/src/traffic_ctl/CMakeLists.txt b/src/traffic_ctl/CMakeLists.txt
index 94c8ed289d..be7d1e9808 100644
--- a/src/traffic_ctl/CMakeLists.txt
+++ b/src/traffic_ctl/CMakeLists.txt
@@ -27,7 +27,6 @@ target_include_directories(traffic_ctl PRIVATE
${IOCORE_INCLUDE_DIRS}
${PROXY_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/mgmt
- ${CMAKE_SOURCE_DIR}/mgmt/utils
)
target_link_libraries(traffic_ctl
tscore
diff --git a/src/traffic_layout/CMakeLists.txt
b/src/traffic_layout/CMakeLists.txt
index 63437f1bd6..bbc58f0551 100644
--- a/src/traffic_layout/CMakeLists.txt
+++ b/src/traffic_layout/CMakeLists.txt
@@ -31,7 +31,7 @@ target_link_libraries(traffic_layout
PRIVATE
ts::inkevent
${OPENSSL_LIBRARY}
- ts::records_p
+ ts::records
yaml-cpp::yaml-cpp
)
diff --git a/src/traffic_layout/Makefile.inc b/src/traffic_layout/Makefile.inc
index 0bdde7f6a0..233d145461 100644
--- a/src/traffic_layout/Makefile.inc
+++ b/src/traffic_layout/Makefile.inc
@@ -23,7 +23,6 @@ traffic_layout_traffic_layout_CPPFLAGS = \
-I$(abs_top_srcdir)/include \
-I$(abs_top_srcdir)/lib \
-I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
@SWOC_INCLUDES@ \
@YAMLCPP_INCLUDES@ \
$(TS_INCLUDES)
diff --git a/src/traffic_logcat/Makefile.inc b/src/traffic_logcat/Makefile.inc
index c9c5a09dca..c085cf8048 100644
--- a/src/traffic_logcat/Makefile.inc
+++ b/src/traffic_logcat/Makefile.inc
@@ -28,7 +28,6 @@ traffic_logcat_traffic_logcat_CPPFLAGS = \
-I$(abs_top_srcdir)/proxy/logging \
-I$(abs_top_srcdir)/proxy/shared \
-I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
@SWOC_INCLUDES@ $(TS_INCLUDES)
traffic_logcat_traffic_logcat_LDFLAGS = \
@@ -46,8 +45,7 @@ traffic_logcat_traffic_logcat_LDADD = \
$(top_builddir)/iocore/eventsystem/libinkevent.a \
$(top_builddir)/iocore/utils/libinkutils.a \
$(top_builddir)/src/tscore/libtscore.la \
- $(top_builddir)/src/tscpp/util/libtscpputil.la \
- $(top_builddir)/mgmt/utils/libutils_p.la
+ $(top_builddir)/src/tscpp/util/libtscpputil.la
traffic_logcat_traffic_logcat_LDADD += \
@SWOC_LIBS@ @HWLOC_LIBS@ \
diff --git a/src/traffic_logstats/Makefile.inc
b/src/traffic_logstats/Makefile.inc
index 7a2ac7f0d1..16aebb459e 100644
--- a/src/traffic_logstats/Makefile.inc
+++ b/src/traffic_logstats/Makefile.inc
@@ -28,8 +28,7 @@ traffic_logstats_traffic_logstats_CPPFLAGS = \
-I$(abs_top_srcdir)/proxy/logging \
-I$(abs_top_srcdir)/proxy/shared \
-I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
- @SWOC_INCLUDES@ \
+ @SWOC_INCLUDES@ \
$(TS_INCLUDES)
traffic_logstats_traffic_logstats_LDFLAGS = \
@@ -51,8 +50,7 @@ traffic_logstats_traffic_logstats_LDADD = \
$(top_builddir)/iocore/eventsystem/libinkevent.a \
$(top_builddir)/iocore/utils/libinkutils.a \
$(top_builddir)/src/tscore/libtscore.la \
- $(top_builddir)/src/tscpp/util/libtscpputil.la \
- $(top_builddir)/mgmt/utils/libutils_p.la
+ $(top_builddir)/src/tscpp/util/libtscpputil.la
traffic_logstats_traffic_logstats_LDADD += \
@SWOC_LIBS@ \
diff --git a/src/traffic_quic/Makefile.inc b/src/traffic_quic/Makefile.inc
index bc4d7ea502..70f523ad9a 100644
--- a/src/traffic_quic/Makefile.inc
+++ b/src/traffic_quic/Makefile.inc
@@ -24,7 +24,6 @@ traffic_quic_traffic_quic_CPPFLAGS = \
-I$(abs_top_srcdir)/lib \
-I$(abs_top_srcdir)/src/records \
-I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
-I$(abs_top_srcdir)/proxy \
-I$(abs_top_srcdir)/proxy/hdrs \
-I$(abs_top_srcdir)/proxy/http \
@@ -57,7 +56,6 @@ traffic_quic_traffic_quic_LDADD = \
$(top_builddir)/proxy/http2/libhttp2.a \
$(top_builddir)/proxy/libproxy.a \
$(top_builddir)/proxy/hdrs/libhdrs.a \
- $(top_builddir)/mgmt/utils/libutils_p.la \
@HWLOC_LIBS@ \
@SWOC_LIBS@ \
@YAMLCPP_LIBS@ \
diff --git a/src/traffic_server/CMakeLists.txt
b/src/traffic_server/CMakeLists.txt
index 895a0e2285..6152bfb4dc 100644
--- a/src/traffic_server/CMakeLists.txt
+++ b/src/traffic_server/CMakeLists.txt
@@ -31,7 +31,6 @@ target_include_directories(traffic_server PRIVATE
${IOCORE_INCLUDE_DIRS}
${PROXY_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/mgmt
- ${CMAKE_SOURCE_DIR}/mgmt/utils
)
target_link_libraries(traffic_server
PRIVATE
@@ -43,7 +42,6 @@ target_link_libraries(traffic_server
hdrs
configmanager
diagsconfig
- utils_p
inkutils
inkdns
inkhostdb
@@ -53,7 +51,7 @@ target_link_libraries(traffic_server
tscpputil
proxy
inknet
- records_p
+ records
inkevent
yaml-cpp
libswoc
diff --git a/src/traffic_server/Makefile.inc b/src/traffic_server/Makefile.inc
index 54469db224..2c33b899db 100644
--- a/src/traffic_server/Makefile.inc
+++ b/src/traffic_server/Makefile.inc
@@ -33,7 +33,6 @@ traffic_server_traffic_server_CPPFLAGS = \
-I$(abs_top_srcdir)/proxy/hdrs \
-I$(abs_top_srcdir)/proxy/shared \
-I$(abs_top_srcdir)/mgmt \
- -I$(abs_top_srcdir)/mgmt/utils \
@SWOC_INCLUDES@ \
$(TS_INCLUDES) \
@OPENSSL_INCLUDES@ \
@@ -89,7 +88,6 @@ traffic_server_traffic_server_LDADD = \
$(top_builddir)/mgmt/rpc/libjsonrpc_protocol.la \
$(top_builddir)/mgmt/config/libconfigmanager.la \
$(top_builddir)/mgmt/rpc/librpcpublichandlers.la \
- $(top_builddir)/mgmt/utils/libutils_p.la \
@HWLOC_LIBS@ \
@LIBPCRE@ \
@LIBRESOLV@ \
diff --git a/src/traffic_server/traffic_server.cc
b/src/traffic_server/traffic_server.cc
index d155bc0042..86220aaba6 100644
--- a/src/traffic_server/traffic_server.cc
+++ b/src/traffic_server/traffic_server.cc
@@ -89,7 +89,6 @@ extern "C" int plock(int);
#include "IPAllow.h"
#include "ParentSelection.h"
#include "HostStatus.h"
-#include "MgmtUtils.h"
#include "StatPages.h"
#include "HTTP.h"
#include "HuffmanCodec.h"
@@ -136,6 +135,8 @@ static char diags_log_filename[PATH_NAME_MAX] =
DEFAULT_DIAGS_LOG_FILENAME;
static const long MAX_LOGIN = ink_login_name_max();
static void init_ssl_ctx_callback(void *ctx, bool server);
+// This isn't static as its also called from InkAPI.cc
+void load_config_file_callback(const char *parent_file, const char
*remap_file);
static void load_ssl_file_callback(const char *ssl_file);
static void task_threads_started_callback();
@@ -666,8 +667,6 @@ check_config_directories()
static void
initialize_process_manager()
{
- mgmt_use_syslog();
-
RecProcessInit(diags());
LibRecordsConfigInit();