[PATCH] rtconfig/Cisco: make needToPrintNoRouteMap static

Faidon Liambotis paravoid at debian.org
Mon Jul 6 22:52:16 UTC 2009


needToPrintNoRouteMap is initialized to false and then is set to true
only when mapName is different than lastMapName.

It isn't guranteed, though, that when it is set, that the route-map will
be printed (e.g. no terms could exist yet). Next invocations of print(),
however, will reset it to false, hence it will never be printed.

Fix this by making the variable static; the code path that actually
prints the statement ensures that it gets set back to false, so there
shouldn't be any breakage.

Tested with:
@rtconfig set cisco_map_name = "bgp-hol-in"
@rtconfig import AS5408 83.212.8.1 AS3329 83.212.8.0
---
 src/rtconfig/f_cisco.cc |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/rtconfig/f_cisco.cc b/src/rtconfig/f_cisco.cc
index 1b5b80a..ed0462d 100644
--- a/src/rtconfig/f_cisco.cc
+++ b/src/rtconfig/f_cisco.cc
@@ -1006,7 +1006,9 @@ int CiscoConfig::print(NormalExpression *ne,
 		last = 1;
    }
 	
-   bool needToPrintNoRouteMap = false;
+   /* static: turn the value false, only when it was actually printed */
+   static bool needToPrintNoRouteMap = false;
+
    if (strcmp(mapName, lastMapName)) {
       strcpy(lastMapName, mapName);
       needToPrintNoRouteMap = true;
-- 
1.5.6.5




More information about the irrtoolset mailing list