diff --git a/mcproxy/files/mcproxy.config b/mcproxy/files/mcproxy.config index e548ede18d81b6dbf291130d2d10403abaa021b1..f6e7ccb9ece04c528a02eb71d78734055f71a443 100644 --- a/mcproxy/files/mcproxy.config +++ b/mcproxy/files/mcproxy.config @@ -2,6 +2,7 @@ config mcproxy 'mcproxy' option disabled '0' option respawn '1' + option fastleave '0' option protocol 'IGMPv2' option force_protocol '1' # option query_interval '125' diff --git a/mcproxy/files/mcproxy.init b/mcproxy/files/mcproxy.init index a1d28406accc0013d049541a3255de661787dfb3..039cb1376a50ae5793e5d0f8c98d87fd5189a0ea 100644 --- a/mcproxy/files/mcproxy.init +++ b/mcproxy/files/mcproxy.init @@ -152,6 +152,10 @@ start_instance() { config_get protocol "$cfg" "protocol" "IGMPv3" echo -e "protocol ${protocol};\n" > $conf_file + local fastleave + config_get fastleave "$cfg" "fastleave" "0" + echo -e "fastleave ${fastleave};\n" >> $conf_file + local force_protocol config_get_bool force_protocol "$cfg" "force_protocol" 0 echo 0 > /proc/sys/net/ipv4/conf/all/force_igmp_version diff --git a/mcproxy/patches/0010-support-fastleave.patch b/mcproxy/patches/0010-support-fastleave.patch new file mode 100644 index 0000000000000000000000000000000000000000..137b726baf0da1b856c0196437f9fbe35b51d19d --- /dev/null +++ b/mcproxy/patches/0010-support-fastleave.patch @@ -0,0 +1,96 @@ +--- a/mcproxy/include/proxy/timers_values.hpp 2019-08-28 15:50:29.601704202 +0200 ++++ b/mcproxy/include/proxy/timers_values.hpp 2019-08-28 16:00:27.043074882 +0200 +@@ -36,6 +36,7 @@ struct timers_values_tank { + std::chrono::milliseconds last_listener_query_interval = std::chrono::milliseconds(1000); + unsigned int last_listener_query_count = robustness_variable; + std::chrono::milliseconds unsolicited_report_interval = std::chrono::milliseconds(1000); ++ bool fastleave = false; + }; + + static timers_values_tank default_timers_values_tank = timers_values_tank(); +@@ -82,6 +83,7 @@ public: + std::chrono::milliseconds get_last_listener_query_time() const; // + std::chrono::milliseconds get_unsolicited_report_interval() const; + std::chrono::milliseconds get_older_host_present_interval() const; // ++ bool get_fastleave() const; + + void set_robustness_variable(unsigned int robustness_variable); + void set_query_interval(std::chrono::seconds query_interval); +@@ -91,6 +93,7 @@ public: + void set_last_listener_query_interval(std::chrono::milliseconds last_listener_query_interval); + void set_last_listener_query_count(unsigned int last_listener_query_count); + void set_unsolicited_report_interval(std::chrono::milliseconds unsolicited_report_interval); ++ void set_fastleave(bool fastleave); + + void reset_to_default_tank(); + +--- a/mcproxy/include/parser/configuration.hpp 2019-08-28 15:50:29.609703792 +0200 ++++ b/mcproxy/include/parser/configuration.hpp 2019-08-28 16:03:41.841095157 +0200 +@@ -45,7 +45,7 @@ private: + int m_qri = -1; // Query response interval + int m_lmqi = -1; // Last member Query interval + int m_rv = -1; // robustness value +- bool m_fastleave = true; // Fast leave ++ bool m_fastleave = false; // Fast leave + + //<line number (for a better error message output), command> + std::vector<std::pair<unsigned int, std::string>> m_cmds; +--- a/mcproxy/src/proxy/querier.cpp 2019-08-28 15:50:29.613703587 +0200 ++++ b/mcproxy/src/proxy/querier.cpp 2019-08-30 17:07:00.287689355 +0200 +@@ -163,7 +163,13 @@ void querier::receive_record(const std:: + + break; + case EXCLUDE_MODE: +- receive_record_in_exclude_mode(gr->get_record_type(), gr->get_gaddr(), gr->get_slist(), db_info_it->second); ++ if (m_timers_values.get_fastleave() && gr->get_record_type() == CHANGE_TO_INCLUDE_MODE && gr->get_slist().empty()) { ++ send_Q(gr->get_gaddr(), db_info_it->second); ++ m_db.group_info.erase(db_info_it); ++ state_change_notification(gr->get_gaddr()); ++ } else ++ receive_record_in_exclude_mode(gr->get_record_type(), gr->get_gaddr(), gr->get_slist(), db_info_it->second); ++ + break; + default : + HC_LOG_ERROR("wrong filter mode: " << db_info_it->second.filter_mode); +--- a/mcproxy/src/proxy/timers_values.cpp 2019-08-28 15:50:29.621703177 +0200 ++++ b/mcproxy/src/proxy/timers_values.cpp 2019-08-28 16:06:03.917816941 +0200 +@@ -176,6 +176,12 @@ uint16_t timers_values::maxrespi_to_maxr + } + + //-------------------------------------- ++bool timers_values::get_fastleave() const ++{ ++ HC_LOG_TRACE(""); ++ return tank->fastleave; ++} ++ + unsigned int timers_values::get_robustness_variable() const + { + HC_LOG_TRACE(""); +@@ -271,6 +277,13 @@ void timers_values::reset_to_default_tan + } + + //-------------------------------------- ++void timers_values::set_fastleave(bool fastleave) ++{ ++ HC_LOG_TRACE(""); ++ set_new_tank(); ++ tank->fastleave = fastleave; ++} ++ + void timers_values::set_robustness_variable(unsigned int robustness_variable) + { + HC_LOG_TRACE(""); +--- a/mcproxy/src/proxy/proxy.cpp 2019-08-28 15:50:29.625702972 +0200 ++++ b/mcproxy/src/proxy/proxy.cpp 2019-08-28 16:10:27.584311145 +0200 +@@ -276,7 +276,9 @@ void proxy::start_proxy_instances() + tv.set_startup_query_count(val); + } + +- std::cout << "fastleave :" <<m_configuration->get_fastleave() <<std::endl; ++ bool fastleave = m_configuration->get_fastleave(); ++ std::cout << "fastleave :" <<fastleave <<std::endl; ++ tv.set_fastleave(fastleave); + + pr_i->add_msg(std::make_shared<config_msg>(config_msg::ADD_DOWNSTREAM, if_index, d, tv)); + }