From b00a06d8e0aef2348e58424404ef456dba7a47fe Mon Sep 17 00:00:00 2001 From: "Bhagya Tholpady (bbantwal)" Date: Tue, 19 May 2020 13:47:42 +0000 Subject: [PATCH] Merge pull request #2216 in SNORT/snort3 from ~BBANTWAL/snort3:sort_ilist_by_type to master Squashed commit of the following: commit 8439e633309782e799d1adbf410c12cff413c0ba Author: Bhagya Tholpady Date: Mon May 18 22:24:24 2020 -0400 managers: print alphabetically sorted verbose inspector config output within an inspection policy commit 5a085e5a729027f8f85cafb90970fa9d024651f5 Author: Bhagya Tholpady Date: Mon May 18 22:18:34 2020 -0400 Revert "Merge pull request #2185 in SNORT/snort3 from ~BBANTWAL/snort3:sort_inspectors to master" This reverts commit f19685fd2b8b3443369f1181ca8f0f98c85df49d. --- src/managers/inspector_manager.cc | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/managers/inspector_manager.cc b/src/managers/inspector_manager.cc index cbf257ede..9cff9f4f5 100644 --- a/src/managers/inspector_manager.cc +++ b/src/managers/inspector_manager.cc @@ -113,7 +113,7 @@ struct PHInstance ~PHInstance(); static bool comp(PHInstance* a, PHInstance* b) - { return ( a->name < b->name ); } + { return ( a->pp_class.api.type < b->pp_class.api.type ); } void set_name(const char* s) { name = s; } @@ -1004,11 +1004,7 @@ void InspectorManager::print_config(SnortConfig* sc) if ( !(inspection and inspection->framework_policy) ) continue; - const std::string label = "Inspection Policy : policy id " + - std::to_string(inspection->user_policy_id) + " : " + - shell->get_file(); - LogLabel(label.c_str()); - + std::map sorted_ilist; for ( const auto* p : inspection->framework_policy->ilist ) { std::string inspector_name(p->pp_class.api.base.name); @@ -1016,8 +1012,18 @@ void InspectorManager::print_config(SnortConfig* sc) inspector_name += " (" + p->name + "):"; else inspector_name += ":"; - LogLabel(inspector_name.c_str()); - p->handler->show(sc); + sorted_ilist.emplace(inspector_name, p); + } + + const std::string label = "Inspection Policy : policy id " + + std::to_string(inspection->user_policy_id) + " : " + + shell->get_file(); + LogLabel(label.c_str()); + + for ( const auto& p : sorted_ilist ) + { + LogLabel(p.first.c_str()); + p.second->handler->show(sc); } } } -- 2.47.3