]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1440 in SNORT/snort3 from ~SMINUT/snort3:reject_forward_option...
authorMike Stepanek (mstepane) <mstepane@cisco.com>
Mon, 19 Nov 2018 21:03:38 +0000 (16:03 -0500)
committerMike Stepanek (mstepane) <mstepane@cisco.com>
Mon, 19 Nov 2018 21:03:38 +0000 (16:03 -0500)
Squashed commit of the following:

commit 49f47f3950be7b6f9952be1866639a388508e9ec
Author: Silviu Minut <sminut@cisco.com>
Date:   Fri Nov 16 15:36:45 2018 -0500

    snort2lua: add code to output control = forward under the reject module.

commit bb5bf4702dc9b7b1673d352700b4b79ad66d5af6
Author: Masud Hasan <mashasan@cisco.com>
Date:   Fri Nov 16 11:48:42 2018 -0500

    actions: Fixing incorrect order of IPS reject unreachable codes and adding forward option

src/actions/act_reject.cc
tools/snort2lua/preprocessor_states/pps_firewall.cc

index d01f47a3d913db0a4aea613fa6df5aae139a1ddb..1ea4ef958edefca4e83c06f5c074339c5ea43728 100644 (file)
@@ -60,9 +60,10 @@ using namespace snort;
 #define REJ_UNR_NET  0x04
 #define REJ_UNR_HOST 0x08
 #define REJ_UNR_PORT 0x10
+#define REJ_UNR_FWD  0x20
 
 #define REJ_RST_BOTH (REJ_RST_SRC|REJ_RST_DST)
-#define REJ_UNR_ALL  (REJ_UNR_NET|REJ_UNR_HOST|REJ_UNR_PORT)
+#define REJ_UNR_ALL  (REJ_UNR_NET|REJ_UNR_HOST|REJ_UNR_PORT|REJ_UNR_FWD)
 
 #define s_name "reject"
 
@@ -134,6 +135,9 @@ void RejectAction::send(Packet* p)
     if ( flags & REJ_RST_DST )
         Active::send_reset(p, ENC_FLAG_FWD);
 
+    if ( flags & REJ_UNR_FWD )
+        Active::send_unreach(p, snort::UnreachResponse::FWD);
+
     if ( flags & REJ_UNR_NET )
         Active::send_unreach(p, snort::UnreachResponse::NET);
 
@@ -153,7 +157,7 @@ static const Parameter s_params[] =
     { "reset", Parameter::PT_ENUM, "source|dest|both", nullptr,
       "send TCP reset to one or both ends" },
 
-    { "control", Parameter::PT_ENUM, "network|host|port|all", nullptr,
+    { "control", Parameter::PT_ENUM, "network|host|port|forward|all", nullptr,
       "send ICMP unreachable(s)" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
@@ -192,9 +196,10 @@ static const int rst[] =
 
 static const int unr[] =
 {
-    REJ_UNR_PORT,
-    REJ_UNR_HOST,
     REJ_UNR_NET,
+    REJ_UNR_HOST,
+    REJ_UNR_PORT,
+    REJ_UNR_FWD,
     REJ_UNR_ALL
 };
 
index ccdf8a4b55acf5f2dbcccc3c01d4f523b2f7c2cc..3fa54abbe251aa980a9ba2a2a176eb1d8063e231 100644 (file)
@@ -179,6 +179,7 @@ namespace preprocessors
         // Auto enable for firewall
         table_api.open_top_level_table("reject");
         table_api.add_option("reset", "both");
+        table_api.add_option("control", "forward");
         table_api.close_table();
 
         return retval;
@@ -201,4 +202,3 @@ namespace preprocessors
 
     const ConvertMap* firewall_map = &firewall_api;
 } // namespace preprocessors
-