From 284a5a08dfb9ee4497b5b9ff7563a7f7d84f38f3 Mon Sep 17 00:00:00 2001 From: Leif Hedstrom Date: Tue, 5 Nov 2019 17:29:02 -0700 Subject: [PATCH 1/4] Cleans up some of the filenames mess However, I did not finish eliminating all configurations. I've marked some of them deprecated, the changes to refactor all of this is too big to be safe for a v9.0.0 PR. We will revisit their removals for v10.0.0, but I'll also add a deprecation note for all of these for v9.0.0. --- doc/admin-guide/files/records.config.en.rst | 1 + include/tscore/Filenames.h | 13 +++++++++++ iocore/cache/CacheHosting.cc | 11 +++++----- iocore/dns/SplitDNS.cc | 11 +++++----- iocore/net/QUICMultiCertConfigLoader.cc | 5 +++-- iocore/net/SSLClientUtils.cc | 7 +++--- iocore/net/SSLUtils.cc | 13 +++++------ mgmt/LocalManager.cc | 2 +- mgmt/RecordsConfig.cc | 23 ++++++++++---------- proxy/CacheControl.cc | 15 +++++++------ proxy/IPAllow.cc | 5 +++-- proxy/ParentSelection.cc | 13 +++++------ proxy/Plugin.cc | 13 +++++------ proxy/ReverseProxy.cc | 21 +++++++++--------- proxy/http/HttpBodyFactory.cc | 3 ++- proxy/http/HttpConfig.cc | 9 ++++---- proxy/http/HttpTransact.cc | 5 +++-- proxy/http/remap/UrlRewrite.cc | 5 +++-- proxy/logging/LogConfig.cc | 3 ++- proxy/shared/DiagsConfig.cc | 3 ++- src/traffic_layout/info.cc | 12 +++++------ src/traffic_manager/AddConfigFilesHere.cc | 24 ++++++++++----------- src/traffic_server/InkAPITest.cc | 9 ++++---- src/traffic_server/traffic_server.cc | 22 ++++++++++--------- src/tscore/Filenames.cc | 14 ++++++++++++ 25 files changed, 154 insertions(+), 108 deletions(-) diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst index 099782b62fc..c1df4085ccc 100644 --- a/doc/admin-guide/files/records.config.en.rst +++ b/doc/admin-guide/files/records.config.en.rst @@ -3061,6 +3061,7 @@ URL Remap Rules =============== .. ts:cv:: CONFIG proxy.config.url_remap.filename STRING remap.config + :deprecated: Sets the name of the :file:`remap.config` file. diff --git a/include/tscore/Filenames.h b/include/tscore/Filenames.h index 6c880e02d52..a7d533f6321 100644 --- a/include/tscore/Filenames.h +++ b/include/tscore/Filenames.h @@ -25,6 +25,19 @@ // Configuration file names extern const char *STORAGE_CONF_FILENAME; extern const char *RECORDS_CONF_FILENAME; +extern const char *VOLUME_CONF_FILENAME; +extern const char *PLUGIN_CONF_FILENAME; + +extern const char *LOGGING_CONF_FILENAME; +extern const char *CACHE_CONF_FILENAME; +extern const char *IPALLOW_CONF_FILENAME; +extern const char *HOSTING_CONF_FILENAME; +extern const char *SOCKS_CONF_FILENAME; +extern const char *PARENT_CONF_FILENAME; +extern const char *REMAP_CONF_FILENAME; +extern const char *MULTICERT_CONF_FILENAME; +extern const char *SPLITDNS_CONF_FILENAME; +extern const char *SNI_CONF_FILENAME; /////////////////////////////////////////////////////////////////// // Various other file names diff --git a/iocore/cache/CacheHosting.cc b/iocore/cache/CacheHosting.cc index 98e75073611..35d70113db0 100644 --- a/iocore/cache/CacheHosting.cc +++ b/iocore/cache/CacheHosting.cc @@ -26,6 +26,7 @@ #include "tscore/HostLookup.h" #include "tscore/Tokenizer.h" #include "tscore/Regression.h" +#include "tscore/Filenames.h" extern int gndisks; @@ -244,7 +245,7 @@ int fstat_wrapper(int fd, struct stat *s); int CacheHostTable::BuildTableFromString(const char *config_file_path, char *file_buf) { - Note("hosting.config loading ..."); + Note("%s loading ...", HOSTING_CONF_FILENAME); // Table build locals Tokenizer bufTok("\n"); @@ -325,7 +326,7 @@ CacheHostTable::BuildTableFromString(const char *config_file_path, char *file_bu if (gen_host_rec.Init(type)) { Warning("Problems encountered while initializing the Generic Volume"); } - Note("hosting.config finished loading"); + Note("%s finished loading", HOSTING_CONF_FILENAME); return 0; } @@ -374,7 +375,7 @@ CacheHostTable::BuildTableFromString(const char *config_file_path, char *file_bu current = current->next; ats_free(last); - Note("hosting.config finished loading"); + Note("%s finished loading", HOSTING_CONF_FILENAME); } if (!generic_rec_initd) { @@ -596,11 +597,11 @@ ConfigVolumes::read_config_file() config_path = RecConfigReadConfigPath("proxy.config.cache.volume_filename"); ink_release_assert(config_path); - Note("volume.config loading ..."); + Note("%s loading ...", VOLUME_CONF_FILENAME); file_buf = readIntoBuffer(config_path, "[CacheVolition]", nullptr); if (file_buf == nullptr) { - Error("volume.config failed to load"); + Error("%s failed to load", VOLUME_CONF_FILENAME); Warning("Cannot read the config file: %s", (const char *)config_path); return; } diff --git a/iocore/dns/SplitDNS.cc b/iocore/dns/SplitDNS.cc index 827204b7e32..27db19bc5de 100644 --- a/iocore/dns/SplitDNS.cc +++ b/iocore/dns/SplitDNS.cc @@ -30,6 +30,7 @@ #include "tscore/ink_platform.h" #include "tscore/Tokenizer.h" +#include "tscore/Filenames.h" #ifdef SPLIT_DNS #include @@ -130,7 +131,7 @@ SplitDNSConfig::reconfigure() return; } - Note("splitdns.config loading ..."); + Note("%s loading ...", SPLITDNS_CONF_FILENAME); SplitDNS *params = new SplitDNS; @@ -138,7 +139,7 @@ SplitDNSConfig::reconfigure() params->m_DNSSrvrTable = new DNS_table("proxy.config.dns.splitdns.filename", modulePrefix, &sdns_dest_tags); if (nullptr == params->m_DNSSrvrTable || (0 == params->m_DNSSrvrTable->getEntryCount())) { - Error("splitdns.config failed to load"); + Error("%s failed to load", SPLITDNS_CONF_FILENAME); Warning("No NAMEDs provided! Disabling SplitDNS"); gsplit_dns_enabled = 0; delete params; @@ -159,7 +160,7 @@ SplitDNSConfig::reconfigure() SplitDNSConfig::print(); } - Note("splitdns.config finished loading"); + Note("%s finished loading", SPLITDNS_CONF_FILENAME); } /* -------------------------------------------------------------- @@ -476,7 +477,7 @@ SplitDNSRecord::Init(matcher_line *line_info) } if (!ats_is_ip(&m_servers.x_server_ip[0].sa)) { - return Result::failure("%s No server specified in splitdns.config at line %d", modulePrefix, line_num); + return Result::failure("%s No server specified in %s at line %d", modulePrefix, SPLITDNS_CONF_FILENAME, line_num); } DNSHandler *dnsH = new DNSHandler; @@ -505,7 +506,7 @@ SplitDNSRecord::Init(matcher_line *line_info) if (line_info->num_el > 0) { const char *tmp = ProcessModifiers(line_info); if (tmp != nullptr) { - return Result::failure("%s %s at line %d in splitdns.config", modulePrefix, tmp, line_num); + return Result::failure("%s %s at line %d in %s", modulePrefix, tmp, line_num, SPLITDNS_CONF_FILENAME); } } diff --git a/iocore/net/QUICMultiCertConfigLoader.cc b/iocore/net/QUICMultiCertConfigLoader.cc index 7e37f3427dc..b1c2df4144f 100644 --- a/iocore/net/QUICMultiCertConfigLoader.cc +++ b/iocore/net/QUICMultiCertConfigLoader.cc @@ -29,6 +29,7 @@ #include "QUICConfig.h" #include "QUICConnection.h" #include "QUICTypes.h" +#include "tscore/Filenames.h" // #include "QUICGlobals.h" #define QUICConfDebug(fmt, ...) Debug("quic_conf", fmt, ##__VA_ARGS__) @@ -128,7 +129,7 @@ QUICMultiCertConfigLoader::init_server_ssl_ctx(std::vector &cert_list, c #if TS_USE_TLS_SET_CIPHERSUITES if (params->server_tls13_cipher_suites != nullptr) { if (!SSL_CTX_set_ciphersuites(ctx, params->server_tls13_cipher_suites)) { - Error("invalid tls server cipher suites in records.config"); + Error("invalid tls server cipher suites in %s", RECORDS_CONF_FILENAME); goto fail; } } @@ -141,7 +142,7 @@ QUICMultiCertConfigLoader::init_server_ssl_ctx(std::vector &cert_list, c #else if (!SSL_CTX_set1_curves_list(ctx, params->server_groups_list)) { #endif - Error("invalid groups list for server in records.config"); + Error("invalid groups list for server in %s", RECORDS_CONF_FILENAME); goto fail; } } diff --git a/iocore/net/SSLClientUtils.cc b/iocore/net/SSLClientUtils.cc index 59f2bce646d..b85624db33c 100644 --- a/iocore/net/SSLClientUtils.cc +++ b/iocore/net/SSLClientUtils.cc @@ -22,6 +22,7 @@ #include "tscore/ink_config.h" #include "records/I_RecHttp.h" #include "tscore/ink_platform.h" +#include "tscore/Filenames.h" #include "tscore/X509HostnameValidator.h" #include "P_Net.h" @@ -158,7 +159,7 @@ SSLInitClientContext(const SSLConfigParams *params) SSL_CTX_set_options(client_ctx, params->ssl_client_ctx_options); if (params->client_cipherSuite != nullptr) { if (!SSL_CTX_set_cipher_list(client_ctx, params->client_cipherSuite)) { - SSLError("invalid client cipher suite in records.config"); + SSLError("invalid client cipher suite in %s", RECORDS_CONF_FILENAME); goto fail; } } @@ -166,7 +167,7 @@ SSLInitClientContext(const SSLConfigParams *params) #if TS_USE_TLS_SET_CIPHERSUITES if (params->client_tls13_cipher_suites != nullptr) { if (!SSL_CTX_set_ciphersuites(client_ctx, params->client_tls13_cipher_suites)) { - SSLError("invalid tls client cipher suites in records.config"); + SSLError("invalid tls client cipher suites in %s", RECORDS_CONF_FILENAME); goto fail; } } @@ -179,7 +180,7 @@ SSLInitClientContext(const SSLConfigParams *params) #else if (!SSL_CTX_set1_curves_list(client_ctx, params->client_groups_list)) { #endif - SSLError("invalid groups list for client in records.config"); + SSLError("invalid groups list for client in %s", RECORDS_CONF_FILENAME); goto fail; } } diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc index 9e8b352abbc..5434931defa 100644 --- a/iocore/net/SSLUtils.cc +++ b/iocore/net/SSLUtils.cc @@ -27,6 +27,7 @@ #include "tscore/I_Layout.h" #include "tscore/ink_cap.h" #include "tscore/ink_mutex.h" +#include "tscore/Filenames.h" #include "records/I_RecHttp.h" #include "P_Net.h" @@ -962,7 +963,7 @@ SSLPrivateKeyHandler(SSL_CTX *ctx, const SSLConfigParams *params, const std::str SSLConfigParams::load_ssl_file_cb(completeServerKeyPath); } } else { - SSLError("empty SSL private key path in records.config"); + SSLError("empty SSL private key path in %s", RECORDS_CONF_FILENAME); return false; } @@ -1328,7 +1329,7 @@ SSLMultiCertConfigLoader::init_server_ssl_ctx(std::vector &cert_list, co } else { // disable client cert support server_verify_client = SSL_VERIFY_NONE; - Error("illegal client certification level %d in records.config", server_verify_client); + Error("illegal client certification level %d in %s", server_verify_client, RECORDS_CONF_FILENAME); } SSL_CTX_set_verify(ctx, server_verify_client, ssl_verify_client_callback); SSL_CTX_set_verify_depth(ctx, params->verify_depth); // might want to make configurable at some point. @@ -1340,7 +1341,7 @@ SSLMultiCertConfigLoader::init_server_ssl_ctx(std::vector &cert_list, co if (params->cipherSuite != nullptr) { if (!SSL_CTX_set_cipher_list(ctx, params->cipherSuite)) { - SSLError("invalid cipher suite in records.config"); + SSLError("invalid cipher suite in %s", RECORDS_CONF_FILENAME); goto fail; } } @@ -1348,7 +1349,7 @@ SSLMultiCertConfigLoader::init_server_ssl_ctx(std::vector &cert_list, co #if TS_USE_TLS_SET_CIPHERSUITES if (params->server_tls13_cipher_suites != nullptr) { if (!SSL_CTX_set_ciphersuites(ctx, params->server_tls13_cipher_suites)) { - SSLError("invalid tls server cipher suites in records.config"); + SSLError("invalid tls server cipher suites in %s", RECORDS_CONF_FILENAME); goto fail; } } @@ -1361,7 +1362,7 @@ SSLMultiCertConfigLoader::init_server_ssl_ctx(std::vector &cert_list, co #else if (!SSL_CTX_set1_curves_list(ctx, params->server_groups_list)) { #endif - SSLError("invalid groups list for server in records.config"); + SSLError("invalid groups list for server in %s", RECORDS_CONF_FILENAME); goto fail; } } @@ -1590,7 +1591,7 @@ SSLMultiCertConfigLoader::load(SSLCertLookup *lookup) const matcher_tags sslCertTags = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, false}; - Note("ssl_multicert.config loading ..."); + Note("%s loading ...", MULTICERT_CONF_FILENAME); if (params->configFilePath) { file_buf = readIntoBuffer(params->configFilePath, __func__, nullptr); diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc index 369cfd66e3e..b75576c1568 100644 --- a/mgmt/LocalManager.cc +++ b/mgmt/LocalManager.cc @@ -752,7 +752,7 @@ LocalManager::processEventQueue() // records.config if (!(strcmp(payload.begin(), RECORDS_CONF_FILENAME))) { if (RecReadConfigFile() != REC_ERR_OKAY) { - mgmt_elog(errno, "[fileUpdated] Config update failed for records.config\n"); + mgmt_elog(errno, "[fileUpdated] Config update failed for %s\n", RECORDS_CONF_FILENAME); } else { RecConfigWarnIfUnregistered(); } diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc index 55fd6a677a3..9361e33e3b2 100644 --- a/mgmt/RecordsConfig.cc +++ b/mgmt/RecordsConfig.cc @@ -22,6 +22,7 @@ */ #include "tscore/ink_config.h" +#include "tscore/Filenames.h" #include "RecordsConfig.h" #if TS_USE_REMOTE_UNWINDING @@ -420,7 +421,7 @@ static const RecordElement RecordsConfig[] = // ############################## {RECT_CONFIG, "proxy.config.http.parent_proxies", RECD_STRING, nullptr, RECU_DYNAMIC, RR_NULL, RECC_STR, ".*", RECA_NULL} , - {RECT_CONFIG, "proxy.config.http.parent_proxy.file", RECD_STRING, "parent.config", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.http.parent_proxy.file", RECD_STRING, PARENT_CONF_FILENAME, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.http.parent_proxy.retry_time", RECD_INT, "300", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , @@ -687,7 +688,7 @@ static const RecordElement RecordsConfig[] = , {RECT_CONFIG, "proxy.config.socks.socks_version", RECD_INT, "4", RECU_RESTART_TS, RR_NULL, RECC_INT, "[4-5]", RECA_NULL} , - {RECT_CONFIG, "proxy.config.socks.socks_config_file", RECD_STRING, "socks.config", RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.socks.socks_config_file", RECD_STRING, SOCKS_CONF_FILENAME, RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.socks.socks_timeout", RECD_INT, "100", RECU_RESTART_TS, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL} , @@ -796,13 +797,13 @@ static const RecordElement RecordsConfig[] = //# Cache //# //############################################################################## - {RECT_CONFIG, "proxy.config.cache.control.filename", RECD_STRING, "cache.config", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.cache.control.filename", RECD_STRING, CACHE_CONF_FILENAME, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , - {RECT_CONFIG, "proxy.config.cache.ip_allow.filename", RECD_STRING, "ip_allow.yaml", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.cache.ip_allow.filename", RECD_STRING, IPALLOW_CONF_FILENAME, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , - {RECT_CONFIG, "proxy.config.cache.hosting_filename", RECD_STRING, "hosting.config", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.cache.hosting_filename", RECD_STRING, HOSTING_CONF_FILENAME, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , - {RECT_CONFIG, "proxy.config.cache.volume_filename", RECD_STRING, "volume.config", RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.cache.volume_filename", RECD_STRING, VOLUME_CONF_FILENAME, RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.cache.permit.pinning", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL} , @@ -879,7 +880,7 @@ static const RecordElement RecordsConfig[] = , {RECT_CONFIG, "proxy.config.dns.splitDNS.enabled", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL} , - {RECT_CONFIG, "proxy.config.dns.splitdns.filename", RECD_STRING, "splitdns.config", RECU_NULL, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.dns.splitdns.filename", RECD_STRING, SPLITDNS_CONF_FILENAME, RECU_NULL, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.dns.nameservers", RECD_STRING, nullptr, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , @@ -1000,7 +1001,7 @@ static const RecordElement RecordsConfig[] = , {RECT_CONFIG, "proxy.config.log.logfile_perm", RECD_STRING, "rw-r--r--", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , - {RECT_CONFIG, "proxy.config.log.config.filename", RECD_STRING, "logging.yaml", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.log.config.filename", RECD_STRING, LOGGING_CONF_FILENAME, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.log.preproc_threads", RECD_INT, "1", RECU_DYNAMIC, RR_REQUIRED, RECC_INT, "[1-128]", RECA_NULL} , @@ -1041,7 +1042,7 @@ static const RecordElement RecordsConfig[] = //############################################################################## {RECT_CONFIG, "proxy.config.reverse_proxy.enabled", RECD_INT, "1", RECU_DYNAMIC, RR_REQUIRED, RECC_INT, "[0-1]", RECA_NULL} , - {RECT_CONFIG, "proxy.config.url_remap.filename", RECD_STRING, "remap.config", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.url_remap.filename", RECD_STRING, REMAP_CONF_FILENAME, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.url_remap.remap_required", RECD_INT, "1", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL} , @@ -1085,11 +1086,11 @@ static const RecordElement RecordsConfig[] = , {RECT_CONFIG, "proxy.config.ssl.server.cert_chain.filename", RECD_STRING, nullptr, RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , - {RECT_CONFIG, "proxy.config.ssl.server.multicert.filename", RECD_STRING, "ssl_multicert.config", RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.ssl.server.multicert.filename", RECD_STRING, MULTICERT_CONF_FILENAME, RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.ssl.server.multicert.exit_on_load_fail", RECD_INT, "1", RECU_RESTART_TS, RR_NULL, RECC_NULL, "[0-1]", RECA_NULL} , - {RECT_CONFIG, "proxy.config.ssl.servername.filename", RECD_STRING, "sni.yaml", RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.ssl.servername.filename", RECD_STRING, SNI_CONF_FILENAME, RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.ssl.server.ticket_key.filename", RECD_STRING, nullptr, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , diff --git a/proxy/CacheControl.cc b/proxy/CacheControl.cc index 072c4709e99..308d00c0793 100644 --- a/proxy/CacheControl.cc +++ b/proxy/CacheControl.cc @@ -31,6 +31,7 @@ #include #include "tscore/ink_config.h" +#include "tscore/Filenames.h" #include "CacheControl.h" #include "ControlMatcher.h" #include "Main.h" @@ -143,16 +144,16 @@ initCacheControl() void reloadCacheControl() { - Note("cache.config loading ..."); + Note("%s loading ...", CACHE_CONF_FILENAME); CC_table *newTable; - Debug("cache_control", "cache.config updated, reloading"); + Debug("cache_control", "%s updated, reloading", CACHE_CONF_FILENAME); eventProcessor.schedule_in(new CC_FreerContinuation(CacheControlTable), CACHE_CONTROL_TIMEOUT, ET_CACHE); newTable = new CC_table("proxy.config.cache.control.filename", modulePrefix, &http_dest_tags); ink_atomic_swap(&CacheControlTable, newTable); - Note("cache.config finished loading"); + Note("%s finished loading", CACHE_CONF_FILENAME); } void @@ -297,7 +298,7 @@ CacheControlRecord::Init(matcher_line *line_info) directive = CC_IGNORE_SERVER_NO_CACHE; d_found = true; } else { - return Result::failure("%s Invalid action at line %d in cache.config", modulePrefix, line_num); + return Result::failure("%s Invalid action at line %d in %s", modulePrefix, line_num, CACHE_CONF_FILENAME); } } else { if (strcasecmp(label, "revalidate") == 0) { @@ -317,7 +318,7 @@ CacheControlRecord::Init(matcher_line *line_info) this->time_arg = time_in; } else { - return Result::failure("%s %s at line %d in cache.config", modulePrefix, tmp, line_num); + return Result::failure("%s %s at line %d in %s", modulePrefix, tmp, line_num, CACHE_CONF_FILENAME); } } } @@ -331,14 +332,14 @@ CacheControlRecord::Init(matcher_line *line_info) } if (d_found == false) { - return Result::failure("%s No directive in cache.config at line %d", modulePrefix, line_num); + return Result::failure("%s No directive in %s at line %d", modulePrefix, CACHE_CONF_FILENAME, line_num); } // Process any modifiers to the directive, if they exist if (line_info->num_el > 0) { tmp = ProcessModifiers(line_info); if (tmp != nullptr) { - return Result::failure("%s %s at line %d in cache.config", modulePrefix, tmp, line_num); + return Result::failure("%s %s at line %d in %s", modulePrefix, tmp, line_num, CACHE_CONF_FILENAME); } } diff --git a/proxy/IPAllow.cc b/proxy/IPAllow.cc index 1761a0c7e54..1e0b7fcd826 100644 --- a/proxy/IPAllow.cc +++ b/proxy/IPAllow.cc @@ -29,6 +29,7 @@ #include "tscore/BufferWriter.h" #include "tscore/ts_file.h" #include "tscore/ink_memory.h" +#include "tscore/Filenames.h" #include "yaml-cpp/yaml.h" @@ -136,14 +137,14 @@ IpAllow::reconfigure() { self_type *new_table; - Note("ip_allow.yaml loading ..."); + Note("%s loading ...", IPALLOW_CONF_FILENAME); new_table = new self_type("proxy.config.cache.ip_allow.filename"); new_table->BuildTable(); configid = configProcessor.set(configid, new_table); - Note("ip_allow.yaml finished loading"); + Note("%s finished loading", IPALLOW_CONF_FILENAME); } IpAllow * diff --git a/proxy/ParentSelection.cc b/proxy/ParentSelection.cc index e8a787798d0..2d192a50890 100644 --- a/proxy/ParentSelection.cc +++ b/proxy/ParentSelection.cc @@ -30,6 +30,7 @@ #include "HTTP.h" #include "HttpTransact.h" #include "I_Machine.h" +#include "tscore/Filenames.h" #define MAX_SIMPLE_RETRIES 5 #define MAX_UNAVAILABLE_SERVER_RETRIES 5 @@ -264,7 +265,7 @@ ParentConfig::startup() void ParentConfig::reconfigure() { - Note("parent.config loading ..."); + Note("%s loading ...", PARENT_CONF_FILENAME); ParentConfigParams *params = nullptr; @@ -280,7 +281,7 @@ ParentConfig::reconfigure() ParentConfig::print(); } - Note("parent.config finished loading"); + Note("%s finished loading", PARENT_CONF_FILENAME); } // void ParentConfig::print @@ -743,14 +744,14 @@ ParentRecord::Init(matcher_line *line_info) } if (this->parents == nullptr && go_direct == false) { - return Result::failure("%s No parent specified in parent.config at line %d", modulePrefix, line_num); + return Result::failure("%s No parent specified in %s at line %d", modulePrefix, PARENT_CONF_FILENAME, line_num); } // Process any modifiers to the directive, if they exist if (line_info->num_el > 0) { tmp = ProcessModifiers(line_info); if (tmp != nullptr) { - return Result::failure("%s %s at line %d in parent.config", modulePrefix, tmp, line_num); + return Result::failure("%s %s at line %d in %s", modulePrefix, tmp, line_num, PARENT_CONF_FILENAME); } // record SCHEME modifier if present. // NULL if not present @@ -895,7 +896,7 @@ setup_socks_servers(ParentRecord *rec_arr, int len) void SocksServerConfig::reconfigure() { - Note("socks.config loading ..."); + Note("%s loading ...", SOCKS_CONF_FILENAME); char *default_val = nullptr; int retry_time = 30; @@ -935,7 +936,7 @@ SocksServerConfig::reconfigure() SocksServerConfig::print(); } - Note("socks.config finished loading"); + Note("%s finished loading", SOCKS_CONF_FILENAME); } void diff --git a/proxy/Plugin.cc b/proxy/Plugin.cc index 4687ddb5528..d942a73a0ac 100644 --- a/proxy/Plugin.cc +++ b/proxy/Plugin.cc @@ -30,6 +30,7 @@ #include "InkAPIInternal.h" #include "Plugin.h" #include "tscore/ink_cap.h" +#include "tscore/Filenames.h" #define MAX_PLUGIN_ARGS 64 @@ -208,7 +209,7 @@ plugin_expand(char *arg) } not_found: - Warning("plugin.config: unable to find parameter %s", arg); + Warning("%s: unable to find parameter %s", PLUGIN_CONF_FILENAME, arg); return nullptr; } @@ -231,11 +232,11 @@ plugin_init(bool validateOnly) INIT_ONCE = false; } - Note("plugin.config loading ..."); - path = RecConfigReadConfigPath(nullptr, "plugin.config"); + Note("%s loading ...", PLUGIN_CONF_FILENAME); + path = RecConfigReadConfigPath(nullptr, PLUGIN_CONF_FILENAME); fd = open(path, O_RDONLY); if (fd < 0) { - Warning("plugin.config failed to load: %d, %s", errno, strerror(errno)); + Warning("%s failed to load: %d, %s", PLUGIN_CONF_FILENAME, errno, strerror(errno)); return false; } @@ -311,9 +312,9 @@ plugin_init(bool validateOnly) close(fd); if (retVal) { - Note("plugin.config finished loading"); + Note("%s finished loading", PLUGIN_CONF_FILENAME); } else { - Error("plugin.config failed to load"); + Error("%s failed to load", PLUGIN_CONF_FILENAME); } return retVal; } diff --git a/proxy/ReverseProxy.cc b/proxy/ReverseProxy.cc index 2f5de1a917b..56927217b14 100644 --- a/proxy/ReverseProxy.cc +++ b/proxy/ReverseProxy.cc @@ -28,6 +28,7 @@ */ #include "tscore/ink_platform.h" +#include "tscore/Filenames.h" #include #include "P_EventSystem.h" #include "P_Cache.h" @@ -64,11 +65,11 @@ init_reverse_proxy() reconfig_mutex = new_ProxyMutex(); rewrite_table = new UrlRewrite(); - Note("remap.config loading ..."); + Note("%s loading ...", REMAP_CONF_FILENAME); if (!rewrite_table->load()) { - Fatal("remap.config failed to load"); + Fatal("%s failed to load", REMAP_CONF_FILENAME); } - Note("remap.config finished loading"); + Note("%s finished loading", REMAP_CONF_FILENAME); REC_RegisterConfigUpdateFunc("proxy.config.url_remap.filename", url_rewrite_CB, (void *)FILE_CHANGED); REC_RegisterConfigUpdateFunc("proxy.config.proxy_name", url_rewrite_CB, (void *)TSNAME_CHANGED); @@ -136,11 +137,11 @@ reloadUrlRewrite() { UrlRewrite *newTable, *oldTable; - Note("remap.config loading ..."); - Debug("url_rewrite", "remap.config updated, reloading..."); + Note("%s loading ...", REMAP_CONF_FILENAME); + Debug("url_rewrite", "%s updated, reloading...", REMAP_CONF_FILENAME); newTable = new UrlRewrite(); if (newTable->load()) { - static const char *msg = "remap.config finished loading"; + static const char *msg = "%s finished loading"; // Hold at least one lease, until we reload the configuration newTable->acquire(); @@ -154,15 +155,15 @@ reloadUrlRewrite() oldTable->pluginFactory.deactivate(); oldTable->release(); - Debug("url_rewrite", "%s", msg); + Debug("url_rewrite", msg, REMAP_CONF_FILENAME); Note("%s", msg); return true; } else { - static const char *msg = "remap.config failed to load"; + static const char *msg = "%s failed to load"; delete newTable; - Debug("url_rewrite", "%s", msg); - Error("%s", msg); + Debug("url_rewrite", msg, REMAP_CONF_FILENAME); + Error(msg, REMAP_CONF_FILENAME); return false; } } diff --git a/proxy/http/HttpBodyFactory.cc b/proxy/http/HttpBodyFactory.cc index 65b44c2d287..538da655b9d 100644 --- a/proxy/http/HttpBodyFactory.cc +++ b/proxy/http/HttpBodyFactory.cc @@ -31,6 +31,7 @@ #include "tscore/ink_platform.h" #include "tscore/ink_sprintf.h" #include "tscore/ink_file.h" +#include "tscore/Filenames.h" #include "HttpBodyFactory.h" #include #include @@ -334,7 +335,7 @@ HttpBodyFactory::HttpBodyFactory() for (i = 0; config_record_names[i] != nullptr; i++) { status = REC_RegisterConfigUpdateFunc(config_record_names[i], config_callback, (void *)this); if (status != REC_ERR_OKAY) { - Warning("couldn't register variable '%s', is records.config up to date?", config_record_names[i]); + Warning("couldn't register variable '%s', is %s up to date?", config_record_names[i], RECORDS_CONF_FILENAME); } no_registrations_failed = no_registrations_failed && (status == REC_ERR_OKAY); } diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc index fa0b494aea9..21899d60d1f 100644 --- a/proxy/http/HttpConfig.cc +++ b/proxy/http/HttpConfig.cc @@ -22,6 +22,7 @@ */ #include "tscore/ink_config.h" +#include "tscore/Filenames.h" #include #include #include "HttpConfig.h" @@ -1302,9 +1303,9 @@ HttpConfig::reconfigure() if (params->outbound_conntrack.queue_size > 0 && !(params->oride.outbound_conntrack.max > 0 || params->oride.outbound_conntrack.min > 0)) { Warning("'%s' is set, but neither '%s' nor '%s' are " - "set, please correct your records.config", + "set, please correct your %s", OutboundConnTrack::CONFIG_VAR_QUEUE_SIZE.data(), OutboundConnTrack::CONFIG_VAR_MAX.data(), - OutboundConnTrack::CONFIG_VAR_MIN.data()); + OutboundConnTrack::CONFIG_VAR_MIN.data(), RECORDS_CONF_FILENAME); } params->oride.attach_server_session_to_client = m_master.oride.attach_server_session_to_client; @@ -1312,8 +1313,8 @@ HttpConfig::reconfigure() params->http_hdr_field_max_size = m_master.http_hdr_field_max_size; if (params->oride.outbound_conntrack.max > 0 && params->oride.outbound_conntrack.max < params->oride.outbound_conntrack.min) { - Warning("'%s' < per_server.min_keep_alive_connections, setting min=max , please correct your records.config", - OutboundConnTrack::CONFIG_VAR_MAX.data()); + Warning("'%s' < per_server.min_keep_alive_connections, setting min=max , please correct your %s", + OutboundConnTrack::CONFIG_VAR_MAX.data(), RECORDS_CONF_FILENAME); params->oride.outbound_conntrack.min = params->oride.outbound_conntrack.max; } diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index e31430a54ae..2cd8717272c 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -33,6 +33,7 @@ #include "HttpDebugNames.h" #include #include "tscore/ParseRules.h" +#include "tscore/Filenames.h" #include "HTTP.h" #include "HdrUtils.h" #include "logging/Log.h" @@ -6061,8 +6062,8 @@ HttpTransact::is_response_cacheable(State *s, HTTPHdr *request, HTTPHdr *respons // If a ttl is set, allow caching even if response contains // Cache-Control headers to prevent caching if (s->cache_control.ttl_in_cache > 0) { - TxnDebug("http_trans", - "[is_response_cacheable] Cache-control header directives in response overridden by ttl in cache.config"); + TxnDebug("http_trans", "[is_response_cacheable] Cache-control header directives in response overridden by ttl in %s", + CACHE_CONF_FILENAME); } else { TxnDebug("http_trans", "[is_response_cacheable] NO by response cache control"); return false; diff --git a/proxy/http/remap/UrlRewrite.cc b/proxy/http/remap/UrlRewrite.cc index 39052138174..fcfc1ca155e 100644 --- a/proxy/http/remap/UrlRewrite.cc +++ b/proxy/http/remap/UrlRewrite.cc @@ -27,6 +27,7 @@ #include "ReverseProxy.h" #include "RemapConfig.h" #include "tscore/I_Layout.h" +#include "tscore/Filenames.h" #include "HttpSM.h" #define modulePrefix "[ReverseProxy]" @@ -55,10 +56,10 @@ UrlRewrite::load() { ats_scoped_str config_file_path; - config_file_path = RecConfigReadConfigPath("proxy.config.url_remap.filename", "remap.config"); + config_file_path = RecConfigReadConfigPath("proxy.config.url_remap.filename", REMAP_CONF_FILENAME); if (!config_file_path) { pmgmt->signalManager(MGMT_SIGNAL_CONFIG_ERROR, "Unable to find proxy.config.url_remap.filename"); - Warning("%s Unable to locate remap.config. No remappings in effect", modulePrefix); + Warning("%s Unable to locate %s. No remappings in effect", modulePrefix, REMAP_CONF_FILENAME); return false; } diff --git a/proxy/logging/LogConfig.cc b/proxy/logging/LogConfig.cc index 77d517147da..7cf3b429948 100644 --- a/proxy/logging/LogConfig.cc +++ b/proxy/logging/LogConfig.cc @@ -34,6 +34,7 @@ #include "tscore/ink_file.h" #include "tscore/List.h" +#include "tscore/Filenames.h" #include "Log.h" #include "LogField.h" @@ -806,7 +807,7 @@ LogConfig::update_space_used() bool LogConfig::evaluate_config() { - ats_scoped_str path(RecConfigReadConfigPath("proxy.config.log.config.filename", "logging.yaml")); + ats_scoped_str path(RecConfigReadConfigPath("proxy.config.log.config.filename", LOGGING_CONF_FILENAME)); struct stat sbuf; if (stat(path.get(), &sbuf) == -1 && errno == ENOENT) { Warning("logging configuration '%s' doesn't exist", path.get()); diff --git a/proxy/shared/DiagsConfig.cc b/proxy/shared/DiagsConfig.cc index b1ce1fe33cb..88d3cfdd871 100644 --- a/proxy/shared/DiagsConfig.cc +++ b/proxy/shared/DiagsConfig.cc @@ -25,6 +25,7 @@ #include "tscore/ink_memory.h" #include "tscore/ink_file.h" #include "tscore/I_Layout.h" +#include "tscore/Filenames.h" #include "DiagsConfig.h" #include "records/P_RecCore.h" @@ -337,7 +338,7 @@ DiagsConfig::register_diags_callbacks() for (i = 0; config_record_names[i] != nullptr; i++) { status = (REC_RegisterConfigUpdateFunc(config_record_names[i], diags_config_callback, o) == REC_ERR_OKAY); if (!status) { - Warning("couldn't register variable '%s', is records.config up to date?", config_record_names[i]); + Warning("couldn't register variable '%s', is %s up to date?", config_record_names[i], RECORDS_CONF_FILENAME); } total_status = total_status && status; } diff --git a/src/traffic_layout/info.cc b/src/traffic_layout/info.cc index 64afb6110db..ac6ea4cb3e4 100644 --- a/src/traffic_layout/info.cc +++ b/src/traffic_layout/info.cc @@ -156,13 +156,13 @@ produce_layout(bool json) print_var("INCLUDEDIR", Layout::get()->includedir, json); print_var(RECORDS_CONF_FILENAME, RecConfigReadConfigPath(nullptr, RECORDS_CONF_FILENAME), json); - print_var("remap.config", RecConfigReadConfigPath("proxy.config.url_remap.filename"), json); - print_var("plugin.config", RecConfigReadConfigPath(nullptr, "plugin.config"), json); - print_var("ssl_multicert.config", RecConfigReadConfigPath("proxy.config.ssl.server.multicert.filename"), json); + print_var(REMAP_CONF_FILENAME, RecConfigReadConfigPath("proxy.config.url_remap.filename"), json); + print_var(PLUGIN_CONF_FILENAME, RecConfigReadConfigPath(nullptr, PLUGIN_CONF_FILENAME), json); + print_var(MULTICERT_CONF_FILENAME, RecConfigReadConfigPath("proxy.config.ssl.server.multicert.filename"), json); print_var(STORAGE_CONF_FILENAME, RecConfigReadConfigPath(nullptr, STORAGE_CONF_FILENAME), json); - print_var("hosting.config", RecConfigReadConfigPath("proxy.config.cache.hosting_filename"), json); - print_var("volume.config", RecConfigReadConfigPath("proxy.config.cache.volume_filename"), json); - print_var("ip_allow.yaml", RecConfigReadConfigPath("proxy.config.cache.ip_allow.filename"), json, true); + print_var(HOSTING_CONF_FILENAME, RecConfigReadConfigPath("proxy.config.cache.hosting_filename"), json); + print_var(VOLUME_CONF_FILENAME, RecConfigReadConfigPath("proxy.config.cache.volume_filename"), json); + print_var(IPALLOW_CONF_FILENAME, RecConfigReadConfigPath("proxy.config.cache.ip_allow.filename"), json, true); if (json) { printf("}\n"); } diff --git a/src/traffic_manager/AddConfigFilesHere.cc b/src/traffic_manager/AddConfigFilesHere.cc index 553c050d00c..bd8502a91cb 100644 --- a/src/traffic_manager/AddConfigFilesHere.cc +++ b/src/traffic_manager/AddConfigFilesHere.cc @@ -73,20 +73,20 @@ initializeRegistry() ink_assert(!"Configuration Object Registry Initialized More than Once"); } - registerFile("proxy.config.log.config.filename", "logging.yaml"); + registerFile("proxy.config.log.config.filename", LOGGING_CONF_FILENAME); registerFile("", STORAGE_CONF_FILENAME); - registerFile("proxy.config.socks.socks_config_file", "socks.config"); + registerFile("proxy.config.socks.socks_config_file", SOCKS_CONF_FILENAME); registerFile(RECORDS_CONF_FILENAME, RECORDS_CONF_FILENAME); - registerFile("proxy.config.cache.control.filename", "cache.config"); - registerFile("proxy.config.cache.ip_allow.filename", "ip_allow.yaml"); - registerFile("proxy.config.http.parent_proxy.file", "parent.config"); - registerFile("proxy.config.url_remap.filename", "remap.config"); - registerFile("", "volume.config"); - registerFile("proxy.config.cache.hosting_filename", "hosting.config"); - registerFile("", "plugin.config"); - registerFile("proxy.config.dns.splitdns.filename", "splitdns.config"); - registerFile("proxy.config.ssl.server.multicert.filename", "ssl_multicert.config"); - registerFile("proxy.config.ssl.servername.filename", "sni.config"); + registerFile("proxy.config.cache.control.filename", CACHE_CONF_FILENAME); + registerFile("proxy.config.cache.ip_allow.filename", IPALLOW_CONF_FILENAME); + registerFile("proxy.config.http.parent_proxy.file", PARENT_CONF_FILENAME); + registerFile("proxy.config.url_remap.filename", REMAP_CONF_FILENAME); + registerFile("", VOLUME_CONF_FILENAME); + registerFile("proxy.config.cache.hosting_filename", HOSTING_CONF_FILENAME); + registerFile("", PLUGIN_CONF_FILENAME); + registerFile("proxy.config.dns.splitdns.filename", SPLITDNS_CONF_FILENAME); + registerFile("proxy.config.ssl.server.multicert.filename", MULTICERT_CONF_FILENAME); + registerFile("proxy.config.ssl.servername.filename", SNI_CONF_FILENAME); configFiles->registerCallback(testcall); } diff --git a/src/traffic_server/InkAPITest.cc b/src/traffic_server/InkAPITest.cc index d6713a8180b..2c9e1662d5d 100644 --- a/src/traffic_server/InkAPITest.cc +++ b/src/traffic_server/InkAPITest.cc @@ -40,6 +40,7 @@ #include "tscore/ink_sprintf.h" #include "tscore/ink_file.h" #include "tscore/Regression.h" +#include "tscore/Filenames.h" #include "ts/ts.h" #include "ts/experimental.h" #include "records/I_RecCore.h" @@ -1995,7 +1996,6 @@ REGRESSION_TEST(SDK_API_TSCache)(RegressionTest *test, int /* atype ATS_UNUSED * // TSfread // TSfwrite ////////////////////////////////////////////// -#define PFX "plugin.config" // Note that for each test, if it fails, we set the error status and return. REGRESSION_TEST(SDK_API_TSfopen)(RegressionTest *test, int /* atype ATS_UNUSED */, int *pstatus) @@ -2013,8 +2013,7 @@ REGRESSION_TEST(SDK_API_TSfopen)(RegressionTest *test, int /* atype ATS_UNUSED * struct stat stat_buffer_pre, stat_buffer_post, stat_buffer_input; char *ret_val; int read = 0, wrote = 0; - int64_t read_amount = 0; - char INPUT_TEXT_FILE[] = "plugin.config"; + int64_t read_amount = 0; char input_file_full_path[BUFSIZ]; // Set full path to file at run time. @@ -2027,7 +2026,7 @@ REGRESSION_TEST(SDK_API_TSfopen)(RegressionTest *test, int /* atype ATS_UNUSED * return; } // Add "etc/trafficserver" to point to config directory - ink_filepath_make(input_file_full_path, sizeof(input_file_full_path), TSConfigDirGet(), INPUT_TEXT_FILE); + ink_filepath_make(input_file_full_path, sizeof(input_file_full_path), TSConfigDirGet(), PLUGIN_CONF_FILENAME); // open existing file for reading if (!(source_read_file = TSfopen(input_file_full_path, "r"))) { @@ -2041,7 +2040,7 @@ REGRESSION_TEST(SDK_API_TSfopen)(RegressionTest *test, int /* atype ATS_UNUSED * } // Create unique tmp _file_name_, do not use any TS file_name - snprintf(write_file_name, PATH_NAME_MAX, "/tmp/%sXXXXXX", PFX); + snprintf(write_file_name, PATH_NAME_MAX, "/tmp/%sXXXXXX", PLUGIN_CONF_FILENAME); int write_file_fd; // this file will be reopened below if ((write_file_fd = mkstemp(write_file_name)) <= 0) { SDK_RPRINT(test, "mkstemp", "std func", TC_FAIL, "can't create file for writing"); diff --git a/src/traffic_server/traffic_server.cc b/src/traffic_server/traffic_server.cc index 07d46ad740a..bd302099ee2 100644 --- a/src/traffic_server/traffic_server.cc +++ b/src/traffic_server/traffic_server.cc @@ -38,6 +38,7 @@ #include "tscore/ink_syslog.h" #include "tscore/hugepages.h" #include "tscore/runroot.h" +#include "tscore/Filenames.h" #include "ts/ts.h" // This is sadly needed because of us using TSThreadInit() for some reason. @@ -857,23 +858,23 @@ cmd_verify(char * /* cmd ATS_UNUSED */) if (!urlRewriteVerify()) { exitStatus |= (1 << 0); - fprintf(stderr, "ERROR: Failed to load remap.config, exitStatus %d\n\n", exitStatus); + fprintf(stderr, "ERROR: Failed to load %s, exitStatus %d\n\n", REMAP_CONF_FILENAME, exitStatus); } else { - fprintf(stderr, "INFO: Successfully loaded remap.config\n\n"); + fprintf(stderr, "INFO: Successfully loaded %s\n\n", REMAP_CONF_FILENAME); } if (RecReadConfigFile() != REC_ERR_OKAY) { exitStatus |= (1 << 1); - fprintf(stderr, "ERROR: Failed to load records.config, exitStatus %d\n\n", exitStatus); + fprintf(stderr, "ERROR: Failed to load %s, exitStatus %d\n\n", RECORDS_CONF_FILENAME, exitStatus); } else { - fprintf(stderr, "INFO: Successfully loaded records.config\n\n"); + fprintf(stderr, "INFO: Successfully loaded %s\n\n", RECORDS_CONF_FILENAME); } if (!plugin_init(true)) { exitStatus |= (1 << 2); - fprintf(stderr, "ERROR: Failed to load plugin.config, exitStatus %d\n\n", exitStatus); + fprintf(stderr, "ERROR: Failed to load %s, exitStatus %d\n\n", PLUGIN_CONF_FILENAME, exitStatus); } else { - fprintf(stderr, "INFO: Successfully loaded plugin.config\n\n"); + fprintf(stderr, "INFO: Successfully loaded %s\n\n", PLUGIN_CONF_FILENAME); } SSLInitializeLibrary(); @@ -1304,7 +1305,7 @@ syslog_log_configure() ats_free(facility_str); if (facility < 0) { - syslog(LOG_WARNING, "Bad syslog facility in records.config. Keeping syslog at LOG_DAEMON"); + syslog(LOG_WARNING, "Bad syslog facility in %s. Keeping syslog at LOG_DAEMON", RECORDS_CONF_FILENAME); } else { Debug("server", "Setting syslog facility to %d", facility); closelog(); @@ -1474,7 +1475,8 @@ change_uid_gid(const char *user) "\tand then rebuild the server.\n" "\tIt is strongly suggested that you instead modify the\n" "\tproxy.config.admin.user_id directive in your\n" - "\trecords.config file to list a non-root user.\n"); + "\t%s file to list a non-root user.\n", + RECORDS_CONF_FILENAME); } #endif } @@ -2098,13 +2100,13 @@ init_ssl_ctx_callback(void *ctx, bool server) static void load_ssl_file_callback(const char *ssl_file) { - pmgmt->signalConfigFileChild("ssl_multicert.config", ssl_file); + pmgmt->signalConfigFileChild(MULTICERT_CONF_FILENAME, ssl_file); } static void load_remap_file_callback(const char *remap_file) { - pmgmt->signalConfigFileChild("remap.config", remap_file); + pmgmt->signalConfigFileChild(REMAP_CONF_FILENAME, remap_file); } static void diff --git a/src/tscore/Filenames.cc b/src/tscore/Filenames.cc index 018804c7ffe..bd622064b8a 100644 --- a/src/tscore/Filenames.cc +++ b/src/tscore/Filenames.cc @@ -23,6 +23,20 @@ // Configuration file names const char *STORAGE_CONF_FILENAME = "storage.config"; const char *RECORDS_CONF_FILENAME = "records.config"; +const char *VOLUME_CONF_FILENAME = "volume.config"; +const char *PLUGIN_CONF_FILENAME = "plugin.config"; + +// These still need to have their corrensponding records.config settings remove +const char *LOGGING_CONF_FILENAME = "logging.yaml"; +const char *CACHE_CONF_FILENAME = "cache.config"; +const char *IPALLOW_CONF_FILENAME = "ip_allow.yaml"; +const char *HOSTING_CONF_FILENAME = "hosting.config"; +const char *SOCKS_CONF_FILENAME = "socks.config"; +const char *PARENT_CONF_FILENAME = "parent.config"; +const char *REMAP_CONF_FILENAME = "remap.config"; +const char *MULTICERT_CONF_FILENAME = "ssl_multicert.config"; +const char *SPLITDNS_CONF_FILENAME = "splitdns.config"; +const char *SNI_CONF_FILENAME = "sni.yaml"; /////////////////////////////////////////////////////////////////// // Various other file names From 324614e6876cea52f2ad38313059b42bf0611add Mon Sep 17 00:00:00 2001 From: Leif Hedstrom Date: Wed, 6 Nov 2019 21:02:02 -0700 Subject: [PATCH 2/4] Replaced with constexpr, and namespace. DON'T MERGE THIS!! --- include/tscore/Filenames.h | 48 +++++++++++++---------- iocore/cache/Cache.cc | 2 +- iocore/cache/CacheHosting.cc | 10 ++--- iocore/cache/Store.cc | 12 +++--- iocore/dns/SplitDNS.cc | 10 ++--- iocore/net/QUICMultiCertConfigLoader.cc | 4 +- iocore/net/SSLClientUtils.cc | 6 +-- iocore/net/SSLUtils.cc | 12 +++--- lib/records/RecCore.cc | 6 +-- mgmt/LocalManager.cc | 4 +- mgmt/RecordsConfig.cc | 22 +++++------ proxy/CacheControl.cc | 14 +++---- proxy/IPAllow.cc | 4 +- proxy/ParentSelection.cc | 12 +++--- proxy/Plugin.cc | 12 +++--- proxy/ReverseProxy.cc | 16 ++++---- proxy/http/HttpBodyFactory.cc | 2 +- proxy/http/HttpConfig.cc | 4 +- proxy/http/HttpTransact.cc | 2 +- proxy/http/remap/UrlRewrite.cc | 4 +- proxy/logging/LogConfig.cc | 2 +- proxy/shared/DiagsConfig.cc | 2 +- src/traffic_layout/info.cc | 16 ++++---- src/traffic_manager/AddConfigFilesHere.cc | 28 ++++++------- src/traffic_manager/traffic_manager.cc | 2 +- src/traffic_server/InkAPITest.cc | 4 +- src/traffic_server/traffic_server.cc | 20 +++++----- src/tscore/Filenames.cc | 43 -------------------- src/tscore/Makefile.am | 1 - src/tscore/unit_tests/test_layout.cc | 4 +- 30 files changed, 145 insertions(+), 183 deletions(-) delete mode 100644 src/tscore/Filenames.cc diff --git a/include/tscore/Filenames.h b/include/tscore/Filenames.h index a7d533f6321..fed779870d1 100644 --- a/include/tscore/Filenames.h +++ b/include/tscore/Filenames.h @@ -21,24 +21,30 @@ #pragma once -/////////////////////////////////////////////////////////////////// -// Configuration file names -extern const char *STORAGE_CONF_FILENAME; -extern const char *RECORDS_CONF_FILENAME; -extern const char *VOLUME_CONF_FILENAME; -extern const char *PLUGIN_CONF_FILENAME; - -extern const char *LOGGING_CONF_FILENAME; -extern const char *CACHE_CONF_FILENAME; -extern const char *IPALLOW_CONF_FILENAME; -extern const char *HOSTING_CONF_FILENAME; -extern const char *SOCKS_CONF_FILENAME; -extern const char *PARENT_CONF_FILENAME; -extern const char *REMAP_CONF_FILENAME; -extern const char *MULTICERT_CONF_FILENAME; -extern const char *SPLITDNS_CONF_FILENAME; -extern const char *SNI_CONF_FILENAME; - -/////////////////////////////////////////////////////////////////// -// Various other file names -extern const char *RECORDS_STATS_FILE; +namespace ts +{ +namespace filename +{ + constexpr const char *const STORAGE = "storage.config"; + constexpr const char *const RECORDS = "records.config"; + constexpr const char *const VOLUME = "volume.config"; + constexpr const char *const PLUGIN = "plugin.config"; + + // These still need to have their corrensponding records.config settings remove + constexpr const char *const LOGGING = "logging.yaml"; + constexpr const char *const CACHE = "cache.config"; + constexpr const char *const IP_ALLOW = "ip_allow.yaml"; + constexpr const char *const HOSTING = "hosting.config"; + constexpr const char *const SOCKS = "socks.config"; + constexpr const char *const PARENT = "parent.config"; + constexpr const char *const REMAP = "remap.config"; + constexpr const char *const SSL_MULTICERT = "ssl_multicert.config"; + constexpr const char *const SPLITDNS = "splitdns.config"; + constexpr const char *const SNI = "sni.yaml"; + + /////////////////////////////////////////////////////////////////// + // Various other file names + constexpr const char *const RECORDS_STATS = "records.snap"; + +} // namespace filename +} // namespace ts diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc index 8b52c6a5a8a..b150660b0db 100644 --- a/iocore/cache/Cache.cc +++ b/iocore/cache/Cache.cc @@ -3248,7 +3248,7 @@ ink_cache_init(ts::ModuleVersion v) Result result = theCacheStore.read_config(); if (result.failed()) { - Fatal("Failed to read cache configuration %s: %s", STORAGE_CONF_FILENAME, result.message()); + Fatal("Failed to read cache configuration %s: %s", ts::filename::STORAGE, result.message()); } } diff --git a/iocore/cache/CacheHosting.cc b/iocore/cache/CacheHosting.cc index 35d70113db0..24930c73ef2 100644 --- a/iocore/cache/CacheHosting.cc +++ b/iocore/cache/CacheHosting.cc @@ -245,7 +245,7 @@ int fstat_wrapper(int fd, struct stat *s); int CacheHostTable::BuildTableFromString(const char *config_file_path, char *file_buf) { - Note("%s loading ...", HOSTING_CONF_FILENAME); + Note("%s loading ...", ts::filename::HOSTING); // Table build locals Tokenizer bufTok("\n"); @@ -326,7 +326,7 @@ CacheHostTable::BuildTableFromString(const char *config_file_path, char *file_bu if (gen_host_rec.Init(type)) { Warning("Problems encountered while initializing the Generic Volume"); } - Note("%s finished loading", HOSTING_CONF_FILENAME); + Note("%s finished loading", ts::filename::HOSTING); return 0; } @@ -375,7 +375,7 @@ CacheHostTable::BuildTableFromString(const char *config_file_path, char *file_bu current = current->next; ats_free(last); - Note("%s finished loading", HOSTING_CONF_FILENAME); + Note("%s finished loading", ts::filename::HOSTING); } if (!generic_rec_initd) { @@ -597,11 +597,11 @@ ConfigVolumes::read_config_file() config_path = RecConfigReadConfigPath("proxy.config.cache.volume_filename"); ink_release_assert(config_path); - Note("%s loading ...", VOLUME_CONF_FILENAME); + Note("%s loading ...", ts::filename::VOLUME); file_buf = readIntoBuffer(config_path, "[CacheVolition]", nullptr); if (file_buf == nullptr) { - Error("%s failed to load", VOLUME_CONF_FILENAME); + Error("%s failed to load", ts::filename::VOLUME); Warning("Cannot read the config file: %s", (const char *)config_path); return; } diff --git a/iocore/cache/Store.cc b/iocore/cache/Store.cc index 119206f91ad..22592fdb726 100644 --- a/iocore/cache/Store.cc +++ b/iocore/cache/Store.cc @@ -325,13 +325,13 @@ Store::read_config() Span *sd = nullptr, *cur = nullptr; Span *ns; ats_scoped_fd fd; - ats_scoped_str storage_path(RecConfigReadConfigPath(nullptr, STORAGE_CONF_FILENAME)); + ats_scoped_str storage_path(RecConfigReadConfigPath(nullptr, ts::filename::STORAGE)); - Note("%s loading ...", STORAGE_CONF_FILENAME); + Note("%s loading ...", ts::filename::STORAGE); Debug("cache_init", "Store::read_config, fd = -1, \"%s\"", (const char *)storage_path); fd = ::open(storage_path, O_RDONLY); if (fd < 0) { - Error("%s failed to load", STORAGE_CONF_FILENAME); + Error("%s failed to load", ts::filename::STORAGE); return Result::failure("open %s: %s", (const char *)storage_path, strerror(errno)); } @@ -372,7 +372,7 @@ Store::read_config() const char *end; if ((size = ink_atoi64(e, &end)) <= 0 || *end != '\0') { delete sd; - Error("%s failed to load", STORAGE_CONF_FILENAME); + Error("%s failed to load", ts::filename::STORAGE); return Result::failure("failed to parse size '%s'", e); } } else if (0 == strncasecmp(HASH_BASE_STRING_KEY, e, sizeof(HASH_BASE_STRING_KEY) - 1)) { @@ -390,7 +390,7 @@ Store::read_config() } if (!*e || !ParseRules::is_digit(*e) || 0 >= (volume_num = ink_atoi(e))) { delete sd; - Error("%s failed to load", STORAGE_CONF_FILENAME); + Error("%s failed to load", ts::filename::STORAGE); return Result::failure("failed to parse volume number '%s'", e); } } @@ -442,7 +442,7 @@ Store::read_config() sd = nullptr; // these are all used. sort(); - Note("%s finished loading", STORAGE_CONF_FILENAME); + Note("%s finished loading", ts::filename::STORAGE); return Result::ok(); } diff --git a/iocore/dns/SplitDNS.cc b/iocore/dns/SplitDNS.cc index 27db19bc5de..2ad8c245507 100644 --- a/iocore/dns/SplitDNS.cc +++ b/iocore/dns/SplitDNS.cc @@ -131,7 +131,7 @@ SplitDNSConfig::reconfigure() return; } - Note("%s loading ...", SPLITDNS_CONF_FILENAME); + Note("%s loading ...", ts::filename::SPLITDNS); SplitDNS *params = new SplitDNS; @@ -139,7 +139,7 @@ SplitDNSConfig::reconfigure() params->m_DNSSrvrTable = new DNS_table("proxy.config.dns.splitdns.filename", modulePrefix, &sdns_dest_tags); if (nullptr == params->m_DNSSrvrTable || (0 == params->m_DNSSrvrTable->getEntryCount())) { - Error("%s failed to load", SPLITDNS_CONF_FILENAME); + Error("%s failed to load", ts::filename::SPLITDNS); Warning("No NAMEDs provided! Disabling SplitDNS"); gsplit_dns_enabled = 0; delete params; @@ -160,7 +160,7 @@ SplitDNSConfig::reconfigure() SplitDNSConfig::print(); } - Note("%s finished loading", SPLITDNS_CONF_FILENAME); + Note("%s finished loading", ts::filename::SPLITDNS); } /* -------------------------------------------------------------- @@ -477,7 +477,7 @@ SplitDNSRecord::Init(matcher_line *line_info) } if (!ats_is_ip(&m_servers.x_server_ip[0].sa)) { - return Result::failure("%s No server specified in %s at line %d", modulePrefix, SPLITDNS_CONF_FILENAME, line_num); + return Result::failure("%s No server specified in %s at line %d", modulePrefix, ts::filename::SPLITDNS, line_num); } DNSHandler *dnsH = new DNSHandler; @@ -506,7 +506,7 @@ SplitDNSRecord::Init(matcher_line *line_info) if (line_info->num_el > 0) { const char *tmp = ProcessModifiers(line_info); if (tmp != nullptr) { - return Result::failure("%s %s at line %d in %s", modulePrefix, tmp, line_num, SPLITDNS_CONF_FILENAME); + return Result::failure("%s %s at line %d in %s", modulePrefix, tmp, line_num, ts::filename::SPLITDNS); } } diff --git a/iocore/net/QUICMultiCertConfigLoader.cc b/iocore/net/QUICMultiCertConfigLoader.cc index b1c2df4144f..2b1aecf594d 100644 --- a/iocore/net/QUICMultiCertConfigLoader.cc +++ b/iocore/net/QUICMultiCertConfigLoader.cc @@ -129,7 +129,7 @@ QUICMultiCertConfigLoader::init_server_ssl_ctx(std::vector &cert_list, c #if TS_USE_TLS_SET_CIPHERSUITES if (params->server_tls13_cipher_suites != nullptr) { if (!SSL_CTX_set_ciphersuites(ctx, params->server_tls13_cipher_suites)) { - Error("invalid tls server cipher suites in %s", RECORDS_CONF_FILENAME); + Error("invalid tls server cipher suites in %s", ts::filename::RECORDS); goto fail; } } @@ -142,7 +142,7 @@ QUICMultiCertConfigLoader::init_server_ssl_ctx(std::vector &cert_list, c #else if (!SSL_CTX_set1_curves_list(ctx, params->server_groups_list)) { #endif - Error("invalid groups list for server in %s", RECORDS_CONF_FILENAME); + Error("invalid groups list for server in %s", ts::filename::RECORDS); goto fail; } } diff --git a/iocore/net/SSLClientUtils.cc b/iocore/net/SSLClientUtils.cc index b85624db33c..70f36d1740f 100644 --- a/iocore/net/SSLClientUtils.cc +++ b/iocore/net/SSLClientUtils.cc @@ -159,7 +159,7 @@ SSLInitClientContext(const SSLConfigParams *params) SSL_CTX_set_options(client_ctx, params->ssl_client_ctx_options); if (params->client_cipherSuite != nullptr) { if (!SSL_CTX_set_cipher_list(client_ctx, params->client_cipherSuite)) { - SSLError("invalid client cipher suite in %s", RECORDS_CONF_FILENAME); + SSLError("invalid client cipher suite in %s", ts::filename::RECORDS); goto fail; } } @@ -167,7 +167,7 @@ SSLInitClientContext(const SSLConfigParams *params) #if TS_USE_TLS_SET_CIPHERSUITES if (params->client_tls13_cipher_suites != nullptr) { if (!SSL_CTX_set_ciphersuites(client_ctx, params->client_tls13_cipher_suites)) { - SSLError("invalid tls client cipher suites in %s", RECORDS_CONF_FILENAME); + SSLError("invalid tls client cipher suites in %s", ts::filename::RECORDS); goto fail; } } @@ -180,7 +180,7 @@ SSLInitClientContext(const SSLConfigParams *params) #else if (!SSL_CTX_set1_curves_list(client_ctx, params->client_groups_list)) { #endif - SSLError("invalid groups list for client in %s", RECORDS_CONF_FILENAME); + SSLError("invalid groups list for client in %s", ts::filename::RECORDS); goto fail; } } diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc index 5434931defa..b1994c1b920 100644 --- a/iocore/net/SSLUtils.cc +++ b/iocore/net/SSLUtils.cc @@ -963,7 +963,7 @@ SSLPrivateKeyHandler(SSL_CTX *ctx, const SSLConfigParams *params, const std::str SSLConfigParams::load_ssl_file_cb(completeServerKeyPath); } } else { - SSLError("empty SSL private key path in %s", RECORDS_CONF_FILENAME); + SSLError("empty SSL private key path in %s", ts::filename::RECORDS); return false; } @@ -1329,7 +1329,7 @@ SSLMultiCertConfigLoader::init_server_ssl_ctx(std::vector &cert_list, co } else { // disable client cert support server_verify_client = SSL_VERIFY_NONE; - Error("illegal client certification level %d in %s", server_verify_client, RECORDS_CONF_FILENAME); + Error("illegal client certification level %d in %s", server_verify_client, ts::filename::RECORDS); } SSL_CTX_set_verify(ctx, server_verify_client, ssl_verify_client_callback); SSL_CTX_set_verify_depth(ctx, params->verify_depth); // might want to make configurable at some point. @@ -1341,7 +1341,7 @@ SSLMultiCertConfigLoader::init_server_ssl_ctx(std::vector &cert_list, co if (params->cipherSuite != nullptr) { if (!SSL_CTX_set_cipher_list(ctx, params->cipherSuite)) { - SSLError("invalid cipher suite in %s", RECORDS_CONF_FILENAME); + SSLError("invalid cipher suite in %s", ts::filename::RECORDS); goto fail; } } @@ -1349,7 +1349,7 @@ SSLMultiCertConfigLoader::init_server_ssl_ctx(std::vector &cert_list, co #if TS_USE_TLS_SET_CIPHERSUITES if (params->server_tls13_cipher_suites != nullptr) { if (!SSL_CTX_set_ciphersuites(ctx, params->server_tls13_cipher_suites)) { - SSLError("invalid tls server cipher suites in %s", RECORDS_CONF_FILENAME); + SSLError("invalid tls server cipher suites in %s", ts::filename::RECORDS); goto fail; } } @@ -1362,7 +1362,7 @@ SSLMultiCertConfigLoader::init_server_ssl_ctx(std::vector &cert_list, co #else if (!SSL_CTX_set1_curves_list(ctx, params->server_groups_list)) { #endif - SSLError("invalid groups list for server in %s", RECORDS_CONF_FILENAME); + SSLError("invalid groups list for server in %s", ts::filename::RECORDS); goto fail; } } @@ -1591,7 +1591,7 @@ SSLMultiCertConfigLoader::load(SSLCertLookup *lookup) const matcher_tags sslCertTags = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, false}; - Note("%s loading ...", MULTICERT_CONF_FILENAME); + Note("%s loading ...", ts::filename::SSL_MULTICERT); if (params->configFilePath) { file_buf = readIntoBuffer(params->configFilePath, __func__, nullptr); diff --git a/lib/records/RecCore.cc b/lib/records/RecCore.cc index 01430b7253e..75b481df963 100644 --- a/lib/records/RecCore.cc +++ b/lib/records/RecCore.cc @@ -219,9 +219,9 @@ RecCoreInit(RecModeT mode_type, Diags *_diags) ink_mutex_init(&g_rec_config_lock); - g_rec_config_fpath = ats_stringdup(RecConfigReadConfigPath(nullptr, RECORDS_CONF_FILENAME)); + g_rec_config_fpath = ats_stringdup(RecConfigReadConfigPath(nullptr, ts::filename::RECORDS)); if (RecFileExists(g_rec_config_fpath) == REC_ERR_FAIL) { - RecLog(DL_Warning, "Could not find '%s', system will run with defaults\n", RECORDS_CONF_FILENAME); + RecLog(DL_Warning, "Could not find '%s', system will run with defaults\n", ts::filename::RECORDS); file_exists = false; } @@ -1257,7 +1257,7 @@ std::string RecConfigReadPersistentStatsPath() { std::string rundir(RecConfigReadRuntimeDir()); - return Layout::relative_to(rundir, RECORDS_STATS_FILE); + return Layout::relative_to(rundir, ts::filename::RECORDS_STATS); } void diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc index b75576c1568..09c9c1ce030 100644 --- a/mgmt/LocalManager.cc +++ b/mgmt/LocalManager.cc @@ -750,9 +750,9 @@ LocalManager::processEventQueue() // check if we have a local file update if (mh->msg_id == MGMT_EVENT_CONFIG_FILE_UPDATE) { // records.config - if (!(strcmp(payload.begin(), RECORDS_CONF_FILENAME))) { + if (!(strcmp(payload.begin(), ts::filename::RECORDS))) { if (RecReadConfigFile() != REC_ERR_OKAY) { - mgmt_elog(errno, "[fileUpdated] Config update failed for %s\n", RECORDS_CONF_FILENAME); + mgmt_elog(errno, "[fileUpdated] Config update failed for %s\n", ts::filename::RECORDS); } else { RecConfigWarnIfUnregistered(); } diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc index 9361e33e3b2..3ffda96a191 100644 --- a/mgmt/RecordsConfig.cc +++ b/mgmt/RecordsConfig.cc @@ -421,7 +421,7 @@ static const RecordElement RecordsConfig[] = // ############################## {RECT_CONFIG, "proxy.config.http.parent_proxies", RECD_STRING, nullptr, RECU_DYNAMIC, RR_NULL, RECC_STR, ".*", RECA_NULL} , - {RECT_CONFIG, "proxy.config.http.parent_proxy.file", RECD_STRING, PARENT_CONF_FILENAME, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.http.parent_proxy.file", RECD_STRING, ts::filename::PARENT, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.http.parent_proxy.retry_time", RECD_INT, "300", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , @@ -688,7 +688,7 @@ static const RecordElement RecordsConfig[] = , {RECT_CONFIG, "proxy.config.socks.socks_version", RECD_INT, "4", RECU_RESTART_TS, RR_NULL, RECC_INT, "[4-5]", RECA_NULL} , - {RECT_CONFIG, "proxy.config.socks.socks_config_file", RECD_STRING, SOCKS_CONF_FILENAME, RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.socks.socks_config_file", RECD_STRING, ts::filename::SOCKS, RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.socks.socks_timeout", RECD_INT, "100", RECU_RESTART_TS, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL} , @@ -797,13 +797,13 @@ static const RecordElement RecordsConfig[] = //# Cache //# //############################################################################## - {RECT_CONFIG, "proxy.config.cache.control.filename", RECD_STRING, CACHE_CONF_FILENAME, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.cache.control.filename", RECD_STRING, ts::filename::CACHE, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , - {RECT_CONFIG, "proxy.config.cache.ip_allow.filename", RECD_STRING, IPALLOW_CONF_FILENAME, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.cache.ip_allow.filename", RECD_STRING, ts::filename::IP_ALLOW, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , - {RECT_CONFIG, "proxy.config.cache.hosting_filename", RECD_STRING, HOSTING_CONF_FILENAME, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.cache.hosting_filename", RECD_STRING, ts::filename::HOSTING, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , - {RECT_CONFIG, "proxy.config.cache.volume_filename", RECD_STRING, VOLUME_CONF_FILENAME, RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.cache.volume_filename", RECD_STRING, ts::filename::VOLUME, RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.cache.permit.pinning", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL} , @@ -880,7 +880,7 @@ static const RecordElement RecordsConfig[] = , {RECT_CONFIG, "proxy.config.dns.splitDNS.enabled", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL} , - {RECT_CONFIG, "proxy.config.dns.splitdns.filename", RECD_STRING, SPLITDNS_CONF_FILENAME, RECU_NULL, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.dns.splitdns.filename", RECD_STRING, ts::filename::SPLITDNS, RECU_NULL, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.dns.nameservers", RECD_STRING, nullptr, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , @@ -1001,7 +1001,7 @@ static const RecordElement RecordsConfig[] = , {RECT_CONFIG, "proxy.config.log.logfile_perm", RECD_STRING, "rw-r--r--", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , - {RECT_CONFIG, "proxy.config.log.config.filename", RECD_STRING, LOGGING_CONF_FILENAME, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.log.config.filename", RECD_STRING, ts::filename::LOGGING, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.log.preproc_threads", RECD_INT, "1", RECU_DYNAMIC, RR_REQUIRED, RECC_INT, "[1-128]", RECA_NULL} , @@ -1042,7 +1042,7 @@ static const RecordElement RecordsConfig[] = //############################################################################## {RECT_CONFIG, "proxy.config.reverse_proxy.enabled", RECD_INT, "1", RECU_DYNAMIC, RR_REQUIRED, RECC_INT, "[0-1]", RECA_NULL} , - {RECT_CONFIG, "proxy.config.url_remap.filename", RECD_STRING, REMAP_CONF_FILENAME, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.url_remap.filename", RECD_STRING, ts::filename::REMAP, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.url_remap.remap_required", RECD_INT, "1", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL} , @@ -1086,11 +1086,11 @@ static const RecordElement RecordsConfig[] = , {RECT_CONFIG, "proxy.config.ssl.server.cert_chain.filename", RECD_STRING, nullptr, RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , - {RECT_CONFIG, "proxy.config.ssl.server.multicert.filename", RECD_STRING, MULTICERT_CONF_FILENAME, RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.ssl.server.multicert.filename", RECD_STRING, ts::filename::SSL_MULTICERT, RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.ssl.server.multicert.exit_on_load_fail", RECD_INT, "1", RECU_RESTART_TS, RR_NULL, RECC_NULL, "[0-1]", RECA_NULL} , - {RECT_CONFIG, "proxy.config.ssl.servername.filename", RECD_STRING, SNI_CONF_FILENAME, RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.ssl.servername.filename", RECD_STRING, ts::filename::SNI, RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.ssl.server.ticket_key.filename", RECD_STRING, nullptr, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , diff --git a/proxy/CacheControl.cc b/proxy/CacheControl.cc index 308d00c0793..bf1608e33db 100644 --- a/proxy/CacheControl.cc +++ b/proxy/CacheControl.cc @@ -144,16 +144,16 @@ initCacheControl() void reloadCacheControl() { - Note("%s loading ...", CACHE_CONF_FILENAME); + Note("%s loading ...", ts::filename::CACHE); CC_table *newTable; - Debug("cache_control", "%s updated, reloading", CACHE_CONF_FILENAME); + Debug("cache_control", "%s updated, reloading", ts::filename::CACHE); eventProcessor.schedule_in(new CC_FreerContinuation(CacheControlTable), CACHE_CONTROL_TIMEOUT, ET_CACHE); newTable = new CC_table("proxy.config.cache.control.filename", modulePrefix, &http_dest_tags); ink_atomic_swap(&CacheControlTable, newTable); - Note("%s finished loading", CACHE_CONF_FILENAME); + Note("%s finished loading", ts::filename::CACHE); } void @@ -298,7 +298,7 @@ CacheControlRecord::Init(matcher_line *line_info) directive = CC_IGNORE_SERVER_NO_CACHE; d_found = true; } else { - return Result::failure("%s Invalid action at line %d in %s", modulePrefix, line_num, CACHE_CONF_FILENAME); + return Result::failure("%s Invalid action at line %d in %s", modulePrefix, line_num, ts::filename::CACHE); } } else { if (strcasecmp(label, "revalidate") == 0) { @@ -318,7 +318,7 @@ CacheControlRecord::Init(matcher_line *line_info) this->time_arg = time_in; } else { - return Result::failure("%s %s at line %d in %s", modulePrefix, tmp, line_num, CACHE_CONF_FILENAME); + return Result::failure("%s %s at line %d in %s", modulePrefix, tmp, line_num, ts::filename::CACHE); } } } @@ -332,14 +332,14 @@ CacheControlRecord::Init(matcher_line *line_info) } if (d_found == false) { - return Result::failure("%s No directive in %s at line %d", modulePrefix, CACHE_CONF_FILENAME, line_num); + return Result::failure("%s No directive in %s at line %d", modulePrefix, ts::filename::CACHE, line_num); } // Process any modifiers to the directive, if they exist if (line_info->num_el > 0) { tmp = ProcessModifiers(line_info); if (tmp != nullptr) { - return Result::failure("%s %s at line %d in %s", modulePrefix, tmp, line_num, CACHE_CONF_FILENAME); + return Result::failure("%s %s at line %d in %s", modulePrefix, tmp, line_num, ts::filename::CACHE); } } diff --git a/proxy/IPAllow.cc b/proxy/IPAllow.cc index 1e0b7fcd826..776c8b5fd34 100644 --- a/proxy/IPAllow.cc +++ b/proxy/IPAllow.cc @@ -137,14 +137,14 @@ IpAllow::reconfigure() { self_type *new_table; - Note("%s loading ...", IPALLOW_CONF_FILENAME); + Note("%s loading ...", ts::filename::IP_ALLOW); new_table = new self_type("proxy.config.cache.ip_allow.filename"); new_table->BuildTable(); configid = configProcessor.set(configid, new_table); - Note("%s finished loading", IPALLOW_CONF_FILENAME); + Note("%s finished loading", ts::filename::IP_ALLOW); } IpAllow * diff --git a/proxy/ParentSelection.cc b/proxy/ParentSelection.cc index 2d192a50890..27c52c9c531 100644 --- a/proxy/ParentSelection.cc +++ b/proxy/ParentSelection.cc @@ -265,7 +265,7 @@ ParentConfig::startup() void ParentConfig::reconfigure() { - Note("%s loading ...", PARENT_CONF_FILENAME); + Note("%s loading ...", ts::filename::PARENT); ParentConfigParams *params = nullptr; @@ -281,7 +281,7 @@ ParentConfig::reconfigure() ParentConfig::print(); } - Note("%s finished loading", PARENT_CONF_FILENAME); + Note("%s finished loading", ts::filename::PARENT); } // void ParentConfig::print @@ -744,14 +744,14 @@ ParentRecord::Init(matcher_line *line_info) } if (this->parents == nullptr && go_direct == false) { - return Result::failure("%s No parent specified in %s at line %d", modulePrefix, PARENT_CONF_FILENAME, line_num); + return Result::failure("%s No parent specified in %s at line %d", modulePrefix, ts::filename::PARENT, line_num); } // Process any modifiers to the directive, if they exist if (line_info->num_el > 0) { tmp = ProcessModifiers(line_info); if (tmp != nullptr) { - return Result::failure("%s %s at line %d in %s", modulePrefix, tmp, line_num, PARENT_CONF_FILENAME); + return Result::failure("%s %s at line %d in %s", modulePrefix, tmp, line_num, ts::filename::PARENT); } // record SCHEME modifier if present. // NULL if not present @@ -896,7 +896,7 @@ setup_socks_servers(ParentRecord *rec_arr, int len) void SocksServerConfig::reconfigure() { - Note("%s loading ...", SOCKS_CONF_FILENAME); + Note("%s loading ...", ts::filename::SOCKS); char *default_val = nullptr; int retry_time = 30; @@ -936,7 +936,7 @@ SocksServerConfig::reconfigure() SocksServerConfig::print(); } - Note("%s finished loading", SOCKS_CONF_FILENAME); + Note("%s finished loading", ts::filename::SOCKS); } void diff --git a/proxy/Plugin.cc b/proxy/Plugin.cc index d942a73a0ac..b658e31c811 100644 --- a/proxy/Plugin.cc +++ b/proxy/Plugin.cc @@ -209,7 +209,7 @@ plugin_expand(char *arg) } not_found: - Warning("%s: unable to find parameter %s", PLUGIN_CONF_FILENAME, arg); + Warning("%s: unable to find parameter %s", ts::filename::PLUGIN, arg); return nullptr; } @@ -232,11 +232,11 @@ plugin_init(bool validateOnly) INIT_ONCE = false; } - Note("%s loading ...", PLUGIN_CONF_FILENAME); - path = RecConfigReadConfigPath(nullptr, PLUGIN_CONF_FILENAME); + Note("%s loading ...", ts::filename::PLUGIN); + path = RecConfigReadConfigPath(nullptr, ts::filename::PLUGIN); fd = open(path, O_RDONLY); if (fd < 0) { - Warning("%s failed to load: %d, %s", PLUGIN_CONF_FILENAME, errno, strerror(errno)); + Warning("%s failed to load: %d, %s", ts::filename::PLUGIN, errno, strerror(errno)); return false; } @@ -312,9 +312,9 @@ plugin_init(bool validateOnly) close(fd); if (retVal) { - Note("%s finished loading", PLUGIN_CONF_FILENAME); + Note("%s finished loading", ts::filename::PLUGIN); } else { - Error("%s failed to load", PLUGIN_CONF_FILENAME); + Error("%s failed to load", ts::filename::PLUGIN); } return retVal; } diff --git a/proxy/ReverseProxy.cc b/proxy/ReverseProxy.cc index 56927217b14..0d68c8beb2a 100644 --- a/proxy/ReverseProxy.cc +++ b/proxy/ReverseProxy.cc @@ -65,11 +65,11 @@ init_reverse_proxy() reconfig_mutex = new_ProxyMutex(); rewrite_table = new UrlRewrite(); - Note("%s loading ...", REMAP_CONF_FILENAME); + Note("%s loading ...", ts::filename::REMAP); if (!rewrite_table->load()) { - Fatal("%s failed to load", REMAP_CONF_FILENAME); + Fatal("%s failed to load", ts::filename::REMAP); } - Note("%s finished loading", REMAP_CONF_FILENAME); + Note("%s finished loading", ts::filename::REMAP); REC_RegisterConfigUpdateFunc("proxy.config.url_remap.filename", url_rewrite_CB, (void *)FILE_CHANGED); REC_RegisterConfigUpdateFunc("proxy.config.proxy_name", url_rewrite_CB, (void *)TSNAME_CHANGED); @@ -137,8 +137,8 @@ reloadUrlRewrite() { UrlRewrite *newTable, *oldTable; - Note("%s loading ...", REMAP_CONF_FILENAME); - Debug("url_rewrite", "%s updated, reloading...", REMAP_CONF_FILENAME); + Note("%s loading ...", ts::filename::REMAP); + Debug("url_rewrite", "%s updated, reloading...", ts::filename::REMAP); newTable = new UrlRewrite(); if (newTable->load()) { static const char *msg = "%s finished loading"; @@ -155,15 +155,15 @@ reloadUrlRewrite() oldTable->pluginFactory.deactivate(); oldTable->release(); - Debug("url_rewrite", msg, REMAP_CONF_FILENAME); + Debug("url_rewrite", msg, ts::filename::REMAP); Note("%s", msg); return true; } else { static const char *msg = "%s failed to load"; delete newTable; - Debug("url_rewrite", msg, REMAP_CONF_FILENAME); - Error(msg, REMAP_CONF_FILENAME); + Debug("url_rewrite", msg, ts::filename::REMAP); + Error(msg, ts::filename::REMAP); return false; } } diff --git a/proxy/http/HttpBodyFactory.cc b/proxy/http/HttpBodyFactory.cc index 538da655b9d..a13d06daf57 100644 --- a/proxy/http/HttpBodyFactory.cc +++ b/proxy/http/HttpBodyFactory.cc @@ -335,7 +335,7 @@ HttpBodyFactory::HttpBodyFactory() for (i = 0; config_record_names[i] != nullptr; i++) { status = REC_RegisterConfigUpdateFunc(config_record_names[i], config_callback, (void *)this); if (status != REC_ERR_OKAY) { - Warning("couldn't register variable '%s', is %s up to date?", config_record_names[i], RECORDS_CONF_FILENAME); + Warning("couldn't register variable '%s', is %s up to date?", config_record_names[i], ts::filename::RECORDS); } no_registrations_failed = no_registrations_failed && (status == REC_ERR_OKAY); } diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc index 21899d60d1f..6ee3c46d5b7 100644 --- a/proxy/http/HttpConfig.cc +++ b/proxy/http/HttpConfig.cc @@ -1305,7 +1305,7 @@ HttpConfig::reconfigure() Warning("'%s' is set, but neither '%s' nor '%s' are " "set, please correct your %s", OutboundConnTrack::CONFIG_VAR_QUEUE_SIZE.data(), OutboundConnTrack::CONFIG_VAR_MAX.data(), - OutboundConnTrack::CONFIG_VAR_MIN.data(), RECORDS_CONF_FILENAME); + OutboundConnTrack::CONFIG_VAR_MIN.data(), ts::filename::RECORDS); } params->oride.attach_server_session_to_client = m_master.oride.attach_server_session_to_client; @@ -1314,7 +1314,7 @@ HttpConfig::reconfigure() if (params->oride.outbound_conntrack.max > 0 && params->oride.outbound_conntrack.max < params->oride.outbound_conntrack.min) { Warning("'%s' < per_server.min_keep_alive_connections, setting min=max , please correct your %s", - OutboundConnTrack::CONFIG_VAR_MAX.data(), RECORDS_CONF_FILENAME); + OutboundConnTrack::CONFIG_VAR_MAX.data(), ts::filename::RECORDS); params->oride.outbound_conntrack.min = params->oride.outbound_conntrack.max; } diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index 2cd8717272c..d3b670219fb 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -6063,7 +6063,7 @@ HttpTransact::is_response_cacheable(State *s, HTTPHdr *request, HTTPHdr *respons // Cache-Control headers to prevent caching if (s->cache_control.ttl_in_cache > 0) { TxnDebug("http_trans", "[is_response_cacheable] Cache-control header directives in response overridden by ttl in %s", - CACHE_CONF_FILENAME); + ts::filename::CACHE); } else { TxnDebug("http_trans", "[is_response_cacheable] NO by response cache control"); return false; diff --git a/proxy/http/remap/UrlRewrite.cc b/proxy/http/remap/UrlRewrite.cc index fcfc1ca155e..c0dc69b5da5 100644 --- a/proxy/http/remap/UrlRewrite.cc +++ b/proxy/http/remap/UrlRewrite.cc @@ -56,10 +56,10 @@ UrlRewrite::load() { ats_scoped_str config_file_path; - config_file_path = RecConfigReadConfigPath("proxy.config.url_remap.filename", REMAP_CONF_FILENAME); + config_file_path = RecConfigReadConfigPath("proxy.config.url_remap.filename", ts::filename::REMAP); if (!config_file_path) { pmgmt->signalManager(MGMT_SIGNAL_CONFIG_ERROR, "Unable to find proxy.config.url_remap.filename"); - Warning("%s Unable to locate %s. No remappings in effect", modulePrefix, REMAP_CONF_FILENAME); + Warning("%s Unable to locate %s. No remappings in effect", modulePrefix, ts::filename::REMAP); return false; } diff --git a/proxy/logging/LogConfig.cc b/proxy/logging/LogConfig.cc index 7cf3b429948..6500bc1dc69 100644 --- a/proxy/logging/LogConfig.cc +++ b/proxy/logging/LogConfig.cc @@ -807,7 +807,7 @@ LogConfig::update_space_used() bool LogConfig::evaluate_config() { - ats_scoped_str path(RecConfigReadConfigPath("proxy.config.log.config.filename", LOGGING_CONF_FILENAME)); + ats_scoped_str path(RecConfigReadConfigPath("proxy.config.log.config.filename", ts::filename::LOGGING)); struct stat sbuf; if (stat(path.get(), &sbuf) == -1 && errno == ENOENT) { Warning("logging configuration '%s' doesn't exist", path.get()); diff --git a/proxy/shared/DiagsConfig.cc b/proxy/shared/DiagsConfig.cc index 88d3cfdd871..2246dc89631 100644 --- a/proxy/shared/DiagsConfig.cc +++ b/proxy/shared/DiagsConfig.cc @@ -338,7 +338,7 @@ DiagsConfig::register_diags_callbacks() for (i = 0; config_record_names[i] != nullptr; i++) { status = (REC_RegisterConfigUpdateFunc(config_record_names[i], diags_config_callback, o) == REC_ERR_OKAY); if (!status) { - Warning("couldn't register variable '%s', is %s up to date?", config_record_names[i], RECORDS_CONF_FILENAME); + Warning("couldn't register variable '%s', is %s up to date?", config_record_names[i], ts::filename::RECORDS); } total_status = total_status && status; } diff --git a/src/traffic_layout/info.cc b/src/traffic_layout/info.cc index ac6ea4cb3e4..736e2879c0b 100644 --- a/src/traffic_layout/info.cc +++ b/src/traffic_layout/info.cc @@ -155,14 +155,14 @@ produce_layout(bool json) print_var("PLUGINDIR", RecConfigReadPluginDir(), json); print_var("INCLUDEDIR", Layout::get()->includedir, json); - print_var(RECORDS_CONF_FILENAME, RecConfigReadConfigPath(nullptr, RECORDS_CONF_FILENAME), json); - print_var(REMAP_CONF_FILENAME, RecConfigReadConfigPath("proxy.config.url_remap.filename"), json); - print_var(PLUGIN_CONF_FILENAME, RecConfigReadConfigPath(nullptr, PLUGIN_CONF_FILENAME), json); - print_var(MULTICERT_CONF_FILENAME, RecConfigReadConfigPath("proxy.config.ssl.server.multicert.filename"), json); - print_var(STORAGE_CONF_FILENAME, RecConfigReadConfigPath(nullptr, STORAGE_CONF_FILENAME), json); - print_var(HOSTING_CONF_FILENAME, RecConfigReadConfigPath("proxy.config.cache.hosting_filename"), json); - print_var(VOLUME_CONF_FILENAME, RecConfigReadConfigPath("proxy.config.cache.volume_filename"), json); - print_var(IPALLOW_CONF_FILENAME, RecConfigReadConfigPath("proxy.config.cache.ip_allow.filename"), json, true); + print_var(ts::filename::RECORDS, RecConfigReadConfigPath(nullptr, ts::filename::RECORDS), json); + print_var(ts::filename::REMAP, RecConfigReadConfigPath("proxy.config.url_remap.filename"), json); + print_var(ts::filename::PLUGIN, RecConfigReadConfigPath(nullptr, ts::filename::PLUGIN), json); + print_var(ts::filename::SSL_MULTICERT, RecConfigReadConfigPath("proxy.config.ssl.server.multicert.filename"), json); + print_var(ts::filename::STORAGE, RecConfigReadConfigPath(nullptr, ts::filename::STORAGE), json); + print_var(ts::filename::HOSTING, RecConfigReadConfigPath("proxy.config.cache.hosting_filename"), json); + print_var(ts::filename::VOLUME, RecConfigReadConfigPath("proxy.config.cache.volume_filename"), json); + print_var(ts::filename::IP_ALLOW, RecConfigReadConfigPath("proxy.config.cache.ip_allow.filename"), json, true); if (json) { printf("}\n"); } diff --git a/src/traffic_manager/AddConfigFilesHere.cc b/src/traffic_manager/AddConfigFilesHere.cc index bd8502a91cb..be91a826603 100644 --- a/src/traffic_manager/AddConfigFilesHere.cc +++ b/src/traffic_manager/AddConfigFilesHere.cc @@ -73,20 +73,20 @@ initializeRegistry() ink_assert(!"Configuration Object Registry Initialized More than Once"); } - registerFile("proxy.config.log.config.filename", LOGGING_CONF_FILENAME); - registerFile("", STORAGE_CONF_FILENAME); - registerFile("proxy.config.socks.socks_config_file", SOCKS_CONF_FILENAME); - registerFile(RECORDS_CONF_FILENAME, RECORDS_CONF_FILENAME); - registerFile("proxy.config.cache.control.filename", CACHE_CONF_FILENAME); - registerFile("proxy.config.cache.ip_allow.filename", IPALLOW_CONF_FILENAME); - registerFile("proxy.config.http.parent_proxy.file", PARENT_CONF_FILENAME); - registerFile("proxy.config.url_remap.filename", REMAP_CONF_FILENAME); - registerFile("", VOLUME_CONF_FILENAME); - registerFile("proxy.config.cache.hosting_filename", HOSTING_CONF_FILENAME); - registerFile("", PLUGIN_CONF_FILENAME); - registerFile("proxy.config.dns.splitdns.filename", SPLITDNS_CONF_FILENAME); - registerFile("proxy.config.ssl.server.multicert.filename", MULTICERT_CONF_FILENAME); - registerFile("proxy.config.ssl.servername.filename", SNI_CONF_FILENAME); + registerFile("proxy.config.log.config.filename", ts::filename::LOGGING); + registerFile("", ts::filename::STORAGE); + registerFile("proxy.config.socks.socks_config_file", ts::filename::SOCKS); + registerFile(ts::filename::RECORDS, ts::filename::RECORDS); + registerFile("proxy.config.cache.control.filename", ts::filename::CACHE); + registerFile("proxy.config.cache.ip_allow.filename", ts::filename::IP_ALLOW); + registerFile("proxy.config.http.parent_proxy.file", ts::filename::PARENT); + registerFile("proxy.config.url_remap.filename", ts::filename::REMAP); + registerFile("", ts::filename::VOLUME); + registerFile("proxy.config.cache.hosting_filename", ts::filename::HOSTING); + registerFile("", ts::filename::PLUGIN); + registerFile("proxy.config.dns.splitdns.filename", ts::filename::SPLITDNS); + registerFile("proxy.config.ssl.server.multicert.filename", ts::filename::SSL_MULTICERT); + registerFile("proxy.config.ssl.servername.filename", ts::filename::SNI); configFiles->registerCallback(testcall); } diff --git a/src/traffic_manager/traffic_manager.cc b/src/traffic_manager/traffic_manager.cc index ccbf1626267..152ab78280c 100644 --- a/src/traffic_manager/traffic_manager.cc +++ b/src/traffic_manager/traffic_manager.cc @@ -91,7 +91,7 @@ static char bind_stderr[512] = ""; static const char *mgmt_path = nullptr; // By default, set the current directory as base -static const char *recs_conf = RECORDS_CONF_FILENAME; +static const char *recs_conf = ts::filename::RECORDS; static int fds_limit; diff --git a/src/traffic_server/InkAPITest.cc b/src/traffic_server/InkAPITest.cc index 2c9e1662d5d..685da749bb1 100644 --- a/src/traffic_server/InkAPITest.cc +++ b/src/traffic_server/InkAPITest.cc @@ -2026,7 +2026,7 @@ REGRESSION_TEST(SDK_API_TSfopen)(RegressionTest *test, int /* atype ATS_UNUSED * return; } // Add "etc/trafficserver" to point to config directory - ink_filepath_make(input_file_full_path, sizeof(input_file_full_path), TSConfigDirGet(), PLUGIN_CONF_FILENAME); + ink_filepath_make(input_file_full_path, sizeof(input_file_full_path), TSConfigDirGet(), ts::filename::PLUGIN); // open existing file for reading if (!(source_read_file = TSfopen(input_file_full_path, "r"))) { @@ -2040,7 +2040,7 @@ REGRESSION_TEST(SDK_API_TSfopen)(RegressionTest *test, int /* atype ATS_UNUSED * } // Create unique tmp _file_name_, do not use any TS file_name - snprintf(write_file_name, PATH_NAME_MAX, "/tmp/%sXXXXXX", PLUGIN_CONF_FILENAME); + snprintf(write_file_name, PATH_NAME_MAX, "/tmp/%sXXXXXX", ts::filename::PLUGIN); int write_file_fd; // this file will be reopened below if ((write_file_fd = mkstemp(write_file_name)) <= 0) { SDK_RPRINT(test, "mkstemp", "std func", TC_FAIL, "can't create file for writing"); diff --git a/src/traffic_server/traffic_server.cc b/src/traffic_server/traffic_server.cc index bd302099ee2..1a934cc67b1 100644 --- a/src/traffic_server/traffic_server.cc +++ b/src/traffic_server/traffic_server.cc @@ -858,23 +858,23 @@ cmd_verify(char * /* cmd ATS_UNUSED */) if (!urlRewriteVerify()) { exitStatus |= (1 << 0); - fprintf(stderr, "ERROR: Failed to load %s, exitStatus %d\n\n", REMAP_CONF_FILENAME, exitStatus); + fprintf(stderr, "ERROR: Failed to load %s, exitStatus %d\n\n", ts::filename::REMAP, exitStatus); } else { - fprintf(stderr, "INFO: Successfully loaded %s\n\n", REMAP_CONF_FILENAME); + fprintf(stderr, "INFO: Successfully loaded %s\n\n", ts::filename::REMAP); } if (RecReadConfigFile() != REC_ERR_OKAY) { exitStatus |= (1 << 1); - fprintf(stderr, "ERROR: Failed to load %s, exitStatus %d\n\n", RECORDS_CONF_FILENAME, exitStatus); + fprintf(stderr, "ERROR: Failed to load %s, exitStatus %d\n\n", ts::filename::RECORDS, exitStatus); } else { - fprintf(stderr, "INFO: Successfully loaded %s\n\n", RECORDS_CONF_FILENAME); + fprintf(stderr, "INFO: Successfully loaded %s\n\n", ts::filename::RECORDS); } if (!plugin_init(true)) { exitStatus |= (1 << 2); - fprintf(stderr, "ERROR: Failed to load %s, exitStatus %d\n\n", PLUGIN_CONF_FILENAME, exitStatus); + fprintf(stderr, "ERROR: Failed to load %s, exitStatus %d\n\n", ts::filename::PLUGIN, exitStatus); } else { - fprintf(stderr, "INFO: Successfully loaded %s\n\n", PLUGIN_CONF_FILENAME); + fprintf(stderr, "INFO: Successfully loaded %s\n\n", ts::filename::PLUGIN); } SSLInitializeLibrary(); @@ -1305,7 +1305,7 @@ syslog_log_configure() ats_free(facility_str); if (facility < 0) { - syslog(LOG_WARNING, "Bad syslog facility in %s. Keeping syslog at LOG_DAEMON", RECORDS_CONF_FILENAME); + syslog(LOG_WARNING, "Bad syslog facility in %s. Keeping syslog at LOG_DAEMON", ts::filename::RECORDS); } else { Debug("server", "Setting syslog facility to %d", facility); closelog(); @@ -1476,7 +1476,7 @@ change_uid_gid(const char *user) "\tIt is strongly suggested that you instead modify the\n" "\tproxy.config.admin.user_id directive in your\n" "\t%s file to list a non-root user.\n", - RECORDS_CONF_FILENAME); + ts::filename::RECORDS); } #endif } @@ -2100,13 +2100,13 @@ init_ssl_ctx_callback(void *ctx, bool server) static void load_ssl_file_callback(const char *ssl_file) { - pmgmt->signalConfigFileChild(MULTICERT_CONF_FILENAME, ssl_file); + pmgmt->signalConfigFileChild(ts::filename::SSL_MULTICERT, ssl_file); } static void load_remap_file_callback(const char *remap_file) { - pmgmt->signalConfigFileChild(REMAP_CONF_FILENAME, remap_file); + pmgmt->signalConfigFileChild(ts::filename::REMAP, remap_file); } static void diff --git a/src/tscore/Filenames.cc b/src/tscore/Filenames.cc deleted file mode 100644 index bd622064b8a..00000000000 --- a/src/tscore/Filenames.cc +++ /dev/null @@ -1,43 +0,0 @@ -/** @file - - @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. - */ - -/////////////////////////////////////////////////////////////////// -// Configuration file names -const char *STORAGE_CONF_FILENAME = "storage.config"; -const char *RECORDS_CONF_FILENAME = "records.config"; -const char *VOLUME_CONF_FILENAME = "volume.config"; -const char *PLUGIN_CONF_FILENAME = "plugin.config"; - -// These still need to have their corrensponding records.config settings remove -const char *LOGGING_CONF_FILENAME = "logging.yaml"; -const char *CACHE_CONF_FILENAME = "cache.config"; -const char *IPALLOW_CONF_FILENAME = "ip_allow.yaml"; -const char *HOSTING_CONF_FILENAME = "hosting.config"; -const char *SOCKS_CONF_FILENAME = "socks.config"; -const char *PARENT_CONF_FILENAME = "parent.config"; -const char *REMAP_CONF_FILENAME = "remap.config"; -const char *MULTICERT_CONF_FILENAME = "ssl_multicert.config"; -const char *SPLITDNS_CONF_FILENAME = "splitdns.config"; -const char *SNI_CONF_FILENAME = "sni.yaml"; - -/////////////////////////////////////////////////////////////////// -// Various other file names -const char *RECORDS_STATS_FILE = "records.snap"; diff --git a/src/tscore/Makefile.am b/src/tscore/Makefile.am index faa2fc02ca3..c342179c890 100644 --- a/src/tscore/Makefile.am +++ b/src/tscore/Makefile.am @@ -64,7 +64,6 @@ libtscore_la_SOURCES = \ EventNotify.cc \ Extendible.cc \ fastlz.c \ - Filenames.cc \ Hash.cc \ HashFNV.cc \ HashMD5.cc \ diff --git a/src/tscore/unit_tests/test_layout.cc b/src/tscore/unit_tests/test_layout.cc index bd25517b798..736393bd847 100644 --- a/src/tscore/unit_tests/test_layout.cc +++ b/src/tscore/unit_tests/test_layout.cc @@ -80,8 +80,8 @@ TEST_CASE("relative to test", "[relative_to]") // relative to (4 parameters) char config_file[PATH_NAME_MAX]; - Layout::relative_to(config_file, sizeof(config_file), Layout::get()->sysconfdir, RECORDS_CONF_FILENAME); - std::string a = Layout::relative_to(Layout::get()->sysconfdir, RECORDS_CONF_FILENAME); + Layout::relative_to(config_file, sizeof(config_file), Layout::get()->sysconfdir, ts::filename::RECORDS); + std::string a = Layout::relative_to(Layout::get()->sysconfdir, ts::filename::RECORDS); std::string b = config_file; REQUIRE(a == b); } From fb014a4ffe7422547c22a4701bc9665fe3418e8a Mon Sep 17 00:00:00 2001 From: Leif Hedstrom Date: Sat, 9 Nov 2019 09:07:21 -0700 Subject: [PATCH 3/4] Mark a few more configurations deprecated --- doc/admin-guide/files/records.config.en.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst index c1df4085ccc..be0fb023817 100644 --- a/doc/admin-guide/files/records.config.en.rst +++ b/doc/admin-guide/files/records.config.en.rst @@ -2910,6 +2910,7 @@ Logging Configuration .. ts:cv:: CONFIG proxy.config.log.config.filename STRING logging.yaml :reloadable: + :deprecated: This configuration value specifies the path to the :file:`logging.yaml` configuration file. If this is a relative @@ -3192,6 +3193,7 @@ SSL Termination .. ts:cv:: CONFIG proxy.config.ssl.server.multicert.filename STRING ssl_multicert.config + :deprecated: The location of the :file:`ssl_multicert.config` file, relative to the |TS| configuration directory. In the following @@ -3260,6 +3262,7 @@ SSL Termination file is changed with new tickets, use :option:`traffic_ctl config reload` to begin using them. .. ts:cv:: CONFIG proxy.config.ssl.servername.filename STRING sni.yaml + :deprecated: The filename of the :file:`sni.yaml` configuration file. If relative, it is relative to the configuration directory. @@ -3988,6 +3991,7 @@ SOCKS Processor Specifies the SOCKS version (``4``) or (``5``) .. ts:cv:: CONFIG proxy.config.socks.socks_config_file STRING socks.config + :deprecated: The socks.config file allows you to specify ranges of IP addresses that will not be relayed to the SOCKS server. It can also be used From db7564027591125c13541f8bc623d3722f2d256a Mon Sep 17 00:00:00 2001 From: Leif Hedstrom Date: Sat, 9 Nov 2019 09:28:52 -0700 Subject: [PATCH 4/4] Remove one superfluous const --- include/tscore/Filenames.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/include/tscore/Filenames.h b/include/tscore/Filenames.h index fed779870d1..6fe0eb8f460 100644 --- a/include/tscore/Filenames.h +++ b/include/tscore/Filenames.h @@ -25,26 +25,26 @@ namespace ts { namespace filename { - constexpr const char *const STORAGE = "storage.config"; - constexpr const char *const RECORDS = "records.config"; - constexpr const char *const VOLUME = "volume.config"; - constexpr const char *const PLUGIN = "plugin.config"; + constexpr const char *STORAGE = "storage.config"; + constexpr const char *RECORDS = "records.config"; + constexpr const char *VOLUME = "volume.config"; + constexpr const char *PLUGIN = "plugin.config"; // These still need to have their corrensponding records.config settings remove - constexpr const char *const LOGGING = "logging.yaml"; - constexpr const char *const CACHE = "cache.config"; - constexpr const char *const IP_ALLOW = "ip_allow.yaml"; - constexpr const char *const HOSTING = "hosting.config"; - constexpr const char *const SOCKS = "socks.config"; - constexpr const char *const PARENT = "parent.config"; - constexpr const char *const REMAP = "remap.config"; - constexpr const char *const SSL_MULTICERT = "ssl_multicert.config"; - constexpr const char *const SPLITDNS = "splitdns.config"; - constexpr const char *const SNI = "sni.yaml"; + constexpr const char *LOGGING = "logging.yaml"; + constexpr const char *CACHE = "cache.config"; + constexpr const char *IP_ALLOW = "ip_allow.yaml"; + constexpr const char *HOSTING = "hosting.config"; + constexpr const char *SOCKS = "socks.config"; + constexpr const char *PARENT = "parent.config"; + constexpr const char *REMAP = "remap.config"; + constexpr const char *SSL_MULTICERT = "ssl_multicert.config"; + constexpr const char *SPLITDNS = "splitdns.config"; + constexpr const char *SNI = "sni.yaml"; /////////////////////////////////////////////////////////////////// // Various other file names - constexpr const char *const RECORDS_STATS = "records.snap"; + constexpr const char *RECORDS_STATS = "records.snap"; } // namespace filename } // namespace ts