Squashed commit of the following:
commit
ddc9f5cae9538ae04a1ce6f161a457b4bb217b53
Author: Oleksandr Serhiienko <oserhiie@cisco.com>
Date: Mon Jun 7 12:50:48 2021 +0300
main: fix config dump for list-based inspector aliases
if ( idx )
node_type = Parameter::PT_TABLE;
- add_config_child_node(table_name, node_type);
+ add_config_child_node(table_name, node_type, idx);
}
}
}
-void Shell::add_config_child_node(const std::string& node_name, snort::Parameter::Type type)
+void Shell::add_config_child_node(const std::string& node_name, snort::Parameter::Type type,
+ bool is_root_list_item)
{
if ( !s_config_output || !s_current_node )
return;
- std::string name;
- if ( s_current_node->get_name() != node_name )
- name = node_name;
+ // element of the top-level list is anonymous
+ std::string name = ( !is_root_list_item && s_current_node->get_name() != node_name ) ?
+ node_name : "";
auto new_node = new TreeConfigNode(s_current_node, name, type);
s_current_node->add_child_node(new_node);
static void config_open_table(bool is_root_node, bool is_list, int idx,
const std::string& table_name, const snort::Parameter* p);
static void set_config_value(const std::string& fqn, const snort::Value& value);
- static void add_config_child_node(const std::string& node_name, snort::Parameter::Type type);
+ static void add_config_child_node(const std::string& node_name, snort::Parameter::Type type,
+ bool is_root_list_item);
static void update_current_config_node(const std::string& node_name = "");
static void config_close_table();
static void set_config_output(ConfigOutput* config_output);
{
const Parameter* table_item_params = reinterpret_cast<const Parameter*>(p->range);
- Shell::add_config_child_node(get_sub_table(fqn), p->type);
+ Shell::add_config_child_node(get_sub_table(fqn), p->type, false);
if ( !begin(m, table_item_params, fqn.c_str(), idx, depth+1) )
return false;