]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2544 in SNORT/snort3 from ~SVLASIUK/snort3:snort_upgrade_doc...
authorBhagya Tholpady (bbantwal) <bbantwal@cisco.com>
Wed, 21 Oct 2020 13:55:05 +0000 (13:55 +0000)
committerBhagya Tholpady (bbantwal) <bbantwal@cisco.com>
Wed, 21 Oct 2020 13:55:05 +0000 (13:55 +0000)
Squashed commit of the following:

commit 67d68cd61b13cf5c10f0e19a1df3923c064576a4
Author: Serhii Vlasiuk <svlasiuk@cisco.com>
Date:   Mon Oct 12 18:38:49 2020 +0300

    snort2lua: update comments for deleted rule_state options

doc/upgrade/differences.txt
doc/upgrade/get_differences.rb
tools/snort2lua/data/dt_state_api.cc
tools/snort2lua/data/dt_state_api.h
tools/snort2lua/keyword_states/kws_rule_state.cc

index f267f771ea0ed85447361ee62220862ca95ee1f4..da955f8f45a84792650e01356798c743f028a980 100644 (file)
@@ -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)
index 1995a094faca5ababf66bffd1cd0cd6b27f6c90f..30924893c237b7937a1d596da8dcbeca857e3e18 100755 (executable)
@@ -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=<path>'"
+                arr << "change -> #{$1.strip} ==> 'snort.--plugin_path=<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
index ce21c08ed5efe7ee7a47e1ab04e38d3ab7a40098..340ddf432ecd041b81fb939eec47276f3efb1d6f 100644 (file)
@@ -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
index 831de4a84b86705a90065bbdbb92f3c5f67b344f..e4030333847bd67ac45f8e31416e1e94f9ec1ad6 100644 (file)
@@ -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;
 
index d3a8a1c3ae1629641c98ca6484d1fce88fa992e7..1eeef00a4743dc358b8864769cc3cbab080f3013 100644 (file)
@@ -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);