• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修訂a25ac81183f94e01b6face1db6e06ae210f0df92 (tree)
時間2013-07-05 11:31:00
作者Hiroaki Nakano <nakano.hiroaki@nttc...>
CommiterHiroaki Nakano

Log Message

Merge branch 'v3.1.0-devel' into gettid_for_debug

Change Summary

差異

--- a/CHANGES
+++ b/CHANGES
@@ -1,8 +1,19 @@
1-[Sep. 8 2012] 3.1.0-1 HIBARI Michiro
1+[Sep. 8 2012] 3.1.0-1 HIBARI Michiro, Hiroaki Nakano
22 - Add "session_thread_pool_size" option for l7vsadm and l7directord.
33 - Change spec file. Make devel package.
44 - Fixed bug: Evaluated the header section with the body section in HTTP negotiate check.
55 - Add "server_connect_timeout" option at l7vsd.cf.
6+ - #30844 Fixed man isn't installed.
7+ - #30845 Fixed config file of log-rotation isn't installed.
8+ - #30846 Add CRM sample file for Pacemaker.
9+ - #30847 Support cross operation on Pacemaker.
10+ - #30993 Fixed compailing error of gcc4.6.
11+ - #31199 Fixed remaining threads when deleted virtual service.
12+ - #31200 Fixed segmantaion fault when deleted virtual service.
13+ - #31545 Fixed bulding error of boost 1.50 upper.
14+
15+[Dec. 12 2012] 3.0.4-3 Hiroaki Nakano
16+ - Fixed breaking HTTP header over MAX_BUFFER_SIZE on ip module.(#30300 patch)
617
718 [Aug. 30 2012] 3.0.4-2 Hiroaki Nakano
819 - Fixed LogLevel at #29144 patch.
--- a/l7directord/init.d/l7directord
+++ b/l7directord/init.d/l7directord
@@ -39,6 +39,7 @@ case "$1" in
3939 start)
4040 action "Starting l7directord ... " /usr/sbin/l7directord start
4141 if [ $? -eq 0 ]; then
42+ mkdir -p `dirname $LOCKFILE`
4243 touch $LOCKFILE
4344 fi
4445 ;;
--- a/l7vsd/include/session_thread_control.h
+++ b/l7vsd/include/session_thread_control.h
@@ -120,7 +120,7 @@ public:
120120 }
121121
122122 //! create up down thread
123- void start_thread();
123+ int start_thread();
124124
125125 //! session shared ptr getter
126126 //! @return session shared ptr
--- a/l7vsd/include/virtualservice.h
+++ b/l7vsd/include/virtualservice.h
@@ -451,6 +451,8 @@ protected:
451451 session_map_type active_sessions;
452452 l7vs::atomic<unsigned long long>
453453 active_count;
454+ session_thread_control *waiting_stc;
455+ //! session_thread_control waiting accept
454456
455457 bool defer_accept_opt;
456458 //! is set option TCP_DEFER_ACCEPT
--- a/l7vsd/init.d/l7vsd
+++ b/l7vsd/init.d/l7vsd
@@ -39,6 +39,7 @@ start() {
3939 else
4040 echo "done."
4141 pidof $PROG > $PIDFILE
42+ mkdir -p `dirname $LOCKFILE`
4243 touch $LOCKFILE
4344 fi
4445
--- a/l7vsd/module/protocol/protocol_module_ip.cpp
+++ b/l7vsd/module/protocol/protocol_module_ip.cpp
@@ -324,7 +324,6 @@ protocol_module_base::check_message_result protocol_module_ip::check_parameter(c
324324 bool timeout_flag = false;
325325 bool reschedule_flag = false;
326326 bool no_reschedule_flag = false;
327- bool forward_checked = false;
328327 bool sorryuri_checked = false;
329328 bool stats_checked = false;
330329
@@ -447,11 +446,6 @@ protocol_module_base::check_message_result protocol_module_ip::check_parameter(c
447446 break;
448447 }
449448 }
450- //option string = "-F"
451- else if (*it == "-F" || *it == "--forwarded-for") {
452- //set forward flag ON
453- forward_checked = true;
454- }
455449 //option string = "-S"
456450 else if (*it == "-S" || *it == "--sorry-uri") {
457451 //set sorryURI flag OFF
@@ -5657,11 +5651,6 @@ bool protocol_module_ip::put_data_into_sendbuffer(
56575651 buffer_element.first += sendbuffer_rest_size;
56585652 buffer_element.second -= sendbuffer_rest_size;
56595653 sendbuffer_rest_size = 0;
5660-
5661- //add remain item
5662- data_ptr->buffer_sequence.push_back(buffer_element);
5663- //delete the item
5664- data_ptr->buffer_sequence.pop_front();
56655654 break;
56665655 }
56675656 }
--- a/l7vsd/module/protocol/protocol_module_ip.h
+++ b/l7vsd/module/protocol/protocol_module_ip.h
@@ -93,8 +93,8 @@ protected:
9393 hash = cl_endpoint.address().to_v4().to_ulong() * GOLDEN_RATIO_PRIME;
9494 } else {
9595 boost::asio::ip::address_v6::bytes_type v6_bytes = cl_endpoint.address().to_v6().to_bytes();
96- boost::asio::ip::address_v4::bytes_type v4_bytes = {{v6_bytes[12], v6_bytes[13], v6_bytes[14], v6_bytes[15]}};
97- boost::asio::ip::address_v4::address_v4 v4_address = boost::asio::ip::address_v4::address_v4(v4_bytes);
96+ const boost::asio::ip::address_v4::bytes_type v4_bytes = {{v6_bytes[12], v6_bytes[13], v6_bytes[14], v6_bytes[15]}};
97+ boost::asio::ip::address_v4 v4_address(v4_bytes);
9898 hash = v4_address.to_ulong() * GOLDEN_RATIO_PRIME;
9999
100100 }
--- a/l7vsd/module/protocol/protocol_module_sessionless.cpp
+++ b/l7vsd/module/protocol/protocol_module_sessionless.cpp
@@ -356,7 +356,6 @@ protocol_module_base::check_message_result protocol_module_sessionless::check_pa
356356 //set check result true
357357 check_message_result check_result;
358358 check_result.flag = true;
359- bool forward_checked = false;
360359 bool sorryuri_checked = false;
361360 bool stats_checked = false;
362361
@@ -405,13 +404,8 @@ protocol_module_base::check_message_result protocol_module_sessionless::check_pa
405404 vec_str_it it_end = args.end();
406405 //loop option strings
407406 for (; it != it_end; ++it) {
408- //option string = "-F"
409- if (*it == "-F" || *it == "--forwarded-for") {
410- //set forward flag ON
411- forward_checked = true;
412- }
413407 //option string = "-S"
414- else if (*it == "-S" || *it == "--sorry-uri") {
408+ if (*it == "-S" || *it == "--sorry-uri") {
415409 //set sorryURI flag OFF
416410 if (!sorryuri_checked) {
417411 //next item exist
--- a/l7vsd/src/l7vsadm.cpp
+++ b/l7vsd/src/l7vsadm.cpp
@@ -2993,14 +2993,14 @@ bool l7vs::l7vsadm::execute(int argc, char *argv[])
29932993 set_parameter();
29942994
29952995 // Get l7vsadm execute file path from /proc/(pid)/exe (symbolic link)
2996+ ssize_t ret;
29962997 char l7vsadm_file_path[256];
2997- ssize_t retsize;
29982998 memset(l7vsadm_file_path, 0, sizeof(l7vsadm_file_path));
2999- retsize = readlink("/proc/self/exe", l7vsadm_file_path, sizeof(l7vsadm_file_path));
2999+ ret = readlink("/proc/self/exe", l7vsadm_file_path, sizeof(l7vsadm_file_path));
30003000
30013001 // L7vsadm command conflict check. (Try l7vsadm execute file lock)
30023002 file_lock lock(l7vsadm_file_path, l7vsadm_err);
3003- if (l7vsadm_err) {
3003+ if (l7vsadm_err || ret == -1) {
30043004 std::cerr << "COMMON ERROR: " << l7vsadm_err.get_message() << std::endl;
30053005 Logger::putLogError(LOG_CAT_L7VSADM_COMMON, 2, l7vsadm_err.get_message(), __FILE__, __LINE__);
30063006 return false;
@@ -3039,7 +3039,12 @@ bool l7vs::l7vsadm::execute(int argc, char *argv[])
30393039
30403040 // Lock retrying.
30413041 boost::xtime xt;
3042+#if BOOST_VERSION >= 105000
3043+ xtime_get(&xt, boost::TIME_UTC_);
3044+#else
30423045 xtime_get(&xt, boost::TIME_UTC);
3046+#endif
3047+
30433048 xt.sec += command_wait_interval;
30443049 boost::thread::sleep(xt);
30453050 }
--- a/l7vsd/src/logger_impl.cpp
+++ b/l7vsd/src/logger_impl.cpp
@@ -343,9 +343,8 @@ bool l7vs::LoggerImpl::init()
343343 }
344344
345345 // get hostname
346- int ret = 0;
347346 char buff[HOST_NAME_MAX];
348- ret = gethostname(buff, HOST_NAME_MAX);
347+ gethostname(buff, HOST_NAME_MAX);
349348 hostname = buff;
350349
351350 initialized = true;
--- a/l7vsd/src/session_thread_control.cpp
+++ b/l7vsd/src/session_thread_control.cpp
@@ -34,18 +34,18 @@ namespace l7vs
3434 //
3535 //! @brief create up down thread
3636 //
37-void session_thread_control::start_thread()
37+int session_thread_control::start_thread()
3838 {
3939
40- int int_val;
41-
4240 upthread.reset(new boost::thread(&session_thread_control::upstream_run, this)); //! upstream thread create
4341 downthread.reset(new boost::thread(&session_thread_control::downstream_run, this)); //! downstream thread create
4442
4543 //pthread_setschedparam
4644 int retval, sched_policy;
4745 sched_param scheduler_param;
48- int_val = pthread_getschedparam(upthread->native_handle(), &sched_policy, &scheduler_param);
46+ retval = pthread_getschedparam(upthread->native_handle(), &sched_policy, &scheduler_param);
47+ if (retval != 0) return retval;
48+
4949 if (SCHED_FIFO == sched_algorithm) {
5050 scheduler_param.__sched_priority = sched_priority;
5151 sched_policy = SCHED_FIFO;
@@ -57,9 +57,12 @@ void session_thread_control::start_thread()
5757 }
5858 if (0 <= sched_algorithm) {
5959 retval = pthread_setschedparam(upthread->native_handle(), sched_algorithm, &scheduler_param);
60+ if (retval != 0 ) return retval;
6061 retval = pthread_setschedparam(downthread->native_handle(), sched_algorithm, &scheduler_param);
62+ if (retval != 0 ) return retval;
6163 }
6264
65+ return retval;
6366 }
6467
6568 //
@@ -108,7 +111,12 @@ void session_thread_control::upstream_run()
108111 if (state == WAIT) { // after create or session end. this thread is pooling mode
109112 boost::mutex::scoped_lock lock(upthread_condition_mutex);
110113 boost::xtime wait;
114+#if BOOST_VERSION >= 105000
115+ boost::xtime_get(&wait, boost::TIME_UTC_);
116+#else
111117 boost::xtime_get(&wait, boost::TIME_UTC);
118+#endif
119+
112120 wait.sec += 1;
113121 upthread_running_mutex.unlock();
114122 upthread_condition.timed_wait(lock, wait); // thread is condition wait( start at notify_all() )
@@ -175,7 +183,12 @@ void session_thread_control::downstream_run()
175183 boost::mutex::scoped_lock lock(downthread_condition_mutex);
176184 // downthread_condition.wait( lock ); // thread is condition wait( start at notify_all() )
177185 boost::xtime wait;
186+#if BOOST_VERSION >= 105000
187+ boost::xtime_get(&wait, boost::TIME_UTC_);
188+#else
178189 boost::xtime_get(&wait, boost::TIME_UTC);
190+#endif
191+
179192 wait.sec += 1;
180193 downthread_running_mutex.unlock();
181194 downthread_condition.timed_wait(lock, wait); // thread is condition wait( start at notify_all() )
--- a/l7vsd/src/tcp_session.cpp
+++ b/l7vsd/src/tcp_session.cpp
@@ -822,7 +822,12 @@ void tcp_session::up_thread_run()
822822 } //message alive end.
823823 if (ssl_flag && up_thread_next_call_function.first == UP_FUNC_CLIENT_ACCEPT_EVENT) { //handshake timeout check
824824 boost::xtime now_time;
825+#if BOOST_VERSION >= 105000
826+ boost::xtime_get(&now_time, boost::TIME_UTC_);
827+#else
825828 boost::xtime_get(&now_time, boost::TIME_UTC);
829+#endif
830+
826831 if ((now_time.sec - start_handshake_time.sec) > ssl_handshake_time_out) { // timeout detect.
827832 boost::system::error_code error_code;
828833 client_ssl_socket.close(error_code);
@@ -1123,7 +1128,12 @@ void tcp_session::up_thread_client_accept(const TCP_PROCESS_TYPE_TAG process_typ
11231128 if (ssl_flag) {
11241129 upthread_status = UPTHREAD_LOCK;
11251130 // try ssl handshake
1131+#if BOOST_VERSION >= 105000
1132+ boost::xtime_get(&start_handshake_time, boost::TIME_UTC_);
1133+#else
11261134 boost::xtime_get(&start_handshake_time, boost::TIME_UTC);
1135+#endif
1136+
11271137 client_ssl_socket.setoption(error_code);
11281138 client_ssl_socket.async_handshake(boost::bind(&tcp_session::up_thread_client_handshake_handle,
11291139 this,
@@ -4192,7 +4202,12 @@ void tcp_session::down_thread_sorryserver_handle_async_read_some(tcp_session::TC
41924202 //! milliseconds to boost::xtime converter
41934203 void tcp_session::to_time(int in, boost::xtime &xt)
41944204 {
4205+#if BOOST_VERSION >= 105000
4206+ boost::xtime_get(&xt, boost::TIME_UTC_);
4207+#else
41954208 boost::xtime_get(&xt, boost::TIME_UTC);
4209+#endif
4210+
41964211 xt.sec += (in / 1000);
41974212 xt.nsec += (in % 1000) * 1000000;
41984213 if (xt.nsec >= 1000000000) {
--- a/l7vsd/src/virtualservice_base.cpp
+++ b/l7vsd/src/virtualservice_base.cpp
@@ -481,7 +481,7 @@ cpu_set_t l7vs::virtualservice_base::get_cpu_mask(std::string nic_name)
481481 map< size_t, string > cpu_nic_map;
482482 string buff;
483483 ifstream ifs("/proc/interrupts");
484- unsigned int target_interrupt;
484+ //unsigned int target_interrupt;
485485 size_t target_cpuid = 0;
486486 cpu_set_t mask;
487487 sched_getaffinity(0, sizeof(cpu_set_t), &mask);
@@ -503,7 +503,8 @@ cpu_set_t l7vs::virtualservice_base::get_cpu_mask(std::string nic_name)
503503 algorithm::split(split_vec, buff, algorithm::is_any_of(":"));
504504 if (!split_vec.size()) return mask; // cannot split interrupt
505505 algorithm::trim(split_vec[0]);
506- target_interrupt = lexical_cast<unsigned int>(split_vec[0]);
506+ //target_interrupt = lexical_cast<unsigned int>(split_vec[0]);
507+ lexical_cast<unsigned int>(split_vec[0]);
507508 for (size_t i = 0; i < cpu_nic_map.size(); ++i) {
508509 size_t start_position = 4 + (i * 11);
509510 size_t end_position = 11;
--- a/l7vsd/src/virtualservice_tcp.cpp
+++ b/l7vsd/src/virtualservice_tcp.cpp
@@ -30,6 +30,7 @@
3030 #include <boost/format.hpp>
3131 #include <sys/socket.h>
3232 #include <linux/version.h>
33+#include <pthread.h>
3334
3435 #include "virtualservice.h"
3536 #include "logger_enum.h"
@@ -433,6 +434,7 @@ void l7vs::virtualservice_tcp::handle_accept(const l7vs::session_thread_control
433434 stc_ptr_noconst->session_access_log_output_mode_change(access_log_flag);
434435
435436 active_sessions.insert(tmp_session, stc_ptr_noconst);
437+ waiting_stc = NULL;
436438
437439 //check sorry flag and status
438440 if (unlikely(
@@ -503,6 +505,7 @@ void l7vs::virtualservice_tcp::handle_accept(const l7vs::session_thread_control
503505 boost::mutex::scoped_lock down_wait_lk(stc_ptr_register_accept->get_downthread_mutex());
504506
505507 waiting_session = stc_ptr_register_accept->get_session().get();
508+ waiting_stc = stc_ptr_register_accept;
506509
507510 if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_VIRTUALSERVICE))) {
508511 boost::format fmt1("active session thread id = %d");
@@ -551,6 +554,8 @@ void l7vs::virtualservice_tcp::handle_accept(const l7vs::session_thread_control
551554 */
552555 void l7vs::virtualservice_tcp::initialize(l7vs::error_code &err)
553556 {
557+ int ret = 0;
558+
554559 if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_VIRTUALSERVICE))) {
555560 boost::format formatter("in_function: void virtualservice_tcp::initialize( "
556561 "l7vs::error_code& err )");
@@ -833,7 +838,16 @@ void l7vs::virtualservice_tcp::initialize(l7vs::error_code &err)
833838 session_thread_control *p_stc = new session_thread_control(
834839 sess, vsnic_cpumask, rsnic_cpumask, -1);
835840
836- p_stc->start_thread();
841+ ret = p_stc->start_thread();
842+ if (ret == ESRCH) {
843+ continue;
844+ } else if (ret == EPERM) {
845+ //Error
846+ Logger::putLogError(LOG_CAT_L7VSD_VIRTUALSERVICE, 999, "Not super user authority",
847+ __FILE__, __LINE__);
848+ err.setter(true, "set pthread schedule parameter.");
849+ throw;
850+ }
837851 while (!pool_sessions.push(p_stc)) {}
838852 } catch (...) {
839853 Logger::putLogFatal(
@@ -889,6 +903,7 @@ void l7vs::virtualservice_tcp::initialize(l7vs::error_code &err)
889903 */
890904 void l7vs::virtualservice_tcp::finalize(l7vs::error_code &err)
891905 {
906+
892907 if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_VIRTUALSERVICE))) {
893908 boost::format formatter("in_function: void virtualservice_tcp::finalize( "
894909 "l7vs::error_code& err )");
@@ -915,7 +930,7 @@ void l7vs::virtualservice_tcp::finalize(l7vs::error_code &err)
915930 delete stc;
916931 stc = NULL;
917932 if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_VIRTUALSERVICE))) {
918- boost::format fmt("join pool session: pool_sessions.size = %d");
933+ boost::format fmt("join pool session: pool_session.size = %d");
919934 fmt % pool_sessions.size();
920935 Logger::putLogDebug(LOG_CAT_L7VSD_VIRTUALSERVICE, 55, fmt.str(),
921936 __FILE__, __LINE__);
@@ -925,6 +940,9 @@ void l7vs::virtualservice_tcp::finalize(l7vs::error_code &err)
925940 delete waiting_session;
926941 waiting_session = NULL;
927942
943+ //waiting thread delete
944+ waiting_stc->join();
945+
928946 //unload ProtocolModule
929947 if (protomod) {
930948 //finalize ProtocolModule
@@ -1595,6 +1613,7 @@ void l7vs::virtualservice_tcp::run()
15951613 } while (!stc_ptr);
15961614
15971615 waiting_session = stc_ptr->get_session().get();
1616+ waiting_stc = stc_ptr;
15981617
15991618 if (!ssl_virtualservice_mode_flag) {
16001619 acceptor_->async_accept(waiting_session->get_client_socket().get_socket(),
@@ -1640,11 +1659,6 @@ void l7vs::virtualservice_tcp::run()
16401659
16411660 //join dispatcher_thread_group when virtualservice_tcp::stop() executed.
16421661 dispatcher_thread_group.join_all();
1643-
1644- //stop all active sessions
1645- {
1646- active_sessions.do_all(boost::bind(&session_thread_control::session_stop, _1));
1647- }
16481662 }
16491663
16501664 /*!