[Xorp-hackers] [PATCH] rtrmngr fixes

"Igor Maravić" igorm at etf.rs
Fri Sep 23 06:48:00 PDT 2011


cleaned_xrl should have reference to it. That reference should be argument of functions XRLDB::check_xrl_syntax and XRLDB::check_xrl_exists.
Don't know why but it didn't wont to compile with out that fix.

VALIDATE_XRLDB should be replaced with DEBUG_XRLDB

BR
Igor Maravić

Signed-off-by: Igor Maravić <igorm at etf.rs>
---

diff -upNr xorp.old/rtrmgr/template_commands.cc xorp.mpls/rtrmgr/template_commands.cc
--- xorp.old/rtrmgr/template_commands.cc	2011-03-22 22:08:58.000000000 +0100
+++ xorp.mpls/rtrmgr/template_commands.cc	2011-09-08 00:30:24.000000000 +0200
@@ -316,6 +316,7 @@ XrlAction::check_xrl_is_valid(const list
     // Then we can check it is a valid XRL as known by the XRLdb.
     //
     string cleaned_xrl;
+    const string& refToCleanedXRL = cleaned_xrl;

     // Trim quotes from around the XRL
     size_t start = 0;
@@ -465,13 +466,14 @@ XrlAction::check_xrl_is_valid(const list
     }
     debug_msg("XrlAction after cleaning:\n%s\n", cleaned_xrl.c_str());

-    if (xrldb->check_xrl_syntax(cleaned_xrl) == false) {
+    if (xrldb->check_xrl_syntax(refToCleanedXRL) == false) {
 	error_msg = c_format("Syntax error in module %s XRL %s: "
 			     "invalid XRL syntax (check_xrl_syntax failed)",
 			     module_name.c_str(), cleaned_xrl.c_str());
 	return false;
     }
-    XRLMatchType match = xrldb->check_xrl_exists(cleaned_xrl);
+
+    XRLMatchType match = xrldb->check_xrl_exists(refToCleanedXRL);
     switch (match) {
     case MATCH_FAIL:
     case MATCH_RSPEC: {
diff -upNr xorp.old/rtrmgr/xrldb.cc xorp.mpls/rtrmgr/xrldb.cc
--- xorp.old/rtrmgr/xrldb.cc	2011-03-22 22:08:58.000000000 +0100
+++ xorp.mpls/rtrmgr/xrldb.cc	2011-09-07 16:13:24.000000000 +0200
@@ -160,7 +160,7 @@ XRLtarget::str() const
 XRLdb::XRLdb(const string& xrldir, bool verbose) throw (InitError)
     : _verbose(verbose)
 {
-#ifdef VALIDATE_XRLDB
+#ifdef DEBUG_XRLDB
     string errmsg;
     list<string> files;

@@ -209,7 +209,7 @@ XRLdb::XRLdb(const string& xrldir, bool
 #endif
 }

-#ifdef VALIDATE_XRLDB
+#ifdef DEBUG_XRLDB
 bool
 XRLdb::check_xrl_syntax(const string& xrlstr) const
 {
diff -upNr xorp.old/rtrmgr/xrldb.hh xorp.mpls/rtrmgr/xrldb.hh
--- xorp.old/rtrmgr/xrldb.hh	2011-03-22 22:08:58.000000000 +0100
+++ xorp.mpls/rtrmgr/xrldb.hh	2011-09-07 16:05:26.000000000 +0200
@@ -65,7 +65,7 @@ private:
 class XRLdb {
 public:
     XRLdb(const string& xrldir, bool verbose) throw (InitError);
-#ifdef VALIDATE_XRLDB
+#ifdef DEBUG_XRLDB
     bool check_xrl_syntax(const string& xrl) const;
     XRLMatchType check_xrl_exists(const string& xrl) const;
 #endif




More information about the Xorp-hackers mailing list