JunOS RtConfig bugfix

Daryl Collins daryl at htb.com.au
Thu Mar 7 06:04:18 UTC 2013


Hi,

We've found that the same RPSL policy is behaving different on IOS &
JunOS.  By default JunOS will OR community-lists & prefix-lists, so this
patch is to force it to AND and thus behave like IOS does.

eg:

-     policy [ community-pol-50 prefix-list-151 ];
+     policy ( community-pol-50 && prefix-list-151 );

Regards,
Daryl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/irrtoolset/attachments/20130307/eb3f54a2/attachment.html>
-------------- next part --------------
--- src/rtconfig/f_junos.cc.orig	2013-03-07 12:26:00.000000000 +1030
+++ src/rtconfig/f_junos.cc	2013-03-07 12:51:34.000000000 +1030
@@ -817,6 +817,7 @@
       
       ListNodeOf2Ints *asp, *cmp, *prp; 
       int i;
+      bool first_policy = true;
 
       if (printRouteMap) {
 	 for (asp = aspath_acls->head(); asp; asp = aspath_acls->next(asp)) {
@@ -834,11 +835,27 @@
 		  for (i = asp->start; i <= asp->end; i++)
 		     cout << "            as-path as-path-" << i << ";\n";
 	       
-		  for (i = cmp->start; i <= cmp->end; i++)
-		     cout << "            policy community-pol-" << i << ";\n";
-
-		  for (i = prp->start; i <= prp->end; i++)
-		     cout << "            policy prefix-list-" << i << ";\n";
+		  for (i = cmp->start; i <= cmp->end; i++) {
+                     if (first_policy) {
+                       cout << "            policy (";
+                       first_policy = false;
+                     } else {
+                       cout << " && ";
+                     } 
+		     cout << "community-pol-" << i;
+                  }
+
+		  for (i = prp->start; i <= prp->end; i++) {
+                     if (first_policy) {
+                       cout << "            policy (";
+                       first_policy = false;
+                     } else {
+                       cout << " && ";
+                     } 
+		     cout << "prefix-list-" << i;
+                  }
+ 
+                  if (!first_policy) cout << ");\n";
 
 		  cout << "         }\n"
 		       << "         then {\n";


More information about the irrtoolset mailing list