From: Bhagya Tholpady (bbantwal) Date: Wed, 21 Oct 2020 13:55:05 +0000 (+0000) Subject: Merge pull request #2544 in SNORT/snort3 from ~SVLASIUK/snort3:snort_upgrade_doc... X-Git-Tag: 3.0.3-3~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0b11217ff303a98ea0ebedb0581ad6dc40a59ab;p=thirdparty%2Fsnort3.git Merge pull request #2544 in SNORT/snort3 from ~SVLASIUK/snort3:snort_upgrade_doc to master Squashed commit of the following: commit 67d68cd61b13cf5c10f0e19a1df3923c064576a4 Author: Serhii Vlasiuk Date: Mon Oct 12 18:38:49 2020 +0300 snort2lua: update comments for deleted rule_state options --- diff --git a/doc/upgrade/differences.txt b/doc/upgrade/differences.txt index f267f771e..da955f8f4 100644 --- a/doc/upgrade/differences.txt +++ b/doc/upgrade/differences.txt @@ -149,7 +149,6 @@ Some things Snort++ can do today that Snort can not do as well: * all rules must have a sid * sid == 0 not allowed * deleted activate / dynamic rules -* deleted unused rule_state.action * deleted metadata engine shared * deleted metadata: rule-flushing (with PDU flushing rule flushing can cause missed attacks, the opposite of its intent) diff --git a/doc/upgrade/get_differences.rb b/doc/upgrade/get_differences.rb index 1995a094f..30924893c 100755 --- a/doc/upgrade/get_differences.rb +++ b/doc/upgrade/get_differences.rb @@ -43,33 +43,33 @@ Dir.glob("#{dir}/**/*cc").each do |file| end if line =~ delete_pattern - arr << "deleted -> #{snort_opt}: '#{$1}'" + arr << "deleted -> #{snort_opt.strip}: '#{$1.strip}'" end if line =~ diff_pattern - arr << "change -> #{snort_opt}: '#{$1}' ==> '#{$2}'" + arr << "change -> #{snort_opt.strip}: '#{$1.strip}' ==> '#{$2.strip}'" end if line =~ template_diff - arr << "change -> config '#{$1}' ==> '#{$2}.#{$3}'" + arr << "change -> config '#{$1.strip}' ==> '#{$2.strip}.#{$3.strip}'" end if line =~ config_delete_template - arr << "deleted -> config '#{$1}'" + arr << "deleted -> config '#{$1.strip}'" end # Files with special templates if line =~ paths_diff - arr << "change -> #{$1} ==> 'snort.--plugin_path='" + arr << "change -> #{$1.strip} ==> 'snort.--plugin_path='" end if line =~ normalizers_diff - arr << "change -> preprocessor 'normalize_#{$1}' ==> 'normalize.#{$1}'" + arr << "change -> preprocessor 'normalize_#{$1.strip}' ==> 'normalize.#{$1.strip}'" end if line =~ unified2_diff - arr << "change -> unified2: '#{$1}' ==> 'unified2'" + arr << "change -> unified2: '#{$1.strip}' ==> 'unified2'" end end diff --git a/tools/snort2lua/data/dt_state_api.cc b/tools/snort2lua/data/dt_state_api.cc index ce21c08ed..340ddf432 100644 --- a/tools/snort2lua/data/dt_state_api.cc +++ b/tools/snort2lua/data/dt_state_api.cc @@ -52,10 +52,13 @@ void StateApi::add_option(const std::string& name, const std::string& val) curr_state->add_option(name, val); } -void StateApi::add_comment(const std::string& comment) +void StateApi::add_deleted_comment(const std::string& option) { if ( curr_state ) + { + std::string comment = "rule_state option '" + option + "' deleted"; curr_state->add_comment(comment); + } } void StateApi::print_states(std::ostream& out) const diff --git a/tools/snort2lua/data/dt_state_api.h b/tools/snort2lua/data/dt_state_api.h index 831de4a84..e40303338 100644 --- a/tools/snort2lua/data/dt_state_api.h +++ b/tools/snort2lua/data/dt_state_api.h @@ -35,7 +35,7 @@ public: void clear(); bool empty() const; void add_option(const std::string& keyword, const std::string& val); - void add_comment(const std::string& comment); + void add_deleted_comment(const std::string& option); void set_action(const std::string& action); void print_states(std::ostream& out) const; diff --git a/tools/snort2lua/keyword_states/kws_rule_state.cc b/tools/snort2lua/keyword_states/kws_rule_state.cc index d3a8a1c3a..1eeef00a4 100644 --- a/tools/snort2lua/keyword_states/kws_rule_state.cc +++ b/tools/snort2lua/keyword_states/kws_rule_state.cc @@ -109,7 +109,7 @@ bool RuleState::convert(std::istringstream& data_stream) if ( !enable.empty() ) { state_api.add_option("enable", enable); - state_api.add_comment("option change: 'enabled/disabled' --> 'enable'"); + state_api.add_deleted_comment("enable"); } if ( !action.empty() ) @@ -117,7 +117,7 @@ bool RuleState::convert(std::istringstream& data_stream) if ( action == "sdrop" ) { action = "drop"; - state_api.add_comment("action change: 'sdrop' --> 'drop'"); + state_api.add_deleted_comment("action"); } state_api.set_action(action);