From: Igor Maravic <[email protected]>

When adding child node, remove named variable with same name. If we wouldn't
do that, we couldn't set value for child node, in function 
ConfigTreeNode::set_variable(),
because we would always find named variable first.

Signed-off-by: Igor Maravic <[email protected]>
---
 xorp/rtrmgr/conf_tree_node.cc |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/xorp/rtrmgr/conf_tree_node.cc b/xorp/rtrmgr/conf_tree_node.cc
index bb8fd25..c26d2a9 100644
--- a/xorp/rtrmgr/conf_tree_node.cc
+++ b/xorp/rtrmgr/conf_tree_node.cc
@@ -222,6 +222,15 @@ ConfigTreeNode::is_same(const ConfigTreeNode& them, bool 
ignore_node_id) const
 void
 ConfigTreeNode::add_child(ConfigTreeNode* child)
 {
+    map<string, string>::iterator iter;
+
+    iter = _variables.find(child->segname());
+    if (iter != _variables.end()) {
+       debug_msg("Remove conflicting named variable %s on %s",
+               iter->first.c_str(), _segname.c_str());
+       _variables.erase(iter);
+    }
+
     _children.push_back(child);
     list<ConfigTreeNode *> sorted_children = _children;
     sort_by_template(sorted_children);
-- 
1.7.5.4

_______________________________________________
Xorp-hackers mailing list
[email protected]
http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers

Reply via email to