TS-2082: fix build with --enable-standalone-iocore before we remove that completely, get it work fist.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/94215bf2 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/94215bf2 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/94215bf2 Branch: refs/heads/master Commit: 94215bf293d76d27a88a0fc9e35356321310fbf5 Parents: 1577c71 Author: Zhao Yongming <[email protected]> Authored: Mon Nov 4 23:33:16 2013 +0800 Committer: Zhao Yongming <[email protected]> Committed: Thu Nov 7 11:35:31 2013 +0800 ---------------------------------------------------------------------- CHANGES | 2 ++ iocore/cache/Cache.cc | 30 +++++++++++++-------------- iocore/cache/CacheHttp.cc | 16 +++++++------- iocore/cache/CacheRead.cc | 10 ++++++++- iocore/cache/CacheWrite.cc | 4 ++++ iocore/cache/I_CacheDefs.h | 2 +- iocore/cache/Makefile.am | 3 +++ iocore/cache/P_CacheInternal.h | 11 +++++----- iocore/dns/DNS.cc | 3 ++- iocore/dns/Makefile.am | 4 ++++ iocore/dns/P_DNSProcessor.h | 26 +++++++++++++++++++++++ iocore/dns/P_SplitDNSProcessor.h | 27 ------------------------ iocore/hostdb/HostDB.cc | 2 +- iocore/hostdb/Makefile.am | 3 +++ iocore/hostdb/MultiCache.cc | 1 + iocore/net/Makefile.am | 4 ++++ iocore/net/Socks.cc | 2 +- lib/records/RecMessage.cc | 6 ++++-- proxy/Initialize.cc | 39 +++++++++++++++++++++++++++++++---- proxy/Initialize.h | 2 +- proxy/shared/UglyLogStubs.cc | 1 + 21 files changed, 129 insertions(+), 69 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index d0a6d6c..bfbbc10 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,8 @@ Changes with Apache Traffic Server 4.2.0 + *) [TS-2082] fix build with --enable-standalone-iocore. + *) [TS-2712] Explicitly use subdir-objects in automake init. *) [TS-2309] Allow mod_generator plugin for lighttpd to accept "SI" postfixes. http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/iocore/cache/Cache.cc ---------------------------------------------------------------------- diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc index e903a90..da63ec4 100644 --- a/iocore/cache/Cache.cc +++ b/iocore/cache/Cache.cc @@ -123,20 +123,6 @@ CacheKey zero_key(0, 0); #if TS_USE_INTERIM_CACHE == 1 ClassAllocator<MigrateToInterimCache> migrateToInterimCacheAllocator("migrateToInterimCache"); #endif -void verify_cache_api() { - ink_assert((int)TS_EVENT_CACHE_OPEN_READ == (int)CACHE_EVENT_OPEN_READ); - ink_assert((int)TS_EVENT_CACHE_OPEN_READ_FAILED == (int)CACHE_EVENT_OPEN_READ_FAILED); - ink_assert((int)TS_EVENT_CACHE_OPEN_WRITE == (int)CACHE_EVENT_OPEN_WRITE); - ink_assert((int)TS_EVENT_CACHE_OPEN_WRITE_FAILED == (int)CACHE_EVENT_OPEN_WRITE_FAILED); - ink_assert((int)TS_EVENT_CACHE_REMOVE == (int)CACHE_EVENT_REMOVE); - ink_assert((int)TS_EVENT_CACHE_REMOVE_FAILED == (int)CACHE_EVENT_REMOVE_FAILED); - ink_assert((int)TS_EVENT_CACHE_SCAN == (int)CACHE_EVENT_SCAN); - ink_assert((int)TS_EVENT_CACHE_SCAN_FAILED == (int)CACHE_EVENT_SCAN_FAILED); - ink_assert((int)TS_EVENT_CACHE_SCAN_OBJECT == (int)CACHE_EVENT_SCAN_OBJECT); - ink_assert((int)TS_EVENT_CACHE_SCAN_OPERATION_BLOCKED == (int)CACHE_EVENT_SCAN_OPERATION_BLOCKED); - ink_assert((int)TS_EVENT_CACHE_SCAN_OPERATION_FAILED == (int)CACHE_EVENT_SCAN_OPERATION_FAILED); - ink_assert((int)TS_EVENT_CACHE_SCAN_DONE == (int)CACHE_EVENT_SCAN_DONE); -} struct VolInitInfo { @@ -220,7 +206,6 @@ ConfigVolumes config_volumes; #if TS_HAS_TESTS void force_link_CacheTestCaller() { - force_link_CacheTest(); } #endif @@ -309,12 +294,14 @@ CacheVC::CacheVC():alternate_index(CACHE_ALT_INDEX_DEFAULT) //coverity[uninit_member] } +#ifdef HTTP_CACHE HTTPInfo::FragOffset* CacheVC::get_frag_table() { ink_assert(alternate.valid()); return alternate.valid() ? alternate.get_frag_table() : 0; } +#endif VIO * CacheVC::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *abuf) @@ -594,7 +581,18 @@ int CacheProcessor::start_internal(int flags) { #ifdef NON_MODULAR - verify_cache_api(); + ink_assert((int)TS_EVENT_CACHE_OPEN_READ == (int)CACHE_EVENT_OPEN_READ); + ink_assert((int)TS_EVENT_CACHE_OPEN_READ_FAILED == (int)CACHE_EVENT_OPEN_READ_FAILED); + ink_assert((int)TS_EVENT_CACHE_OPEN_WRITE == (int)CACHE_EVENT_OPEN_WRITE); + ink_assert((int)TS_EVENT_CACHE_OPEN_WRITE_FAILED == (int)CACHE_EVENT_OPEN_WRITE_FAILED); + ink_assert((int)TS_EVENT_CACHE_REMOVE == (int)CACHE_EVENT_REMOVE); + ink_assert((int)TS_EVENT_CACHE_REMOVE_FAILED == (int)CACHE_EVENT_REMOVE_FAILED); + ink_assert((int)TS_EVENT_CACHE_SCAN == (int)CACHE_EVENT_SCAN); + ink_assert((int)TS_EVENT_CACHE_SCAN_FAILED == (int)CACHE_EVENT_SCAN_FAILED); + ink_assert((int)TS_EVENT_CACHE_SCAN_OBJECT == (int)CACHE_EVENT_SCAN_OBJECT); + ink_assert((int)TS_EVENT_CACHE_SCAN_OPERATION_BLOCKED == (int)CACHE_EVENT_SCAN_OPERATION_BLOCKED); + ink_assert((int)TS_EVENT_CACHE_SCAN_OPERATION_FAILED == (int)CACHE_EVENT_SCAN_OPERATION_FAILED); + ink_assert((int)TS_EVENT_CACHE_SCAN_DONE == (int)CACHE_EVENT_SCAN_DONE); #endif #if AIO_MODE == AIO_MODE_NATIVE http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/iocore/cache/CacheHttp.cc ---------------------------------------------------------------------- diff --git a/iocore/cache/CacheHttp.cc b/iocore/cache/CacheHttp.cc index 36db36a..e07698c 100644 --- a/iocore/cache/CacheHttp.cc +++ b/iocore/cache/CacheHttp.cc @@ -274,7 +274,7 @@ CacheHTTPInfoVector::~CacheHTTPInfoVector() -------------------------------------------------------------------------*/ int -CacheHTTPInfoVector::insert(CacheHTTPInfo * info, int index) +CacheHTTPInfoVector::insert(CacheHTTPInfo */* info ATS_UNUSED */, int index) { ink_assert(0); return index; @@ -285,7 +285,7 @@ CacheHTTPInfoVector::insert(CacheHTTPInfo * info, int index) void -CacheHTTPInfoVector::detach(int idx, CacheHTTPInfo * r) +CacheHTTPInfoVector::detach(int /* idx ATS_UNUSED */, CacheHTTPInfo */* r ATS_UNUSED */) { ink_assert(0); } @@ -294,7 +294,7 @@ CacheHTTPInfoVector::detach(int idx, CacheHTTPInfo * r) -------------------------------------------------------------------------*/ void -CacheHTTPInfoVector::remove(int idx, bool destroy) +CacheHTTPInfoVector::remove(int /* idx ATS_UNUSED */, bool /* destroy ATS_UNUSED */) { ink_assert(0); } @@ -303,7 +303,7 @@ CacheHTTPInfoVector::remove(int idx, bool destroy) -------------------------------------------------------------------------*/ void -CacheHTTPInfoVector::clear(bool destroy) +CacheHTTPInfoVector::clear(bool /* destroy ATS_UNUSED */) { } @@ -311,7 +311,7 @@ CacheHTTPInfoVector::clear(bool destroy) -------------------------------------------------------------------------*/ void -CacheHTTPInfoVector::print(char *buffer, size_t buf_size, bool temps) +CacheHTTPInfoVector::print(char */* buffer ATS_UNUSED */, size_t /* buf_size ATS_UNUSED */, bool /* temps ATS_UNUSED */) { ink_assert(0); } @@ -329,14 +329,14 @@ CacheHTTPInfoVector::marshal_length() /*------------------------------------------------------------------------- -------------------------------------------------------------------------*/ int -CacheHTTPInfoVector::marshal(char *buf, int length) +CacheHTTPInfoVector::marshal(char */* buf ATS_UNUSED */, int length) { ink_assert(0); return length; } int -CacheHTTPInfoVector::unmarshal(const char *buf, int length, RefCountObj * block_ptr) +CacheHTTPInfoVector::unmarshal(const char */* buf ATS_UNUSED */, int /* length ATS_UNUSED */, RefCountObj */* block_ptr ATS_UNUSED */) { ink_assert(0); return 0; @@ -346,7 +346,7 @@ CacheHTTPInfoVector::unmarshal(const char *buf, int length, RefCountObj * block_ /*------------------------------------------------------------------------- -------------------------------------------------------------------------*/ uint32_t -CacheHTTPInfoVector::get_handles(const char *buf, int length, RefCountObj * block_ptr) +CacheHTTPInfoVector::get_handles(const char */* buf ATS_UNUSED */, int /* length ATS_UNUSED */, RefCountObj */* block_ptr ATS_UNUSED */) { ink_assert(0); return 0; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/iocore/cache/CacheRead.cc ---------------------------------------------------------------------- diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc index f11aee4..6121668 100644 --- a/iocore/cache/CacheRead.cc +++ b/iocore/cache/CacheRead.cc @@ -632,6 +632,7 @@ CacheVC::openReadMain(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) vio.ndone = doc_len; return calluser(VC_EVENT_EOS); } +#ifdef HTTP_CACHE HTTPInfo::FragOffset* frags = alternate.get_frag_table(); if (is_debug_tag_set("cache_seek")) { char b[33], c[33]; @@ -699,6 +700,7 @@ CacheVC::openReadMain(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) key.toHexStr(target_key_str); Debug("cache_seek", "Read # %d @ %" PRId64"/%d for %" PRId64, fragment, doc_pos, doc->len, bytes); } +#endif } if (ntodo <= 0) return EVENT_CONT; @@ -1123,7 +1125,13 @@ CacheVC::openReadStartHead(int event, Event * e) Debug("cache_read", "CacheReadStartHead - read %s target %s - %s %d of %" PRId64" bytes, %d fragments", doc->key.toHexStr(xt), key.toHexStr(yt), f.single_fragment ? "single" : "multi", - doc->len, doc->total_len, alternate.get_frag_offset_count()); + doc->len, doc->total_len, +#ifdef HTTP_CACHE + alternate.get_frag_offset_count() +#else + 0 +#endif + ); } // the first fragment might have been gc'ed. Make sure the first // fragment is there before returning CACHE_EVENT_OPEN_READ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/iocore/cache/CacheWrite.cc ---------------------------------------------------------------------- diff --git a/iocore/cache/CacheWrite.cc b/iocore/cache/CacheWrite.cc index 1a35b3f..ee2160f 100644 --- a/iocore/cache/CacheWrite.cc +++ b/iocore/cache/CacheWrite.cc @@ -1223,11 +1223,13 @@ CacheVC::openWriteCloseDataDone(int event, Event *e) if (!fragment) { ink_assert(key == earliest_key); earliest_dir = dir; +#ifdef HTTP_CACHE } else { // Store the offset only if there is a table. // Currently there is no alt (and thence no table) for non-HTTP. if (alternate.valid()) alternate.push_frag_offset(write_pos); +#endif } fragment++; write_pos += write_len; @@ -1318,11 +1320,13 @@ CacheVC::openWriteWriteDone(int event, Event *e) if (!fragment) { ink_assert(key == earliest_key); earliest_dir = dir; +#ifdef HTTP_CACHE } else { // Store the offset only if there is a table. // Currently there is no alt (and thence no table) for non-HTTP. if (alternate.valid()) alternate.push_frag_offset(write_pos); +#endif } ++fragment; write_pos += write_len; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/iocore/cache/I_CacheDefs.h ---------------------------------------------------------------------- diff --git a/iocore/cache/I_CacheDefs.h b/iocore/cache/I_CacheDefs.h index 96337de..6b25873 100644 --- a/iocore/cache/I_CacheDefs.h +++ b/iocore/cache/I_CacheDefs.h @@ -63,7 +63,7 @@ enum CacheType { }; // NOTE: All the failures are ODD, and one greater than the success -// Some of these must match those in <ts/ts.h> (tested in verify_cache_api()) +// Some of these must match those in <ts/ts.h> enum CacheEventType { CACHE_EVENT_LOOKUP = CACHE_EVENT_EVENTS_START + 0, http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/iocore/cache/Makefile.am ---------------------------------------------------------------------- diff --git a/iocore/cache/Makefile.am b/iocore/cache/Makefile.am index c2242ca..366baaf 100644 --- a/iocore/cache/Makefile.am +++ b/iocore/cache/Makefile.am @@ -19,6 +19,9 @@ if STANDALONE_IOCORE AM_CPPFLAGS = \ $(iocore_include_dirs) \ + -I$(top_srcdir)/mgmt \ + -I$(top_srcdir)/mgmt/utils \ + -I$(top_srcdir)/lib \ -I$(top_srcdir)/lib/records \ -I$(top_srcdir)/lib/ts http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/iocore/cache/P_CacheInternal.h ---------------------------------------------------------------------- diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h index 3c180ac..929cac5 100644 --- a/iocore/cache/P_CacheInternal.h +++ b/iocore/cache/P_CacheInternal.h @@ -357,6 +357,11 @@ struct CacheVC: public CacheVConnection #ifdef HTTP_CACHE virtual void set_http_info(CacheHTTPInfo *info); virtual void get_http_info(CacheHTTPInfo ** info); + /** Get the fragment table. + @return The address of the start of the fragment table, + or @c NULL if there is no fragment table. + */ + virtual HTTPInfo::FragOffset* get_frag_table(); #endif virtual bool is_pread_capable(); virtual bool set_pin_in_cache(time_t time_pin); @@ -364,12 +369,6 @@ struct CacheVC: public CacheVConnection virtual bool set_disk_io_priority(int priority); virtual int get_disk_io_priority(); - /** Get the fragment table. - @return The address of the start of the fragment table, - or @c NULL if there is no fragment table. - */ - virtual HTTPInfo::FragOffset* get_frag_table(); - // offsets from the base stat #define CACHE_STAT_ACTIVE 0 #define CACHE_STAT_SUCCESS 1 http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/iocore/dns/DNS.cc ---------------------------------------------------------------------- diff --git a/iocore/dns/DNS.cc b/iocore/dns/DNS.cc index a84c8c0..ba24a8c 100644 --- a/iocore/dns/DNS.cc +++ b/iocore/dns/DNS.cc @@ -194,10 +194,12 @@ DNSProcessor::start(int, size_t stacksize) { dns_failover_try_period = dns_timeout + 1; // Modify the "default" accordingly +#ifndef STANDALONE_IOCORE if (SplitDNSConfig::gsplit_dns_enabled) { //reconfigure after threads start SplitDNSConfig::reconfigure(); } +#endif // Setup the default DNSHandler, it's used both by normal DNS, and SplitDNS (for PTR lookups etc.) dns_init(); @@ -373,7 +375,6 @@ DNSEntry::init(const char *x, int len, int qtype_arg, Continuation* acont, dnsH = dnsProcessor.handler; } #else - INK_NOWARN(adnsH); dnsH = dnsProcessor.handler; #endif // SPLIT_DNS http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/iocore/dns/Makefile.am ---------------------------------------------------------------------- diff --git a/iocore/dns/Makefile.am b/iocore/dns/Makefile.am index 300af79..cf4c85a 100644 --- a/iocore/dns/Makefile.am +++ b/iocore/dns/Makefile.am @@ -19,6 +19,10 @@ if STANDALONE_IOCORE AM_CPPFLAGS = \ $(iocore_include_dirs) \ + -I. \ + -I$(top_srcdir)/mgmt \ + -I$(top_srcdir)/mgmt/utils \ + -I$(top_srcdir)/lib \ -I$(top_srcdir)/lib/records \ -I$(top_srcdir)/lib/ts else http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/iocore/dns/P_DNSProcessor.h ---------------------------------------------------------------------- diff --git a/iocore/dns/P_DNSProcessor.h b/iocore/dns/P_DNSProcessor.h index e5b79f8..7df7e10 100644 --- a/iocore/dns/P_DNSProcessor.h +++ b/iocore/dns/P_DNSProcessor.h @@ -292,6 +292,32 @@ private: void validate_ip(); }; +/* -------------------------------------------------------------- + ** struct DNSServer + + A record for an single server + -------------------------------------------------------------- */ +struct DNSServer +{ + IpEndpoint x_server_ip[MAXNS]; + char x_dns_ip_line[MAXDNAME * 2]; + + char x_def_domain[MAXDNAME]; + char x_domain_srch_list[MAXDNAME]; + + DNSHandler *x_dnsH; + + DNSServer() + : x_dnsH(NULL) + { + memset(x_server_ip, 0, sizeof(x_server_ip)); + + memset(x_def_domain, 0, MAXDNAME); + memset(x_domain_srch_list, 0, MAXDNAME); + memset(x_dns_ip_line, 0, MAXDNAME * 2); + } +}; + TS_INLINE DNSHandler::DNSHandler() : Continuation(NULL), n_con(0), options(0), in_flight(0), name_server(0), in_write_dns(0), http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/iocore/dns/P_SplitDNSProcessor.h ---------------------------------------------------------------------- diff --git a/iocore/dns/P_SplitDNSProcessor.h b/iocore/dns/P_SplitDNSProcessor.h index 6785db1..b2559ad 100644 --- a/iocore/dns/P_SplitDNSProcessor.h +++ b/iocore/dns/P_SplitDNSProcessor.h @@ -129,33 +129,6 @@ TS_INLINE bool SplitDNSConfig::isSplitDNSEnabled() /* -------------------------------------------------------------- - ** struct DNSServer - - A record for an single server - -------------------------------------------------------------- */ -struct DNSServer -{ - IpEndpoint x_server_ip[MAXNS]; - char x_dns_ip_line[MAXDNAME * 2]; - - char x_def_domain[MAXDNAME]; - char x_domain_srch_list[MAXDNAME]; - - DNSHandler *x_dnsH; - - DNSServer() - : x_dnsH(NULL) - { - memset(x_server_ip, 0, sizeof(x_server_ip)); - - memset(x_def_domain, 0, MAXDNAME); - memset(x_domain_srch_list, 0, MAXDNAME); - memset(x_dns_ip_line, 0, MAXDNAME * 2); - } -}; - - -/* -------------------------------------------------------------- ** class DNSRequestData A record for an single server http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/iocore/hostdb/HostDB.cc ---------------------------------------------------------------------- diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc index 0b114b4..e421475 100644 --- a/iocore/hostdb/HostDB.cc +++ b/iocore/hostdb/HostDB.cc @@ -2460,7 +2460,7 @@ run_HostDBTest() if (is_action_tag_set("hostdb_test_rr")) eventProcessor.schedule_every(new HostDBTestRR, HRTIME_SECONDS(1), ET_NET); if (is_action_tag_set("hostdb_test_reverse")) { - eventProcessor.schedule_imm(new HostDBTestReverse, ET_CACHE); + eventProcessor.schedule_imm(new HostDBTestReverse, ET_CALL); } } #endif http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/iocore/hostdb/Makefile.am ---------------------------------------------------------------------- diff --git a/iocore/hostdb/Makefile.am b/iocore/hostdb/Makefile.am index f4661ca..c48b230 100644 --- a/iocore/hostdb/Makefile.am +++ b/iocore/hostdb/Makefile.am @@ -19,6 +19,9 @@ if STANDALONE_IOCORE AM_CPPFLAGS = \ $(iocore_include_dirs) \ + -I$(top_srcdir)/mgmt \ + -I$(top_srcdir)/mgmt/utils \ + -I$(top_srcdir)/lib \ -I$(top_srcdir)/lib/records \ -I$(top_srcdir)/lib/ts else http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/iocore/hostdb/MultiCache.cc ---------------------------------------------------------------------- diff --git a/iocore/hostdb/MultiCache.cc b/iocore/hostdb/MultiCache.cc index a9a6ceb..bd0fdb0 100644 --- a/iocore/hostdb/MultiCache.cc +++ b/iocore/hostdb/MultiCache.cc @@ -34,6 +34,7 @@ #include "P_HostDB.h" #else //extern const char *system_config_directory; +extern int hostdb_sync_frequency; #endif #include "P_MultiCache.h" http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/iocore/net/Makefile.am ---------------------------------------------------------------------- diff --git a/iocore/net/Makefile.am b/iocore/net/Makefile.am index a10dbf9..f1cb2d1 100644 --- a/iocore/net/Makefile.am +++ b/iocore/net/Makefile.am @@ -19,6 +19,9 @@ if STANDALONE_IOCORE AM_CPPFLAGS = \ $(iocore_include_dirs) \ + -I$(top_srcdir)/mgmt \ + -I$(top_srcdir)/mgmt/utils \ + -I$(top_srcdir)/lib \ -I$(top_srcdir)/lib/records \ -I$(top_srcdir)/lib/ts else @@ -29,6 +32,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/lib/ts \ -I$(top_srcdir)/proxy \ -I$(top_srcdir)/proxy/hdrs \ + -I$(top_srcdir)/proxy/shared \ -I$(top_srcdir)/mgmt \ -I$(top_srcdir)/mgmt/preparse \ -I$(top_srcdir)/mgmt/utils http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/iocore/net/Socks.cc ---------------------------------------------------------------------- diff --git a/iocore/net/Socks.cc b/iocore/net/Socks.cc index 5f37919..88b22e5 100644 --- a/iocore/net/Socks.cc +++ b/iocore/net/Socks.cc @@ -122,7 +122,7 @@ SocksEntry::findServer() #else if (nattempts > netProcessor.socks_conf_stuff->connection_attempts) memset(&server_addr, 0, sizeof(server_addr)); - else ats_ip_copy(server_addr, g_socks_conf_stuff->socks_server); + else ats_ip_copy(&server_addr, &g_socks_conf_stuff->server_addr); #endif // SOCKS_WITH_TS char buff[INET6_ADDRSTRLEN]; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/lib/records/RecMessage.cc ---------------------------------------------------------------------- diff --git a/lib/records/RecMessage.cc b/lib/records/RecMessage.cc index 87c59ca..8c84c8b 100644 --- a/lib/records/RecMessage.cc +++ b/lib/records/RecMessage.cc @@ -39,6 +39,8 @@ static void *g_recv_cookie = NULL; //------------------------------------------------------------------------- #if defined (REC_BUILD_STAND_ALONE) +extern RecModeT g_mode_type; + static LLQ *g_send_llq = NULL; static LLQ *g_recv_llq = NULL; @@ -71,7 +73,7 @@ send_thr(void *data) static void * recv_thr(void *data) { - int msg_size; + int msg_size = 0; RecMessageHdr msg_hdr; RecMessage *msg; RecHandle h_pipe = (RecHandle)(intptr_t)data; @@ -145,7 +147,7 @@ RecMessageInit() g_send_llq = create_queue(); g_recv_llq = create_queue(); - switch (mode_type) { + switch (g_mode_type) { case RECM_CLIENT: h_pipe = RecPipeConnect(Layout::get()->runtimedir, REC_PIPE_NAME); if (h_pipe == REC_HANDLE_INVALID) { http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/proxy/Initialize.cc ---------------------------------------------------------------------- diff --git a/proxy/Initialize.cc b/proxy/Initialize.cc index c74b0f5..be296b2 100644 --- a/proxy/Initialize.cc +++ b/proxy/Initialize.cc @@ -37,7 +37,9 @@ #include "I_Version.h" #include "Initialize.h" // TODO: move to I_Initialize.h ??? +#include "ink_sys_control.h" +extern char* admin_user; // // Initialize operating system related information/services @@ -61,7 +63,7 @@ init_system_settings(void) #endif static int -set_core_size(const char *name, RecDataT data_type, RecData data, void *opaque_token) +set_core_size(const char */* name ATS_UNUSED */, RecDataT /* data_type ATS_UNUSED */, RecData data, void */* opaque_token ATS_UNUSED */) { RecInt size = data.rec_int; @@ -237,6 +239,35 @@ init_system_reconfigure_diags(void) } +void +chown_file_to_user(const char *file, const char *user) +{ + struct passwd *pwd = NULL; + + if (user && *user) { + if (*user == '#') { + int uid = atoi(user + 1); + if (uid == -1) { + // XXX: Can this call hapen after setuid? + uid = (int)geteuid(); + } + pwd = getpwuid((uid_t)uid); + } else { + pwd = getpwnam(user); + } + if (pwd) { + if (chown(file, pwd->pw_uid, pwd->pw_gid) < 0) { + diags->print(NULL, DL_Warning, __FILE__, __FUNCTION__, __LINE__, "cop couldn't chown the file: '%s' [%d] %s\n", + file, errno, strerror(errno) + ); + } + } else { + diags->print(NULL, DL_Warning, __FILE__, __FUNCTION__, __LINE__, "can't get passwd entry for the admin user '%s' - [%d] %s\n", user, errno, strerror(errno)); + } + } else { + diags->print(NULL, DL_Warning, __FILE__, __FUNCTION__, __LINE__, "Admin user was the empty string.\n"); + } +} void init_system_diags(char *bdt, char *bat) @@ -250,7 +281,7 @@ init_system_diags(char *bdt, char *bat) diags_log_fp = fopen(diags_logpath, "w"); if (diags_log_fp) { int status; - chown_file_to_user(diag_logpath,admin_user); + chown_file_to_user(diags_logpath, admin_user); status = setvbuf(diags_log_fp, NULL, _IOLBF, 512); if (status != 0) { fclose(diags_log_fp); @@ -262,10 +293,10 @@ init_system_diags(char *bdt, char *bat) if (diags_log_fp == NULL) { SrcLoc loc(__FILE__, __FUNCTION__, __LINE__); - diags->print(NULL, DL_Warning, NULL, &loc, + diags->print(NULL, DL_Warning, __FILE__, __FUNCTION__, __LINE__, "couldn't open diags log file '%s', " "will not log to this file", diags_logpath); } else { - diags->print(NULL, DL_Status, "STATUS", NULL, "opened %s", diags_logpath); + diags->print(NULL, DL_Status, "STATUS", NULL, 0, "opened %s", diags_logpath); } init_system_reconfigure_diags(); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/proxy/Initialize.h ---------------------------------------------------------------------- diff --git a/proxy/Initialize.h b/proxy/Initialize.h index 485f8e7..556f251 100644 --- a/proxy/Initialize.h +++ b/proxy/Initialize.h @@ -49,7 +49,7 @@ void init_system_syslog_log_configure(void); //void init_system_logging(); void init_system_reconfigure_diags(void); void init_system_diags(char *bdt, char *bat); - +void chown_file_to_user(const char *file, const char *user); void init_system_adjust_num_of_net_threads(void); //void initialize_standalone(); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94215bf2/proxy/shared/UglyLogStubs.cc ---------------------------------------------------------------------- diff --git a/proxy/shared/UglyLogStubs.cc b/proxy/shared/UglyLogStubs.cc index 0a048e8..9690571 100644 --- a/proxy/shared/UglyLogStubs.cc +++ b/proxy/shared/UglyLogStubs.cc @@ -196,6 +196,7 @@ UnixNetProcessor::freeThread(UnixNetVConnection * /* vc ATS_UNUSED */, EThread * // For Intel ICC int cache_config_mutex_retry_delay = 2; +#include "I_SplitDNSProcessor.h" void SplitDNSConfig::reconfigure() {
